mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-26 17:54:46 +01:00
Starting development branch. Merging works, artwork does not fully work.
This commit is contained in:
parent
b22dc3d72c
commit
2320c62577
@ -16,6 +16,7 @@
|
||||
|
||||
#include "MenuParser.h"
|
||||
#include "CollectionInfo.h"
|
||||
#include "CollectionInfoBuilder.h"
|
||||
#include "Item.h"
|
||||
#include "../Utility/Log.h"
|
||||
#include "../Utility/Utils.h"
|
||||
@ -40,7 +41,7 @@ MenuParser::~MenuParser()
|
||||
}
|
||||
|
||||
//todo: clean up this method, too much nesting
|
||||
bool MenuParser::buildMenuItems(CollectionInfo *collection, bool sort)
|
||||
bool MenuParser::buildMenuItems(CollectionInfo *collection, bool sort, CollectionInfoBuilder &builder)
|
||||
{
|
||||
bool retVal = false;
|
||||
//todo: magic string
|
||||
@ -99,12 +100,23 @@ bool MenuParser::buildMenuItems(CollectionInfo *collection, bool sort)
|
||||
{
|
||||
std::string collectionName = collectionAttribute->value();
|
||||
Logger::write(Logger::ZONE_INFO, "Menu", "Loading collection into menu: " + collectionName);
|
||||
CollectionInfo *subcollection = builder.buildCollection(collectionName);
|
||||
|
||||
// todo, there must be a faster way of doing this
|
||||
collection->items.insert(collection->items.begin(), subcollection->items.begin(), subcollection->items.end());
|
||||
|
||||
// prevent the temporary collection object from deleting the item pointers
|
||||
subcollection->items.clear();
|
||||
delete subcollection;
|
||||
|
||||
//todo: unsupported option with this refactor
|
||||
// need to append the collection
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::sort( collection->items.begin(), collection->items.end(), VectorSort);
|
||||
|
||||
// todo: sorting should occur within the collection itself, not externally
|
||||
if(sort)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "CollectionInfoBuilder.h"
|
||||
class CollectionInfo;
|
||||
|
||||
class MenuParser
|
||||
@ -22,6 +23,6 @@ class MenuParser
|
||||
public:
|
||||
MenuParser();
|
||||
virtual ~MenuParser();
|
||||
bool buildMenuItems(CollectionInfo *cdb, bool sort);
|
||||
bool buildMenuItems(CollectionInfo *cdb, bool sort, CollectionInfoBuilder &builder);
|
||||
|
||||
};
|
||||
|
||||
@ -284,7 +284,10 @@ void RetroFE::run()
|
||||
config_.setProperty("currentCollection", firstCollection);
|
||||
CollectionInfo *info = getCollection(firstCollection);
|
||||
MenuParser mp;
|
||||
mp.buildMenuItems(info, menuSort);
|
||||
|
||||
CollectionInfoBuilder cib(config_, *metadb_);
|
||||
mp.buildMenuItems(info, menuSort, cib);
|
||||
|
||||
currentPage_->pushCollection(info);
|
||||
}
|
||||
else
|
||||
@ -469,7 +472,8 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
CollectionInfo *info = getCollection(nextPageItem_->name);
|
||||
|
||||
MenuParser mp;
|
||||
mp.buildMenuItems(info, menuSort);
|
||||
CollectionInfoBuilder cib(config_, *metadb_);
|
||||
mp.buildMenuItems(info, menuSort, cib);
|
||||
page->pushCollection(info);
|
||||
|
||||
if(rememberMenu && lastMenuOffsets_.find(nextPageItem_->name) != lastMenuOffsets_.end())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user