diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/gui/configdocument.cpp | 39 | ||||
-rw-r--r-- | utils/themeeditor/gui/configdocument.h | 5 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 3 | ||||
-rw-r--r-- | utils/themeeditor/gui/tabcontent.h | 5 |
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 @@ | |||
22 | #include "projectmodel.h" | 22 | #include "projectmodel.h" |
23 | #include "configdocument.h" | 23 | #include "configdocument.h" |
24 | #include "ui_configdocument.h" | 24 | #include "ui_configdocument.h" |
25 | #include "preferencesdialog.h" | ||
25 | 26 | ||
26 | #include <QMessageBox> | 27 | #include <QMessageBox> |
27 | #include <QFile> | 28 | #include <QFile> |
@@ -103,6 +104,8 @@ ConfigDocument::ConfigDocument(QMap<QString, QString>& settings, QString file, | |||
103 | this, SLOT(buttonChecked())); | 104 | this, SLOT(buttonChecked())); |
104 | QObject::connect(ui->textButton, SIGNAL(toggled(bool)), | 105 | QObject::connect(ui->textButton, SIGNAL(toggled(bool)), |
105 | this, SLOT(buttonChecked())); | 106 | this, SLOT(buttonChecked())); |
107 | |||
108 | settingsChanged(); | ||
106 | } | 109 | } |
107 | 110 | ||
108 | ConfigDocument::~ConfigDocument() | 111 | ConfigDocument::~ConfigDocument() |
@@ -398,3 +401,39 @@ void ConfigDocument::buttonChecked() | |||
398 | settings.setValue("linesVisible", ui->linesButton->isChecked()); | 401 | settings.setValue("linesVisible", ui->linesButton->isChecked()); |
399 | settings.endGroup(); | 402 | settings.endGroup(); |
400 | } | 403 | } |
404 | |||
405 | void ConfigDocument::connectPrefs(PreferencesDialog *prefs) | ||
406 | { | ||
407 | QObject::connect(prefs, SIGNAL(accepted()), | ||
408 | this, SLOT(settingsChanged())); | ||
409 | } | ||
410 | |||
411 | |||
412 | void ConfigDocument::settingsChanged() | ||
413 | { | ||
414 | /* Setting the editor colors */ | ||
415 | QSettings settings; | ||
416 | settings.beginGroup("SkinDocument"); | ||
417 | |||
418 | QColor fg = settings.value("fgColor", Qt::black).value<QColor>(); | ||
419 | QColor bg = settings.value("bgColor", Qt::white).value<QColor>(); | ||
420 | QPalette palette; | ||
421 | palette.setColor(QPalette::All, QPalette::Base, bg); | ||
422 | palette.setColor(QPalette::All, QPalette::Text, fg); | ||
423 | editor->setPalette(palette); | ||
424 | |||
425 | QColor highlight = settings.value("errorColor", Qt::red).value<QColor>(); | ||
426 | editor->setErrorColor(highlight); | ||
427 | |||
428 | /* Setting the font */ | ||
429 | QFont def("Monospace"); | ||
430 | def.setStyleHint(QFont::TypeWriter); | ||
431 | QFont family = settings.value("fontFamily", def).value<QFont>(); | ||
432 | family.setPointSize(settings.value("fontSize", 12).toInt()); | ||
433 | editor->setFont(family); | ||
434 | |||
435 | editor->repaint(); | ||
436 | |||
437 | settings.endGroup(); | ||
438 | |||
439 | } | ||
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: | |||
88 | void unblockUpdates(){ block = false; } | 88 | void unblockUpdates(){ block = false; } |
89 | void buttonChecked(); | 89 | void buttonChecked(); |
90 | 90 | ||
91 | void connectPrefs(PreferencesDialog *prefs); | ||
92 | |||
93 | public slots: | ||
94 | void settingsChanged(); | ||
95 | |||
91 | private: | 96 | private: |
92 | void addRow(QString key, QString value); | 97 | void addRow(QString key, QString value); |
93 | 98 | ||
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) | |||
311 | this, SLOT(lineChanged(int))); | 311 | this, SLOT(lineChanged(int))); |
312 | 312 | ||
313 | /* Connecting to settings change events */ | 313 | /* Connecting to settings change events */ |
314 | if(doc->type() == TabContent::Skin) | 314 | doc->connectPrefs(prefs); |
315 | dynamic_cast<SkinDocument*>(doc)->connectPrefs(prefs); | ||
316 | } | 315 | } |
317 | 316 | ||
318 | 317 | ||
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 @@ | |||
3 | 3 | ||
4 | #include <QWidget> | 4 | #include <QWidget> |
5 | 5 | ||
6 | class PreferencesDialog; | ||
7 | |||
6 | class TabContent : public QWidget | 8 | class TabContent : public QWidget |
7 | { | 9 | { |
8 | Q_OBJECT | 10 | Q_OBJECT |
@@ -24,11 +26,14 @@ public: | |||
24 | 26 | ||
25 | virtual bool requestClose() = 0; | 27 | virtual bool requestClose() = 0; |
26 | 28 | ||
29 | virtual void connectPrefs(PreferencesDialog* prefs) = 0; | ||
30 | |||
27 | signals: | 31 | signals: |
28 | void titleChanged(QString); | 32 | void titleChanged(QString); |
29 | void lineChanged(int); | 33 | void lineChanged(int); |
30 | 34 | ||
31 | public slots: | 35 | public slots: |
36 | virtual void settingsChanged() = 0; | ||
32 | 37 | ||
33 | }; | 38 | }; |
34 | 39 | ||