summaryrefslogtreecommitdiffstats
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.tar.bz2
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 @@
#include <QMessageBox>
#include <QFileDialog>
+#include <iostream>
+
SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
QWidget(parent), statusLabel(statusLabel)
{
@@ -141,9 +143,13 @@ void SkinDocument::settingsChanged()
QPalette palette;
palette.setColor(QPalette::All, QPalette::Base, bg);
palette.setColor(QPalette::All, QPalette::Text, fg);
-
editor->setPalette(palette);
+ errorColor = QTextCharFormat();
+ QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
+ errorColor.setBackground(highlight);
+ errorColor.setProperty(QTextFormat::FullWidthSelection, true);
+
/* Setting the font */
QFont family = settings.value("fontFamily", QFont()).value<QFont>();
family.setPointSize(settings.value("fontSize", 12).toInt());
@@ -161,6 +167,26 @@ void SkinDocument::codeChanged()
toPlainText().toAscii());
statusLabel->setText(parseStatus);
+ /* Highlighting if an error was found */
+ if(skin_error_line() > 0)
+ {
+ QList<QTextEdit::ExtraSelection> highlight;
+ QTextEdit::ExtraSelection error;
+
+ /* Finding the apropriate line */
+ error.cursor = QTextCursor(editor->document()->
+ findBlockByNumber(skin_error_line() - 1));
+ error.format = errorColor;
+ highlight.append(error);
+
+ editor->setExtraSelections(highlight);
+
+ }
+ else
+ {
+ editor->setExtraSelections(QList<QTextEdit::ExtraSelection>());
+ }
+
if(editor->document()->toPlainText() != saved)
emit titleChanged(title + QChar('*'));
else