summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/editorwindow.cpp2
-rw-r--r--utils/themeeditor/preferencesdialog.cpp7
-rw-r--r--utils/themeeditor/preferencesdialog.h1
-rw-r--r--utils/themeeditor/preferencesdialog.ui22
-rw-r--r--utils/themeeditor/skindocument.cpp28
-rw-r--r--utils/themeeditor/skindocument.h2
6 files changed, 58 insertions, 4 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 23724ee1ad..cc2a0fb350 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -96,7 +96,7 @@ void EditorWindow::setupUI()
96 96
97 /* Setting up the parse status label */ 97 /* Setting up the parse status label */
98 parseStatus = new QLabel(this); 98 parseStatus = new QLabel(this);
99 ui->statusbar->addWidget(parseStatus); 99 ui->statusbar->addPermanentWidget(parseStatus);
100 100
101} 101}
102 102
diff --git a/utils/themeeditor/preferencesdialog.cpp b/utils/themeeditor/preferencesdialog.cpp
index 79f781c1ca..9b28b275f8 100644
--- a/utils/themeeditor/preferencesdialog.cpp
+++ b/utils/themeeditor/preferencesdialog.cpp
@@ -81,6 +81,9 @@ void PreferencesDialog::loadColors()
81 bgColor = settings.value("bgColor", Qt::white).value<QColor>(); 81 bgColor = settings.value("bgColor", Qt::white).value<QColor>();
82 setButtonColor(ui->bgButton, bgColor); 82 setButtonColor(ui->bgButton, bgColor);
83 83
84 errorColor = settings.value("errorColor", Qt::red).value<QColor>();
85 setButtonColor(ui->errorButton, errorColor);
86
84 settings.endGroup(); 87 settings.endGroup();
85} 88}
86 89
@@ -114,6 +117,7 @@ void PreferencesDialog::saveColors()
114 117
115 settings.setValue("fgColor", fgColor); 118 settings.setValue("fgColor", fgColor);
116 settings.setValue("bgColor", bgColor); 119 settings.setValue("bgColor", bgColor);
120 settings.setValue("errorColor", errorColor);
117 121
118 settings.endGroup(); 122 settings.endGroup();
119 123
@@ -149,6 +153,7 @@ void PreferencesDialog::setupUI()
149 buttons.append(ui->tagButton); 153 buttons.append(ui->tagButton);
150 buttons.append(ui->conditionalButton); 154 buttons.append(ui->conditionalButton);
151 buttons.append(ui->escapedButton); 155 buttons.append(ui->escapedButton);
156 buttons.append(ui->errorButton);
152 157
153 for(int i = 0; i < buttons.count(); i++) 158 for(int i = 0; i < buttons.count(); i++)
154 QObject::connect(buttons[i], SIGNAL(pressed()), 159 QObject::connect(buttons[i], SIGNAL(pressed()),
@@ -171,6 +176,8 @@ void PreferencesDialog::colorClicked()
171 toEdit = &conditionalColor; 176 toEdit = &conditionalColor;
172 else if(QObject::sender() == ui->escapedButton) 177 else if(QObject::sender() == ui->escapedButton)
173 toEdit = &escapedColor; 178 toEdit = &escapedColor;
179 else if(QObject::sender() == ui->errorButton)
180 toEdit = &errorColor;
174 181
175 if(!toEdit) 182 if(!toEdit)
176 return; 183 return;
diff --git a/utils/themeeditor/preferencesdialog.h b/utils/themeeditor/preferencesdialog.h
index 7aadbade07..e28a830751 100644
--- a/utils/themeeditor/preferencesdialog.h
+++ b/utils/themeeditor/preferencesdialog.h
@@ -62,6 +62,7 @@ private:
62 62
63 QColor fgColor; 63 QColor fgColor;
64 QColor bgColor; 64 QColor bgColor;
65 QColor errorColor;
65 QColor commentColor; 66 QColor commentColor;
66 QColor escapedColor; 67 QColor escapedColor;
67 QColor tagColor; 68 QColor tagColor;
diff --git a/utils/themeeditor/preferencesdialog.ui b/utils/themeeditor/preferencesdialog.ui
index 5364fb4952..af10875721 100644
--- a/utils/themeeditor/preferencesdialog.ui
+++ b/utils/themeeditor/preferencesdialog.ui
@@ -26,7 +26,7 @@
26 <attribute name="title"> 26 <attribute name="title">
27 <string>Editor</string> 27 <string>Editor</string>
28 </attribute> 28 </attribute>
29 <layout class="QVBoxLayout" name="verticalLayout_4"> 29 <layout class="QVBoxLayout" name="verticalLayout_2">
30 <item> 30 <item>
31 <layout class="QHBoxLayout" name="horizontalLayout_7"> 31 <layout class="QHBoxLayout" name="horizontalLayout_7">
32 <item> 32 <item>
@@ -113,9 +113,27 @@
113 </item> 113 </item>
114 </layout> 114 </layout>
115 </item> 115 </item>
116 <item>
117 <layout class="QHBoxLayout" name="horizontalLayout_9">
118 <item>
119 <widget class="QLabel" name="label_9">
120 <property name="text">
121 <string>Error Color</string>
122 </property>
123 </widget>
124 </item>
125 <item>
126 <widget class="QPushButton" name="errorButton">
127 <property name="text">
128 <string>Click To Change</string>
129 </property>
130 </widget>
131 </item>
132 </layout>
133 </item>
116 </layout> 134 </layout>
117 </widget> 135 </widget>
118 <widget class="QWidget" name="prefsGroupsPage1" native="true"> 136 <widget class="QWidget" name="prefsGroupsPage1">
119 <attribute name="title"> 137 <attribute name="title">
120 <string>Highlighting</string> 138 <string>Highlighting</string>
121 </attribute> 139 </attribute>
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
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index 4a6516f6de..b5eb60b2f4 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -78,6 +78,8 @@ private:
78 QString saved; 78 QString saved;
79 QString parseStatus; 79 QString parseStatus;
80 80
81 QTextCharFormat errorColor;
82
81 QLayout* layout; 83 QLayout* layout;
82 QPlainTextEdit* editor; 84 QPlainTextEdit* editor;
83 85