diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-06-07 03:25:40 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-07 03:25:40 +0000 |
| commit | 53b619c6e80c9efc6993c23ff7b1035e8e101834 (patch) | |
| tree | 7bca9e3845748332c0e6288b5704e9b004f41a22 /utils/themeeditor/skindocument.cpp | |
| parent | fbfdaf5c79c664a6ec47b1c3a131577e77efbbd0 (diff) | |
| download | rockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.zip rockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.tar.gz rockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.tar.bz2 rockbox-53b619c6e80c9efc6993c23ff7b1035e8e101834.tar.xz | |
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 '')
| -rw-r--r-- | utils/themeeditor/skindocument.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp index efb16ee..fbb33cc 100644 --- a/utils/themeeditor/skindocument.cpp +++ b/utils/themeeditor/skindocument.cpp @@ -23,6 +23,7 @@ #include <QFile> #include <QSettings> +#include <QColor> #include <QMessageBox> #include <QFileDialog> @@ -61,6 +62,14 @@ SkinDocument::~SkinDocument() delete model; } +void SkinDocument::connectPrefs(PreferencesDialog* prefs) +{ + QObject::connect(prefs, SIGNAL(accepted()), + this, SLOT(colorsChanged())); + QObject::connect(prefs, SIGNAL(accepted()), + highlighter, SLOT(loadSettings())); +} + bool SkinDocument::requestClose() { if(editor->document()->toPlainText() != saved) @@ -106,9 +115,7 @@ void SkinDocument::setupUI() setLayout(layout); /* Attaching the syntax highlighter */ - highlighter = new SkinHighlighter(QColor(0,180,0), QColor(255,0,0), - QColor(0,0,255), QColor(120,120,120), - editor->document()); + highlighter = new SkinHighlighter(editor->document()); /* Setting up the model */ model = new ParseTreeModel(""); @@ -116,6 +123,27 @@ void SkinDocument::setupUI() /* Connecting the editor's signal */ QObject::connect(editor, SIGNAL(textChanged()), this, SLOT(codeChanged())); + + colorsChanged(); +} + +void SkinDocument::colorsChanged() +{ + /* Setting the editor colors */ + QSettings settings; + settings.beginGroup("SkinDocument"); + + QColor fg = settings.value("fgColor", Qt::black).value<QColor>(); + QColor bg = settings.value("bgColor", Qt::white).value<QColor>(); + QPalette palette; + palette.setColor(QPalette::All, QPalette::Base, bg); + palette.setColor(QPalette::All, QPalette::Text, fg); + + editor->setPalette(palette); + editor->repaint(); + + settings.endGroup(); + } void SkinDocument::codeChanged() |