summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-15 01:50:27 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-15 01:50:27 +0000
commit18a6f42f2622d27967c3ad83b27a1de4f713dff2 (patch)
treeaa432ef119d2a1a0140122397bdcd6ba7d4185ec /utils/themeeditor
parenta9d752b1bd439a20f3ca4d53670a42f880ead533 (diff)
downloadrockbox-18a6f42f2622d27967c3ad83b27a1de4f713dff2.tar.gz
rockbox-18a6f42f2622d27967c3ad83b27a1de4f713dff2.tar.bz2
rockbox-18a6f42f2622d27967c3ad83b27a1de4f713dff2.zip
Theme Editor: Editor font/color settings are now applied to config documents
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27818 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/gui/configdocument.cpp39
-rw-r--r--utils/themeeditor/gui/configdocument.h5
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp3
-rw-r--r--utils/themeeditor/gui/tabcontent.h5
4 files changed, 50 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/configdocument.cpp b/utils/themeeditor/gui/configdocument.cpp
index f3bfc7280c..aaea3aa1e2 100644
--- a/utils/themeeditor/gui/configdocument.cpp
+++ b/utils/themeeditor/gui/configdocument.cpp
@@ -22,6 +22,7 @@
#include "projectmodel.h"
#include "configdocument.h"
#include "ui_configdocument.h"
+#include "preferencesdialog.h"
#include <QMessageBox>
#include <QFile>
@@ -103,6 +104,8 @@ ConfigDocument::ConfigDocument(QMap<QString, QString>& settings, QString file,
this, SLOT(buttonChecked()));
QObject::connect(ui->textButton, SIGNAL(toggled(bool)),
this, SLOT(buttonChecked()));
+
+ settingsChanged();
}
ConfigDocument::~ConfigDocument()
@@ -398,3 +401,39 @@ void ConfigDocument::buttonChecked()
settings.setValue("linesVisible", ui->linesButton->isChecked());
settings.endGroup();
}
+
+void ConfigDocument::connectPrefs(PreferencesDialog *prefs)
+{
+ QObject::connect(prefs, SIGNAL(accepted()),
+ this, SLOT(settingsChanged()));
+}
+
+
+void ConfigDocument::settingsChanged()
+{
+ /* 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);
+
+ QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
+ editor->setErrorColor(highlight);
+
+ /* Setting the font */
+ QFont def("Monospace");
+ def.setStyleHint(QFont::TypeWriter);
+ QFont family = settings.value("fontFamily", def).value<QFont>();
+ family.setPointSize(settings.value("fontSize", 12).toInt());
+ editor->setFont(family);
+
+ editor->repaint();
+
+ settings.endGroup();
+
+}
diff --git a/utils/themeeditor/gui/configdocument.h b/utils/themeeditor/gui/configdocument.h
index 29278dbd11..41b74e1599 100644
--- a/utils/themeeditor/gui/configdocument.h
+++ b/utils/themeeditor/gui/configdocument.h
@@ -88,6 +88,11 @@ private slots:
void unblockUpdates(){ block = false; }
void buttonChecked();
+ void connectPrefs(PreferencesDialog *prefs);
+
+public slots:
+ void settingsChanged();
+
private:
void addRow(QString key, QString value);
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index 64443a1fd1..71b0c07405 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -311,8 +311,7 @@ void EditorWindow::addTab(TabContent *doc)
this, SLOT(lineChanged(int)));
/* Connecting to settings change events */
- if(doc->type() == TabContent::Skin)
- dynamic_cast<SkinDocument*>(doc)->connectPrefs(prefs);
+ doc->connectPrefs(prefs);
}
diff --git a/utils/themeeditor/gui/tabcontent.h b/utils/themeeditor/gui/tabcontent.h
index 1b153f7df5..30d80fedf5 100644
--- a/utils/themeeditor/gui/tabcontent.h
+++ b/utils/themeeditor/gui/tabcontent.h
@@ -3,6 +3,8 @@
#include <QWidget>
+class PreferencesDialog;
+
class TabContent : public QWidget
{
Q_OBJECT
@@ -24,11 +26,14 @@ public:
virtual bool requestClose() = 0;
+ virtual void connectPrefs(PreferencesDialog* prefs) = 0;
+
signals:
void titleChanged(QString);
void lineChanged(int);
public slots:
+ virtual void settingsChanged() = 0;
};