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 virtual void onAccepted(QModelIndex
);
50 virtual void performQuery() = 0;
53 QStandardItem
* currentItem();
54 bool eventFilter( QObject
*, QEvent
* );
55 void paintEvent( QPaintEvent
* );
58 static QList
<QStandardItem
*> makeDialogItem(QString
const & name
, QString
const & displayPath
,
59 QString
const & path
, int position
, bool isClassItem
);
62 QLineEdit
*mQueryEdit
;
65 class LookupDialog
: public GenericLookupDialog
70 explicit LookupDialog(QWidget
*parent
= 0);
74 void onAccepted(QModelIndex
);
77 QStandardItemModel
* modelForClass(const QString
& className
);
78 QStandardItemModel
* modelForMethod(const QString
& methodName
);
79 QStandardItemModel
* modelForPartialQuery(const QString
& queryString
);
80 bool performClassQuery(const QString
& className
);
81 bool performMethodQuery(const QString
& methodName
);
82 bool performPartialQuery(const QString
& queryString
);
87 // LATER: cache symbol references to avoid duplicate lookup
88 class SymbolReferenceRequest
:
94 SymbolReferenceRequest(SCProcess
* process
, QObject
* parent
= NULL
):
95 ScRequest(process
, parent
)
98 void sendRequest(QString
const & symbol
)
100 send("findReferencesToSymbol", symbol
);
104 class ReferencesDialog
:
110 explicit ReferencesDialog(QWidget
* parent
= NULL
);
113 void requestCanceled();
115 void onResposeFromLanguage(const QString
&command
, const QString
&responseData
);
116 QStandardItemModel
* parse(QString
const & responseData
);
121 #endif // SCIDE_WIDGETS_LOOKUP_DIALOG_HPP_INCLUDED