mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-26 17:54:46 +01:00
Added support for layouts per collection. When switching collections,
RetroFE will look for layout.xml and corresponding art in the collections/<collection name>/layout/ subdirectory of your chosen layout, and load that layout if it is available.
This commit is contained in:
parent
1157096f55
commit
537322f9c0
@ -855,3 +855,10 @@ void Page::launchExit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Page::resetMenuItems()
|
||||
{
|
||||
activeMenu_->deallocateSpritePoints();
|
||||
activeMenu_->allocateSpritePoints();
|
||||
}
|
||||
|
||||
@ -89,6 +89,7 @@ public:
|
||||
float getMinShowTime();
|
||||
void addPlaylist();
|
||||
void removePlaylist();
|
||||
void resetMenuItems();
|
||||
|
||||
private:
|
||||
void highlightEnter();
|
||||
|
||||
@ -70,14 +70,22 @@ PageBuilder::~PageBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
Page *PageBuilder::buildPage()
|
||||
Page *PageBuilder::buildPage( std::string collectionName )
|
||||
{
|
||||
Page *page = NULL;
|
||||
|
||||
std::string layoutFile;
|
||||
std::string layoutName = layoutKey;
|
||||
|
||||
layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName);
|
||||
if ( collectionName == "" )
|
||||
{
|
||||
layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName);
|
||||
}
|
||||
else
|
||||
{
|
||||
layoutPath = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, "collections", collectionName);
|
||||
layoutPath = Utils::combinePath(layoutPath, "layout");
|
||||
}
|
||||
layoutFile = Utils::combinePath(layoutPath, layoutPage + ".xml");
|
||||
|
||||
Logger::write(Logger::ZONE_INFO, "Layout", "Initializing " + layoutFile);
|
||||
|
||||
@ -33,7 +33,7 @@ class PageBuilder
|
||||
public:
|
||||
PageBuilder(std::string layoutKey, std::string layoutPage, Configuration &c, FontCache *fc);
|
||||
virtual ~PageBuilder();
|
||||
Page *buildPage();
|
||||
Page *buildPage( std::string collectionName = "" );
|
||||
|
||||
private:
|
||||
std::string layoutKey;
|
||||
|
||||
@ -342,11 +342,25 @@ void RetroFE::run()
|
||||
case RETROFE_NEXT_PAGE_MENU_EXIT:
|
||||
if(currentPage_->isIdle())
|
||||
{
|
||||
bool menuSort = true;
|
||||
config_.setProperty("currentCollection", nextPageItem_->name);
|
||||
config_.getProperty("collections." + nextPageItem_->name + ".list.menuSort", menuSort);
|
||||
// Load new layout if available
|
||||
std::string layoutName;
|
||||
config_.getProperty("layout", layoutName);
|
||||
PageBuilder pb(layoutName, "layout", config_, &fontcache_);
|
||||
Page *page = pb.buildPage( nextPageItem_->name);
|
||||
std::string nextPageName = nextPageItem_->name;
|
||||
if(page)
|
||||
{
|
||||
currentPage_->freeGraphicsMemory();
|
||||
pages_.push( currentPage_ );
|
||||
currentPage_ = page;
|
||||
currentPage_->start();
|
||||
}
|
||||
|
||||
CollectionInfo *info = getCollection(nextPageItem_->name);
|
||||
bool menuSort = true;
|
||||
config_.setProperty("currentCollection", nextPageName);
|
||||
config_.getProperty("collections." + nextPageName + ".list.menuSort", menuSort);
|
||||
|
||||
CollectionInfo *info = getCollection(nextPageName);
|
||||
|
||||
MenuParser mp;
|
||||
mp.buildMenuItems(info, menuSort);
|
||||
@ -355,9 +369,9 @@ void RetroFE::run()
|
||||
bool rememberMenu = false;
|
||||
config_.getProperty("rememberMenu", rememberMenu);
|
||||
|
||||
if(rememberMenu && lastMenuOffsets_.find(nextPageItem_->name) != lastMenuOffsets_.end())
|
||||
if(rememberMenu && lastMenuOffsets_.find(nextPageName) != lastMenuOffsets_.end())
|
||||
{
|
||||
currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageItem_->name]);
|
||||
currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageName]);
|
||||
}
|
||||
|
||||
bool autoFavorites = true;
|
||||
@ -388,7 +402,14 @@ void RetroFE::run()
|
||||
break;
|
||||
|
||||
case RETROFE_BACK_REQUEST:
|
||||
currentPage_->exitMenu();
|
||||
if (currentPage_->getMenuDepth() == 1 )
|
||||
{
|
||||
currentPage_->stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPage_->exitMenu();
|
||||
}
|
||||
state = RETROFE_BACK_MENU_EXIT;
|
||||
break;
|
||||
|
||||
@ -396,8 +417,20 @@ void RetroFE::run()
|
||||
if(currentPage_->isIdle())
|
||||
{
|
||||
lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex();
|
||||
currentPage_->popCollection();
|
||||
if (currentPage_->getMenuDepth() == 1)
|
||||
{
|
||||
currentPage_->DeInitialize();
|
||||
delete currentPage_;
|
||||
currentPage_ = pages_.top();
|
||||
pages_.pop();
|
||||
currentPage_->allocateGraphicsMemory();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPage_->popCollection();
|
||||
}
|
||||
config_.setProperty("currentCollection", currentPage_->getCollectionName());
|
||||
currentPage_->resetMenuItems();
|
||||
currentPage_->setNewItemSelected();
|
||||
currentPage_->enterMenu();
|
||||
state = RETROFE_BACK_MENU_ENTER;
|
||||
@ -468,7 +501,7 @@ bool RetroFE::back(bool &exit)
|
||||
config_.getProperty("exitOnFirstPageBack", exitOnBack);
|
||||
exit = false;
|
||||
|
||||
if(currentPage_->getMenuDepth() <= 1)
|
||||
if(currentPage_->getMenuDepth() <= 1 && pages_.empty())
|
||||
{
|
||||
exit = exitOnBack;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "Video/VideoFactory.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <map>
|
||||
|
||||
class CollectionInfo;
|
||||
@ -80,6 +80,7 @@ private:
|
||||
MetadataDatabase *metadb_;
|
||||
UserInput input_;
|
||||
Page *currentPage_;
|
||||
std::stack<Page *> pages_;
|
||||
float keyInputDisable_;
|
||||
float currentTime_;
|
||||
float lastLaunchReturnTime_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user