Added an option to use plain ASCII for some special gamelist characters.

This commit is contained in:
Leon Styhre 2021-06-28 22:05:24 +02:00
parent 605257aa89
commit c30fab0919
3 changed files with 35 additions and 6 deletions

View file

@ -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<SwitchComponent>(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<SwitchComponent>(mWindow);
list_scroll_overlay->setState(Settings::getInstance()->getBool("ListScrollOverlay"));

View file

@ -77,19 +77,32 @@ void BasicGameListView::populateList(const std::vector<FileData*>& 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));

View file

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