3 Copyright (c) 2012 Jakob Leben & Tim Blechmann
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef SCIDE_WIDGETS_LOOKUP_DIALOG_HPP_INCLUDED
22 #define SCIDE_WIDGETS_LOOKUP_DIALOG_HPP_INCLUDED
26 #include <QStandardItemModel>
27 #include <QTreeWidget>
29 #include "../core/sc_process.hpp"
33 class GenericLookupDialog
: public QDialog
38 static const int PathRole
= Qt::UserRole
+ 1;
39 static const int CharPosRole
= Qt::UserRole
+ 2;
40 static const int IsClassRole
= Qt::UserRole
+ 3;
42 explicit GenericLookupDialog(QWidget
*parent
= 0);
43 void query( const QString
& query
) { mQueryEdit
->setText(query
); this->performQuery(); }
44 void clearQuery() { mQueryEdit
->clear(); }
47 void onAccepted(QModelIndex
);
48 virtual void performQuery() = 0;
51 bool eventFilter( QObject
*, QEvent
* );
52 void paintEvent( QPaintEvent
* );
55 static QList
<QStandardItem
*> makeDialogItem(QString
const & name
, QString
const & displayPath
,
56 QString
const & path
, int position
, bool isClassItem
);
59 QLineEdit
*mQueryEdit
;
62 class LookupDialog
: public GenericLookupDialog
67 explicit LookupDialog(QWidget
*parent
= 0);
73 QStandardItemModel
* modelForClass(const QString
& className
);
74 QStandardItemModel
* modelForMethod(const QString
& methodName
);
75 QStandardItemModel
* modelForCaseInsensitiveQuery(const QString
& queryString
);
76 bool performClassQuery(const QString
& className
);
77 bool performMethodQuery(const QString
& methodName
);
78 bool performPartialQuery(const QString
& queryString
);
81 // LATER: cache symbol references to avoid duplicate lookup
82 class SymbolReferenceRequest
:
88 SymbolReferenceRequest(SCProcess
* process
, QObject
* parent
= NULL
):
89 ScRequest(process
, parent
)
92 void sendRequest(QString
const & symbol
)
94 send("findReferencesToSymbol", symbol
);
98 class ReferencesDialog
:
104 explicit ReferencesDialog(QWidget
* parent
= NULL
);
107 void requestCanceled();
109 void onResposeFromLanguage(const QString
&command
, const QString
&responseData
);
110 QStandardItemModel
* parse(QString
const & responseData
);
115 #endif // SCIDE_WIDGETS_LOOKUP_DIALOG_HPP_INCLUDED