diff options
Diffstat (limited to 'utils/themeeditor/findreplace')
-rw-r--r-- | utils/themeeditor/findreplace/findreplacedialog.cpp | 64 | ||||
-rw-r--r-- | utils/themeeditor/findreplace/findreplacedialog.h | 80 | ||||
-rw-r--r-- | utils/themeeditor/findreplace/findreplacedialog.ui | 32 | ||||
-rw-r--r-- | utils/themeeditor/findreplace/findreplaceform.cpp | 222 | ||||
-rw-r--r-- | utils/themeeditor/findreplace/findreplaceform.h | 153 | ||||
-rw-r--r-- | utils/themeeditor/findreplace/findreplaceform.ui | 204 |
6 files changed, 0 insertions, 755 deletions
diff --git a/utils/themeeditor/findreplace/findreplacedialog.cpp b/utils/themeeditor/findreplace/findreplacedialog.cpp deleted file mode 100644 index 547ad236e5..0000000000 --- a/utils/themeeditor/findreplace/findreplacedialog.cpp +++ /dev/null | |||
@@ -1,64 +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 | #include "findreplacedialog.h" | ||
20 | #include "ui_findreplacedialog.h" | ||
21 | |||
22 | FindReplaceDialog::FindReplaceDialog(QWidget *parent) : | ||
23 | QDialog(parent), | ||
24 | ui(new Ui::FindReplaceDialog) | ||
25 | { | ||
26 | ui->setupUi(this); | ||
27 | } | ||
28 | |||
29 | FindReplaceDialog::~FindReplaceDialog() | ||
30 | { | ||
31 | delete ui; | ||
32 | } | ||
33 | |||
34 | void FindReplaceDialog::changeEvent(QEvent *e) | ||
35 | { | ||
36 | QDialog::changeEvent(e); | ||
37 | switch (e->type()) { | ||
38 | case QEvent::LanguageChange: | ||
39 | ui->retranslateUi(this); | ||
40 | break; | ||
41 | default: | ||
42 | break; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | void FindReplaceDialog::setTextEdit(QPlainTextEdit *textEdit) { | ||
47 | ui->findReplaceForm->setTextEdit(textEdit); | ||
48 | } | ||
49 | |||
50 | void FindReplaceDialog::writeSettings(QSettings &settings, const QString &prefix) { | ||
51 | ui->findReplaceForm->writeSettings(settings, prefix); | ||
52 | } | ||
53 | |||
54 | void FindReplaceDialog::readSettings(QSettings &settings, const QString &prefix) { | ||
55 | ui->findReplaceForm->readSettings(settings, prefix); | ||
56 | } | ||
57 | |||
58 | void FindReplaceDialog::findNext() { | ||
59 | ui->findReplaceForm->findNext(); | ||
60 | } | ||
61 | |||
62 | void FindReplaceDialog::findPrev() { | ||
63 | ui->findReplaceForm->findPrev(); | ||
64 | } | ||
diff --git a/utils/themeeditor/findreplace/findreplacedialog.h b/utils/themeeditor/findreplace/findreplacedialog.h deleted file mode 100644 index c3f2539113..0000000000 --- a/utils/themeeditor/findreplace/findreplacedialog.h +++ /dev/null | |||
@@ -1,80 +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 FINDREPLACEDIALOG_H | ||
20 | #define FINDREPLACEDIALOG_H | ||
21 | |||
22 | #include <QDialog> | ||
23 | #include <QPlainTextEdit> | ||
24 | |||
25 | namespace Ui { | ||
26 | class FindReplaceDialog; | ||
27 | } | ||
28 | |||
29 | class QTextEdit; | ||
30 | class QSettings; | ||
31 | |||
32 | /** | ||
33 | * A find/replace dialog. | ||
34 | * | ||
35 | * It relies on a FindReplaceForm object (see that class for the functionalities provided). | ||
36 | */ | ||
37 | class FindReplaceDialog : public QDialog { | ||
38 | Q_OBJECT | ||
39 | public: | ||
40 | FindReplaceDialog(QWidget *parent = 0); | ||
41 | virtual ~FindReplaceDialog(); | ||
42 | |||
43 | /** | ||
44 | * Associates the text editor where to perform the search | ||
45 | * @param textEdit | ||
46 | */ | ||
47 | void setTextEdit(QPlainTextEdit *textEdit); | ||
48 | |||
49 | /** | ||
50 | * Writes the state of the form to the passed settings. | ||
51 | * @param settings | ||
52 | * @param prefix the prefix to insert in the settings | ||
53 | */ | ||
54 | virtual void writeSettings(QSettings &settings, const QString &prefix = "FindReplaceDialog"); | ||
55 | |||
56 | /** | ||
57 | * Reads the state of the form from the passed settings. | ||
58 | * @param settings | ||
59 | * @param prefix the prefix to look for in the settings | ||
60 | */ | ||
61 | virtual void readSettings(QSettings &settings, const QString &prefix = "FindReplaceDialog"); | ||
62 | |||
63 | public slots: | ||
64 | /** | ||
65 | * Finds the next occurrence | ||
66 | */ | ||
67 | void findNext(); | ||
68 | |||
69 | /** | ||
70 | * Finds the previous occurrence | ||
71 | */ | ||
72 | void findPrev(); | ||
73 | |||
74 | protected: | ||
75 | void changeEvent(QEvent *e); | ||
76 | |||
77 | Ui::FindReplaceDialog *ui; | ||
78 | }; | ||
79 | |||
80 | #endif // FINDREPLACEDIALOG_H | ||
diff --git a/utils/themeeditor/findreplace/findreplacedialog.ui b/utils/themeeditor/findreplace/findreplacedialog.ui deleted file mode 100644 index 74984b3070..0000000000 --- a/utils/themeeditor/findreplace/findreplacedialog.ui +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ui version="4.0"> | ||
3 | <class>FindReplaceDialog</class> | ||
4 | <widget class="QDialog" name="FindReplaceDialog"> | ||
5 | <property name="geometry"> | ||
6 | <rect> | ||
7 | <x>0</x> | ||
8 | <y>0</y> | ||
9 | <width>342</width> | ||
10 | <height>140</height> | ||
11 | </rect> | ||
12 | </property> | ||
13 | <property name="windowTitle"> | ||
14 | <string>Find/Replace</string> | ||
15 | </property> | ||
16 | <layout class="QGridLayout" name="gridLayout"> | ||
17 | <item row="0" column="0"> | ||
18 | <widget class="FindReplaceForm" name="findReplaceForm" native="true"/> | ||
19 | </item> | ||
20 | </layout> | ||
21 | </widget> | ||
22 | <customwidgets> | ||
23 | <customwidget> | ||
24 | <class>FindReplaceForm</class> | ||
25 | <extends>QWidget</extends> | ||
26 | <header location="global">findreplaceform.h</header> | ||
27 | <container>1</container> | ||
28 | </customwidget> | ||
29 | </customwidgets> | ||
30 | <resources/> | ||
31 | <connections/> | ||
32 | </ui> | ||
diff --git a/utils/themeeditor/findreplace/findreplaceform.cpp b/utils/themeeditor/findreplace/findreplaceform.cpp deleted file mode 100644 index cd2700f033..0000000000 --- a/utils/themeeditor/findreplace/findreplaceform.cpp +++ /dev/null | |||
@@ -1,222 +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 | #include <QtGui> | ||
20 | #include <QTextEdit> | ||
21 | #include <QRegExp> | ||
22 | #include <QSettings> | ||
23 | |||
24 | #include "findreplaceform.h" | ||
25 | #include "ui_findreplaceform.h" | ||
26 | |||
27 | #define TEXT_TO_FIND "textToFind" | ||
28 | #define TEXT_TO_REPLACE "textToReplace" | ||
29 | #define DOWN_RADIO "downRadio" | ||
30 | #define UP_RADIO "upRadio" | ||
31 | #define CASE_CHECK "caseCheck" | ||
32 | #define WHOLE_CHECK "wholeCheck" | ||
33 | #define REGEXP_CHECK "regexpCheck" | ||
34 | |||
35 | FindReplaceForm::FindReplaceForm(QWidget *parent) : | ||
36 | QWidget(parent), | ||
37 | ui(new Ui::FindReplaceForm), textEdit(0) | ||
38 | { | ||
39 | ui->setupUi(this); | ||
40 | |||
41 | ui->errorLabel->setText(""); | ||
42 | |||
43 | connect(ui->textToFind, SIGNAL(textChanged(QString)), this, SLOT(textToFindChanged())); | ||
44 | connect(ui->textToFind, SIGNAL(textChanged(QString)), this, SLOT(validateRegExp(QString))); | ||
45 | |||
46 | connect(ui->regexCheckBox, SIGNAL(toggled(bool)), this, SLOT(regexpSelected(bool))); | ||
47 | |||
48 | connect(ui->findButton, SIGNAL(clicked()), this, SLOT(find())); | ||
49 | connect(ui->closeButton, SIGNAL(clicked()), parent, SLOT(close())); | ||
50 | |||
51 | connect(ui->replaceButton, SIGNAL(clicked()), this, SLOT(replace())); | ||
52 | connect(ui->replaceAllButton, SIGNAL(clicked()), this, SLOT(replaceAll())); | ||
53 | } | ||
54 | |||
55 | FindReplaceForm::~FindReplaceForm() | ||
56 | { | ||
57 | delete ui; | ||
58 | } | ||
59 | |||
60 | void FindReplaceForm::hideReplaceWidgets() { | ||
61 | ui->replaceLabel->setVisible(false); | ||
62 | ui->textToReplace->setVisible(false); | ||
63 | ui->replaceButton->setVisible(false); | ||
64 | ui->replaceAllButton->setVisible(false); | ||
65 | } | ||
66 | |||
67 | void FindReplaceForm::setTextEdit(QPlainTextEdit *textEdit_) { | ||
68 | textEdit = textEdit_; | ||
69 | connect(textEdit, SIGNAL(copyAvailable(bool)), ui->replaceButton, SLOT(setEnabled(bool))); | ||
70 | connect(textEdit, SIGNAL(copyAvailable(bool)), ui->replaceAllButton, SLOT(setEnabled(bool))); | ||
71 | } | ||
72 | |||
73 | void FindReplaceForm::changeEvent(QEvent *e) | ||
74 | { | ||
75 | QWidget::changeEvent(e); | ||
76 | switch (e->type()) { | ||
77 | case QEvent::LanguageChange: | ||
78 | ui->retranslateUi(this); | ||
79 | break; | ||
80 | default: | ||
81 | break; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | void FindReplaceForm::textToFindChanged() { | ||
86 | ui->findButton->setEnabled(ui->textToFind->text().size() > 0); | ||
87 | } | ||
88 | |||
89 | void FindReplaceForm::regexpSelected(bool sel) { | ||
90 | if (sel) | ||
91 | validateRegExp(ui->textToFind->text()); | ||
92 | else | ||
93 | validateRegExp(""); | ||
94 | } | ||
95 | |||
96 | void FindReplaceForm::validateRegExp(const QString &text) { | ||
97 | if (!ui->regexCheckBox->isChecked() || text.size() == 0) { | ||
98 | ui->errorLabel->setText(""); | ||
99 | return; // nothing to validate | ||
100 | } | ||
101 | |||
102 | QRegExp reg(text, | ||
103 | (ui->caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive)); | ||
104 | |||
105 | if (reg.isValid()) { | ||
106 | showError(""); | ||
107 | } else { | ||
108 | showError(reg.errorString()); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | void FindReplaceForm::showError(const QString &error) { | ||
113 | if (error == "") { | ||
114 | ui->errorLabel->setText(""); | ||
115 | } else { | ||
116 | ui->errorLabel->setText("<span style=\" font-weight:600; color:#ff0000;\">" + | ||
117 | error + | ||
118 | "</span>"); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | void FindReplaceForm::showMessage(const QString &message) { | ||
123 | if (message == "") { | ||
124 | ui->errorLabel->setText(""); | ||
125 | } else { | ||
126 | ui->errorLabel->setText("<span style=\" font-weight:600; color:green;\">" + | ||
127 | message + | ||
128 | "</span>"); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | void FindReplaceForm::find() { | ||
133 | find(ui->downRadioButton->isChecked()); | ||
134 | } | ||
135 | |||
136 | void FindReplaceForm::find(bool next) { | ||
137 | if (!textEdit) | ||
138 | return; // TODO: show some warning? | ||
139 | |||
140 | // backward search | ||
141 | bool back = !next; | ||
142 | |||
143 | const QString &toSearch = ui->textToFind->text(); | ||
144 | |||
145 | bool result = false; | ||
146 | |||
147 | QTextDocument::FindFlags flags; | ||
148 | |||
149 | if (back) | ||
150 | flags |= QTextDocument::FindBackward; | ||
151 | if (ui->caseCheckBox->isChecked()) | ||
152 | flags |= QTextDocument::FindCaseSensitively; | ||
153 | if (ui->wholeCheckBox->isChecked()) | ||
154 | flags |= QTextDocument::FindWholeWords; | ||
155 | |||
156 | if (ui->regexCheckBox->isChecked()) { | ||
157 | QRegExp reg(toSearch, | ||
158 | (ui->caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive)); | ||
159 | |||
160 | qDebug() << "searching for regexp: " << reg.pattern(); | ||
161 | |||
162 | textCursor = textEdit->document()->find(reg, textCursor, flags); | ||
163 | textEdit->setTextCursor(textCursor); | ||
164 | result = (!textCursor.isNull()); | ||
165 | } else { | ||
166 | qDebug() << "searching for: " << toSearch; | ||
167 | |||
168 | result = textEdit->find(toSearch, flags); | ||
169 | } | ||
170 | |||
171 | if (result) { | ||
172 | showError(""); | ||
173 | } else { | ||
174 | showError(tr("no match found")); | ||
175 | // move to the beginning of the document for the next find | ||
176 | textCursor.setPosition(0); | ||
177 | textEdit->setTextCursor(textCursor); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | void FindReplaceForm::replace() { | ||
182 | if (!textEdit->textCursor().hasSelection()) { | ||
183 | find(); | ||
184 | } else { | ||
185 | textEdit->textCursor().insertText(ui->textToReplace->text()); | ||
186 | find(); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | void FindReplaceForm::replaceAll() { | ||
191 | int i=0; | ||
192 | while (textEdit->textCursor().hasSelection()){ | ||
193 | textEdit->textCursor().insertText(ui->textToReplace->text()); | ||
194 | find(); | ||
195 | i++; | ||
196 | } | ||
197 | showMessage(tr("Replaced %1 occurrence(s)").arg(i)); | ||
198 | } | ||
199 | |||
200 | void FindReplaceForm::writeSettings(QSettings &settings, const QString &prefix) { | ||
201 | settings.beginGroup(prefix); | ||
202 | settings.setValue(TEXT_TO_FIND, ui->textToFind->text()); | ||
203 | settings.setValue(TEXT_TO_REPLACE, ui->textToReplace->text()); | ||
204 | settings.setValue(DOWN_RADIO, ui->downRadioButton->isChecked()); | ||
205 | settings.setValue(UP_RADIO, ui->upRadioButton->isChecked()); | ||
206 | settings.setValue(CASE_CHECK, ui->caseCheckBox->isChecked()); | ||
207 | settings.setValue(WHOLE_CHECK, ui->wholeCheckBox->isChecked()); | ||
208 | settings.setValue(REGEXP_CHECK, ui->regexCheckBox->isChecked()); | ||
209 | settings.endGroup(); | ||
210 | } | ||
211 | |||
212 | void FindReplaceForm::readSettings(QSettings &settings, const QString &prefix) { | ||
213 | settings.beginGroup(prefix); | ||
214 | ui->textToFind->setText(settings.value(TEXT_TO_FIND, "").toString()); | ||
215 | ui->textToReplace->setText(settings.value(TEXT_TO_REPLACE, "").toString()); | ||
216 | ui->downRadioButton->setChecked(settings.value(DOWN_RADIO, true).toBool()); | ||
217 | ui->upRadioButton->setChecked(settings.value(UP_RADIO, false).toBool()); | ||
218 | ui->caseCheckBox->setChecked(settings.value(CASE_CHECK, false).toBool()); | ||
219 | ui->wholeCheckBox->setChecked(settings.value(WHOLE_CHECK, false).toBool()); | ||
220 | ui->regexCheckBox->setChecked(settings.value(REGEXP_CHECK, false).toBool()); | ||
221 | settings.endGroup(); | ||
222 | } | ||
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 | |||
26 | namespace Ui { | ||
27 | class FindReplaceForm; | ||
28 | } | ||
29 | |||
30 | class QTextEdit; | ||
31 | class 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 | */ | ||
62 | class FindReplaceForm : public QWidget { | ||
63 | Q_OBJECT | ||
64 | public: | ||
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 | |||
91 | public 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 | |||
124 | protected: | ||
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 | |||
133 | protected 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 | |||
143 | protected: | ||
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 | ||
diff --git a/utils/themeeditor/findreplace/findreplaceform.ui b/utils/themeeditor/findreplace/findreplaceform.ui deleted file mode 100644 index acc055ca88..0000000000 --- a/utils/themeeditor/findreplace/findreplaceform.ui +++ /dev/null | |||
@@ -1,204 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ui version="4.0"> | ||
3 | <class>FindReplaceForm</class> | ||
4 | <widget class="QWidget" name="FindReplaceForm"> | ||
5 | <property name="geometry"> | ||
6 | <rect> | ||
7 | <x>0</x> | ||
8 | <y>0</y> | ||
9 | <width>483</width> | ||
10 | <height>288</height> | ||
11 | </rect> | ||
12 | </property> | ||
13 | <property name="windowTitle"> | ||
14 | <string>Form</string> | ||
15 | </property> | ||
16 | <layout class="QGridLayout" name="gridLayout"> | ||
17 | <item row="0" column="0"> | ||
18 | <layout class="QVBoxLayout" name="verticalLayout_5"> | ||
19 | <item> | ||
20 | <layout class="QVBoxLayout" name="verticalLayout_2"> | ||
21 | <item> | ||
22 | <layout class="QGridLayout" name="gridLayout_3"> | ||
23 | <item row="0" column="0"> | ||
24 | <widget class="QLabel" name="label"> | ||
25 | <property name="text"> | ||
26 | <string>&Find:</string> | ||
27 | </property> | ||
28 | <property name="buddy"> | ||
29 | <cstring>textToFind</cstring> | ||
30 | </property> | ||
31 | </widget> | ||
32 | </item> | ||
33 | <item row="0" column="1"> | ||
34 | <widget class="QLineEdit" name="textToFind"/> | ||
35 | </item> | ||
36 | <item row="1" column="0"> | ||
37 | <widget class="QLabel" name="replaceLabel"> | ||
38 | <property name="text"> | ||
39 | <string>R&eplace with:</string> | ||
40 | </property> | ||
41 | <property name="buddy"> | ||
42 | <cstring>textToReplace</cstring> | ||
43 | </property> | ||
44 | </widget> | ||
45 | </item> | ||
46 | <item row="1" column="1"> | ||
47 | <widget class="QLineEdit" name="textToReplace"/> | ||
48 | </item> | ||
49 | </layout> | ||
50 | </item> | ||
51 | </layout> | ||
52 | </item> | ||
53 | <item> | ||
54 | <widget class="QLabel" name="errorLabel"> | ||
55 | <property name="text"> | ||
56 | <string>errorLabel</string> | ||
57 | </property> | ||
58 | </widget> | ||
59 | </item> | ||
60 | <item> | ||
61 | <layout class="QHBoxLayout" name="horizontalLayout"> | ||
62 | <item> | ||
63 | <widget class="QGroupBox" name="groupBox"> | ||
64 | <property name="title"> | ||
65 | <string>D&irection</string> | ||
66 | </property> | ||
67 | <layout class="QVBoxLayout" name="verticalLayout_3"> | ||
68 | <item> | ||
69 | <widget class="QRadioButton" name="downRadioButton"> | ||
70 | <property name="text"> | ||
71 | <string>&Down</string> | ||
72 | </property> | ||
73 | <property name="checked"> | ||
74 | <bool>true</bool> | ||
75 | </property> | ||
76 | </widget> | ||
77 | </item> | ||
78 | <item> | ||
79 | <widget class="QRadioButton" name="upRadioButton"> | ||
80 | <property name="text"> | ||
81 | <string>&Up</string> | ||
82 | </property> | ||
83 | </widget> | ||
84 | </item> | ||
85 | </layout> | ||
86 | </widget> | ||
87 | </item> | ||
88 | <item> | ||
89 | <widget class="QGroupBox" name="groupBox_2"> | ||
90 | <property name="title"> | ||
91 | <string>&Options</string> | ||
92 | </property> | ||
93 | <layout class="QVBoxLayout" name="verticalLayout_4"> | ||
94 | <item> | ||
95 | <widget class="QCheckBox" name="caseCheckBox"> | ||
96 | <property name="text"> | ||
97 | <string>&Case sensitive</string> | ||
98 | </property> | ||
99 | </widget> | ||
100 | </item> | ||
101 | <item> | ||
102 | <widget class="QCheckBox" name="wholeCheckBox"> | ||
103 | <property name="text"> | ||
104 | <string>&Whole words only</string> | ||
105 | </property> | ||
106 | </widget> | ||
107 | </item> | ||
108 | <item> | ||
109 | <widget class="QCheckBox" name="regexCheckBox"> | ||
110 | <property name="toolTip"> | ||
111 | <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
112 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
113 | p, li { white-space: pre-wrap; } | ||
114 | </style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> | ||
115 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">whether the text to search should be interpreted as a regular expression.</p> | ||
116 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> | ||
117 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may want to take a look at the syntax of regular expressions:</p> | ||
118 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://doc.trolltech.com/qregexp.html"><span style=" text-decoration: underline; color:#0000ff;">http://doc.trolltech.com/qregexp.html</span></a></p></body></html></string> | ||
119 | </property> | ||
120 | <property name="text"> | ||
121 | <string>R&egular Expression</string> | ||
122 | </property> | ||
123 | </widget> | ||
124 | </item> | ||
125 | </layout> | ||
126 | </widget> | ||
127 | </item> | ||
128 | </layout> | ||
129 | </item> | ||
130 | </layout> | ||
131 | </item> | ||
132 | <item row="0" column="1"> | ||
133 | <layout class="QVBoxLayout" name="verticalLayout"> | ||
134 | <property name="leftMargin"> | ||
135 | <number>10</number> | ||
136 | </property> | ||
137 | <item> | ||
138 | <widget class="QPushButton" name="findButton"> | ||
139 | <property name="enabled"> | ||
140 | <bool>false</bool> | ||
141 | </property> | ||
142 | <property name="text"> | ||
143 | <string>&Find</string> | ||
144 | </property> | ||
145 | </widget> | ||
146 | </item> | ||
147 | <item> | ||
148 | <widget class="QPushButton" name="closeButton"> | ||
149 | <property name="text"> | ||
150 | <string>&Close</string> | ||
151 | </property> | ||
152 | </widget> | ||
153 | </item> | ||
154 | <item> | ||
155 | <widget class="QPushButton" name="replaceButton"> | ||
156 | <property name="enabled"> | ||
157 | <bool>false</bool> | ||
158 | </property> | ||
159 | <property name="text"> | ||
160 | <string>&Replace</string> | ||
161 | </property> | ||
162 | </widget> | ||
163 | </item> | ||
164 | <item> | ||
165 | <widget class="QPushButton" name="replaceAllButton"> | ||
166 | <property name="enabled"> | ||
167 | <bool>false</bool> | ||
168 | </property> | ||
169 | <property name="text"> | ||
170 | <string>Replace &All</string> | ||
171 | </property> | ||
172 | </widget> | ||
173 | </item> | ||
174 | <item> | ||
175 | <spacer name="verticalSpacer"> | ||
176 | <property name="orientation"> | ||
177 | <enum>Qt::Vertical</enum> | ||
178 | </property> | ||
179 | <property name="sizeHint" stdset="0"> | ||
180 | <size> | ||
181 | <width>20</width> | ||
182 | <height>40</height> | ||
183 | </size> | ||
184 | </property> | ||
185 | </spacer> | ||
186 | </item> | ||
187 | </layout> | ||
188 | </item> | ||
189 | </layout> | ||
190 | </widget> | ||
191 | <tabstops> | ||
192 | <tabstop>textToFind</tabstop> | ||
193 | <tabstop>textToReplace</tabstop> | ||
194 | <tabstop>downRadioButton</tabstop> | ||
195 | <tabstop>upRadioButton</tabstop> | ||
196 | <tabstop>caseCheckBox</tabstop> | ||
197 | <tabstop>wholeCheckBox</tabstop> | ||
198 | <tabstop>regexCheckBox</tabstop> | ||
199 | <tabstop>findButton</tabstop> | ||
200 | <tabstop>closeButton</tabstop> | ||
201 | </tabstops> | ||
202 | <resources/> | ||
203 | <connections/> | ||
204 | </ui> | ||