summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp2
-rw-r--r--utils/themeeditor/gui/findreplacedialog.cpp47
-rw-r--r--utils/themeeditor/gui/findreplacedialog.h1
3 files changed, 48 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index 96f855242d..4c073b9e0b 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -163,6 +163,8 @@ void EditorWindow::setupUI()
163 deviceDock->setWidget(deviceConfig); 163 deviceDock->setWidget(deviceConfig);
164 deviceDock->setFloating(true); 164 deviceDock->setFloating(true);
165 deviceDock->hide(); 165 deviceDock->hide();
166
167 shiftTab(-1);
166} 168}
167 169
168void EditorWindow::setupMenus() 170void EditorWindow::setupMenus()
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp
index 234c6f6886..e2b8b9bc43 100644
--- a/utils/themeeditor/gui/findreplacedialog.cpp
+++ b/utils/themeeditor/gui/findreplacedialog.cpp
@@ -26,7 +26,7 @@
26 26
27FindReplaceDialog::FindReplaceDialog(QWidget *parent) : 27FindReplaceDialog::FindReplaceDialog(QWidget *parent) :
28 QDialog(parent), 28 QDialog(parent),
29 ui(new Ui::FindReplaceDialog), editor(0) 29 ui(new Ui::FindReplaceDialog), editor(0), textFound()
30{ 30{
31 ui->setupUi(this); 31 ui->setupUi(this);
32 setupUI(); 32 setupUI();
@@ -77,7 +77,50 @@ void FindReplaceDialog::find()
77 if(!editor) 77 if(!editor)
78 return; 78 return;
79 79
80 editor->setTextCursor(editor->document()->find(ui->findBox->text())); 80 /* Figuring out the range to search in */
81 int begin = editor->textCursor().selectionStart();
82 int end = editor->textCursor().selectionEnd();
83
84 QTextDocument::FindFlags flags = 0;
85 if(ui->caseBox->isChecked())
86 flags |= QTextDocument::FindCaseSensitively;
87 if(ui->backwardsBox->isChecked())
88 flags |= QTextDocument::FindBackward;
89
90 QTextCursor start = textFound.isNull() ? editor->textCursor() : textFound;
91
92 textFound = editor->document()->find(ui->findBox->text(), start, flags);
93
94 if(textFound.isNull() && ui->wrapBox->isChecked())
95 {
96 if(ui->backwardsBox->isChecked())
97 {
98 textFound = editor->document()
99 ->find(ui->findBox->text(),
100 editor->document()->toPlainText().length(),
101 flags);
102 }
103 else
104 {
105 textFound = editor->document()->find(ui->findBox->text(), 0, flags);
106 }
107 }
108
109 QPalette newPal;
110 if(!textFound.isNull())
111 {
112 newPal.setColor(QPalette::Foreground, QColor(150, 255, 150));
113 ui->statusLabel->setPalette(newPal);
114 ui->statusLabel->setText(tr("Match Found"));
115 editor->setTextCursor(textFound);
116 }
117 else
118 {
119 newPal.setColor(QPalette::Foreground, Qt::red);
120 ui->statusLabel->setPalette(newPal);
121 ui->statusLabel->setText(tr("Match Not Found"));
122 editor->setTextCursor(start);
123 }
81 124
82} 125}
83 126
diff --git a/utils/themeeditor/gui/findreplacedialog.h b/utils/themeeditor/gui/findreplacedialog.h
index 793094a5fe..009a077d8b 100644
--- a/utils/themeeditor/gui/findreplacedialog.h
+++ b/utils/themeeditor/gui/findreplacedialog.h
@@ -53,6 +53,7 @@ private:
53 Ui::FindReplaceDialog *ui; 53 Ui::FindReplaceDialog *ui;
54 54
55 QPlainTextEdit* editor; 55 QPlainTextEdit* editor;
56 QTextCursor textFound;
56}; 57};
57 58
58#endif // FINDREPLACEDIALOG_H 59#endif // FINDREPLACEDIALOG_H