Konsole
IncrementalSearchBar.h
Go to the documentation of this file.00001 /* 00002 Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301 USA. 00018 */ 00019 00020 #ifndef INCREMENTALSEARCHBAR_H 00021 #define INCREMENTALSEARCHBAR_H 00022 00023 // Qt 00024 #include <QtGui/QWidget> 00025 00026 class QCheckBox; 00027 class QLabel; 00028 class QProgressBar; 00029 class QTimer; 00030 class KLineEdit; 00031 00032 namespace Konsole 00033 { 00034 00064 class IncrementalSearchBar : public QWidget 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 enum Continue 00070 { 00075 ContinueFromTop, 00080 ContinueFromBottom, 00081 00083 ClearContinue 00084 }; 00085 00090 enum Features 00091 { 00093 HighlightMatches = 1, 00095 MatchCase = 2, 00097 RegExp = 4, 00099 AllFeatures = HighlightMatches | MatchCase | RegExp 00100 }; 00101 00106 explicit IncrementalSearchBar(Features features , QWidget* parent = 0); 00107 00119 void setFoundMatch( bool match ); 00120 00127 void setContinueFlag( Continue flag ); 00128 00130 QString searchText(); 00135 bool highlightMatches(); 00140 bool matchCase(); 00145 bool matchRegExp(); 00146 00147 // reimplemented 00148 virtual void setVisible( bool visible ); 00149 signals: 00151 void searchChanged( const QString& text ); 00153 void findNextClicked(); 00155 void findPreviousClicked(); 00160 void highlightMatchesToggled(bool); 00165 void matchCaseToggled(bool); 00170 void matchRegExpToggled(bool); 00172 void closeClicked(); 00173 00174 protected: 00175 virtual bool eventFilter( QObject* watched , QEvent* event ); 00176 00177 private slots: 00178 void notifySearchChanged(); 00179 void clearLineEdit(); 00180 00181 private: 00182 bool _foundMatch; 00183 QCheckBox* _matchCaseBox; 00184 QCheckBox* _matchRegExpBox; 00185 QCheckBox* _highlightBox; 00186 00187 KLineEdit* _searchEdit; 00188 QLabel* _continueLabel; 00189 QProgressBar* _progress; 00190 00191 QTimer* _searchTimer; 00192 }; 00193 00194 } 00195 #endif // INCREMENTALSEARCHBAR_H