1 | /* |
---|
2 | Copyright 2013 Christian Surlykke |
---|
3 | |
---|
4 | This program is free software; you can redistribute it and/or modify |
---|
5 | it under the terms of the GNU General Public License as published by |
---|
6 | the Free Software Foundation; either version 2 of the License, or |
---|
7 | (at your option) any later version. |
---|
8 | |
---|
9 | This program is distributed in the hope that it will be useful, |
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | GNU General Public License for more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License |
---|
15 | along with this program; if not, write to the Free Software |
---|
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
17 | 02110-1301 USA. |
---|
18 | */ |
---|
19 | #ifndef _SEARCHBAR_H |
---|
20 | #define _SEARCHBAR_H |
---|
21 | |
---|
22 | #include <QRegExp> |
---|
23 | |
---|
24 | #include "ui_SearchBar.h" |
---|
25 | #include "HistorySearch.h" |
---|
26 | |
---|
27 | class SearchBar : public QWidget { |
---|
28 | Q_OBJECT |
---|
29 | public: |
---|
30 | SearchBar(QWidget* parent = nullptr); |
---|
31 | ~SearchBar() override; |
---|
32 | virtual void show(); |
---|
33 | QString searchText(); |
---|
34 | bool useRegularExpression(); |
---|
35 | bool matchCase(); |
---|
36 | bool highlightAllMatches(); |
---|
37 | |
---|
38 | public slots: |
---|
39 | void noMatchFound(); |
---|
40 | void hide(); |
---|
41 | |
---|
42 | signals: |
---|
43 | void searchCriteriaChanged(); |
---|
44 | void highlightMatchesChanged(bool highlightMatches); |
---|
45 | void findNext(); |
---|
46 | void findPrevious(); |
---|
47 | |
---|
48 | protected: |
---|
49 | void keyReleaseEvent(QKeyEvent* keyEvent) override; |
---|
50 | |
---|
51 | private slots: |
---|
52 | void clearBackgroundColor(); |
---|
53 | |
---|
54 | private: |
---|
55 | Ui::SearchBar widget; |
---|
56 | QAction *m_matchCaseMenuEntry; |
---|
57 | QAction *m_useRegularExpressionMenuEntry; |
---|
58 | QAction *m_highlightMatchesMenuEntry; |
---|
59 | }; |
---|
60 | |
---|
61 | #endif /* _SEARCHBAR_H */ |
---|