summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skindocument.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-07 21:59:16 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-07 21:59:16 +0000
commit42b065f04afffdae502b00383bafa9c925e309f8 (patch)
treec4545ef3502dcd69f6854b517539844045cee167 /utils/themeeditor/skindocument.cpp
parentfe0334394fc2d167ffa2bb2f8c15f82b91a5f22d (diff)
downloadrockbox-42b065f04afffdae502b00383bafa9c925e309f8.tar.gz
rockbox-42b065f04afffdae502b00383bafa9c925e309f8.zip
Theme Editor: Made status label a permanent widget and made editor highlight line that causes parse error
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26676 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/skindocument.cpp')
-rw-r--r--utils/themeeditor/skindocument.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 3ce70ad5be..aa8fc500d3 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -27,6 +27,8 @@
27#include <QMessageBox> 27#include <QMessageBox>
28#include <QFileDialog> 28#include <QFileDialog>
29 29
30#include <iostream>
31
30SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) : 32SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
31 QWidget(parent), statusLabel(statusLabel) 33 QWidget(parent), statusLabel(statusLabel)
32{ 34{
@@ -141,9 +143,13 @@ void SkinDocument::settingsChanged()
141 QPalette palette; 143 QPalette palette;
142 palette.setColor(QPalette::All, QPalette::Base, bg); 144 palette.setColor(QPalette::All, QPalette::Base, bg);
143 palette.setColor(QPalette::All, QPalette::Text, fg); 145 palette.setColor(QPalette::All, QPalette::Text, fg);
144
145 editor->setPalette(palette); 146 editor->setPalette(palette);
146 147
148 errorColor = QTextCharFormat();
149 QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
150 errorColor.setBackground(highlight);
151 errorColor.setProperty(QTextFormat::FullWidthSelection, true);
152
147 /* Setting the font */ 153 /* Setting the font */
148 QFont family = settings.value("fontFamily", QFont()).value<QFont>(); 154 QFont family = settings.value("fontFamily", QFont()).value<QFont>();
149 family.setPointSize(settings.value("fontSize", 12).toInt()); 155 family.setPointSize(settings.value("fontSize", 12).toInt());
@@ -161,6 +167,26 @@ void SkinDocument::codeChanged()
161 toPlainText().toAscii()); 167 toPlainText().toAscii());
162 statusLabel->setText(parseStatus); 168 statusLabel->setText(parseStatus);
163 169
170 /* Highlighting if an error was found */
171 if(skin_error_line() > 0)
172 {
173 QList<QTextEdit::ExtraSelection> highlight;
174 QTextEdit::ExtraSelection error;
175
176 /* Finding the apropriate line */
177 error.cursor = QTextCursor(editor->document()->
178 findBlockByNumber(skin_error_line() - 1));
179 error.format = errorColor;
180 highlight.append(error);
181
182 editor->setExtraSelections(highlight);
183
184 }
185 else
186 {
187 editor->setExtraSelections(QList<QTextEdit::ExtraSelection>());
188 }
189
164 if(editor->document()->toPlainText() != saved) 190 if(editor->document()->toPlainText() != saved)
165 emit titleChanged(title + QChar('*')); 191 emit titleChanged(title + QChar('*'));
166 else 192 else