summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
: valid(false), imageData(0), offsetData(0), widthData(0)
{
+ bool badFile = false;
+
/* Attempting to locate the correct file name */
if(!QFile::exists(file))
{
@@ -52,7 +54,11 @@ RBFont::RBFont(QString file)
settings.endGroup();
if(!QFile::exists(file))
+ {
file = ":/fonts/08-Schumacher-Clean.fnt";
+
+ badFile = true;
+ }
}
header.insert("filename", file);
@@ -65,6 +71,9 @@ RBFont::RBFont(QString file)
widthData = cache->widthData;
header = cache->header;
+ if(!badFile)
+ valid = true;
+
return;
}
@@ -162,6 +171,9 @@ RBFont::RBFont(QString file)
cache->header = header;
RBFontCache::insert(file, cache);
+ if(!badFile)
+ valid = true;
+
}
RBFont::~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:
static quint16 maxFontSizeFor16BitOffsets;
+ bool isValid(){ return valid; }
+
private:
QHash<QString, QVariant> header;
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 @@
#include "rbimage.h"
#include "parsetreenode.h"
+#include <rbscene.h>
RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
QGraphicsItem* parent)
@@ -56,6 +57,9 @@ RBImage::RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
}
else
{
+ RBScene* s = dynamic_cast<RBScene*>(scene());
+ s->addWarning(QObject::tr("Image not found: ") + file);
+
size = QRectF(0, 0, 0, 0);
image = 0;
}
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)
if(QFile::exists(filename))
backdrop = new QPixmap(filename);
else
+ {
+ RBScene* s = dynamic_cast<RBScene*>(scene());
+ s->addWarning(QObject::tr("Image not found: ") + filename);
backdrop = 0;
+ }
}
void 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)
char c, hAlign, vAlign;
RBImage* image;
QPixmap temp;
+ RBFont* fLoad;
/* Two switch statements to narrow down the tag name */
switch(element->tag->name[0])
@@ -857,7 +858,11 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
x = element->params[0].data.number;
filename = info.settings()->value("themebase", "") + "/fonts/" +
element->params[1].data.text;
- info.screen()->loadFont(x, new RBFont(filename));
+ fLoad = new RBFont(filename);
+ if(!fLoad->isValid())
+ dynamic_cast<RBScene*>(info.screen()->scene())
+ ->addWarning(QObject::tr("Missing font file: ") + filename);
+ info.screen()->loadFont(x, fLoad);
return true;
}