Changeset View
Changeset View
Standalone View
Standalone View
addons/symbolviewer/ecma_parser.cpp
Show All 37 Lines | 19 | { | |||
---|---|---|---|---|---|
38 | int brace_depth = 0; | 38 | int brace_depth = 0; | ||
39 | // a list of inserted nodes with the index being the brace depth at insertion | 39 | // a list of inserted nodes with the index being the brace depth at insertion | ||
40 | QList<QTreeWidgetItem *> nodes; | 40 | QList<QTreeWidgetItem *> nodes; | ||
41 | 41 | | |||
42 | QPixmap cls( ( const char** ) class_xpm ); | 42 | QPixmap cls( ( const char** ) class_xpm ); | ||
43 | QPixmap mtd( ( const char** ) method_xpm ); | 43 | QPixmap mtd( ( const char** ) method_xpm ); | ||
44 | QTreeWidgetItem *node = nullptr; | 44 | QTreeWidgetItem *node = nullptr; | ||
45 | 45 | | |||
46 | if (m_plugin->treeOn) { | 46 | if (m_treeOn->isChecked()) { | ||
47 | m_symbols->setRootIsDecorated(1); | 47 | m_symbols->setRootIsDecorated(1); | ||
48 | } | 48 | } | ||
49 | else { | 49 | else { | ||
50 | m_symbols->setRootIsDecorated(0); | 50 | m_symbols->setRootIsDecorated(0); | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | // read the document line by line | 53 | // read the document line by line | ||
54 | KTextEditor::Document *kv = m_mainWindow->activeView()->document(); | 54 | KTextEditor::Document *kv = m_mainWindow->activeView()->document(); | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 118 | for (c = c; c < stripped.length(); c++) { | |||
124 | } | 124 | } | ||
125 | else { | 125 | else { | ||
126 | identifier += current; | 126 | identifier += current; | ||
127 | } | 127 | } | ||
128 | } | 128 | } | ||
129 | // trim whitespace | 129 | // trim whitespace | ||
130 | identifier = identifier.trimmed(); | 130 | identifier = identifier.trimmed(); | ||
131 | // get the node to add the class entry to | 131 | // get the node to add the class entry to | ||
132 | if ((m_plugin->treeOn) && (! nodes.isEmpty())) { | 132 | if ((m_treeOn->isChecked()) && (! nodes.isEmpty())) { | ||
133 | node = new QTreeWidgetItem(nodes.last()); | 133 | node = new QTreeWidgetItem(nodes.last()); | ||
134 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | 134 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | ||
135 | } | 135 | } | ||
136 | else { | 136 | else { | ||
137 | node = new QTreeWidgetItem(m_symbols); | 137 | node = new QTreeWidgetItem(m_symbols); | ||
138 | } | 138 | } | ||
139 | // add an entry for the class | 139 | // add an entry for the class | ||
140 | node->setText(0, identifier); | 140 | node->setText(0, identifier); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 147 | if ((current == QLatin1Char('f')) && (stripped.indexOf(QLatin1String("function"), c) == c)) { | |||
200 | } | 200 | } | ||
201 | // if we have a function identifier, make a node | 201 | // if we have a function identifier, make a node | ||
202 | if (identifier.length() > 0) { | 202 | if (identifier.length() > 0) { | ||
203 | // make a node for the function | 203 | // make a node for the function | ||
204 | QTreeWidgetItem *parent = nullptr; | 204 | QTreeWidgetItem *parent = nullptr; | ||
205 | if (! nodes.isEmpty()) { | 205 | if (! nodes.isEmpty()) { | ||
206 | parent = nodes.last(); | 206 | parent = nodes.last(); | ||
207 | } | 207 | } | ||
208 | if ((m_plugin->treeOn) && (parent != nullptr)) | 208 | if ((m_treeOn->isChecked()) && (parent != nullptr)) | ||
209 | node = new QTreeWidgetItem(parent); | 209 | node = new QTreeWidgetItem(parent); | ||
210 | else | 210 | else | ||
211 | node = new QTreeWidgetItem(m_symbols); | 211 | node = new QTreeWidgetItem(m_symbols); | ||
212 | // mark the parent as a class (if it's not the root level) | 212 | // mark the parent as a class (if it's not the root level) | ||
213 | if (parent != nullptr) { | 213 | if (parent != nullptr) { | ||
214 | parent->setIcon(0, QIcon(cls)); | 214 | parent->setIcon(0, QIcon(cls)); | ||
215 | // mark this function as a method of the parent | 215 | // mark this function as a method of the parent | ||
216 | node->setIcon(0, QIcon(mtd)); | 216 | node->setIcon(0, QIcon(mtd)); | ||
Show All 30 Lines | 231 | if (stripped.midRef(c, 3) == QLatin1String("id:")) { | |||
247 | identifier = identifier.trimmed(); | 247 | identifier = identifier.trimmed(); | ||
248 | 248 | | |||
249 | // if we have an id, make a node | 249 | // if we have an id, make a node | ||
250 | if (identifier.length() > 0) { | 250 | if (identifier.length() > 0) { | ||
251 | QTreeWidgetItem *parent = nullptr; | 251 | QTreeWidgetItem *parent = nullptr; | ||
252 | if (! nodes.isEmpty()) { | 252 | if (! nodes.isEmpty()) { | ||
253 | parent = nodes.last(); | 253 | parent = nodes.last(); | ||
254 | } | 254 | } | ||
255 | if ((m_plugin->treeOn) && (parent != nullptr)) | 255 | if ((m_treeOn->isChecked()) && (parent != nullptr)) | ||
256 | node = new QTreeWidgetItem(parent); | 256 | node = new QTreeWidgetItem(parent); | ||
257 | else | 257 | else | ||
258 | node = new QTreeWidgetItem(m_symbols); | 258 | node = new QTreeWidgetItem(m_symbols); | ||
259 | 259 | | |||
260 | // mark the node as a class | 260 | // mark the node as a class | ||
261 | node->setIcon(0, QIcon(cls)); | 261 | node->setIcon(0, QIcon(cls)); | ||
262 | 262 | | |||
263 | // add the id | 263 | // add the id | ||
Show All 30 Lines |