Added the possibility to mark folders as favorites.

Also added the options to mark folders as completed and broken/not working.
This commit is contained in:
Leon Styhre 2020-08-04 13:04:55 +02:00
parent 72e728ac94
commit 52069d2417
2 changed files with 33 additions and 2 deletions

View file

@ -46,6 +46,9 @@ MetaDataDecl folderDecls[] = {
{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, {"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true},
{"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, {"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true},
{"players", MD_INT, "unknown", false, "players", "enter number of players", 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}, {"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false},
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} {"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
}; };

View file

@ -6,6 +6,8 @@
#include "views/gamelist/ISimpleGameListView.h" #include "views/gamelist/ISimpleGameListView.h"
#include "guis/GuiInfoPopup.h"
#include "utils/StringUtil.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemManager.h"
@ -158,10 +160,36 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
else if (config->isMappedTo("y", input) && else if (config->isMappedTo("y", input) &&
!UIModeController::getInstance()->isUIModeKid()) { !UIModeController::getInstance()->isUIModeKid()) {
if (mRoot->getSystem()->isGameSystem()) { if (mRoot->getSystem()->isGameSystem()) {
if (getCursor()->getType() == GAME) if (getCursor()->getType() == GAME || getCursor()->getType() == FOLDER)
NavigationSounds::getInstance()->playThemeNavigationSound(FAVORITESOUND); 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; return true;
}
else if (CollectionSystemManager::get()->toggleGameInCollection(getCursor())) {
return true;
}
} }
} }
} }