Added metadata setting to hide metadata fields from the gamelist view.

This commit is contained in:
Leon Styhre 2020-08-08 11:36:43 +02:00
parent 3ca9f5478a
commit bd57d23bce
6 changed files with 193 additions and 55 deletions

View file

@ -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

View file

@ -12,48 +12,51 @@
#include <pugixml.hpp>
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<MetaDataDecl> 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<MetaDataDecl> folderMDD(folderDecls, folderDecls +
sizeof(folderDecls) / sizeof(folderDecls[0]));

View file

@ -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));
}

View file

@ -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;

View file

@ -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;

View file

@ -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;