diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 06:53:06 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 06:53:06 +0000 |
| commit | a8bb62e6e290678f221a01bec7b24e6742366759 (patch) | |
| tree | 8f77f0c145a1b63afbe82433940ab5daae899bfb /utils | |
| parent | fb09d6354c0b6badb449f532f40af9a8037377a3 (diff) | |
| download | rockbox-a8bb62e6e290678f221a01bec7b24e6742366759.zip rockbox-a8bb62e6e290678f221a01bec7b24e6742366759.tar.gz rockbox-a8bb62e6e290678f221a01bec7b24e6742366759.tar.bz2 rockbox-a8bb62e6e290678f221a01bec7b24e6742366759.tar.xz | |
Theme Editor: Made irrelevant menu items disabled at startup, made wrap-around search work in the find/replace dialog
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27253 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 2 | ||||
| -rw-r--r-- | utils/themeeditor/gui/findreplacedialog.cpp | 47 | ||||
| -rw-r--r-- | utils/themeeditor/gui/findreplacedialog.h | 1 |
3 files changed, 48 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index 96f8552..4c073b9 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp @@ -163,6 +163,8 @@ void EditorWindow::setupUI() deviceDock->setWidget(deviceConfig); deviceDock->setFloating(true); deviceDock->hide(); + + shiftTab(-1); } void EditorWindow::setupMenus() diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp index 234c6f6..e2b8b9b 100644 --- a/utils/themeeditor/gui/findreplacedialog.cpp +++ b/utils/themeeditor/gui/findreplacedialog.cpp @@ -26,7 +26,7 @@ FindReplaceDialog::FindReplaceDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::FindReplaceDialog), editor(0) + ui(new Ui::FindReplaceDialog), editor(0), textFound() { ui->setupUi(this); setupUI(); @@ -77,7 +77,50 @@ void FindReplaceDialog::find() if(!editor) return; - editor->setTextCursor(editor->document()->find(ui->findBox->text())); + /* Figuring out the range to search in */ + int begin = editor->textCursor().selectionStart(); + int end = editor->textCursor().selectionEnd(); + + QTextDocument::FindFlags flags = 0; + if(ui->caseBox->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + if(ui->backwardsBox->isChecked()) + flags |= QTextDocument::FindBackward; + + QTextCursor start = textFound.isNull() ? editor->textCursor() : textFound; + + textFound = editor->document()->find(ui->findBox->text(), start, flags); + + if(textFound.isNull() && ui->wrapBox->isChecked()) + { + if(ui->backwardsBox->isChecked()) + { + textFound = editor->document() + ->find(ui->findBox->text(), + editor->document()->toPlainText().length(), + flags); + } + else + { + textFound = editor->document()->find(ui->findBox->text(), 0, flags); + } + } + + QPalette newPal; + if(!textFound.isNull()) + { + newPal.setColor(QPalette::Foreground, QColor(150, 255, 150)); + ui->statusLabel->setPalette(newPal); + ui->statusLabel->setText(tr("Match Found")); + editor->setTextCursor(textFound); + } + else + { + newPal.setColor(QPalette::Foreground, Qt::red); + ui->statusLabel->setPalette(newPal); + ui->statusLabel->setText(tr("Match Not Found")); + editor->setTextCursor(start); + } } diff --git a/utils/themeeditor/gui/findreplacedialog.h b/utils/themeeditor/gui/findreplacedialog.h index 793094a..009a077 100644 --- a/utils/themeeditor/gui/findreplacedialog.h +++ b/utils/themeeditor/gui/findreplacedialog.h @@ -53,6 +53,7 @@ private: Ui::FindReplaceDialog *ui; QPlainTextEdit* editor; + QTextCursor textFound; }; #endif // FINDREPLACEDIALOG_H |