mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Added list.menuSort option.
This commit is contained in:
parent
bcf35a954d
commit
08fad4d876
@ -20,6 +20,13 @@ list.includeMissingItems = true
|
||||
###############################################################################
|
||||
list.extensions = zip
|
||||
|
||||
###############################################################################
|
||||
# If a menu.xml file exists, it will display the menu alphabetically. To
|
||||
# not auto-sort the menu items alphabetically, set the following to false.
|
||||
# This does not apply to how your ROMs are sorted.
|
||||
###############################################################################
|
||||
list.menuSort = true
|
||||
|
||||
###############################################################################
|
||||
# The executable to run when an item in a collection item is selected
|
||||
###############################################################################
|
||||
|
||||
@ -4,3 +4,11 @@
|
||||
# See Menu.xml to configure the menu
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# If a menu.xml file exists, it will display the menu alphabetically. To
|
||||
# not auto-sort the menu items alphabetically, set the following to false.
|
||||
# This does not apply to how your ROMs are sorted.
|
||||
###############################################################################
|
||||
list.menuSort = true
|
||||
|
||||
|
||||
|
||||
@ -21,6 +21,13 @@ list.includeMissingItems = true
|
||||
###############################################################################
|
||||
list.extensions = zip
|
||||
|
||||
###############################################################################
|
||||
# If a menu.xml file exists, it will display the menu alphabetically. To
|
||||
# not auto-sort the menu items alphabetically, set the following to false.
|
||||
# This does not apply to how your ROMs are sorted.
|
||||
###############################################################################
|
||||
list.menuSort = true
|
||||
|
||||
###############################################################################
|
||||
# The executable to run when an item in a collection item is selected
|
||||
###############################################################################
|
||||
|
||||
@ -116,6 +116,8 @@ bool CollectionInfoBuilder::createCollectionDirectory(std::string name)
|
||||
settingsFile << "#list.path = " << Utils::combinePath("%BASE_ITEM_PATH%", "%ITEM_COLLECTION_NAME%", "roms") << std::endl;
|
||||
settingsFile << "list.includeMissingItems = false" << std::endl;
|
||||
settingsFile << "list.extensions = zip" << std::endl;
|
||||
settingsFile << "list.menuSort = yes" << std::endl;
|
||||
settingsFile << std::endl;
|
||||
settingsFile << "launcher = mame" << std::endl;
|
||||
settingsFile << "metadata.type = MAME" << std::endl;
|
||||
settingsFile << std::endl;
|
||||
|
||||
@ -40,13 +40,14 @@ MenuParser::~MenuParser()
|
||||
}
|
||||
|
||||
//todo: clean up this method, too much nesting
|
||||
bool MenuParser::menuItems(CollectionInfo *collection)
|
||||
bool MenuParser::buildMenuItems(CollectionInfo *collection, bool sort)
|
||||
{
|
||||
bool retVal = false;
|
||||
//todo: magic string
|
||||
std::string menuFilename = Utils::combinePath(Configuration::absolutePath, "collections", collection->name, "menu.xml");
|
||||
rapidxml::xml_document<> doc;
|
||||
rapidxml::xml_node<> * rootNode;
|
||||
std::vector<Item *> menuItems;
|
||||
|
||||
Logger::write(Logger::ZONE_INFO, "Menu", "Checking if menu exists at \"" + menuFilename + "\"");
|
||||
|
||||
@ -92,8 +93,7 @@ bool MenuParser::menuItems(CollectionInfo *collection)
|
||||
item->fullTitle = title;
|
||||
item->name = collectionAttribute->value();
|
||||
item->leaf = false;
|
||||
collection->items.push_back(item);
|
||||
|
||||
menuItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -106,8 +106,13 @@ bool MenuParser::menuItems(CollectionInfo *collection)
|
||||
}
|
||||
|
||||
// todo: sorting should occur within the collection itself, not externally
|
||||
std::vector<Item *> *items = &collection->items;
|
||||
std::sort( items->begin(), items->end(), VectorSort);
|
||||
if(sort)
|
||||
{
|
||||
// sort the menu if requested
|
||||
std::sort( menuItems.begin(), menuItems.end(), VectorSort);
|
||||
}
|
||||
|
||||
collection->items.insert(collection->items.begin(), menuItems.begin(), menuItems.end());
|
||||
|
||||
retVal = true;
|
||||
}
|
||||
|
||||
@ -22,6 +22,6 @@ class MenuParser
|
||||
public:
|
||||
MenuParser();
|
||||
virtual ~MenuParser();
|
||||
bool menuItems(CollectionInfo *cdb);
|
||||
bool buildMenuItems(CollectionInfo *cdb, bool sort);
|
||||
|
||||
};
|
||||
|
||||
@ -275,13 +275,16 @@ void RetroFE::run()
|
||||
if(currentPage_)
|
||||
{
|
||||
std::string firstCollection = "Main";
|
||||
bool menuSort = true;
|
||||
|
||||
config_.getProperty("firstCollection", firstCollection);
|
||||
config_.getProperty("collections." + firstCollection + ".list.menuSort", menuSort);
|
||||
|
||||
currentPage_->start();
|
||||
config_.setProperty("currentCollection", firstCollection);
|
||||
CollectionInfo *info = getCollection(firstCollection);
|
||||
MenuParser mp;
|
||||
mp.menuItems(info);
|
||||
mp.buildMenuItems(info, menuSort);
|
||||
currentPage_->pushCollection(info);
|
||||
}
|
||||
else
|
||||
@ -459,11 +462,14 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool menuSort = true;
|
||||
config_.setProperty("currentCollection", nextPageItem_->name);
|
||||
config_.getProperty("collections." + nextPageItem_->name + ".list.menuSort", menuSort);
|
||||
|
||||
CollectionInfo *info = getCollection(nextPageItem_->name);
|
||||
|
||||
MenuParser mp;
|
||||
mp.menuItems(info);
|
||||
mp.buildMenuItems(info, menuSort);
|
||||
page->pushCollection(info);
|
||||
|
||||
if(rememberMenu && lastMenuOffsets_.find(nextPageItem_->name) != lastMenuOffsets_.end())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user