From bd57d23bceac1da488332f5d1631a7bb4adf78aa Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 8 Aug 2020 11:36:43 +0200 Subject: [PATCH] Added metadata setting to hide metadata fields from the gamelist view. --- NEWS.md | 4 +- es-app/src/MetaData.cpp | 75 ++++++++++--------- es-app/src/guis/GuiMetaDataEd.cpp | 7 +- .../views/gamelist/DetailedGameListView.cpp | 54 ++++++++++++- .../src/views/gamelist/GridGameListView.cpp | 54 ++++++++++++- .../src/views/gamelist/VideoGameListView.cpp | 54 ++++++++++++- 6 files changed, 193 insertions(+), 55 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5e39feb66..405170c8a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,4 @@ -EmulationStation Desktop Edition v1.0.0 -======================================= +# EmulationStation Desktop Edition v1.0.0 **Release date:** YYYY-MM-DD @@ -43,6 +42,7 @@ Many bugs have been fixed, and numerous features that were only partially implem * Speed improvements and optimizations, the application now starts faster and feels more responsive * Added metadata entry to mark games as broken/not working * Added metadata entry to indicate whether the file should be counted as a game (for example useful to exclude setup files and similar for DOS games) +* Added metadata entry to hide the metadata values from the gamelist views (useful for general folders, DOS game configuration utilities etc.) * Added a button to the metadata editor to delete the media files for a game or folder while retaining the game file and gamelist.xml entry * Moved all resources to a subdirectory structure and enabled the CMake install prefix variable to generate the resources search path * Changed theme directory to the install prefix (e.g. /usr/local/share/emulationstation/themes) with themes in the home directory taking precedence diff --git a/es-app/src/MetaData.cpp b/es-app/src/MetaData.cpp index 3399dde5d..128aeeb95 100644 --- a/es-app/src/MetaData.cpp +++ b/es-app/src/MetaData.cpp @@ -12,48 +12,51 @@ #include 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}, -{"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}, -{"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}, -{"kidgame", MD_BOOL, "false", false, "kidgame", "enter kidgame off/on", false}, -{"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, -{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, -{"nogamecount", MD_BOOL, "false", false, "exclude from game counter", "enter don't count as game off/on", false}, -{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape 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}, -{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} - +// 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}, +{"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}, +{"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}, +{"kidgame", MD_BOOL, "false", false, "kidgame", "enter kidgame off/on", false}, +{"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, +{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, +{"nogamecount", MD_BOOL, "false", false, "exclude from game counter", "enter don't count as game off/on", false}, +{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false}, +{"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}, +{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} }; + const std::vector gameMDD(gameDecls, gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0])); MetaDataDecl folderDecls[] = { -{"name", MD_STRING, "", false, "name", "enter game 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}, -{"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}, -{"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, -{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, -{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false}, -{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} +{"name", MD_STRING, "", false, "name", "enter game 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}, +{"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}, +{"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, +{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, +{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false}, +{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false}, +{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} }; + const std::vector folderMDD(folderDecls, folderDecls + sizeof(folderDecls) / sizeof(folderDecls[0])); diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index 1da1de9b3..1f7920eee 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -427,11 +427,8 @@ void GuiMetaDataEd::fetchDone(const ScraperSearchResult& result) else mEditors.at(i)->setColor(TEXTCOLOR_SCRAPERMARKED); } - // Save all the keys, except the following which can't be scraped. - if (key != "favorite" && key != "completed" && key != "kidgame" && - key != "hidden" && key != "broken" && key != "nogamecount" && - key != "nomultiscrape" && key != "nocontentscrape" && - key != "nocontentscrape") + // Save all the keys that should be scraped. + if (mMetaDataDecl.at(i).shouldScrape) mEditors.at(i)->setValue(metadata->get(key)); } diff --git a/es-app/src/views/gamelist/DetailedGameListView.cpp b/es-app/src/views/gamelist/DetailedGameListView.cpp index c1d67fe36..4b2075cd3 100644 --- a/es-app/src/views/gamelist/DetailedGameListView.cpp +++ b/es-app/src/views/gamelist/DetailedGameListView.cpp @@ -233,6 +233,47 @@ void DetailedGameListView::initMDValues() void DetailedGameListView::updateInfoPanel() { FileData* file = (mList.size() == 0 || mList.isScrolling()) ? nullptr : mList.getSelected(); + bool hideMetaDataFields = false; + + if (file) + hideMetaDataFields = (file->metadata.get("hidemetadata") == "true"); + + if (hideMetaDataFields) { + mLblRating.setVisible(false); + mRating.setVisible(false); + mLblReleaseDate.setVisible(false); + mReleaseDate.setVisible(false); + mLblDeveloper.setVisible(false); + mDeveloper.setVisible(false); + mLblPublisher.setVisible(false); + mPublisher.setVisible(false); + mLblGenre.setVisible(false); + mGenre.setVisible(false); + mLblPlayers.setVisible(false); + mPlayers.setVisible(false); + mLblLastPlayed.setVisible(false); + mLastPlayed.setVisible(false); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } + else { + mLblRating.setVisible(true); + mRating.setVisible(true); + mLblReleaseDate.setVisible(true); + mReleaseDate.setVisible(true); + mLblDeveloper.setVisible(true); + mDeveloper.setVisible(true); + mLblPublisher.setVisible(true); + mPublisher.setVisible(true); + mLblGenre.setVisible(true); + mGenre.setVisible(true); + mLblPlayers.setVisible(true); + mPlayers.setVisible(true); + mLblLastPlayed.setVisible(true); + mLastPlayed.setVisible(true); + mLblPlayCount.setVisible(true); + mPlayCount.setVisible(true); + } bool fadingOut; if (file == nullptr) { @@ -256,12 +297,17 @@ void DetailedGameListView::updateInfoPanel() mName.setValue(file->metadata.get("name")); if (file->getType() == GAME) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(file->metadata.get("playcount")); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mPlayCount.setValue(file->metadata.get("playcount")); + } } else if (file->getType() == FOLDER) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(""); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } } fadingOut = false; diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp index 7f1c242fd..98a115d84 100644 --- a/es-app/src/views/gamelist/GridGameListView.cpp +++ b/es-app/src/views/gamelist/GridGameListView.cpp @@ -352,6 +352,47 @@ void GridGameListView::initMDValues() void GridGameListView::updateInfoPanel() { FileData* file = (mGrid.size() == 0 || mGrid.isScrolling()) ? nullptr : mGrid.getSelected(); + bool hideMetaDataFields = false; + + if (file) + hideMetaDataFields = (file->metadata.get("hidemetadata") == "true"); + + if (hideMetaDataFields) { + mLblRating.setVisible(false); + mRating.setVisible(false); + mLblReleaseDate.setVisible(false); + mReleaseDate.setVisible(false); + mLblDeveloper.setVisible(false); + mDeveloper.setVisible(false); + mLblPublisher.setVisible(false); + mPublisher.setVisible(false); + mLblGenre.setVisible(false); + mGenre.setVisible(false); + mLblPlayers.setVisible(false); + mPlayers.setVisible(false); + mLblLastPlayed.setVisible(false); + mLastPlayed.setVisible(false); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } + else { + mLblRating.setVisible(true); + mRating.setVisible(true); + mLblReleaseDate.setVisible(true); + mReleaseDate.setVisible(true); + mLblDeveloper.setVisible(true); + mDeveloper.setVisible(true); + mLblPublisher.setVisible(true); + mPublisher.setVisible(true); + mLblGenre.setVisible(true); + mGenre.setVisible(true); + mLblPlayers.setVisible(true); + mPlayers.setVisible(true); + mLblLastPlayed.setVisible(true); + mLastPlayed.setVisible(true); + mLblPlayCount.setVisible(true); + mPlayCount.setVisible(true); + } bool fadingOut; if (file == nullptr) { @@ -384,12 +425,17 @@ void GridGameListView::updateInfoPanel() mName.setValue(file->metadata.get("name")); if (file->getType() == GAME) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(file->metadata.get("playcount")); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mPlayCount.setValue(file->metadata.get("playcount")); + } } else if (file->getType() == FOLDER) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(""); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } } fadingOut = false; diff --git a/es-app/src/views/gamelist/VideoGameListView.cpp b/es-app/src/views/gamelist/VideoGameListView.cpp index 32e253017..14b99e422 100644 --- a/es-app/src/views/gamelist/VideoGameListView.cpp +++ b/es-app/src/views/gamelist/VideoGameListView.cpp @@ -265,9 +265,50 @@ void VideoGameListView::initMDValues() void VideoGameListView::updateInfoPanel() { FileData* file = (mList.size() == 0 || mList.isScrolling()) ? nullptr : mList.getSelected(); + bool hideMetaDataFields = false; Utils::FileSystem::removeFile(getTitlePath()); + if (file) + hideMetaDataFields = (file->metadata.get("hidemetadata") == "true"); + + if (hideMetaDataFields) { + mLblRating.setVisible(false); + mRating.setVisible(false); + mLblReleaseDate.setVisible(false); + mReleaseDate.setVisible(false); + mLblDeveloper.setVisible(false); + mDeveloper.setVisible(false); + mLblPublisher.setVisible(false); + mPublisher.setVisible(false); + mLblGenre.setVisible(false); + mGenre.setVisible(false); + mLblPlayers.setVisible(false); + mPlayers.setVisible(false); + mLblLastPlayed.setVisible(false); + mLastPlayed.setVisible(false); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } + else { + mLblRating.setVisible(true); + mRating.setVisible(true); + mLblReleaseDate.setVisible(true); + mReleaseDate.setVisible(true); + mLblDeveloper.setVisible(true); + mDeveloper.setVisible(true); + mLblPublisher.setVisible(true); + mPublisher.setVisible(true); + mLblGenre.setVisible(true); + mGenre.setVisible(true); + mLblPlayers.setVisible(true); + mPlayers.setVisible(true); + mLblLastPlayed.setVisible(true); + mLastPlayed.setVisible(true); + mLblPlayCount.setVisible(true); + mPlayCount.setVisible(true); + } + bool fadingOut; if (file == nullptr) { mVideo->setVideo(""); @@ -300,12 +341,17 @@ void VideoGameListView::updateInfoPanel() mName.setValue(file->metadata.get("name")); if (file->getType() == GAME) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(file->metadata.get("playcount")); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mPlayCount.setValue(file->metadata.get("playcount")); + } } else if (file->getType() == FOLDER) { - mLastPlayed.setValue(file->metadata.get("lastplayed")); - mPlayCount.setValue(""); + if (!hideMetaDataFields) { + mLastPlayed.setValue(file->metadata.get("lastplayed")); + mLblPlayCount.setVisible(false); + mPlayCount.setVisible(false); + } } fadingOut = false;