summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skindocument.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-07 03:25:40 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-07 03:25:40 +0000
commit53b619c6e80c9efc6993c23ff7b1035e8e101834 (patch)
tree7bca9e3845748332c0e6288b5704e9b004f41a22 /utils/themeeditor/skindocument.cpp
parentfbfdaf5c79c664a6ec47b1c3a131577e77efbbd0 (diff)
downloadrockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.tar.gz
rockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.zip
Theme Editor: Added a preferences dialog and allowed modification of the syntax highlighting and editor colors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26640 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/skindocument.cpp')
-rw-r--r--utils/themeeditor/skindocument.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index efb16eeae1..fbb33cc366 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -23,6 +23,7 @@
23 23
24#include <QFile> 24#include <QFile>
25#include <QSettings> 25#include <QSettings>
26#include <QColor>
26#include <QMessageBox> 27#include <QMessageBox>
27#include <QFileDialog> 28#include <QFileDialog>
28 29
@@ -61,6 +62,14 @@ SkinDocument::~SkinDocument()
61 delete model; 62 delete model;
62} 63}
63 64
65void SkinDocument::connectPrefs(PreferencesDialog* prefs)
66{
67 QObject::connect(prefs, SIGNAL(accepted()),
68 this, SLOT(colorsChanged()));
69 QObject::connect(prefs, SIGNAL(accepted()),
70 highlighter, SLOT(loadSettings()));
71}
72
64bool SkinDocument::requestClose() 73bool SkinDocument::requestClose()
65{ 74{
66 if(editor->document()->toPlainText() != saved) 75 if(editor->document()->toPlainText() != saved)
@@ -106,9 +115,7 @@ void SkinDocument::setupUI()
106 setLayout(layout); 115 setLayout(layout);
107 116
108 /* Attaching the syntax highlighter */ 117 /* Attaching the syntax highlighter */
109 highlighter = new SkinHighlighter(QColor(0,180,0), QColor(255,0,0), 118 highlighter = new SkinHighlighter(editor->document());
110 QColor(0,0,255), QColor(120,120,120),
111 editor->document());
112 119
113 /* Setting up the model */ 120 /* Setting up the model */
114 model = new ParseTreeModel(""); 121 model = new ParseTreeModel("");
@@ -116,6 +123,27 @@ void SkinDocument::setupUI()
116 /* Connecting the editor's signal */ 123 /* Connecting the editor's signal */
117 QObject::connect(editor, SIGNAL(textChanged()), 124 QObject::connect(editor, SIGNAL(textChanged()),
118 this, SLOT(codeChanged())); 125 this, SLOT(codeChanged()));
126
127 colorsChanged();
128}
129
130void SkinDocument::colorsChanged()
131{
132 /* Setting the editor colors */
133 QSettings settings;
134 settings.beginGroup("SkinDocument");
135
136 QColor fg = settings.value("fgColor", Qt::black).value<QColor>();
137 QColor bg = settings.value("bgColor", Qt::white).value<QColor>();
138 QPalette palette;
139 palette.setColor(QPalette::All, QPalette::Base, bg);
140 palette.setColor(QPalette::All, QPalette::Text, fg);
141
142 editor->setPalette(palette);
143 editor->repaint();
144
145 settings.endGroup();
146
119} 147}
120 148
121void SkinDocument::codeChanged() 149void SkinDocument::codeChanged()