Fixed reloadale text for mode system.

This commit is contained in:
Pieter Hulshoff 2019-04-07 22:15:34 +02:00
parent 5c7e58f902
commit 8e9e55b47e
4 changed files with 13 additions and 5 deletions

View File

@ -25,9 +25,10 @@
#include <time.h>
#include <algorithm>
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY)
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY)
: Component(page)
, config_(config)
, systemMode_(systemMode)
, imageInst_(NULL)
, type_(type)
, layoutKey_(layoutKey)
@ -232,11 +233,17 @@ void ReloadableText::ReloadTexture()
}
}
if (!selectedItem->leaf) // item is not a leaf
if (!selectedItem->leaf || systemMode_) // item is not a leaf
{
(void)config_.getProperty("collections." + selectedItem->name + "." + type_, text );
}
if (systemMode_) // Get the system information in stead
{
text = "";
(void)config_.getProperty("collections." + page.getCollectionName() + "." + type_, text );
}
bool overwriteXML = false;
config_.getProperty( "overwriteXML", overwriteXML );
if ( text == "" || overwriteXML ) // No text was found yet; check the info in stead

View File

@ -25,7 +25,7 @@
class ReloadableText : public Component
{
public:
ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
ReloadableText(std::string type, Page &page, Configuration &config, bool systemMode, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
virtual ~ReloadableText();
void update(float dt);
void draw();
@ -38,6 +38,7 @@ private:
void ReloadTexture();
Configuration &config_;
bool systemMode_;
Text *imageInst_;
std::string type_;
std::string layoutKey_;

View File

@ -661,7 +661,7 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
{
pluralPostfix = pluralPostfixXml->value();
}
c = new ReloadableText(type->value(), *page, config_, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
c = new ReloadableText(type->value(), *page, config_, systemMode, font, layoutKey, timeFormat, textFormat, singlePrefix, singlePostfix, pluralPrefix, pluralPostfix, scaleX_, scaleY_);
c->setId( id );
xml_attribute<> *menuScrollReload = componentXml->first_attribute("menuScrollReload");
if (menuScrollReload &&

View File

@ -21,7 +21,7 @@
std::string retrofe_version_major = "0";
std::string retrofe_version_minor = "8";
std::string retrofe_version_build = "23";
std::string retrofe_version_build = "24";
std::string Version::getString( )