From b93d0f86b9680f277c01d2b7486a6b3b018fb0dd Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 12 Sep 2012 16:27:15 +0200 Subject: [PATCH] scide: LookupDialog - store information if dialog item is a class item Signed-off-by: Tim Blechmann --- editors/sc-ide/widgets/lookup_dialog.cpp | 23 ++++++++++++----------- editors/sc-ide/widgets/lookup_dialog.hpp | 4 +++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/editors/sc-ide/widgets/lookup_dialog.cpp b/editors/sc-ide/widgets/lookup_dialog.cpp index 01d1d57e9..9646d7aa4 100644 --- a/editors/sc-ide/widgets/lookup_dialog.cpp +++ b/editors/sc-ide/widgets/lookup_dialog.cpp @@ -151,7 +151,7 @@ void LookupDialog::performQuery() const Introspection & introspection = Main::scProcess()->introspection(); if (!introspection.introspectionAvailable()) { - MainWindow::instance()->showStatusMessage("Introspection Data not available"); + MainWindow::instance()->showStatusMessage("Introspection data not yet available"); return; } @@ -175,11 +175,12 @@ void LookupDialog::performQuery() } QList GenericLookupDialog::makeDialogItem( QString const & name, QString const & displayPath, - QString const & path, int position ) + QString const & path, int position, bool isClassItem ) { QStandardItem * item = new QStandardItem( name ); item->setData( path, PathRole ); item->setData( position, CharPosRole ); + item->setData( isClassItem, IsClassRole ); QStandardItem * pathItem = new QStandardItem(displayPath); QList ret; @@ -206,7 +207,7 @@ QStandardItemModel * LookupDialog::modelForClass(const QString &className) parentItem->appendRow(makeDialogItem(klass->name.get(), displayPath, klass->definition.path.get(), - klass->definition.position)); + klass->definition.position, true )); foreach (const Method * method, metaClass->methods) { QString signature = method->signature( Method::SignatureWithoutArguments ); @@ -214,7 +215,7 @@ QStandardItemModel * LookupDialog::modelForClass(const QString &className) parentItem->appendRow(makeDialogItem( signature, displayPath, method->definition.path.get(), - method->definition.position )); + method->definition.position, false )); } foreach (const Method * method, klass->methods) { @@ -223,7 +224,7 @@ QStandardItemModel * LookupDialog::modelForClass(const QString &className) parentItem->appendRow(makeDialogItem( signature, displayPath, method->definition.path.get(), - method->definition.position )); + method->definition.position, false )); } klass = klass->superClass; @@ -254,7 +255,7 @@ QStandardItemModel * LookupDialog::modelForMethod(const QString & methodName) parentItem->appendRow(makeDialogItem( signature, displayPath, method->definition.path.get(), - method->definition.position )); + method->definition.position, false )); } model->sort(0); @@ -286,7 +287,7 @@ QStandardItemModel * LookupDialog::modelForCaseInsensitiveQuery(const QString & parentItem->appendRow(makeDialogItem( signature, displayPath, method->definition.path.get(), - method->definition.position )); + method->definition.position, false )); } for (ClassIterator it = classes.begin(); it != classes.end(); ++it) { @@ -295,7 +296,7 @@ QStandardItemModel * LookupDialog::modelForCaseInsensitiveQuery(const QString & parentItem->appendRow(makeDialogItem(klass->name.get(), displayPath, klass->definition.path.get(), - klass->definition.position)); + klass->definition.position, true )); } model->sort(0); @@ -367,8 +368,8 @@ QStandardItemModel * ReferencesDialog::parse(const QString &responseData) using namespace ScLanguage; const Introspection & introspection = Main::scProcess()->introspection(); - if (!introspection.introspectionAvailable()) { - qWarning() << "Introspection not available"; // just required for short path name + if (!introspection.introspectionAvailable()) { // just required for short path name + MainWindow::instance()->showStatusMessage("Introspection data not yet available"); return NULL; } @@ -401,7 +402,7 @@ QStandardItemModel * ReferencesDialog::parse(const QString &responseData) QString displayPath = introspection.compactLibraryPath(path); QString fullName = ScLanguage::makeFullMethodName(className, methodName); - parentItem->appendRow(makeDialogItem(fullName, displayPath, path, charPos)); + parentItem->appendRow(makeDialogItem(fullName, displayPath, path, charPos, false)); } return model; diff --git a/editors/sc-ide/widgets/lookup_dialog.hpp b/editors/sc-ide/widgets/lookup_dialog.hpp index 9f0ac8ba9..634b484c9 100644 --- a/editors/sc-ide/widgets/lookup_dialog.hpp +++ b/editors/sc-ide/widgets/lookup_dialog.hpp @@ -37,6 +37,7 @@ class GenericLookupDialog: public QDialog public: static const int PathRole = Qt::UserRole + 1; static const int CharPosRole = Qt::UserRole + 2; + static const int IsClassRole = Qt::UserRole + 3; explicit GenericLookupDialog(QWidget *parent = 0); void query( const QString & query ) { mQueryEdit->setText(query); this->performQuery(); } @@ -51,7 +52,8 @@ protected: void paintEvent( QPaintEvent * ); void focusResults(); - static QList makeDialogItem(QString const & name, QString const & displayPath, QString const & path, int position); + static QList makeDialogItem(QString const & name, QString const & displayPath, + QString const & path, int position, bool isClassItem); QTreeView *mResult; QLineEdit *mQueryEdit; -- 2.11.4.GIT