diff --git a/USERGUIDE.md b/USERGUIDE.md index e3573d5f8..0e9a9dfdd 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -1059,8 +1059,8 @@ Sorting can be applied using the following metadata, in either ascending or desc * Publisher * Genre * Players -* Times played * Last played +* Times played * System _(Only for collections)_ The secondary sorting is always in ascending filename order. diff --git a/es-app/src/FileSorts.cpp b/es-app/src/FileSorts.cpp index dc2f8e739..c5bf9bdea 100644 --- a/es-app/src/FileSorts.cpp +++ b/es-app/src/FileSorts.cpp @@ -38,12 +38,12 @@ namespace FileSorts FileData::SortType(&compareNumPlayers, "players, ascending"), FileData::SortType(&compareNumPlayersDescending, "players, descending"), - FileData::SortType(&compareTimesPlayed, "times played, ascending"), - FileData::SortType(&compareTimesPlayedDescending, "times played, descending"), - FileData::SortType(&compareLastPlayed, "last played, ascending"), FileData::SortType(&compareLastPlayedDescending, "last played, descending"), + FileData::SortType(&compareTimesPlayed, "times played, ascending"), + FileData::SortType(&compareTimesPlayedDescending, "times played, descending"), + FileData::SortType(&compareSystem, "system, ascending"), FileData::SortType(&compareSystemDescending, "system, descending") }; @@ -185,6 +185,18 @@ namespace FileSorts return file1Int > file2Int; } + bool compareLastPlayed(const FileData* file1, const FileData* file2) + { + // Since it's stored as an ISO string (YYYYMMDDTHHMMSS), we can compare as a string + // which is a lot faster than the time casts and the time comparisons. + return (file1)->metadata.get("lastplayed") > (file2)->metadata.get("lastplayed"); + } + + bool compareLastPlayedDescending(const FileData* file1, const FileData* file2) + { + return (file1)->metadata.get("lastplayed") < (file2)->metadata.get("lastplayed"); + } + bool compareTimesPlayed(const FileData* file1, const FileData* file2) { // Only games have playcount metadata. @@ -202,18 +214,6 @@ namespace FileSorts return false; } - bool compareLastPlayed(const FileData* file1, const FileData* file2) - { - // Since it's stored as an ISO string (YYYYMMDDTHHMMSS), we can compare as a string - // which is a lot faster than the time casts and the time comparisons. - return (file1)->metadata.get("lastplayed") > (file2)->metadata.get("lastplayed"); - } - - bool compareLastPlayedDescending(const FileData* file1, const FileData* file2) - { - return (file1)->metadata.get("lastplayed") < (file2)->metadata.get("lastplayed"); - } - bool compareSystem(const FileData* file1, const FileData* file2) { std::string system1 = Utils::String::toUpper(file1->getSystemName()); diff --git a/es-app/src/FileSorts.h b/es-app/src/FileSorts.h index dbcb04ce4..367946a5a 100644 --- a/es-app/src/FileSorts.h +++ b/es-app/src/FileSorts.h @@ -30,10 +30,10 @@ namespace FileSorts bool compareGenreDescending(const FileData* file1, const FileData* file2); bool compareNumPlayers(const FileData* file1, const FileData* file2); bool compareNumPlayersDescending(const FileData* file1, const FileData* file2); - bool compareTimesPlayed(const FileData* file1, const FileData* fil2); - bool compareTimesPlayedDescending(const FileData* file1, const FileData* fil2); bool compareLastPlayed(const FileData* file1, const FileData* file2); bool compareLastPlayedDescending(const FileData* file1, const FileData* file2); + bool compareTimesPlayed(const FileData* file1, const FileData* fil2); + bool compareTimesPlayedDescending(const FileData* file1, const FileData* fil2); bool compareSystem(const FileData* file1, const FileData* file2); bool compareSystemDescending(const FileData* file1, const FileData* file2); diff --git a/es-app/src/MetaData.cpp b/es-app/src/MetaData.cpp index a8d2a696f..29848888a 100644 --- a/es-app/src/MetaData.cpp +++ b/es-app/src/MetaData.cpp @@ -16,14 +16,14 @@ MetaDataDecl gameDecls[] = { // key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape -{"name", MD_STRING, "", false, "name", "enter game name", true}, -{"sortname", MD_STRING, "", false, "sortname", "enter game sort name", false}, +{"name", MD_STRING, "", false, "name", "enter name", true}, +{"sortname", MD_STRING, "", false, "sortname", "enter sort name", false}, {"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true}, {"rating", MD_RATING, "0", false, "rating", "enter rating", true}, {"releasedate", MD_DATE, "19700101T010000", false, "release date", "enter release date", true}, -{"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true}, -{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, -{"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, +{"developer", MD_STRING, "unknown", false, "developer", "enter developer", true}, +{"publisher", MD_STRING, "unknown", false, "publisher", "enter publisher", true}, +{"genre", MD_STRING, "unknown", false, "genre", "enter genre", true}, {"players", MD_STRING, "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}, @@ -35,7 +35,7 @@ MetaDataDecl gameDecls[] = { {"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false}, {"launchcommand", MD_LAUNCHCOMMAND, "", false, "launch command", "enter game launch command " "(emulator override)", false}, -{"playcount", MD_INT, "0", false, "play count", "enter number of times played", false}, +{"playcount", MD_INT, "0", false, "times played", "enter number of times played", false}, {"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} }; @@ -43,13 +43,13 @@ const std::vector gameMDD(gameDecls, gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0])); MetaDataDecl folderDecls[] = { -{"name", MD_STRING, "", false, "name", "enter game name", true}, +{"name", MD_STRING, "", false, "name", "enter name", true}, {"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true}, {"rating", MD_RATING, "0", false, "rating", "enter rating", true}, {"releasedate", MD_DATE, "19700101T010000", false, "release date", "enter release date", true}, -{"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true}, -{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, -{"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, +{"developer", MD_STRING, "unknown", false, "developer", "enter developer", true}, +{"publisher", MD_STRING, "unknown", false, "publisher", "enter publisher", true}, +{"genre", MD_STRING, "unknown", false, "genre", "enter genre", true}, {"players", MD_STRING, "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},