mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-22 22:58:52 +01:00
Added support for flexible collection information printing. If the type of
the reloadableText matches the name tag in the collection's settings.conf it will be printed.
This commit is contained in:
parent
1ab7d129d0
commit
42ffacb1f9
@ -27,6 +27,7 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf
|
|||||||
: Component(page)
|
: Component(page)
|
||||||
, config_(config)
|
, config_(config)
|
||||||
, imageInst_(NULL)
|
, imageInst_(NULL)
|
||||||
|
, type_(type)
|
||||||
, layoutKey_(layoutKey)
|
, layoutKey_(layoutKey)
|
||||||
, reloadRequested_(false)
|
, reloadRequested_(false)
|
||||||
, firstLoad_(true)
|
, firstLoad_(true)
|
||||||
@ -34,49 +35,6 @@ ReloadableText::ReloadableText(std::string type, Page &page, Configuration &conf
|
|||||||
, scaleX_(scaleX)
|
, scaleX_(scaleX)
|
||||||
, scaleY_(scaleY)
|
, scaleY_(scaleY)
|
||||||
{
|
{
|
||||||
|
|
||||||
type_ = TextTypeUnknown;
|
|
||||||
|
|
||||||
if(type == "numberButtons")
|
|
||||||
{
|
|
||||||
type_ = TextTypeNumberButtons;
|
|
||||||
}
|
|
||||||
else if(type == "numberPlayers")
|
|
||||||
{
|
|
||||||
type_ = TextTypeNumberPlayers;
|
|
||||||
}
|
|
||||||
else if(type == "year")
|
|
||||||
{
|
|
||||||
type_ = TextTypeYear;
|
|
||||||
}
|
|
||||||
else if(type == "title")
|
|
||||||
{
|
|
||||||
type_ = TextTypeTitle;
|
|
||||||
}
|
|
||||||
else if(type == "manufacturer")
|
|
||||||
{
|
|
||||||
type_ = TextTypeManufacturer;
|
|
||||||
}
|
|
||||||
else if(type == "genre")
|
|
||||||
{
|
|
||||||
type_ = TextTypeGenre;
|
|
||||||
}
|
|
||||||
else if(type == "playlist")
|
|
||||||
{
|
|
||||||
type_ = TextTypePlaylist;
|
|
||||||
}
|
|
||||||
else if(type == "collectionName")
|
|
||||||
{
|
|
||||||
type_ = TextTypeCollectionName;
|
|
||||||
}
|
|
||||||
else if(type == "collectionSize")
|
|
||||||
{
|
|
||||||
type_ = TextTypeCollectionSize;
|
|
||||||
}
|
|
||||||
else if(type == "collectionIndex")
|
|
||||||
{
|
|
||||||
type_ = TextTypeCollectionIndex;
|
|
||||||
}
|
|
||||||
allocateGraphicsMemory();
|
allocateGraphicsMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +50,8 @@ ReloadableText::~ReloadableText()
|
|||||||
|
|
||||||
void ReloadableText::update(float dt)
|
void ReloadableText::update(float dt)
|
||||||
{
|
{
|
||||||
if((type_ != TextTypePlaylist && newItemSelected) ||
|
if((type_ != "playlist" && newItemSelected) ||
|
||||||
(type_ == TextTypePlaylist && playlistChanged))
|
(type_ == "playlist" && playlistChanged))
|
||||||
{
|
{
|
||||||
reloadRequested_ = true;
|
reloadRequested_ = true;
|
||||||
}
|
}
|
||||||
@ -152,53 +110,61 @@ void ReloadableText::ReloadTexture()
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
std::string text;
|
std::string text;
|
||||||
switch(type_)
|
if (type_ == "numberButtons")
|
||||||
{
|
{
|
||||||
case TextTypeNumberButtons:
|
|
||||||
ss << selectedItem->numberButtons;
|
ss << selectedItem->numberButtons;
|
||||||
break;
|
}
|
||||||
case TextTypeNumberPlayers:
|
else if (type_ == "numberPlayers")
|
||||||
|
{
|
||||||
ss << selectedItem->numberPlayers;
|
ss << selectedItem->numberPlayers;
|
||||||
break;
|
}
|
||||||
case TextTypeYear:
|
else if (type_ == "year")
|
||||||
|
{
|
||||||
if (selectedItem->leaf) // item is a leaf
|
if (selectedItem->leaf) // item is a leaf
|
||||||
text = selectedItem->year;
|
text = selectedItem->year;
|
||||||
else // item is a collection
|
else // item is a collection
|
||||||
(void)config_.getProperty("collections." + selectedItem->name + ".year", text );
|
(void)config_.getProperty("collections." + selectedItem->name + ".year", text );
|
||||||
ss << text;
|
ss << text;
|
||||||
break;
|
}
|
||||||
case TextTypeTitle:
|
else if (type_ == "title")
|
||||||
|
{
|
||||||
ss << selectedItem->title;
|
ss << selectedItem->title;
|
||||||
break;
|
}
|
||||||
case TextTypeManufacturer:
|
else if (type_ == "manufacturer")
|
||||||
|
{
|
||||||
if (selectedItem->leaf) // item is a leaf
|
if (selectedItem->leaf) // item is a leaf
|
||||||
text = selectedItem->manufacturer;
|
text = selectedItem->manufacturer;
|
||||||
else // item is a collection
|
else // item is a collection
|
||||||
(void)config_.getProperty("collections." + selectedItem->name + ".manufacturer", text );
|
(void)config_.getProperty("collections." + selectedItem->name + ".manufacturer", text );
|
||||||
ss << text;
|
ss << text;
|
||||||
break;
|
}
|
||||||
case TextTypeGenre:
|
else if (type_ == "genre")
|
||||||
|
{
|
||||||
if (selectedItem->leaf) // item is a leaf
|
if (selectedItem->leaf) // item is a leaf
|
||||||
text = selectedItem->genre;
|
text = selectedItem->genre;
|
||||||
else // item is a collection
|
else // item is a collection
|
||||||
(void)config_.getProperty("collections." + selectedItem->name + ".genre", text );
|
(void)config_.getProperty("collections." + selectedItem->name + ".genre", text );
|
||||||
ss << text;
|
ss << text;
|
||||||
break;
|
}
|
||||||
case TextTypePlaylist:
|
else if (type_ == "playlist")
|
||||||
|
{
|
||||||
ss << playlistName;
|
ss << playlistName;
|
||||||
break;
|
}
|
||||||
case TextTypeCollectionName:
|
else if (type_ == "collectionName")
|
||||||
|
{
|
||||||
ss << page.getCollectionName();
|
ss << page.getCollectionName();
|
||||||
break;
|
}
|
||||||
case TextTypeCollectionSize:
|
else if (type_ == "collectionSize")
|
||||||
|
{
|
||||||
ss << page.getCollectionSize();
|
ss << page.getCollectionSize();
|
||||||
break;
|
}
|
||||||
case TextTypeCollectionIndex:
|
else if (type_ == "collectionIndex")
|
||||||
|
{
|
||||||
ss << (1+page.getSelectedIndex());
|
ss << (1+page.getSelectedIndex());
|
||||||
break;
|
} else if (!selectedItem->leaf) // item is not a leaf
|
||||||
|
{
|
||||||
default:
|
(void)config_.getProperty("collections." + selectedItem->name + "." + type_, text );
|
||||||
break;
|
ss << text;
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_);
|
imageInst_ = new Text(ss.str(), page, fontInst_, scaleX_, scaleY_);
|
||||||
|
|||||||
@ -35,26 +35,11 @@ public:
|
|||||||
void launchExit();
|
void launchExit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum TextType
|
|
||||||
{
|
|
||||||
TextTypeUnknown = 0,
|
|
||||||
TextTypeNumberButtons,
|
|
||||||
TextTypeNumberPlayers,
|
|
||||||
TextTypeYear,
|
|
||||||
TextTypeTitle,
|
|
||||||
TextTypeManufacturer,
|
|
||||||
TextTypeGenre,
|
|
||||||
TextTypePlaylist,
|
|
||||||
TextTypeCollectionName,
|
|
||||||
TextTypeCollectionSize,
|
|
||||||
TextTypeCollectionIndex
|
|
||||||
};
|
|
||||||
|
|
||||||
void ReloadTexture();
|
void ReloadTexture();
|
||||||
|
|
||||||
Configuration &config_;
|
Configuration &config_;
|
||||||
Text *imageInst_;
|
Text *imageInst_;
|
||||||
TextType type_;
|
std::string type_;
|
||||||
std::string layoutKey_;
|
std::string layoutKey_;
|
||||||
bool reloadRequested_;
|
bool reloadRequested_;
|
||||||
bool firstLoad_;
|
bool firstLoad_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user