Changeset View
Changeset View
Standalone View
Standalone View
src/kgrapheditor.h
Show All 10 Lines | 1 | /* This file is part of KGraphViewer. | |||
---|---|---|---|---|---|
11 | General Public License for more details. | 11 | General Public License for more details. | ||
12 | 12 | | |||
13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software | ||
15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | 02110-1301, USA | 16 | 02110-1301, USA | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | | ||||
20 | #ifndef _KGRAPHEDITOR_H_ | 19 | #ifndef _KGRAPHEDITOR_H_ | ||
21 | #define _KGRAPHEDITOR_H_ | 20 | #define _KGRAPHEDITOR_H_ | ||
22 | 21 | | |||
22 | #include <KParts/MainWindow> | ||||
23 | #include <KRecentFilesAction> | ||||
23 | #include <QAction> | 24 | #include <QAction> | ||
24 | #include <QDir> | 25 | #include <QDir> | ||
25 | #include <QTabWidget> | 26 | #include <QTabWidget> | ||
26 | #include <KParts/MainWindow> | | |||
27 | #include <KRecentFilesAction> | | |||
28 | 27 | | |||
29 | #include <graphviz/gvc.h> | 28 | #include <graphviz/gvc.h> | ||
30 | 29 | | |||
31 | class QTreeWidget; | 30 | class QTreeWidget; | ||
32 | class QTreeWidgetItem; | 31 | class QTreeWidgetItem; | ||
33 | 32 | | |||
34 | class KToggleAction; | 33 | class KToggleAction; | ||
35 | 34 | | |||
Show All 24 Lines | 53 | public: | |||
60 | /** | 59 | /** | ||
61 | * Default Destructor | 60 | * Default Destructor | ||
62 | */ | 61 | */ | ||
63 | ~KGraphEditor() override; | 62 | ~KGraphEditor() override; | ||
64 | 63 | | |||
65 | /** | 64 | /** | ||
66 | * Use this method to load whatever file/URL you have | 65 | * Use this method to load whatever file/URL you have | ||
67 | */ | 66 | */ | ||
68 | void openUrl(const QUrl& url); | 67 | void openUrl(const QUrl &url); | ||
69 | 68 | | |||
70 | void reloadPreviousFiles(); | 69 | void reloadPreviousFiles(); | ||
71 | 70 | | |||
72 | protected: | 71 | protected: | ||
73 | void closeEvent(QCloseEvent *event) override; | 72 | void closeEvent(QCloseEvent *event) override; | ||
74 | 73 | | |||
75 | Q_SIGNALS: | 74 | Q_SIGNALS: | ||
76 | void hide(KParts::Part* part); | 75 | void hide(KParts::Part *part); | ||
77 | void prepareAddNewElement(QMap<QString,QString> attribs); | 76 | void prepareAddNewElement(QMap<QString, QString> attribs); | ||
78 | void prepareAddNewEdge(QMap<QString,QString> attribs); | 77 | void prepareAddNewEdge(QMap<QString, QString> attribs); | ||
79 | void setReadWrite(); | 78 | void setReadWrite(); | ||
80 | void saveTo(const QString& fileName); | 79 | void saveTo(const QString &fileName); | ||
81 | 80 | | |||
82 | void selectNode(const QString&); | 81 | void selectNode(const QString &); | ||
83 | void removeNode(const QString&); | 82 | void removeNode(const QString &); | ||
84 | void removeElement(const QString&); | 83 | void removeElement(const QString &); | ||
85 | void addAttribute(const QString&); | 84 | void addAttribute(const QString &); | ||
86 | void removeAttribute(const QString&,const QString&); | 85 | void removeAttribute(const QString &, const QString &); | ||
87 | void setAttribute(const QString& elementId, const QString& attributeName, const QString& attributeValue); | 86 | void setAttribute(const QString &elementId, const QString &attributeName, const QString &attributeValue); | ||
88 | void update(); | 87 | void update(); | ||
89 | void saddNewEdge(QString src, QString tgt, QMap<QString,QString> attribs); | 88 | void saddNewEdge(QString src, QString tgt, QMap<QString, QString> attribs); | ||
90 | void renameNode(const QString& oldName, const QString& newName); | 89 | void renameNode(const QString &oldName, const QString &newName); | ||
91 | 90 | | |||
92 | public Q_SLOTS: | 91 | public Q_SLOTS: | ||
93 | /** | 92 | /** | ||
94 | * Use this method to load whatever file/URL you have | 93 | * Use this method to load whatever file/URL you have | ||
95 | */ | 94 | */ | ||
96 | void openUrl(const QString& url) { | 95 | void openUrl(const QString &url) | ||
96 | { | ||||
97 | openUrl(QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile)); | 97 | openUrl(QUrl::fromUserInput(url, QDir::currentPath(), QUrl::AssumeLocalFile)); | ||
98 | } | 98 | } | ||
99 | 99 | | |||
100 | void slotSetActiveGraph(KParts::ReadOnlyPart* part); | 100 | void slotSetActiveGraph(KParts::ReadOnlyPart *part); | ||
101 | 101 | | |||
102 | void slotGraphLoaded(); | 102 | void slotGraphLoaded(); | ||
103 | 103 | | |||
104 | void slotRemoveNode(const QString&); | 104 | void slotRemoveNode(const QString &); | ||
105 | void slotAddAttribute(const QString&); | 105 | void slotAddAttribute(const QString &); | ||
106 | void slotRemoveAttribute(const QString&,const QString&); | 106 | void slotRemoveAttribute(const QString &, const QString &); | ||
107 | 107 | | |||
108 | void slotNewElementItemChanged(QTreeWidgetItem*,int); | 108 | void slotNewElementItemChanged(QTreeWidgetItem *, int); | ||
109 | void slotAddNewElementAttribute(const QString&); | 109 | void slotAddNewElementAttribute(const QString &); | ||
110 | void slotRemoveNewElementAttribute(const QString&); | 110 | void slotRemoveNewElementAttribute(const QString &); | ||
111 | 111 | | |||
112 | void slotNewNodeAdded(const QString& id); | 112 | void slotNewNodeAdded(const QString &id); | ||
113 | void slotNewEdgeAdded(const QString& ids, const QString& idt); | 113 | void slotNewEdgeAdded(const QString &ids, const QString &idt); | ||
114 | /*public slots: | 114 | /*public slots: | ||
115 | void reloadOnChangeMode_pressed(int value); | 115 | void reloadOnChangeMode_pressed(int value); | ||
116 | void openInExistingWindowMode_pressed(int value); | 116 | void openInExistingWindowMode_pressed(int value); | ||
117 | void reopenPreviouslyOpenedFilesMode_pressed(int value);*/ | 117 | void reopenPreviouslyOpenedFilesMode_pressed(int value);*/ | ||
118 | void slotRemoveElement(const QString& id); | 118 | void slotRemoveElement(const QString &id); | ||
119 | void slotSelectionIs(const QList<QString>&, const QPoint&p); | 119 | void slotSelectionIs(const QList<QString> &, const QPoint &p); | ||
120 | void slotNewEdgeFinished( const QString&, const QString&, const QMap<QString, QString>&); | 120 | void slotNewEdgeFinished(const QString &, const QString &, const QMap<QString, QString> &); | ||
121 | 121 | | |||
122 | private Q_SLOTS: | 122 | private Q_SLOTS: | ||
123 | void fileNew(); | 123 | void fileNew(); | ||
124 | void fileOpen(); | 124 | void fileOpen(); | ||
125 | void fileSave(); | 125 | void fileSave(); | ||
126 | void fileSaveAs(); | 126 | void fileSaveAs(); | ||
127 | void close(int index); | 127 | void close(int index); | ||
128 | void close(); | 128 | void close(); | ||
129 | void slotURLSelected(const QUrl&); | 129 | void slotURLSelected(const QUrl &); | ||
130 | void optionsShowToolbar(); | 130 | void optionsShowToolbar(); | ||
131 | void optionsShowStatusbar(); | 131 | void optionsShowStatusbar(); | ||
132 | void optionsConfigureKeys(); | 132 | void optionsConfigureKeys(); | ||
133 | void optionsConfigureToolbars(); | 133 | void optionsConfigureToolbars(); | ||
134 | void optionsConfigure(); | 134 | void optionsConfigure(); | ||
135 | void newTabSelectedSlot(int index); | 135 | void newTabSelectedSlot(int index); | ||
136 | 136 | | |||
137 | void applyNewToolbarConfig(); | 137 | void applyNewToolbarConfig(); | ||
138 | void slotItemChanged ( QTreeWidgetItem * item, int column ); | 138 | void slotItemChanged(QTreeWidgetItem *item, int column); | ||
139 | void slotItemClicked ( QTreeWidgetItem * item, int column ); | 139 | void slotItemClicked(QTreeWidgetItem *item, int column); | ||
140 | void slotEditNewVertex(); | 140 | void slotEditNewVertex(); | ||
141 | void slotEditNewEdge(); | 141 | void slotEditNewEdge(); | ||
142 | 142 | | |||
143 | void slotParsingModeExternalToggled(bool value); | 143 | void slotParsingModeExternalToggled(bool value); | ||
144 | void slotParsingModeInternalToggled(bool value); | 144 | void slotParsingModeInternalToggled(bool value); | ||
145 | 145 | | |||
146 | void slotHoverEnter(const QString&); | 146 | void slotHoverEnter(const QString &); | ||
147 | void slotHoverLeave(const QString&); | 147 | void slotHoverLeave(const QString &); | ||
148 | 148 | | |||
149 | KParts::ReadOnlyPart *slotNewGraph(); | 149 | KParts::ReadOnlyPart *slotNewGraph(); | ||
150 | 150 | | |||
151 | private: | 151 | private: | ||
152 | void setupAccel(); | 152 | void setupAccel(); | ||
153 | void setupActions(); | 153 | void setupActions(); | ||
154 | 154 | | |||
155 | private: | 155 | private: | ||
156 | KGraphEditorNodesTreeWidget* m_treeWidget; | 156 | KGraphEditorNodesTreeWidget *m_treeWidget; | ||
157 | KGraphEditorElementTreeWidget* m_newElementAttributesWidget; | 157 | KGraphEditorElementTreeWidget *m_newElementAttributesWidget; | ||
158 | QTabWidget* m_widget; | 158 | QTabWidget *m_widget; | ||
159 | KRecentFilesAction* m_rfa; | 159 | KRecentFilesAction *m_rfa; | ||
160 | KParts::PartManager* m_manager; | 160 | KParts::PartManager *m_manager; | ||
161 | 161 | | |||
162 | KToggleAction *m_toolbarAction; | 162 | KToggleAction *m_toolbarAction; | ||
163 | KToggleAction *m_statusbarAction; | 163 | KToggleAction *m_statusbarAction; | ||
164 | QAction *m_closeAction; | 164 | QAction *m_closeAction; | ||
165 | 165 | | |||
166 | QStringList m_openedFiles; | 166 | QStringList m_openedFiles; | ||
167 | 167 | | |||
168 | QMap<QWidget*, KParts::ReadOnlyPart*> m_tabsPartsMap; | 168 | QMap<QWidget *, KParts::ReadOnlyPart *> m_tabsPartsMap; | ||
169 | QMap<QWidget*, QString> m_tabsFilesMap; | 169 | QMap<QWidget *, QString> m_tabsFilesMap; | ||
170 | KParts::ReadOnlyPart* m_currentPart; | 170 | KParts::ReadOnlyPart *m_currentPart; | ||
171 | 171 | | |||
172 | QMap<QString, QString> m_newElementAttributes; | 172 | QMap<QString, QString> m_newElementAttributes; | ||
173 | 173 | | |||
174 | QString m_currentTreeWidgetItemText; | 174 | QString m_currentTreeWidgetItemText; | ||
175 | }; | 175 | }; | ||
176 | 176 | | |||
177 | #endif // _KGRAPHEDITOR_H_ | 177 | #endif // _KGRAPHEDITOR_H_ |