summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-13 19:14:54 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-13 19:14:54 +0000
commitdfc109ac65e54b3c783b6783a0371a988c8e2dd7 (patch)
tree7008fb3b956d5371e3f820b2e71090585a0e12ec
parente60de9e5bb8059eefc0a5b6330738188850c5a4e (diff)
downloadrockbox-dfc109ac65e54b3c783b6783a0371a988c8e2dd7.tar.gz
rockbox-dfc109ac65e54b3c783b6783a0371a988c8e2dd7.zip
Theme Editor: Added warning messages for missing resources
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27803 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/graphics/rbfont.cpp12
-rw-r--r--utils/themeeditor/graphics/rbfont.h2
-rw-r--r--utils/themeeditor/graphics/rbimage.cpp4
-rw-r--r--utils/themeeditor/graphics/rbscreen.cpp4
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp7
5 files changed, 28 insertions, 1 deletions
diff --git a/utils/themeeditor/graphics/rbfont.cpp b/utils/themeeditor/graphics/rbfont.cpp
index 23791497fd..895e32750e 100644
--- a/utils/themeeditor/graphics/rbfont.cpp
+++ b/utils/themeeditor/graphics/rbfont.cpp
@@ -39,6 +39,8 @@ RBFont::RBFont(QString file)
39 : valid(false), imageData(0), offsetData(0), widthData(0) 39 : valid(false), imageData(0), offsetData(0), widthData(0)
40{ 40{
41 41
42 bool badFile = false;
43
42 /* Attempting to locate the correct file name */ 44 /* Attempting to locate the correct file name */
43 if(!QFile::exists(file)) 45 if(!QFile::exists(file))
44 { 46 {
@@ -52,7 +54,11 @@ RBFont::RBFont(QString file)
52 settings.endGroup(); 54 settings.endGroup();
53 55
54 if(!QFile::exists(file)) 56 if(!QFile::exists(file))
57 {
55 file = ":/fonts/08-Schumacher-Clean.fnt"; 58 file = ":/fonts/08-Schumacher-Clean.fnt";
59
60 badFile = true;
61 }
56 } 62 }
57 header.insert("filename", file); 63 header.insert("filename", file);
58 64
@@ -65,6 +71,9 @@ RBFont::RBFont(QString file)
65 widthData = cache->widthData; 71 widthData = cache->widthData;
66 header = cache->header; 72 header = cache->header;
67 73
74 if(!badFile)
75 valid = true;
76
68 return; 77 return;
69 } 78 }
70 79
@@ -162,6 +171,9 @@ RBFont::RBFont(QString file)
162 cache->header = header; 171 cache->header = header;
163 RBFontCache::insert(file, cache); 172 RBFontCache::insert(file, cache);
164 173
174 if(!badFile)
175 valid = true;
176
165} 177}
166 178
167RBFont::~RBFont() 179RBFont::~RBFont()
diff --git a/utils/themeeditor/graphics/rbfont.h b/utils/themeeditor/graphics/rbfont.h
index 6169d92940..c13f809c94 100644
--- a/utils/themeeditor/graphics/rbfont.h
+++ b/utils/themeeditor/graphics/rbfont.h
@@ -41,6 +41,8 @@ public:
41 41
42 static quint16 maxFontSizeFor16BitOffsets; 42 static quint16 maxFontSizeFor16BitOffsets;
43 43
44 bool isValid(){ return valid; }
45
44private: 46private:
45 QHash<QString, QVariant> header; 47 QHash<QString, QVariant> header;
46 bool valid; 48 bool valid;
diff --git a/utils/themeeditor/graphics/rbimage.cpp b/utils/themeeditor/graphics/rbimage.cpp
index 9d82fb110d..31159ecf75 100644
--- a/utils/themeeditor/graphics/rbimage.cpp
+++ b/utils/themeeditor/graphics/rbimage.cpp
@@ -25,6 +25,7 @@
25 25
26#include "rbimage.h" 26#include "rbimage.h"
27#include "parsetreenode.h" 27#include "parsetreenode.h"
28#include <rbscene.h>
28 29
29RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node, 30RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
30 QGraphicsItem* parent) 31 QGraphicsItem* parent)
@@ -56,6 +57,9 @@ RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
56 } 57 }
57 else 58 else
58 { 59 {
60 RBScene* s = dynamic_cast<RBScene*>(scene());
61 s->addWarning(QObject::tr("Image not found: ") + file);
62
59 size = QRectF(0, 0, 0, 0); 63 size = QRectF(0, 0, 0, 0);
60 image = 0; 64 image = 0;
61 } 65 }
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp
index c66d4f82b2..b01552cc44 100644
--- a/utils/themeeditor/graphics/rbscreen.cpp
+++ b/utils/themeeditor/graphics/rbscreen.cpp
@@ -201,7 +201,11 @@ void RBScreen::setBackdrop(QString filename)
201 if(QFile::exists(filename)) 201 if(QFile::exists(filename))
202 backdrop = new QPixmap(filename); 202 backdrop = new QPixmap(filename);
203 else 203 else
204 {
205 RBScene* s = dynamic_cast<RBScene*>(scene());
206 s->addWarning(QObject::tr("Image not found: ") + filename);
204 backdrop = 0; 207 backdrop = 0;
208 }
205} 209}
206 210
207void RBScreen::makeCustomUI(QString id) 211void RBScreen::makeCustomUI(QString id)
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index cd50718a52..9d23428349 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -641,6 +641,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
641 char c, hAlign, vAlign; 641 char c, hAlign, vAlign;
642 RBImage* image; 642 RBImage* image;
643 QPixmap temp; 643 QPixmap temp;
644 RBFont* fLoad;
644 645
645 /* Two switch statements to narrow down the tag name */ 646 /* Two switch statements to narrow down the tag name */
646 switch(element->tag->name[0]) 647 switch(element->tag->name[0])
@@ -857,7 +858,11 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
857 x = element->params[0].data.number; 858 x = element->params[0].data.number;
858 filename = info.settings()->value("themebase", "") + "/fonts/" + 859 filename = info.settings()->value("themebase", "") + "/fonts/" +
859 element->params[1].data.text; 860 element->params[1].data.text;
860 info.screen()->loadFont(x, new RBFont(filename)); 861 fLoad = new RBFont(filename);
862 if(!fLoad->isValid())
863 dynamic_cast<RBScene*>(info.screen()->scene())
864 ->addWarning(QObject::tr("Missing font file: ") + filename);
865 info.screen()->loadFont(x, fLoad);
861 return true; 866 return true;
862 867
863 } 868 }