diff --git a/addons/symbolviewer/cpp_parser.cpp b/addons/symbolviewer/cpp_parser.cpp index d2dd493b8..c1a90f17c 100644 --- a/addons/symbolviewer/cpp_parser.cpp +++ b/addons/symbolviewer/cpp_parser.cpp @@ -1,363 +1,365 @@ /*************************************************************************** cpp_parser.cpp - description ------------------- begin : Apr 2 2003 author : 2003 Massimo Callegari email : massimocallegari@yahoo.it ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "plugin_katesymbolviewer.h" void KatePluginSymbolViewerView::parseCppSymbols(void) { if (!m_mainWindow->activeView()) return; QString cl; // Current Line QString stripped; int i, j, tmpPos = 0; int par = 0, graph = 0/*, retry = 0*/; char mclass = 0, block = 0, comment = 0; // comment: 0-no comment 1-inline comment 2-multiline comment 3-string char macro = 0/*, macro_pos = 0*/, func_close = 0; bool structure = false; QPixmap cls( ( const char** ) class_xpm ); QPixmap sct( ( const char** ) struct_xpm ); QPixmap mcr( ( const char** ) macro_xpm ); QPixmap mtd( ( const char** ) method_xpm ); //It is necessary to change names to defaults m_macro->setText(i18n("Show Macros")); m_struct->setText(i18n("Show Structures")); m_func->setText(i18n("Show Functions")); QTreeWidgetItem *node = NULL; QTreeWidgetItem *mcrNode = NULL, *sctNode = NULL, *clsNode = NULL, *mtdNode = NULL; QTreeWidgetItem *lastMcrNode = NULL, *lastSctNode = NULL, *lastClsNode = NULL, *lastMtdNode = NULL; KTextEditor::Document *kv = m_mainWindow->activeView()->document(); //qDebug(13000)<<"Lines counted :"<lines(); if(m_plugin->treeOn) { mcrNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Macros") ) ); sctNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Structures") ) ); clsNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Functions") ) ); mcrNode->setIcon(0, QIcon(mcr)); sctNode->setIcon(0, QIcon(sct)); clsNode->setIcon(0, QIcon(cls)); if (m_plugin->expandedOn) { m_symbols->expandItem(mcrNode); m_symbols->expandItem(sctNode); m_symbols->expandItem(clsNode); } lastMcrNode = mcrNode; lastSctNode = sctNode; lastClsNode = clsNode; mtdNode = clsNode; lastMtdNode = clsNode; m_symbols->setRootIsDecorated(1); } else m_symbols->setRootIsDecorated(0); for (i=0; ilines(); i++) { //qDebug(13000)<<"Current line :"<line(i); cl = cl.trimmed(); func_close = 0; if ( (cl.length()>=2) && (cl.at(0) == QLatin1Char('/') && cl.at(1) == QLatin1Char('/'))) continue; if(cl.indexOf(QLatin1String("/*")) == 0 && (cl.indexOf(QLatin1String("*/")) == ((signed)cl.length() - 2)) && graph == 0) continue; // workaround :( if(cl.indexOf(QLatin1String("/*")) >= 0 && graph == 0) comment = 1; if(cl.indexOf(QLatin1String("*/")) >= 0 && graph == 0) comment = 0; if(cl.indexOf(QLatin1Char('#')) >= 0 && graph == 0 ) macro = 1; if (comment != 1) { /* *********************** MACRO PARSING *****************************/ if(macro == 1) { //macro_pos = cl.indexOf(QLatin1Char('#')); for (j = 0; j < cl.length(); j++) { if ( ((j+1) = 0x20) stripped += cl.at(j); if (cl.at(j) == QLatin1Char(' ') || cl.at(j) == QLatin1Char('\t') || j == cl.length() - 1) macro = 4; } //qDebug(13000)<<"Macro -- Stripped : "<treeOn) { node = new QTreeWidgetItem(mcrNode, lastMcrNode); lastMcrNode = node; } else node = new QTreeWidgetItem(m_symbols); node->setText(0, stripped); node->setIcon(0, QIcon(mcr)); node->setText(1, QString::number( i, 10)); } macro = 0; //macro_pos = 0; stripped.clear(); //qDebug(13000)<<"Macro -- Inserted : "<= 0 && graph == 0 && block == 0)) { mclass = 1; for (j = 0; j < cl.length(); j++) { if(((j+1) < cl.length()) && (cl.at(j)==QLatin1Char('/') && cl.at(j+1)==QLatin1Char('/'))) { mclass = 2; break; } if(cl.at(j)==QLatin1Char('{')) { mclass = 4; break;} stripped += cl.at(j); } if(func_on == true) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(clsNode, lastClsNode); if (m_plugin->expandedOn) m_symbols->expandItem(node); lastClsNode = node; mtdNode = lastClsNode; lastMtdNode = lastClsNode; } else node = new QTreeWidgetItem(m_symbols); node->setText(0, stripped); node->setIcon(0, QIcon(cls)); node->setText(1, QString::number( i, 10)); stripped.clear(); if (mclass == 1) mclass = 3; } continue; } if (mclass == 3) { if (cl.indexOf(QLatin1Char('{')) >= 0) { cl = cl.mid(cl.indexOf(QLatin1Char('{'))); mclass = 4; } } if(cl.indexOf(QLatin1Char('(')) >= 0 && cl.at(0) != QLatin1Char('#') && block == 0 && comment != 2) { structure = false; block = 1; } if((cl.indexOf(QLatin1String("typedef")) >= 0 || cl.indexOf(QLatin1String("struct")) >= 0) && graph == 0 && block == 0) { structure = true; block = 2; stripped.clear(); } //if(cl.indexOf(QLatin1Char(';')) >= 0 && graph == 0) // block = 0; if(block > 0 && mclass != 1 ) { for (j = 0; j < cl.length(); j++) { if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('/') && (cl.at(j + 1) == QLatin1Char('*')) && comment != 3)) comment = 2; if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('*') && (cl.at(j + 1) == QLatin1Char('/')) && comment != 3) ) { comment = 0; j+=2; if (j>=cl.length()) break;} // Skip escaped double quotes if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('\\') && (cl.at(j + 1) == QLatin1Char('"')) && comment == 3) ) { j+=2; if (j>=cl.length()) break;} // Skip char declarations that could be interpreted as range start/end if ( ((cl.indexOf(QStringLiteral("'\"'"), j) == j) || (cl.indexOf(QStringLiteral("'{'"), j) == j) || (cl.indexOf(QStringLiteral("'}'"), j) == j)) && comment != 3 ) { j+=3; if (j>=cl.length()) break;} // Handles a string. Those are freaking evilish ! if (cl.at(j) == QLatin1Char('"') && comment == 3) { comment = 0; j++; if (j>=cl.length()) break;} else if (cl.at(j) == QLatin1Char('"') && comment == 0) comment = 3; if ( ((j+1) = 0x20) stripped += cl.at(j); if(cl.at(j) == QLatin1Char('(')) par++; if(cl.at(j) == QLatin1Char(')')) { par--; if(par == 0) { stripped = stripped.trimmed(); stripped.remove(QLatin1String("static ")); //qDebug(13000)<<"Function -- Inserted : "< (int)j)) { stripped.replace(0x9, QLatin1String(" ")); if(func_on == true) { + QString strippedWithTypes = stripped; if (m_plugin->typesOn == false) { while (stripped.indexOf(QLatin1Char('(')) >= 0) stripped = stripped.left(stripped.indexOf(QLatin1Char('('))); while (stripped.indexOf(QLatin1String("::")) >= 0) stripped = stripped.mid(stripped.indexOf(QLatin1String("::")) + 2); stripped = stripped.trimmed(); while (stripped.indexOf(0x20) >= 0) stripped = stripped.mid(stripped.indexOf(0x20, 0) + 1); while ( (stripped.length()>0) && ( (stripped.at(0)==QLatin1Char('*')) || (stripped.at(0)==QLatin1Char('&')) ) ) stripped=stripped.right(stripped.length()-1); } if (m_plugin->treeOn) { if (mclass == 4) { node = new QTreeWidgetItem(mtdNode, lastMtdNode); lastMtdNode = node; } else { node = new QTreeWidgetItem(clsNode, lastClsNode); lastClsNode = node; } } else node = new QTreeWidgetItem(m_symbols); node->setText(0, stripped); if (mclass == 4) node->setIcon(0, QIcon(mtd)); else node->setIcon(0, QIcon(cls)); node->setText(1, QString::number( tmpPos, 10)); + node->setToolTip(0, strippedWithTypes); } stripped.clear(); //retry = 0; block = 3; } if(cl.at(j)==QLatin1Char('{') && structure == true) { block = 3; tmpPos = i; } if(cl.at(j)==QLatin1Char('(') && structure == true) { //retry = 1; block = 0; j = 0; //qDebug(13000)<<"Restart from the beginning of line..."; stripped.clear(); break; // Avoid an infinite loop :( } if(structure == true && cl.at(j) >= 0x20) stripped += cl.at(j); } // BLOCK 2 if (block == 3) { // A comment...there can be anything if( ((j+1)treeOn) { node = new QTreeWidgetItem(sctNode, lastSctNode); lastSctNode = node; } else node = new QTreeWidgetItem(m_symbols); node->setText(0, stripped); node->setIcon(0, QIcon(sct)); node->setText(1, QString::number( tmpPos, 10)); } //qDebug(13000)<<"Structure -- Inserted : "<= 0x20) stripped += cl.at(j); } // BLOCK 4 } // comment != 2 //qDebug(13000)<<"Stripped : "< 0 if (mclass == 4 && block == 0 && func_close == 0) { if (cl.indexOf(QLatin1Char('}')) >= 0) { cl = cl.mid(cl.indexOf(QLatin1Char('}'))); mclass = 0; } } } // Comment != 1 } // for kv->numlines //for (i= 0; i < (m_symbols->itemIndex(node) + 1); i++) // qDebug(13000)<<"Symbol row :"< : 2010, Emmanuel Bouthenot ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "plugin_katesymbolviewer.h" void KatePluginSymbolViewerView::parsePhpSymbols(void) { if (m_mainWindow->activeView()) { QString line, lineWithliterals; QPixmap namespacePix( ( const char** ) class_int_xpm ); QPixmap definePix( ( const char** ) macro_xpm ); QPixmap varPix( ( const char** ) struct_xpm ); QPixmap classPix( ( const char** ) class_xpm ); QPixmap constPix( ( const char** ) macro_xpm ); QPixmap functionPix( ( const char** ) method_xpm ); QTreeWidgetItem *node = NULL; QTreeWidgetItem *namespaceNode = NULL, *defineNode = NULL, \ *classNode = NULL, *functionNode = NULL; QTreeWidgetItem *lastNamespaceNode = NULL, *lastDefineNode = NULL, \ *lastClassNode = NULL, *lastFunctionNode = NULL; KTextEditor::Document *kv = m_mainWindow->activeView()->document(); if (m_plugin->treeOn) { namespaceNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Namespaces") ) ); defineNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Defines") ) ); classNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Classes") ) ); functionNode = new QTreeWidgetItem(m_symbols, QStringList( i18n("Functions") ) ); namespaceNode->setIcon(0, QIcon( namespacePix ) ); defineNode->setIcon(0, QIcon( definePix ) ); classNode->setIcon(0, QIcon( classPix ) ); functionNode->setIcon(0, QIcon( functionPix ) ); if (m_plugin->expandedOn) { m_symbols->expandItem(namespaceNode); m_symbols->expandItem(defineNode); m_symbols->expandItem(classNode); m_symbols->expandItem(functionNode); } lastNamespaceNode = namespaceNode; lastDefineNode = defineNode; lastClassNode = classNode; lastFunctionNode = functionNode; m_symbols->setRootIsDecorated(1); } else { m_symbols->setRootIsDecorated(0); } // Namespaces: http://www.php.net/manual/en/language.namespaces.php QRegExp namespaceRegExp(QLatin1String("^namespace\\s+([^;\\s]+)"), Qt::CaseInsensitive); // defines: http://www.php.net/manual/en/function.define.php QRegExp defineRegExp(QLatin1String("(^|\\W)define\\s*\\(\\s*['\"]([^'\"]+)['\"]"), Qt::CaseInsensitive); // classes: http://www.php.net/manual/en/language.oop5.php QRegExp classRegExp(QLatin1String("^((abstract\\s+|final\\s+)?)class\\s+([\\w_][\\w\\d_]*)\\s*(implements\\s+[\\w\\d_]*)?"), Qt::CaseInsensitive); // interfaces: http://www.php.net/manual/en/language.oop5.php QRegExp interfaceRegExp(QLatin1String("^interface\\s+([\\w_][\\w\\d_]*)"), Qt::CaseInsensitive); // classes constants: http://www.php.net/manual/en/language.oop5.constants.php QRegExp constantRegExp(QLatin1String("^const\\s+([\\w_][\\w\\d_]*)"), Qt::CaseInsensitive); // functions: http://www.php.net/manual/en/language.oop5.constants.php QRegExp functionRegExp(QLatin1String("^((public|protected|private)?(\\s*static)?\\s+)?function\\s+&?\\s*([\\w_][\\w\\d_]*)\\s*(.*)$"), Qt::CaseInsensitive); // variables: http://www.php.net/manual/en/language.oop5.properties.php QRegExp varRegExp(QLatin1String("^((var|public|protected|private)?(\\s*static)?\\s+)?\\$([\\w_][\\w\\d_]*)"), Qt::CaseInsensitive); // function args detection: “function a($b, $c=null)” => “$b, $v” QRegExp functionArgsRegExp(QLatin1String("(\\$[\\w_]+)"), Qt::CaseInsensitive); QStringList functionArgsList; QString functionArgs; + QString nameWithTypes; // replace literals by empty strings: “function a($b='nothing', $c="pretty \"cool\" string")” => “function ($b='', $c="")” QRegExp literalRegExp(QLatin1String("([\"'])(?:\\\\.|[^\\\\])*\\1")); literalRegExp.setMinimal(true); // remove useless comments: “public/* static */ function a($b, $c=null) /* test */” => “public function a($b, $c=null)” QRegExp blockCommentInline(QLatin1String("/\\*.*\\*/")); blockCommentInline.setMinimal(true); int i, pos; bool isClass, isInterface; bool inBlockComment = false; bool inClass = false, inFunction = false; //QString debugBuffer("SymbolViewer(PHP), line %1 %2 → [%3]"); for (i=0; ilines(); i++) { //kdDebug(13000) << debugBuffer.arg(i, 4).arg("=origin", 10).arg(kv->line(i)); line = kv->line(i).simplified(); //kdDebug(13000) << debugBuffer.arg(i, 4).arg("+simplified", 10).arg(line); // keeping a copy with literals for catching “defines()” lineWithliterals = line; // reduce literals to empty strings to not match comments separators in literals line.replace(literalRegExp, QLatin1String("\\1\\1")); //kdDebug(13000) << debugBuffer.arg(i, 4).arg("-literals", 10).arg(line); line.remove(blockCommentInline); //kdDebug(13000) << debugBuffer.arg(i, 4).arg("-comments", 10).arg(line); // trying to find comments and to remove commented parts pos = line.indexOf(QLatin1Char('#')); if (pos >= 0) { line = line.left(pos); } pos = line.indexOf(QLatin1String("//")); if (pos >= 0) { line = line.left(pos); } pos = line.indexOf(QLatin1String("/*")); if (pos >= 0) { line = line.left(pos); inBlockComment = true; } pos = line.indexOf(QLatin1String("*/")); if (pos >= 0) { line = line.right(line.length() - pos - 2); inBlockComment = false; } if (inBlockComment) { continue; } // trimming again after having removed the comments line = line.simplified(); //kdDebug(13000) << debugBuffer.arg(i, 4).arg("+simplified", 10).arg(line); // detect NameSpaces if (namespaceRegExp.indexIn(line) != -1) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(namespaceNode, lastNamespaceNode); if (m_plugin->expandedOn) { m_symbols->expandItem(node); } lastNamespaceNode = node; } else { node = new QTreeWidgetItem(m_symbols); } node->setText(0, namespaceRegExp.cap(1)); node->setIcon(0, QIcon(namespacePix)); node->setText(1, QString::number( i, 10)); } // detect defines if (defineRegExp.indexIn(lineWithliterals) != -1) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(defineNode, lastDefineNode); lastDefineNode = node; } else { node = new QTreeWidgetItem(m_symbols); } node->setText(0, defineRegExp.cap(2)); node->setIcon(0, QIcon(definePix)); node->setText(1, QString::number( i, 10)); } // detect classes, interfaces isClass = classRegExp.indexIn(line) != -1; isInterface = interfaceRegExp.indexIn(line) != -1; if (isClass || isInterface) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(classNode, lastClassNode); if (m_plugin->expandedOn) { m_symbols->expandItem(node); } lastClassNode = node; } else { node = new QTreeWidgetItem(m_symbols); } if (isClass) { - if (m_plugin->typesOn && !classRegExp.cap(1).trimmed().isEmpty() && !classRegExp.cap(4).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(',')+classRegExp.cap(4).trimmed()+QLatin1Char(']')); - } - else if (m_plugin->typesOn && !classRegExp.cap(1).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(']')); - } - else if (m_plugin->typesOn && !classRegExp.cap(4).trimmed().isEmpty()) - { - node->setText(0, classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(4).trimmed()+QLatin1Char(']')); + if (m_plugin->typesOn) { + if (!classRegExp.cap(1).trimmed().isEmpty() && !classRegExp.cap(4).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(',')+classRegExp.cap(4).trimmed()+QLatin1Char(']'); + } + else if (!classRegExp.cap(1).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(1).trimmed()+QLatin1Char(']'); + } + else if (!classRegExp.cap(4).trimmed().isEmpty()) + { + nameWithTypes = classRegExp.cap(3)+QLatin1String(" [")+classRegExp.cap(4).trimmed()+QLatin1Char(']'); + } + node->setText(0, nameWithTypes); } else { node->setText(0, classRegExp.cap(3)); } } else { if (m_plugin->typesOn) { - node->setText(0, interfaceRegExp.cap(1) + QLatin1String(" [interface]")); + nameWithTypes = interfaceRegExp.cap(1) + QLatin1String(" [interface]"); + node->setText(0, nameWithTypes); } else { node->setText(0, interfaceRegExp.cap(1)); } } node->setIcon(0, QIcon(classPix)); node->setText(1, QString::number( i, 10)); + node->setToolTip(0, nameWithTypes); inClass = true; inFunction = false; } // detect class constants if (constantRegExp.indexIn(line) != -1) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(lastClassNode); } else { node = new QTreeWidgetItem(m_symbols); } node->setText(0, constantRegExp.cap(1)); node->setIcon(0, QIcon(constPix)); node->setText(1, QString::number( i, 10)); } // detect class variables if (inClass && !inFunction) { if (varRegExp.indexIn(line) != -1) { if (m_plugin->treeOn && inClass) { node = new QTreeWidgetItem(lastClassNode); } else { node = new QTreeWidgetItem(m_symbols); } node->setText(0, varRegExp.cap(4)); node->setIcon(0, QIcon(varPix)); node->setText(1, QString::number( i, 10)); } } // detect functions if (functionRegExp.indexIn(line) != -1) { if (m_plugin->treeOn && inClass) { node = new QTreeWidgetItem(lastClassNode); } else if (m_plugin->treeOn) { node = new QTreeWidgetItem(lastFunctionNode); } else { node = new QTreeWidgetItem(m_symbols); } + QString functionArgs(functionRegExp.cap(5)); + pos = 0; + while (pos >= 0) { + pos = functionArgsRegExp.indexIn(functionArgs, pos); + if (pos >= 0) { + pos += functionArgsRegExp.matchedLength(); + functionArgsList += functionArgsRegExp.cap(1); + } + } + + nameWithTypes = functionRegExp.cap(4) + QLatin1Char('(') + functionArgsList.join(QLatin1String(", ")) + QLatin1Char(')'); if (m_plugin->typesOn) { - QString functionArgs(functionRegExp.cap(5)); - pos = 0; - while (pos >= 0) { - pos = functionArgsRegExp.indexIn(functionArgs, pos); - if (pos >= 0) { - pos += functionArgsRegExp.matchedLength(); - functionArgsList += functionArgsRegExp.cap(1); - } - } - node->setText(0, functionRegExp.cap(4) + QLatin1Char('(') + functionArgsList.join(QLatin1String(", ")) + QLatin1Char(')')); - functionArgsList.clear(); + node->setText(0, nameWithTypes); } else { node->setText(0, functionRegExp.cap(4)); } + node->setIcon(0, QIcon(functionPix)); node->setText(1, QString::number( i, 10)); + node->setToolTip(0, nameWithTypes); + + functionArgsList.clear(); inFunction = true; } } } } diff --git a/addons/symbolviewer/ruby_parser.cpp b/addons/symbolviewer/ruby_parser.cpp index f11951303..63a7896ff 100644 --- a/addons/symbolviewer/ruby_parser.cpp +++ b/addons/symbolviewer/ruby_parser.cpp @@ -1,105 +1,106 @@ /*************************************************************************** ruby_parser.cpp - description ------------------- begin : May 9th 2007 author : 2007 Massimo Callegari email : massimocallegari@yahoo.it ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "plugin_katesymbolviewer.h" void KatePluginSymbolViewerView::parseRubySymbols(void) { if (!m_mainWindow->activeView()) return; m_macro->setText(i18n("Show Globals")); m_struct->setText(i18n("Show Methods")); m_func->setText(i18n("Show Classes")); QString cl; // Current Line QPixmap cls( ( const char** ) class_xpm ); QPixmap mtd( ( const char** ) method_xpm ); QPixmap mcr( ( const char** ) macro_xpm ); int i; QString name; QTreeWidgetItem *node = NULL; QTreeWidgetItem *mtdNode = NULL, *clsNode = NULL; QTreeWidgetItem *lastMtdNode = NULL, *lastClsNode = NULL; KTextEditor::Document *kv = m_mainWindow->activeView()->document(); //kdDebug(13000)<<"Lines counted :"<numLines()<treeOn) { clsNode = new QTreeWidgetItem(m_symbols); clsNode->setText(0, i18n("Classes")); clsNode->setIcon(0, QIcon(cls)); if (m_plugin->expandedOn) m_symbols->expandItem(clsNode); lastClsNode = clsNode; mtdNode = clsNode; lastMtdNode = clsNode; m_symbols->setRootIsDecorated(1); } else m_symbols->setRootIsDecorated(0); for (i=0; ilines(); i++) { cl = kv->line(i); cl = cl.trimmed(); if (cl.indexOf( QRegExp(QLatin1String("^class [a-zA-Z0-9]+[^#]")) ) >= 0) { - name = cl.mid(6); if (func_on == true) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(clsNode, lastClsNode); if (m_plugin->expandedOn) m_symbols->expandItem(node); lastClsNode = node; mtdNode = lastClsNode; lastMtdNode = lastClsNode; } else node = new QTreeWidgetItem(m_symbols); - node->setText(0, name); + node->setText(0, cl.mid(6)); node->setIcon(0, QIcon(cls)); node->setText(1, QString::number( i, 10)); } } if (cl.indexOf( QRegExp(QLatin1String("^def [a-zA-Z_]+[^#]")) ) >= 0 ) { - name = cl.mid(4); - if (m_plugin->typesOn == false) - { - name = name.left(name.indexOf(QLatin1Char('('))); - } if (struct_on == true) { if (m_plugin->treeOn) { node = new QTreeWidgetItem(mtdNode, lastMtdNode); lastMtdNode = node; } else node = new QTreeWidgetItem(m_symbols); + + name = cl.mid(4); + node->setToolTip(0, name); + if (m_plugin->typesOn == false) + { + name = name.left(name.indexOf(QLatin1Char('('))); + } node->setText(0, name); node->setIcon(0, QIcon(mtd)); node->setText(1, QString::number( i, 10)); } } } }