OSDN Git Service

Merge branch 'master' of git://scm.dev.nokia.troll.no/creator/mainline
[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) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact:  Qt Software Information (qt-info@nokia.com)
8 **
9 **
10 ** Non-Open Source Usage
11 **
12 ** Licensees may use this file in accordance with the Qt Beta Version
13 ** License Agreement, Agreement version 2.2 provided with the Software or,
14 ** alternatively, in accordance with the terms contained in a written
15 ** agreement between you and Nokia.
16 **
17 ** GNU General Public License Usage
18 **
19 ** Alternatively, this file may be used under the terms of the GNU General
20 ** Public License versions 2.0 or 3.0 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.GPL included in the packaging
22 ** of this file.  Please review the following information to ensure GNU
23 ** General Public Licensing requirements will be met:
24 **
25 ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
26 ** http://www.gnu.org/copyleft/gpl.html.
27 **
28 ** In addition, as a special exception, Nokia gives you certain additional
29 ** rights. These rights are described in the Nokia Qt GPL Exception
30 ** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
31 **
32 ***************************************************************************/
33
34 #ifndef FINDPLUGIN_H
35 #define FINDPLUGIN_H
36
37 #include "ui_findwidget.h"
38 #include "ifindfilter.h"
39 #include "findtoolbar.h"
40
41 #include <extensionsystem/iplugin.h>
42
43 #include <QtCore/QHash>
44 #include <QtCore/QStringList>
45 #include <QtGui/QAction>
46 #include <QtGui/QTextDocument>
47
48 namespace Find {
49 namespace Internal {
50
51 class FindToolWindow;
52
53 class FindPlugin : public ExtensionSystem::IPlugin
54 {
55     Q_OBJECT
56
57 public:
58     FindPlugin();
59     virtual ~FindPlugin();
60
61     // IPlugin
62     bool initialize(const QStringList &arguments, QString *error_message);
63     void extensionsInitialized();
64     void shutdown();
65
66     QTextDocument::FindFlags findFlags() const;
67     void updateFindCompletion(const QString &text);
68     void updateReplaceCompletion(const QString &text);
69     QStringListModel *findCompletionModel() { return m_findCompletionModel; }
70     QStringListModel *replaceCompletionModel() { return m_replaceCompletionModel; }
71
72 public slots:
73     void setCaseSensitive(bool sensitive);
74     void setWholeWord(bool wholeOnly);
75     void setBackward(bool backward);
76
77 signals:
78     void findFlagsChanged();
79
80 private slots:
81     void filterChanged();
82     void openFindFilter();
83
84 private:
85     void setFindFlag(QTextDocument::FindFlag flag, bool enabled);
86     bool hasFindFlag(QTextDocument::FindFlag flag);
87     void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model);
88     void setupMenu();
89     void setupFilterMenuItems();
90     void writeSettings();
91     void readSettings();
92
93     //variables
94     QHash<IFindFilter *, QAction *> m_filterActions;
95
96     CurrentDocumentFind *m_currentDocumentFind;
97     FindToolBar *m_findToolBar;
98     FindToolWindow *m_findDialog;
99     QTextDocument::FindFlags m_findFlags;
100     QStringListModel *m_findCompletionModel;
101     QStringListModel *m_replaceCompletionModel;
102     QStringList m_findCompletions;
103     QStringList m_replaceCompletions;
104 };
105
106 } // namespace Internal
107 } // namespace Find
108
109 #endif // FINDPLUGIN_H