diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-07 07:57:56 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-07 07:57:56 +0000 |
commit | ffc1afc30dc4343a3b1630c6b4ebd25570ac8d2d (patch) | |
tree | 287a68f2259b0b03a13ec1244635d006eeffb222 | |
parent | 4a9398e3fcb0c2d4d688a914077e891b053fe07f (diff) | |
download | rockbox-ffc1afc30dc4343a3b1630c6b4ebd25570ac8d2d.tar.gz rockbox-ffc1afc30dc4343a3b1630c6b4ebd25570ac8d2d.zip |
Theme Editor: Added font selection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26650 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/preferencesdialog.cpp | 28 | ||||
-rw-r--r-- | utils/themeeditor/preferencesdialog.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/preferencesdialog.ui | 184 | ||||
-rw-r--r-- | utils/themeeditor/skindocument.cpp | 12 | ||||
-rw-r--r-- | utils/themeeditor/skindocument.h | 2 |
5 files changed, 157 insertions, 71 deletions
diff --git a/utils/themeeditor/preferencesdialog.cpp b/utils/themeeditor/preferencesdialog.cpp index 4d3ad04495..79f781c1ca 100644 --- a/utils/themeeditor/preferencesdialog.cpp +++ b/utils/themeeditor/preferencesdialog.cpp @@ -42,6 +42,7 @@ PreferencesDialog::~PreferencesDialog() void PreferencesDialog::loadSettings() { loadColors(); + loadFont(); } void PreferencesDialog::loadColors() @@ -83,9 +84,25 @@ void PreferencesDialog::loadColors() settings.endGroup(); } +void PreferencesDialog::loadFont() +{ + QSettings settings; + settings.beginGroup("SkinDocument"); + + QVariant family = settings.value("fontFamily", QFont()); + int size = settings.value("fontSize", 12).toInt(); + + settings.endGroup(); + + ui->fontSelect->setCurrentFont(family.value<QFont>()); + ui->fontSize->setValue(size); + +} + void PreferencesDialog::saveSettings() { saveColors(); + saveFont(); } void PreferencesDialog::saveColors() @@ -111,6 +128,17 @@ void PreferencesDialog::saveColors() settings.endGroup(); } +void PreferencesDialog::saveFont() +{ + QSettings settings; + settings.beginGroup("SkinDocument"); + + settings.setValue("fontFamily", ui->fontSelect->currentFont()); + settings.setValue("fontSize", ui->fontSize->value()); + + settings.endGroup(); +} + void PreferencesDialog::setupUI() { /* Connecting color buttons */ diff --git a/utils/themeeditor/preferencesdialog.h b/utils/themeeditor/preferencesdialog.h index a4adda47d1..7aadbade07 100644 --- a/utils/themeeditor/preferencesdialog.h +++ b/utils/themeeditor/preferencesdialog.h @@ -53,8 +53,10 @@ private: void loadSettings(); void loadColors(); + void loadFont(); void saveSettings(); void saveColors(); + void saveFont(); void setupUI(); diff --git a/utils/themeeditor/preferencesdialog.ui b/utils/themeeditor/preferencesdialog.ui index 017e69dd01..5364fb4952 100644 --- a/utils/themeeditor/preferencesdialog.ui +++ b/utils/themeeditor/preferencesdialog.ui @@ -15,109 +15,94 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QToolBox" name="prefsGroups"> + <widget class="QTabWidget" name="prefsGroups"> + <property name="tabPosition"> + <enum>QTabWidget::West</enum> + </property> <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="highlighting"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>352</width> - <height>288</height> - </rect> - </property> - <attribute name="label"> - <string>Editor Colors</string> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Editor</string> </attribute> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QHBoxLayout" name="horizontalLayout_7"> <item> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>Foreground</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>fgButton</cstring> + <string>Font</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_3"> + <widget class="QFontComboBox" name="fontSelect"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>Background</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>bgButton</cstring> + <string>Size</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Comment</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>commentButton</cstring> + <widget class="QSpinBox" name="fontSize"> + <property name="value"> + <number>12</number> </property> </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QLabel" name="label_5"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>Escaped Character</string> + <string>Foreground Color</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <property name="buddy"> - <cstring>escapedButton</cstring> + <cstring>fgButton</cstring> </property> </widget> </item> <item> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Conditional</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <widget class="QPushButton" name="fgButton"> + <property name="autoFillBackground"> + <bool>false</bool> </property> - <property name="buddy"> - <cstring>conditionalButton</cstring> + <property name="text"> + <string>Click To Change</string> </property> </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>Tag</string> + <string>Background Color</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <property name="buddy"> - <cstring>tagButton</cstring> + <cstring>bgButton</cstring> </property> </widget> </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QPushButton" name="fgButton"> + <widget class="QPushButton" name="bgButton"> <property name="autoFillBackground"> <bool>false</bool> </property> @@ -126,13 +111,27 @@ </property> </widget> </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="prefsGroupsPage1" native="true"> + <attribute name="title"> + <string>Highlighting</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> - <widget class="QPushButton" name="bgButton"> - <property name="autoFillBackground"> - <bool>false</bool> - </property> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Click To Change</string> + <string>Comment</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>commentButton</cstring> </property> </widget> </item> @@ -149,6 +148,23 @@ </property> </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Escaped Character</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>escapedButton</cstring> + </property> + </widget> + </item> <item> <widget class="QPushButton" name="escapedButton"> <property name="autoFillBackground"> @@ -159,6 +175,23 @@ </property> </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Conditional</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>conditionalButton</cstring> + </property> + </widget> + </item> <item> <widget class="QPushButton" name="conditionalButton"> <property name="autoFillBackground"> @@ -169,6 +202,23 @@ </property> </widget> </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Tag</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>tagButton</cstring> + </property> + </widget> + </item> <item> <widget class="QPushButton" name="tagButton"> <property name="autoFillBackground"> @@ -206,8 +256,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>248</x> - <y>254</y> + <x>257</x> + <y>360</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -222,8 +272,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>325</x> + <y>360</y> </hint> <hint type="destinationlabel"> <x>286</x> diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp index fbb33cc366..730d03a0a6 100644 --- a/utils/themeeditor/skindocument.cpp +++ b/utils/themeeditor/skindocument.cpp @@ -65,7 +65,7 @@ SkinDocument::~SkinDocument() void SkinDocument::connectPrefs(PreferencesDialog* prefs) { QObject::connect(prefs, SIGNAL(accepted()), - this, SLOT(colorsChanged())); + this, SLOT(settingsChanged())); QObject::connect(prefs, SIGNAL(accepted()), highlighter, SLOT(loadSettings())); } @@ -124,10 +124,10 @@ void SkinDocument::setupUI() QObject::connect(editor, SIGNAL(textChanged()), this, SLOT(codeChanged())); - colorsChanged(); + settingsChanged(); } -void SkinDocument::colorsChanged() +void SkinDocument::settingsChanged() { /* Setting the editor colors */ QSettings settings; @@ -140,6 +140,12 @@ void SkinDocument::colorsChanged() palette.setColor(QPalette::All, QPalette::Text, fg); editor->setPalette(palette); + + /* Setting the font */ + QFont family = settings.value("fontFamily", QFont()).value<QFont>(); + family.setPointSize(settings.value("fontSize", 12).toInt()); + editor->setFont(family); + editor->repaint(); settings.endGroup(); diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h index 14a71e02a1..cf8f8a0313 100644 --- a/utils/themeeditor/skindocument.h +++ b/utils/themeeditor/skindocument.h @@ -63,7 +63,7 @@ signals: void titleChanged(QString); public slots: - void colorsChanged(); + void settingsChanged(); private slots: void codeChanged(); |