diff options
Diffstat (limited to 'utils/themeeditor')
-rw-r--r-- | utils/themeeditor/graphics/rbfont.cpp | 15 | ||||
-rw-r--r-- | utils/themeeditor/gui/preferencesdialog.cpp | 34 | ||||
-rw-r--r-- | utils/themeeditor/gui/preferencesdialog.h | 3 | ||||
-rw-r--r-- | utils/themeeditor/gui/preferencesdialog.ui | 34 |
4 files changed, 82 insertions, 4 deletions
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp index e59c79a970..1c2739d118 100644 --- a/utils/themeeditor/graphics/rbfont.cpp +++ b/utils/themeeditor/graphics/rbfont.cpp | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <QPainter> | 27 | #include <QPainter> |
28 | #include <QBitmap> | 28 | #include <QBitmap> |
29 | #include <QImage> | 29 | #include <QImage> |
30 | #include <QSettings> | ||
30 | 31 | ||
31 | quint16 RBFont::maxFontSizeFor16BitOffsets = 0xFFDB; | 32 | quint16 RBFont::maxFontSizeFor16BitOffsets = 0xFFDB; |
32 | 33 | ||
@@ -36,7 +37,19 @@ RBFont::RBFont(QString file) | |||
36 | 37 | ||
37 | /* Attempting to locate the correct file name */ | 38 | /* Attempting to locate the correct file name */ |
38 | if(!QFile::exists(file)) | 39 | if(!QFile::exists(file)) |
39 | file = ":/fonts/08-Schumacher-Clean.fnt"; | 40 | { |
41 | /* Checking in the fonts repository */ | ||
42 | QSettings settings; | ||
43 | settings.beginGroup("RBFont"); | ||
44 | |||
45 | file = file.split("/").last(); | ||
46 | file = settings.value("fontDir", "").toString() + "/" + file; | ||
47 | |||
48 | settings.endGroup(); | ||
49 | |||
50 | if(!QFile::exists(file)) | ||
51 | file = ":/fonts/08-Schumacher-Clean.fnt"; | ||
52 | } | ||
40 | header.insert("filename", file); | 53 | header.insert("filename", file); |
41 | 54 | ||
42 | /* Opening the file */ | 55 | /* Opening the file */ |
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 | ||
28 | PreferencesDialog::PreferencesDialog(QWidget *parent) : | 29 | PreferencesDialog::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 | ||
48 | void PreferencesDialog::loadColors() | 50 | void PreferencesDialog::loadColors() |
@@ -105,10 +107,21 @@ void PreferencesDialog::loadFont() | |||
105 | 107 | ||
106 | } | 108 | } |
107 | 109 | ||
110 | void 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 | |||
108 | void PreferencesDialog::saveSettings() | 120 | void PreferencesDialog::saveSettings() |
109 | { | 121 | { |
110 | saveColors(); | 122 | saveColors(); |
111 | saveFont(); | 123 | saveFont(); |
124 | saveFontDir(); | ||
112 | } | 125 | } |
113 | 126 | ||
114 | void PreferencesDialog::saveColors() | 127 | void PreferencesDialog::saveColors() |
@@ -146,6 +159,16 @@ void PreferencesDialog::saveFont() | |||
146 | settings.endGroup(); | 159 | settings.endGroup(); |
147 | } | 160 | } |
148 | 161 | ||
162 | void PreferencesDialog::saveFontDir() | ||
163 | { | ||
164 | QSettings settings; | ||
165 | settings.beginGroup("RBFont"); | ||
166 | |||
167 | settings.setValue("fontDir", ui->fontBox->text()); | ||
168 | |||
169 | settings.endGroup(); | ||
170 | } | ||
171 | |||
149 | void PreferencesDialog::setupUI() | 172 | void 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 | ||
166 | void PreferencesDialog::colorClicked() | 192 | void PreferencesDialog::colorClicked() |
@@ -193,6 +219,14 @@ void PreferencesDialog::colorClicked() | |||
193 | } | 219 | } |
194 | } | 220 | } |
195 | 221 | ||
222 | void PreferencesDialog::browseFont() | ||
223 | { | ||
224 | QString path = QFileDialog:: | ||
225 | getExistingDirectory(this, "Font Directory", | ||
226 | ui->fontBox->text()); | ||
227 | ui->fontBox->setText(path); | ||
228 | } | ||
229 | |||
196 | void PreferencesDialog::accept() | 230 | void 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 | ||
48 | private slots: | 48 | private slots: |
49 | void colorClicked(); | 49 | void colorClicked(); |
50 | void browseFont(); | ||
50 | 51 | ||
51 | private: | 52 | private: |
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> |