OSDN Git Service

Merge branch 'refactoring'
[qt-creator-jp/qt-creator-jp.git] / src / plugins / find / findplugin.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** Commercial Usage
10 **
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
27 **
28 **************************************************************************/
29
30 #ifndef FINDPLUGIN_H
31 #define FINDPLUGIN_H
32
33 #include "find_global.h"
34
35 #include <extensionsystem/iplugin.h>
36
37 #include <QtGui/QTextDocument>
38
39 QT_BEGIN_NAMESPACE
40 class QStringListModel;
41 QT_END_NAMESPACE
42
43 namespace Find {
44 class IFindFilter;
45 struct FindPluginPrivate;
46
47 namespace Internal {
48 class FindToolBar;
49 class FindToolWindow;
50 class CurrentDocumentFind;
51 } // namespace Internal
52
53 class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin
54 {
55     Q_OBJECT
56
57 public:
58     FindPlugin();
59     virtual ~FindPlugin();
60     static FindPlugin *instance();
61
62     enum FindDirection {
63         FindForward,
64         FindBackward
65     };
66
67     // IPlugin
68     bool initialize(const QStringList &arguments, QString *error_message);
69     void extensionsInitialized();
70     void shutdown();
71
72     QTextDocument::FindFlags findFlags() const;
73     void updateFindCompletion(const QString &text);
74     void updateReplaceCompletion(const QString &text);
75     QStringListModel *findCompletionModel() const;
76     QStringListModel *replaceCompletionModel() const;
77     void setUseFakeVim(bool on);
78     void openFindToolBar(FindDirection direction);
79
80 public slots:
81     void setCaseSensitive(bool sensitive);
82     void setWholeWord(bool wholeOnly);
83     void setBackward(bool backward);
84
85 signals:
86     void findFlagsChanged();
87
88 private slots:
89     void filterChanged();
90     void openFindFilter();
91
92 private:
93     void setFindFlag(QTextDocument::FindFlag flag, bool enabled);
94     bool hasFindFlag(QTextDocument::FindFlag flag);
95     void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model);
96     void setupMenu();
97     void setupFilterMenuItems();
98     void writeSettings();
99     void readSettings();
100
101     //variables
102     FindPluginPrivate *d;
103 };
104
105 } // namespace Find
106
107 #endif // FINDPLUGIN_H