Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
find-replace-dialog.hh
1 // Copyright (C) 2009-2012, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2012, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // 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 
20 #ifndef __FIND_REPLACE_DIALOG_HH
21 #define __FIND_REPLACE_DIALOG_HH
22 
23 #include <QDialog>
24 #include <QTextCursor>
25 
26 class QPlainTextEdit;
27 class QSettings;
28 class QComboBox;
29 class QCheckBox;
30 
39 class CFindReplaceDialog : public QDialog
40 {
41  Q_OBJECT
42  public:
44  CFindReplaceDialog(QWidget *parent = 0);
45 
47  virtual ~CFindReplaceDialog();
48 
53  void setTextEditor(QPlainTextEdit *editor);
54 
59  void writeSettings();
60 
65  void readSettings();
66 
71  int historySize() const;
72 
77  void setHistorySize(int value);
78 
79 public slots:
85  bool find();
86 
91  void replace();
92 
97  void replaceAll();
98 
99 private slots:
100  void onValueChanged(const QString &);
101 
102 private:
103  QTextCursor cursor() const;
104  void appendToHistory(QComboBox *widget, QStringList & history);
105  void setStatusTip(const QString & message);
106 
107  QPlainTextEdit *m_editor;
108 
109  QComboBox *m_findComboBox;
110  QComboBox *m_replaceComboBox;
111 
112  QCheckBox *m_caseCheckBox;
113  QCheckBox *m_wholeWordsCheckBox;
114  QCheckBox *m_searchBackwardsCheckBox;
115  QCheckBox *m_wrapCheckBox;
116 
117  QPushButton *m_findButton;
118  QPushButton *m_replaceButton;
119  QPushButton *m_replaceAllButton;
120 
121  QStringList m_findWords;
122  QStringList m_replaceWords;
123  int m_historySize;
124 };
125 
126 #endif // __FIND_REPLACE_DIALOG_HH