OSDN Git Service

Support symbolic links in the file manager.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / find / findtoolbar.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 FINDTOOLBAR_H
31 #define FINDTOOLBAR_H
32
33 #include "ui_findwidget.h"
34 #include "currentdocumentfind.h"
35
36 #include <utils/styledbar.h>
37
38 #include <QtCore/QTimer>
39
40 namespace Core {
41 class FindToolBarPlaceHolder;
42 }
43
44 namespace Find {
45 class FindPlugin;
46
47 namespace Internal {
48
49 class FindToolBar : public Utils::StyledBar
50 {
51     Q_OBJECT
52
53 public:
54     explicit FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
55     ~FindToolBar();
56
57     void readSettings();
58     void writeSettings();
59
60     void openFindToolBar();
61     void setUseFakeVim(bool on);
62
63 public slots:
64     void setBackward(bool backward);
65
66 private slots:
67     void invokeFindNext();
68     void invokeFindPrevious();
69     void invokeFindStep();
70     void invokeReplace();
71     void invokeReplaceNext();
72     void invokeReplacePrevious();
73     void invokeReplaceStep();
74     void invokeReplaceAll();
75     void invokeResetIncrementalSearch();
76
77     void invokeFindIncremental();
78     void invokeFindEnter();
79     void invokeReplaceEnter();
80     void putSelectionToFindClipboard();
81     void updateFromFindClipboard();
82
83     void hideAndResetFocus();
84     void openFind();
85     void updateFindAction();
86     void updateToolBar();
87     void findFlagsChanged();
88
89     void setCaseSensitive(bool sensitive);
90     void setWholeWord(bool wholeOnly);
91     void setRegularExpressions(bool regexp);
92
93     void adaptToCandidate();
94
95 protected:
96     bool focusNextPrevChild(bool next);
97
98 private:
99     void installEventFilters();
100     void invokeClearResults();
101     bool setFocusToCurrentFindSupport();
102     void setFindFlag(Find::FindFlag flag, bool enabled);
103     bool hasFindFlag(Find::FindFlag flag);
104     Find::FindFlags effectiveFindFlags();
105     Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
106
107     bool eventFilter(QObject *obj, QEvent *event);
108     void setFindText(const QString &text);
109     QString getFindText();
110     QString getReplaceText();
111     void selectFindText();
112     void updateIcons();
113     void updateFlagMenus();
114
115     FindPlugin *m_plugin;
116     CurrentDocumentFind *m_currentDocumentFind;
117     Ui::FindWidget m_ui;
118     QCompleter *m_findCompleter;
119     QCompleter *m_replaceCompleter;
120     QAction *m_findInDocumentAction;
121     QAction *m_enterFindStringAction;
122     QAction *m_findNextAction;
123     QAction *m_findPreviousAction;
124     QAction *m_replaceAction;
125     QAction *m_replaceNextAction;
126     QAction *m_replacePreviousAction;
127     QAction *m_replaceAllAction;
128     QAction *m_caseSensitiveAction;
129     QAction *m_wholeWordAction;
130     QAction *m_regularExpressionAction;
131     Find::FindFlags m_findFlags;
132
133     QPixmap m_casesensitiveIcon;
134     QPixmap m_regexpIcon;
135     QPixmap m_wholewordsIcon;
136
137     QTimer m_findIncrementalTimer;
138     QTimer m_findStepTimer;
139     bool m_useFakeVim;
140     bool m_eventFiltersInstalled;
141 };
142
143 } // namespace Internal
144 } // namespace Find
145
146 #endif // FINDTOOLBAR_H