diff --git a/es-app/src/MetaData.cpp b/es-app/src/MetaData.cpp index ab8083d6c..7f633b15e 100644 --- a/es-app/src/MetaData.cpp +++ b/es-app/src/MetaData.cpp @@ -46,6 +46,9 @@ MetaDataDecl folderDecls[] = { {"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, {"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, {"players", MD_INT, "unknown", false, "players", "enter number of players", true}, +{"favorite", MD_BOOL, "false", false, "favorite", "enter favorite off/on", false}, +{"completed", MD_BOOL, "false", false, "completed", "enter completed off/on", false}, +{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, {"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, {"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} }; diff --git a/es-app/src/views/gamelist/ISimpleGameListView.cpp b/es-app/src/views/gamelist/ISimpleGameListView.cpp index 033545e9e..ff7639a99 100644 --- a/es-app/src/views/gamelist/ISimpleGameListView.cpp +++ b/es-app/src/views/gamelist/ISimpleGameListView.cpp @@ -6,6 +6,8 @@ #include "views/gamelist/ISimpleGameListView.h" +#include "guis/GuiInfoPopup.h" +#include "utils/StringUtil.h" #include "views/UIModeController.h" #include "views/ViewController.h" #include "CollectionSystemManager.h" @@ -158,10 +160,36 @@ bool ISimpleGameListView::input(InputConfig* config, Input input) else if (config->isMappedTo("y", input) && !UIModeController::getInstance()->isUIModeKid()) { if (mRoot->getSystem()->isGameSystem()) { - if (getCursor()->getType() == GAME) + if (getCursor()->getType() == GAME || getCursor()->getType() == FOLDER) NavigationSounds::getInstance()->playThemeNavigationSound(FAVORITESOUND); - if (CollectionSystemManager::get()->toggleGameInCollection(getCursor())) + + // Marking folders as favorites is only cosmetic as they're not sorted + // differently and they're not part of any collections. So it makes more + // sense to do it here than to add the function to CollectionSystemManager. + if (getCursor()->getType() == FOLDER) { + GuiInfoPopup* s; + MetaDataList* md = &getCursor()->getSourceFileData()->metadata; + if (md->get("favorite") == "false") { + md->set("favorite", "true"); + s = new GuiInfoPopup(mWindow, "Marked folder '" + + Utils::String::removeParenthesis(getCursor()->getName()) + + "' as favorite", 4000); + } + else { + md->set("favorite", "false"); + s = new GuiInfoPopup(mWindow, "Removed favorite marking for folder '" + + Utils::String::removeParenthesis(getCursor()->getName()) + + "'", 4000); + } + + mWindow->setInfoPopup(s); + getCursor()->getSourceFileData()->getSystem()->onMetaDataSavePoint(); + ViewController::get()->onFileChanged(getCursor(), FILE_METADATA_CHANGED); return true; + } + else if (CollectionSystemManager::get()->toggleGameInCollection(getCursor())) { + return true; + } } } }