diff options
-rw-r--r-- | utils/themeeditor/codeeditor.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/skindocument.cpp | 28 | ||||
-rw-r--r-- | utils/themeeditor/skindocument.h | 1 |
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: | |||
62 | void addError(int line){ errors.append(line); } | 62 | void addError(int line){ errors.append(line); } |
63 | void clearErrors(){ errors.clear(); } | 63 | void clearErrors(){ errors.clear(); } |
64 | void setErrorColor(QColor color){ errorColor = color; } | 64 | void setErrorColor(QColor color){ errorColor = color; } |
65 | bool isError(int line){ return errors.contains(line); } | ||
66 | bool hasErrors(){ return !errors.isEmpty(); } | ||
65 | 67 | ||
66 | protected: | 68 | protected: |
67 | void resizeEvent(QResizeEvent *event); | 69 | 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() | |||
138 | /* Connecting the editor's signal */ | 138 | /* Connecting the editor's signal */ |
139 | QObject::connect(editor, SIGNAL(textChanged()), | 139 | QObject::connect(editor, SIGNAL(textChanged()), |
140 | this, SLOT(codeChanged())); | 140 | this, SLOT(codeChanged())); |
141 | QObject::connect(editor, SIGNAL(cursorPositionChanged()), | ||
142 | this, SLOT(cursorChanged())); | ||
141 | 143 | ||
142 | settingsChanged(); | 144 | settingsChanged(); |
143 | } | 145 | } |
@@ -171,6 +173,28 @@ void SkinDocument::settingsChanged() | |||
171 | 173 | ||
172 | } | 174 | } |
173 | 175 | ||
176 | void SkinDocument::cursorChanged() | ||
177 | { | ||
178 | if(editor->isError(editor->textCursor().blockNumber() + 1)) | ||
179 | { | ||
180 | QTextCursor line = editor->textCursor(); | ||
181 | line.movePosition(QTextCursor::StartOfLine); | ||
182 | line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); | ||
183 | skin_parse(line.selectedText().toAscii()); | ||
184 | if(skin_error_line() > 0) | ||
185 | parseStatus = tr("Error on line ") + | ||
186 | QString::number(line.blockNumber() + 1) + tr(": ") + | ||
187 | skin_error_message(); | ||
188 | statusLabel->setText(parseStatus); | ||
189 | } | ||
190 | else if(editor->hasErrors()) | ||
191 | { | ||
192 | parseStatus = tr("Errors in document"); | ||
193 | statusLabel->setText(parseStatus); | ||
194 | } | ||
195 | |||
196 | } | ||
197 | |||
174 | void SkinDocument::codeChanged() | 198 | void SkinDocument::codeChanged() |
175 | { | 199 | { |
176 | if(blockUpdate) | 200 | if(blockUpdate) |
@@ -190,7 +214,6 @@ void SkinDocument::codeChanged() | |||
190 | parseStatus = tr("Errors in document"); | 214 | parseStatus = tr("Errors in document"); |
191 | statusLabel->setText(parseStatus); | 215 | statusLabel->setText(parseStatus); |
192 | 216 | ||
193 | |||
194 | /* Highlighting if an error was found */ | 217 | /* Highlighting if an error was found */ |
195 | if(skin_error_line() > 0) | 218 | if(skin_error_line() > 0) |
196 | { | 219 | { |
@@ -225,6 +248,9 @@ void SkinDocument::codeChanged() | |||
225 | emit titleChanged(title + QChar('*')); | 248 | emit titleChanged(title + QChar('*')); |
226 | else | 249 | else |
227 | emit titleChanged(title); | 250 | emit titleChanged(title); |
251 | |||
252 | cursorChanged(); | ||
253 | |||
228 | } | 254 | } |
229 | 255 | ||
230 | void SkinDocument::save() | 256 | 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: | |||
67 | 67 | ||
68 | public slots: | 68 | public slots: |
69 | void settingsChanged(); | 69 | void settingsChanged(); |
70 | void cursorChanged(); | ||
70 | 71 | ||
71 | private slots: | 72 | private slots: |
72 | void codeChanged(); | 73 | void codeChanged(); |