diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 08:23:20 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 08:23:20 +0000 |
| commit | 5aa684f0581c9e8b24ec20bd70a56042f8899ae5 (patch) | |
| tree | ad2b45de59690a53fd79da3bb2f60f8982b0658c /utils/themeeditor/gui/findreplacedialog.cpp | |
| parent | a8bb62e6e290678f221a01bec7b24e6742366759 (diff) | |
| download | rockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.zip rockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.tar.gz rockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.tar.bz2 rockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.tar.xz | |
Theme Editor: Implemented replace and replace all in find/replace dialog
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27254 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui/findreplacedialog.cpp')
| -rw-r--r-- | utils/themeeditor/gui/findreplacedialog.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp index e2b8b9b..2a61611 100644 --- a/utils/themeeditor/gui/findreplacedialog.cpp +++ b/utils/themeeditor/gui/findreplacedialog.cpp @@ -57,13 +57,13 @@ void FindReplaceDialog::closeEvent(QCloseEvent* event) void FindReplaceDialog::setupUI() { - QObject::connect(ui->findButton, SIGNAL(pressed()), + QObject::connect(ui->findButton, SIGNAL(clicked()), this, SLOT(find())); - QObject::connect(ui->replaceButton, SIGNAL(pressed()), + QObject::connect(ui->replaceButton, SIGNAL(clicked()), this, SLOT(replace())); - QObject::connect(ui->replaceAllButton, SIGNAL(pressed()), + QObject::connect(ui->replaceAllButton, SIGNAL(clicked()), this, SLOT(replaceAll())); - QObject::connect(ui->closeButton, SIGNAL(pressed()), + QObject::connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(ui->findBox, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); @@ -77,10 +77,6 @@ void FindReplaceDialog::find() if(!editor) return; - /* 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; @@ -109,7 +105,7 @@ void FindReplaceDialog::find() QPalette newPal; if(!textFound.isNull()) { - newPal.setColor(QPalette::Foreground, QColor(150, 255, 150)); + newPal.setColor(QPalette::Foreground, QColor(0, 150, 0)); ui->statusLabel->setPalette(newPal); ui->statusLabel->setText(tr("Match Found")); editor->setTextCursor(textFound); @@ -126,12 +122,31 @@ void FindReplaceDialog::find() void FindReplaceDialog::replace() { + if(textFound.isNull()) + find(); + + if(textFound.isNull()) + return; + editor->setTextCursor(textFound); + editor->insertPlainText(ui->replaceBox->text()); + textFound = QTextCursor(); } void FindReplaceDialog::replaceAll() { + do + { + if(!textFound.isNull()) + { + editor->setTextCursor(textFound); + editor->insertPlainText(ui->replaceBox->text()); + } + + find(); + }while(!textFound.isNull()); + } void FindReplaceDialog::textChanged() |