diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-23 20:18:31 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-23 20:18:31 +0000 |
commit | 6d6156603cf2ac5facf08734f12e0b4d0c1fcce0 (patch) | |
tree | 25340c9fdac15f4bf88d7f6e5bd935d1f1934211 /utils/themeeditor/graphics | |
parent | 168eba1aecddc21231d922608380fe811a8a0473 (diff) | |
download | rockbox-6d6156603cf2ac5facf08734f12e0b4d0c1fcce0.tar.gz rockbox-6d6156603cf2ac5facf08734f12e0b4d0c1fcce0.zip |
Theme Editor: Added dummy font class and implemented font load tag
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27096 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics')
-rw-r--r-- | utils/themeeditor/graphics/rbfont.cpp | 30 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbfont.h | 38 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 22 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.h | 5 |
4 files changed, 95 insertions, 0 deletions
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp new file mode 100644 index 0000000000..48e0f304be --- /dev/null +++ b/utils/themeeditor/graphics/rbfont.cpp | |||
@@ -0,0 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "rbfont.h" | ||
23 | |||
24 | RBFont::RBFont(QString file): filename(file) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | RBFont::~RBFont() | ||
29 | { | ||
30 | } | ||
diff --git a/utils/themeeditor/graphics/rbfont.h b/utils/themeeditor/graphics/rbfont.h new file mode 100644 index 0000000000..a1d66f22d4 --- /dev/null +++ b/utils/themeeditor/graphics/rbfont.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef RBFONT_H | ||
23 | #define RBFONT_H | ||
24 | |||
25 | #include <QString> | ||
26 | #include <QFile> | ||
27 | |||
28 | class RBFont | ||
29 | { | ||
30 | public: | ||
31 | RBFont(QString file); | ||
32 | virtual ~RBFont(); | ||
33 | |||
34 | private: | ||
35 | QString filename; | ||
36 | }; | ||
37 | |||
38 | #endif // RBFONT_H | ||
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index 004d2e0990..a090c2f9f2 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -67,6 +67,11 @@ RBScreen::~RBScreen() | |||
67 | { | 67 | { |
68 | if(backdrop) | 68 | if(backdrop) |
69 | delete backdrop; | 69 | delete backdrop; |
70 | |||
71 | QMap<int, RBFont*>::iterator i; | ||
72 | for(i = fonts.begin(); i != fonts.end(); i++) | ||
73 | if(*i) | ||
74 | delete (*i); | ||
70 | } | 75 | } |
71 | 76 | ||
72 | QPainterPath RBScreen::shape() const | 77 | QPainterPath RBScreen::shape() const |
@@ -103,6 +108,23 @@ void RBScreen::showViewport(QString name) | |||
103 | update(); | 108 | update(); |
104 | } | 109 | } |
105 | 110 | ||
111 | void RBScreen::loadFont(int id, RBFont* font) | ||
112 | { | ||
113 | if(id < 2 || id > 9) | ||
114 | return; | ||
115 | |||
116 | fonts.insert(id, font); | ||
117 | } | ||
118 | |||
119 | RBFont* RBScreen::getFont(int id) | ||
120 | { | ||
121 | if(fonts.value(id, 0) != 0) | ||
122 | return fonts.value(id); | ||
123 | else | ||
124 | return fonts.value(0, 0); | ||
125 | } | ||
126 | |||
127 | |||
106 | void RBScreen::setBackdrop(QString filename) | 128 | void RBScreen::setBackdrop(QString filename) |
107 | { | 129 | { |
108 | 130 | ||
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h index 51fa32cee3..95a110a4d5 100644 --- a/utils/themeeditor/graphics/rbscreen.h +++ b/utils/themeeditor/graphics/rbscreen.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "projectmodel.h" | 27 | #include "projectmodel.h" |
28 | #include "rbrenderinfo.h" | 28 | #include "rbrenderinfo.h" |
29 | #include "rbimage.h" | 29 | #include "rbimage.h" |
30 | #include "rbfont.h" | ||
30 | 31 | ||
31 | class RBViewport; | 32 | class RBViewport; |
32 | 33 | ||
@@ -58,6 +59,9 @@ public: | |||
58 | } | 59 | } |
59 | RBImage* getImage(QString name){ return images.value(name, 0); } | 60 | RBImage* getImage(QString name){ return images.value(name, 0); } |
60 | 61 | ||
62 | void loadFont(int id, RBFont* font); | ||
63 | RBFont* getFont(int id); | ||
64 | |||
61 | void setBackdrop(QString filename); | 65 | void setBackdrop(QString filename); |
62 | void makeCustomUI(QString id); | 66 | void makeCustomUI(QString id); |
63 | 67 | ||
@@ -77,6 +81,7 @@ private: | |||
77 | QMap<QString, RBViewport*> namedViewports; | 81 | QMap<QString, RBViewport*> namedViewports; |
78 | QMap<QString, RBImage*> images; | 82 | QMap<QString, RBImage*> images; |
79 | QMap<QString, QString>* settings; | 83 | QMap<QString, QString>* settings; |
84 | QMap<int, RBFont*> fonts; | ||
80 | 85 | ||
81 | }; | 86 | }; |
82 | 87 | ||