summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-11 19:03:49 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-11 19:03:49 +0000
commit0c383538693f04d1e5bc81f4af6a6e9585296bcb (patch)
treed024070233b007b1e1c232c600f9b17009b2bd2e /utils
parent3fec40194c2c07a1693536f08cb9214cec390cf9 (diff)
Theme Editor: Switched error highlighting to the line numbers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26785 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/codeeditor.cpp10
-rw-r--r--utils/themeeditor/codeeditor.h3
-rw-r--r--utils/themeeditor/skindocument.cpp13
3 files changed, 13 insertions, 13 deletions
diff --git a/utils/themeeditor/codeeditor.cpp b/utils/themeeditor/codeeditor.cpp
index 672b210d2e..d4b46ac52e 100644
--- a/utils/themeeditor/codeeditor.cpp
+++ b/utils/themeeditor/codeeditor.cpp
@@ -128,9 +128,15 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
while (block.isValid() && top <= event->rect().bottom()) {
if (block.isVisible() && bottom >= event->rect().top()) {
QString number = QString::number(blockNumber + 1);
+ /* Drawing an error circle if necessary */
+ if(errors.contains(blockNumber + 1))
+ {
+ painter.fillRect(QRect(0, top, lineNumberArea->width(),
+ fontMetrics().height()), Qt::red);
+ }
painter.setPen(Qt::black);
- painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(),
- Qt::AlignRight, number);
+ painter.drawText(0, top, lineNumberArea->width(),
+ fontMetrics().height(), Qt::AlignRight, number);
}
block = block.next();
diff --git a/utils/themeeditor/codeeditor.h b/utils/themeeditor/codeeditor.h
index edbe218ec4..ec36d50c22 100644
--- a/utils/themeeditor/codeeditor.h
+++ b/utils/themeeditor/codeeditor.h
@@ -59,6 +59,8 @@ public:
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
+ void addError(int line){ errors.append(line); }
+ void clearErrors(){ errors.clear(); }
protected:
void resizeEvent(QResizeEvent *event);
@@ -69,6 +71,7 @@ private slots:
private:
QWidget *lineNumberArea;
+ QList<int> errors;
};
//![codeeditordefinition]
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index f7c902f30f..b67c70db61 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -166,6 +166,7 @@ void SkinDocument::settingsChanged()
void SkinDocument::codeChanged()
{
+ editor->clearErrors();
parseStatus = model->changeTree(editor->document()->
toPlainText().toAscii());
statusLabel->setText(parseStatus);
@@ -173,17 +174,7 @@ void SkinDocument::codeChanged()
/* 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);
-
+ editor->addError(skin_error_line());
}
else
{