1 /*************************************************************************** 2 * Copyright (C) 2004-2021 by Pere Constans 3 * constans@molspaces.com 4 * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3. 5 * See the LICENSE file that comes with this distribution. 6 * findDialog is adapted from Qt Designer 7 * Copyright (C) 2001 Trolltech AS. All rights reserved. 8 ***************************************************************************/ 9 #ifndef FINDDIALOG_H 10 #define FINDDIALOG_H 11 12 #include "ui_findDialog.h" 13 14 #include <QDialog> 15 #include <QPointer> 16 17 18 class QAction; 19 class QPlainTextEdit; 20 class QTextEdit; 21 22 23 class findDialog : public QDialog 24 { 25 26 Q_OBJECT 27 28 public: 29 explicit findDialog(QWidget* parentw = 0); 30 ~findDialog(); 31 32 QAction* findAction; 33 QAction* findNextAction; 34 QAction* findPreviousAction; 35 36 37 public slots: 38 int exec(); 39 void findNext(); 40 void findPrevious(); 41 void findText(); 42 void setEditor(QPlainTextEdit* editor); 43 void setEditor(QTextEdit* editor); 44 void show(); 45 46 47 private slots: 48 void accept(); 49 50 51 private: 52 QPointer<QWidget> _editor; 53 QString m_find_pattern; 54 Ui::findDialog ui; 55 bool findText(const QString& pattern, bool do_forward = true, bool do_case_sensitive = false, 56 bool do_whole_words = false); 57 bool m_find_case; 58 bool m_find_words; 59 void init(); 60 }; 61 62 #endif