summaryrefslogtreecommitdiff
path: root/utils/themeeditor/findreplace/findreplaceform.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/findreplace/findreplaceform.h')
-rw-r--r--utils/themeeditor/findreplace/findreplaceform.h153
1 files changed, 0 insertions, 153 deletions
diff --git a/utils/themeeditor/findreplace/findreplaceform.h b/utils/themeeditor/findreplace/findreplaceform.h
deleted file mode 100644
index f18052b793..0000000000
--- a/utils/themeeditor/findreplace/findreplaceform.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * This file has been copied from Lorenzo Bettini, with minor modifications
11 * made available under the LGPL version 3, as the original file was licensed
12 *
13 ****************************************************************************
14 *
15 * Copyright (C) 2009 Lorenzo Bettini <http://www.lorenzobettini.it>
16 * See COPYING file that comes with this distribution
17 */
18
19#ifndef FINDREPLACEFORM_H
20#define FINDREPLACEFORM_H
21
22#include <QWidget>
23#include <QTextCursor>
24#include <QPlainTextEdit>
25
26namespace Ui {
27 class FindReplaceForm;
28}
29
30class QTextEdit;
31class QSettings;
32
33/**
34 * The form for the find/replace dialog. The form presents the typical
35 * widgets you find in standard find/replace dialogs, and it acts on a QTextEdit.
36 *
37 * \image html Screenshot-FindReplace.png
38 *
39 * You need to set the QTextEdit explicitly, using the method setTextEdit(QTextEdit *textEdit).
40 *
41 * For instance
42 * \code
43 * m_findReplaceDialog = new FindReplaceDialog(this);
44 * m_findReplaceDialog->setModal(false);
45 * m_findReplaceDialog->setTextEdit(ui->textEdit);
46 * \endcode
47 *
48 * The find functionalities is available even if the find dialog is not shown: if something
49 * to search for was already specified, the application can call the methods findNext() and
50 * findPrev() (e.g., by connecting them to menu items).
51 *
52 * In case a regular expression is used as the search term, the form also checks whether the
53 * expression is a valid regular expression (You may want to take a look at the syntax of regular expressions:
54 * http://doc.trolltech.com/qregexp.html).
55 *
56 * The form provides also functionalities to save and restore its state using a QSettings object (i.e.,
57 * the last word searched for, the options of the form, etc.) via the methods writeSettings()
58 * and readSettings().
59 *
60 * You can take a look at the \ref examples page.
61 */
62class FindReplaceForm : public QWidget {
63 Q_OBJECT
64public:
65 FindReplaceForm(QWidget *parent = 0);
66 virtual ~FindReplaceForm();
67
68 /**
69 * Associates the text editor where to perform the search
70 * @param textEdit_
71 */
72 void setTextEdit(QPlainTextEdit *textEdit_);
73
74 /// hides replace widgets from the form
75 void hideReplaceWidgets();
76
77 /**
78 * Writes the state of the form to the passed settings.
79 * @param settings
80 * @param prefix the prefix to insert in the settings
81 */
82 virtual void writeSettings(QSettings &settings, const QString &prefix = "FindReplaceDialog");
83
84 /**
85 * Reads the state of the form from the passed settings.
86 * @param settings
87 * @param prefix the prefix to look for in the settings
88 */
89 virtual void readSettings(QSettings &settings, const QString &prefix = "FindReplaceDialog");
90
91public slots:
92 /**
93 * performs the find task
94 * @param down whether to find the next or the previous
95 * occurrence
96 */
97 void find(bool down);
98
99 /**
100 * Finds the next occurrence
101 */
102 void find();
103
104 /**
105 * Finds the next occurrence
106 */
107 void findNext() { find(true); }
108
109 /**
110 * Finds the previous occurrence
111 */
112 void findPrev() { find(false); }
113
114 /**
115 * Replaces the found occurrences and goes to the next occurrence
116 */
117 void replace();
118
119 /**
120 * Replaces all the found occurrences
121 */
122 void replaceAll();
123
124protected:
125 void changeEvent(QEvent *e);
126
127 /// shows an error in the dialog
128 void showError(const QString &error);
129
130 /// shows a message in the dialog
131 void showMessage(const QString &message);
132
133protected slots:
134 /// when the text edit contents changed
135 void textToFindChanged();
136
137 /// checks whether the passed text is a valid regexp
138 void validateRegExp(const QString &text);
139
140 /// the regexp checkbox was selected
141 void regexpSelected(bool sel);
142
143protected:
144 Ui::FindReplaceForm *ui;
145
146 /// for searching into the text
147 QTextCursor textCursor;
148
149 /// the text editor (possibly) associated with this form
150 QPlainTextEdit *textEdit;
151};
152
153#endif // FINDREPLACEFORM_H