Starting development branch. Merging works, artwork does not fully work.

This commit is contained in:
Don Honerbrink 2015-06-25 17:45:09 -05:00
parent b22dc3d72c
commit 2320c62577
3 changed files with 21 additions and 4 deletions

View File

@ -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)
{

View File

@ -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);
};

View File

@ -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())