From c30fab091943d30b6b2068dba7a555d92f2c62aa Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 28 Jun 2021 22:05:24 +0200 Subject: [PATCH] Added an option to use plain ASCII for some special gamelist characters. --- es-app/src/guis/GuiMenu.cpp | 15 +++++++++++ .../src/views/gamelist/BasicGameListView.cpp | 25 ++++++++++++++----- es-core/src/Settings.cpp | 1 + 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 508e1028b..d8095a519 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -458,6 +458,21 @@ void GuiMenu::openUIOptions() } }); + // Use ASCII for special characters in the gamelist view instead of the Font Awesome symbols. + auto special_chars_ascii = std::make_shared(mWindow); + special_chars_ascii->setState(Settings::getInstance()->getBool("SpecialCharsASCII")); + s->addWithLabel("USE PLAIN ASCII FOR SPECIAL GAMELIST CHARACTERS", special_chars_ascii); + s->addSaveFunc([special_chars_ascii, s] { + if (special_chars_ascii->getState() != + Settings::getInstance()->getBool("SpecialCharsASCII")) { + Settings::getInstance()->setBool("SpecialCharsASCII", + special_chars_ascii->getState()); + s->setNeedsSaving(); + s->setNeedsReloading(); + s->setInvalidateCachedBackground(); + } + }); + // Enable quick list scrolling overlay. auto list_scroll_overlay = std::make_shared(mWindow); list_scroll_overlay->setState(Settings::getInstance()->getBool("ListScrollOverlay")); diff --git a/es-app/src/views/gamelist/BasicGameListView.cpp b/es-app/src/views/gamelist/BasicGameListView.cpp index 41f4527b3..cf950e338 100644 --- a/es-app/src/views/gamelist/BasicGameListView.cpp +++ b/es-app/src/views/gamelist/BasicGameListView.cpp @@ -77,19 +77,32 @@ void BasicGameListView::populateList(const std::vector& files, FileDa // Add a leading tick mark icon to the game name if it's part of the custom collection // currently being edited. if (isEditing && (*it)->getType() == GAME) { - if (CollectionSystemsManager::get()->inCustomCollection(editingCollection, (*it))) - inCollectionPrefix = ViewController::TICKMARK_CHAR + " "; - else + if (CollectionSystemsManager::get()->inCustomCollection(editingCollection, (*it))) { + if (Settings::getInstance()->getBool("SpecialCharsASCII")) + inCollectionPrefix = "! "; + else + inCollectionPrefix = ViewController::TICKMARK_CHAR + " "; + } + else { inCollectionPrefix = ""; + } } + if ((*it)->getFavorite() && favoriteStar && mRoot->getSystem()->getName() != "favorites") { - mList.add(inCollectionPrefix + ViewController::FAVORITE_CHAR + " " + - (*it)->getName(), *it, ((*it)->getType() == FOLDER)); + if (Settings::getInstance()->getBool("SpecialCharsASCII")) + mList.add(inCollectionPrefix + "* " + + (*it)->getName(), *it, ((*it)->getType() == FOLDER)); + else + mList.add(inCollectionPrefix + ViewController::FAVORITE_CHAR + " " + + (*it)->getName(), *it, ((*it)->getType() == FOLDER)); } else if ((*it)->getType() == FOLDER && mRoot->getSystem()->getName() != "collections") { - mList.add(ViewController::FOLDER_CHAR + " " + (*it)->getName(), *it, true); + if (Settings::getInstance()->getBool("SpecialCharsASCII")) + mList.add("# " + (*it)->getName(), *it, true); + else + mList.add(ViewController::FOLDER_CHAR + " " + (*it)->getName(), *it, true); } else { mList.add(inCollectionPrefix + (*it)->getName(), *it, ((*it)->getType() == FOLDER)); diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index d3b482fe1..ea2956432 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -145,6 +145,7 @@ void Settings::setDefaults() mBoolMap["FoldersOnTop"] = { true, true }; mBoolMap["FavoritesFirst"] = { true, true }; mBoolMap["FavoritesStar"] = { true, true }; + mBoolMap["SpecialCharsASCII"] = { false, false }; mBoolMap["ListScrollOverlay"] = { false, false }; mBoolMap["FavoritesAddButton"] = { true, true }; mBoolMap["RandomAddButton"] = { false, false };