summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-06 20:23:27 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-06 20:23:27 +0000
commiteccc2bd009e967e45d38a573080d13a1339eb0a6 (patch)
tree810341f795f88ab63147d3ed545c1eb812347ebc /utils/themeeditor/gui
parent120f3e1c10c36fd5d174741d0da81ba84fc79ae3 (diff)
downloadrockbox-eccc2bd009e967e45d38a573080d13a1339eb0a6.tar.gz
rockbox-eccc2bd009e967e45d38a573080d13a1339eb0a6.zip
Theme Editor: Added font directory option in preferences dialog, renderer will now search that directory for fonts if they're not found in the project directory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27322 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui')
-rw-r--r--utils/themeeditor/gui/preferencesdialog.cpp34
-rw-r--r--utils/themeeditor/gui/preferencesdialog.h3
-rw-r--r--utils/themeeditor/gui/preferencesdialog.ui34
3 files changed, 68 insertions, 3 deletions
diff --git a/utils/themeeditor/gui/preferencesdialog.cpp b/utils/themeeditor/gui/preferencesdialog.cpp
index 8cd9665779..f8c71f4450 100644
--- a/utils/themeeditor/gui/preferencesdialog.cpp
+++ b/utils/themeeditor/gui/preferencesdialog.cpp
@@ -24,6 +24,7 @@
24 24
25#include <QSettings> 25#include <QSettings>
26#include <QColorDialog> 26#include <QColorDialog>
27#include <QFileDialog>
27 28
28PreferencesDialog::PreferencesDialog(QWidget *parent) : 29PreferencesDialog::PreferencesDialog(QWidget *parent) :
29 QDialog(parent), 30 QDialog(parent),
@@ -43,6 +44,7 @@ void PreferencesDialog::loadSettings()
43{ 44{
44 loadColors(); 45 loadColors();
45 loadFont(); 46 loadFont();
47 loadFontDir();
46} 48}
47 49
48void PreferencesDialog::loadColors() 50void PreferencesDialog::loadColors()
@@ -105,10 +107,21 @@ void PreferencesDialog::loadFont()
105 107
106} 108}
107 109
110void PreferencesDialog::loadFontDir()
111{
112 QSettings settings;
113 settings.beginGroup("RBFont");
114
115 ui->fontBox->setText(settings.value("fontDir", "/").toString());
116
117 settings.endGroup();
118}
119
108void PreferencesDialog::saveSettings() 120void PreferencesDialog::saveSettings()
109{ 121{
110 saveColors(); 122 saveColors();
111 saveFont(); 123 saveFont();
124 saveFontDir();
112} 125}
113 126
114void PreferencesDialog::saveColors() 127void PreferencesDialog::saveColors()
@@ -146,6 +159,16 @@ void PreferencesDialog::saveFont()
146 settings.endGroup(); 159 settings.endGroup();
147} 160}
148 161
162void PreferencesDialog::saveFontDir()
163{
164 QSettings settings;
165 settings.beginGroup("RBFont");
166
167 settings.setValue("fontDir", ui->fontBox->text());
168
169 settings.endGroup();
170}
171
149void PreferencesDialog::setupUI() 172void PreferencesDialog::setupUI()
150{ 173{
151 /* Connecting color buttons */ 174 /* Connecting color buttons */
@@ -161,6 +184,9 @@ void PreferencesDialog::setupUI()
161 for(int i = 0; i < buttons.count(); i++) 184 for(int i = 0; i < buttons.count(); i++)
162 QObject::connect(buttons[i], SIGNAL(pressed()), 185 QObject::connect(buttons[i], SIGNAL(pressed()),
163 this, SLOT(colorClicked())); 186 this, SLOT(colorClicked()));
187
188 QObject::connect(ui->fontBrowseButton, SIGNAL(clicked()),
189 this, SLOT(browseFont()));
164} 190}
165 191
166void PreferencesDialog::colorClicked() 192void PreferencesDialog::colorClicked()
@@ -193,6 +219,14 @@ void PreferencesDialog::colorClicked()
193 } 219 }
194} 220}
195 221
222void PreferencesDialog::browseFont()
223{
224 QString path = QFileDialog::
225 getExistingDirectory(this, "Font Directory",
226 ui->fontBox->text());
227 ui->fontBox->setText(path);
228}
229
196void PreferencesDialog::accept() 230void PreferencesDialog::accept()
197{ 231{
198 saveSettings(); 232 saveSettings();
diff --git a/utils/themeeditor/gui/preferencesdialog.h b/utils/themeeditor/gui/preferencesdialog.h
index d717d04ab8..3df2409fd9 100644
--- a/utils/themeeditor/gui/preferencesdialog.h
+++ b/utils/themeeditor/gui/preferencesdialog.h
@@ -47,6 +47,7 @@ public slots:
47 47
48private slots: 48private slots:
49 void colorClicked(); 49 void colorClicked();
50 void browseFont();
50 51
51private: 52private:
52 Ui::PreferencesDialog *ui; 53 Ui::PreferencesDialog *ui;
@@ -54,9 +55,11 @@ private:
54 void loadSettings(); 55 void loadSettings();
55 void loadColors(); 56 void loadColors();
56 void loadFont(); 57 void loadFont();
58 void loadFontDir();
57 void saveSettings(); 59 void saveSettings();
58 void saveColors(); 60 void saveColors();
59 void saveFont(); 61 void saveFont();
62 void saveFontDir();
60 63
61 void setupUI(); 64 void setupUI();
62 65
diff --git a/utils/themeeditor/gui/preferencesdialog.ui b/utils/themeeditor/gui/preferencesdialog.ui
index 7dddcf9057..15e1743138 100644
--- a/utils/themeeditor/gui/preferencesdialog.ui
+++ b/utils/themeeditor/gui/preferencesdialog.ui
@@ -23,9 +23,6 @@
23 <property name="tabPosition"> 23 <property name="tabPosition">
24 <enum>QTabWidget::North</enum> 24 <enum>QTabWidget::North</enum>
25 </property> 25 </property>
26 <property name="currentIndex">
27 <number>0</number>
28 </property>
29 <widget class="QWidget" name="tab_2"> 26 <widget class="QWidget" name="tab_2">
30 <attribute name="title"> 27 <attribute name="title">
31 <string>Editor</string> 28 <string>Editor</string>
@@ -258,6 +255,37 @@
258 </item> 255 </item>
259 </layout> 256 </layout>
260 </widget> 257 </widget>
258 <widget class="QWidget" name="tab">
259 <attribute name="title">
260 <string>Fonts</string>
261 </attribute>
262 <layout class="QVBoxLayout" name="verticalLayout_4">
263 <item>
264 <layout class="QHBoxLayout" name="horizontalLayout_10">
265 <item>
266 <widget class="QLabel" name="label_10">
267 <property name="text">
268 <string>Font Path</string>
269 </property>
270 <property name="buddy">
271 <cstring>fontBox</cstring>
272 </property>
273 </widget>
274 </item>
275 <item>
276 <widget class="QLineEdit" name="fontBox"/>
277 </item>
278 <item>
279 <widget class="QPushButton" name="fontBrowseButton">
280 <property name="text">
281 <string>Browse...</string>
282 </property>
283 </widget>
284 </item>
285 </layout>
286 </item>
287 </layout>
288 </widget>
261 </widget> 289 </widget>
262 </item> 290 </item>
263 <item> 291 <item>