summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-03 08:23:20 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-03 08:23:20 +0000
commit5aa684f0581c9e8b24ec20bd70a56042f8899ae5 (patch)
treead2b45de59690a53fd79da3bb2f60f8982b0658c
parenta8bb62e6e290678f221a01bec7b24e6742366759 (diff)
downloadrockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.tar.gz
rockbox-5aa684f0581c9e8b24ec20bd70a56042f8899ae5.zip
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
-rw-r--r--utils/themeeditor/gui/findreplacedialog.cpp33
-rw-r--r--utils/themeeditor/gui/findreplacedialog.ui14
2 files changed, 31 insertions, 16 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp
index e2b8b9bc43..2a6161189e 100644
--- a/utils/themeeditor/gui/findreplacedialog.cpp
+++ b/utils/themeeditor/gui/findreplacedialog.cpp
@@ -57,13 +57,13 @@ void FindReplaceDialog::closeEvent(QCloseEvent* event)
57 57
58void FindReplaceDialog::setupUI() 58void FindReplaceDialog::setupUI()
59{ 59{
60 QObject::connect(ui->findButton, SIGNAL(pressed()), 60 QObject::connect(ui->findButton, SIGNAL(clicked()),
61 this, SLOT(find())); 61 this, SLOT(find()));
62 QObject::connect(ui->replaceButton, SIGNAL(pressed()), 62 QObject::connect(ui->replaceButton, SIGNAL(clicked()),
63 this, SLOT(replace())); 63 this, SLOT(replace()));
64 QObject::connect(ui->replaceAllButton, SIGNAL(pressed()), 64 QObject::connect(ui->replaceAllButton, SIGNAL(clicked()),
65 this, SLOT(replaceAll())); 65 this, SLOT(replaceAll()));
66 QObject::connect(ui->closeButton, SIGNAL(pressed()), 66 QObject::connect(ui->closeButton, SIGNAL(clicked()),
67 this, SLOT(close())); 67 this, SLOT(close()));
68 QObject::connect(ui->findBox, SIGNAL(textChanged(QString)), 68 QObject::connect(ui->findBox, SIGNAL(textChanged(QString)),
69 this, SLOT(textChanged())); 69 this, SLOT(textChanged()));
@@ -77,10 +77,6 @@ void FindReplaceDialog::find()
77 if(!editor) 77 if(!editor)
78 return; 78 return;
79 79
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; 80 QTextDocument::FindFlags flags = 0;
85 if(ui->caseBox->isChecked()) 81 if(ui->caseBox->isChecked())
86 flags |= QTextDocument::FindCaseSensitively; 82 flags |= QTextDocument::FindCaseSensitively;
@@ -109,7 +105,7 @@ void FindReplaceDialog::find()
109 QPalette newPal; 105 QPalette newPal;
110 if(!textFound.isNull()) 106 if(!textFound.isNull())
111 { 107 {
112 newPal.setColor(QPalette::Foreground, QColor(150, 255, 150)); 108 newPal.setColor(QPalette::Foreground, QColor(0, 150, 0));
113 ui->statusLabel->setPalette(newPal); 109 ui->statusLabel->setPalette(newPal);
114 ui->statusLabel->setText(tr("Match Found")); 110 ui->statusLabel->setText(tr("Match Found"));
115 editor->setTextCursor(textFound); 111 editor->setTextCursor(textFound);
@@ -126,12 +122,31 @@ void FindReplaceDialog::find()
126 122
127void FindReplaceDialog::replace() 123void FindReplaceDialog::replace()
128{ 124{
125 if(textFound.isNull())
126 find();
127
128 if(textFound.isNull())
129 return;
129 130
131 editor->setTextCursor(textFound);
132 editor->insertPlainText(ui->replaceBox->text());
133 textFound = QTextCursor();
130} 134}
131 135
132void FindReplaceDialog::replaceAll() 136void FindReplaceDialog::replaceAll()
133{ 137{
134 138
139 do
140 {
141 if(!textFound.isNull())
142 {
143 editor->setTextCursor(textFound);
144 editor->insertPlainText(ui->replaceBox->text());
145 }
146
147 find();
148 }while(!textFound.isNull());
149
135} 150}
136 151
137void FindReplaceDialog::textChanged() 152void FindReplaceDialog::textChanged()
diff --git a/utils/themeeditor/gui/findreplacedialog.ui b/utils/themeeditor/gui/findreplacedialog.ui
index 1c4510788f..5641181a61 100644
--- a/utils/themeeditor/gui/findreplacedialog.ui
+++ b/utils/themeeditor/gui/findreplacedialog.ui
@@ -51,15 +51,15 @@
51 </layout> 51 </layout>
52 </item> 52 </item>
53 <item> 53 <item>
54 <widget class="QLabel" name="statusLabel">
55 <property name="text">
56 <string/>
57 </property>
58 </widget>
59 </item>
60 <item>
54 <layout class="QVBoxLayout" name="verticalLayout"> 61 <layout class="QVBoxLayout" name="verticalLayout">
55 <item> 62 <item>
56 <widget class="QLabel" name="statusLabel">
57 <property name="text">
58 <string/>
59 </property>
60 </widget>
61 </item>
62 <item>
63 <widget class="QCheckBox" name="caseBox"> 63 <widget class="QCheckBox" name="caseBox">
64 <property name="text"> 64 <property name="text">
65 <string>Match Case</string> 65 <string>Match Case</string>