summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-11 21:24:38 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-11 21:24:38 +0000
commitce0d21437e5197f90b0d8aa7a9055571c9db0263 (patch)
tree0fb73fc45eb8b8cb0241bb1df489454dbb0bf3d5 /utils
parent6c921f5e04a1336f4a27f55afe728bae8f96065c (diff)
Theme Editor: Made errors display in status bar when cursor is on error'd line
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26801 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/codeeditor.h2
-rw-r--r--utils/themeeditor/skindocument.cpp28
-rw-r--r--utils/themeeditor/skindocument.h1
3 files changed, 30 insertions, 1 deletions
diff --git a/utils/themeeditor/codeeditor.h b/utils/themeeditor/codeeditor.h
index 5df5b423d5..1771e31051 100644
--- a/utils/themeeditor/codeeditor.h
+++ b/utils/themeeditor/codeeditor.h
@@ -62,6 +62,8 @@ public:
void addError(int line){ errors.append(line); }
void clearErrors(){ errors.clear(); }
void setErrorColor(QColor color){ errorColor = color; }
+ bool isError(int line){ return errors.contains(line); }
+ bool hasErrors(){ return !errors.isEmpty(); }
protected:
void resizeEvent(QResizeEvent *event);
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 53e480cbe3..9a9bf5c85f 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -138,6 +138,8 @@ void SkinDocument::setupUI()
/* Connecting the editor's signal */
QObject::connect(editor, SIGNAL(textChanged()),
this, SLOT(codeChanged()));
+ QObject::connect(editor, SIGNAL(cursorPositionChanged()),
+ this, SLOT(cursorChanged()));
settingsChanged();
}
@@ -171,6 +173,28 @@ void SkinDocument::settingsChanged()
}
+void SkinDocument::cursorChanged()
+{
+ if(editor->isError(editor->textCursor().blockNumber() + 1))
+ {
+ QTextCursor line = editor->textCursor();
+ line.movePosition(QTextCursor::StartOfLine);
+ line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
+ skin_parse(line.selectedText().toAscii());
+ if(skin_error_line() > 0)
+ parseStatus = tr("Error on line ") +
+ QString::number(line.blockNumber() + 1) + tr(": ") +
+ skin_error_message();
+ statusLabel->setText(parseStatus);
+ }
+ else if(editor->hasErrors())
+ {
+ parseStatus = tr("Errors in document");
+ statusLabel->setText(parseStatus);
+ }
+
+}
+
void SkinDocument::codeChanged()
{
if(blockUpdate)
@@ -190,7 +214,6 @@ void SkinDocument::codeChanged()
parseStatus = tr("Errors in document");
statusLabel->setText(parseStatus);
-
/* Highlighting if an error was found */
if(skin_error_line() > 0)
{
@@ -225,6 +248,9 @@ void SkinDocument::codeChanged()
emit titleChanged(title + QChar('*'));
else
emit titleChanged(title);
+
+ cursorChanged();
+
}
void SkinDocument::save()
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index ccbb228dc1..79db8b648a 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -67,6 +67,7 @@ signals:
public slots:
void settingsChanged();
+ void cursorChanged();
private slots:
void codeChanged();