Added menu options to disable the favorite star markings.

This commit is contained in:
Leon Styhre 2020-10-25 21:29:54 +01:00
parent d01be2ecba
commit 01cf401d8f
7 changed files with 87 additions and 24 deletions

View file

@ -620,6 +620,9 @@ Whether to place all folders on top of the gamelists. If done so, the folders wi
Whether to sort your favorite games above your other games in the gamelists.
**Add star markings to favorite games**
With this setting enabled, there is a star symbol added at the beginning of the game name in the gamelist views. It's strongly recommended to keep this setting enabled if the option to sort favorite games above non-favorites has been enabled. If not, favorite games would be sorted on top of the gamelist with no visual indication that they are favorites, which would be very confusing.
**Gamelist filters**
Activating or deactivating the ability to filter your gamelists. Can normally be left on.
@ -756,7 +759,11 @@ This lets you create a completely custom collection with a name that you choose.
**Sort favorites on top for custom collections**
Whether to sort your favorite games above your other games. This is disabled by default, as for collections you normally want to be able to mix all games regardless of whether they are favorites or not.
Whether to sort your favorite games above your other games. This is disabled by default, as for collections you probably want to be able to mix all games regardless of whether they are favorites or not.
**Display star markings for custom collections**
With this option enabled, there is a star marking added to each favorite game name. It works identically to the setting 'Add star markings to favorite games' but is applied specifically to custom collections. It's disabled by default.
**Group unthemed custom collections**

View file

@ -760,27 +760,51 @@ FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sy
}
if (gameCount > 0) {
switch (gameCount) {
case 1:
desc = "This collection contains 1 game: '" + gamesList[0]->metadata.get("name") +
" [" + gamesList[0]->getSourceFileData()->getSystem()->getName() + "]'.";
break;
case 2:
desc = "This collection contains 2 games: '" + gamesList[0]->metadata.get("name") +
" [" + gamesList[0]->getSourceFileData()->getSystem()->getName() +
"]' and '" + gamesList[1]->metadata.get("name") + " [" +
gamesList[1]->getSourceFileData()->getSystem()->getName() + "]'.";
break;
default:
desc = "This collection contains " + std::to_string(gameCount) +
" games: '" + gamesList[0]->metadata.get("name") +
" [" + gamesList[0]->getSourceFileData()->getSystem()->getName() +
"]', '" + gamesList[1]->metadata.get("name") + " [" +
gamesList[1]->getSourceFileData()->getSystem()->getName() + "]' and '" +
gamesList[2]->metadata.get("name") + " [" +
gamesList[2]->getSourceFileData()->getSystem()->getName() + "]'";
desc += (gameCount == 3 ? "." : ", among others.");
break;
if (Settings::getInstance()->getBool("CollectionShowSystemInfo")) {
switch (gameCount) {
case 1:
desc = "This collection contains 1 game: '" +
gamesList[0]->metadata.get("name") + " [" +
gamesList[0]->getSourceFileData()->getSystem()->getName() + "]'.";
break;
case 2:
desc = "This collection contains 2 games: '" +
gamesList[0]->metadata.get("name") + " [" +
gamesList[0]->getSourceFileData()->getSystem()->getName() +
"]' and '" + gamesList[1]->metadata.get("name") + " [" +
gamesList[1]->getSourceFileData()->getSystem()->getName() + "]'.";
break;
default:
desc = "This collection contains " + std::to_string(gameCount) +
" games: '" + gamesList[0]->metadata.get("name") +
" [" + gamesList[0]->getSourceFileData()->getSystem()->getName() +
"]', '" + gamesList[1]->metadata.get("name") + " [" +
gamesList[1]->getSourceFileData()->getSystem()->getName() + "]' and '" +
gamesList[2]->metadata.get("name") + " [" +
gamesList[2]->getSourceFileData()->getSystem()->getName() + "]'";
desc += (gameCount == 3 ? "." : ", among others.");
break;
}
}
else {
switch (gameCount) {
case 1:
desc = "This collection contains 1 game: '" +
gamesList[0]->metadata.get("name") + " '.";
break;
case 2:
desc = "This collection contains 2 games: '" +
gamesList[0]->metadata.get("name") +
"' and '" + gamesList[1]->metadata.get("name") + "'.";
break;
default:
desc = "This collection contains " + std::to_string(gameCount) +
" games: '" + gamesList[0]->metadata.get("name") +
"', '" + gamesList[1]->metadata.get("name") + "' and '" +
gamesList[2]->metadata.get("name") + "'";
desc += (gameCount == 3 ? "." : ", among others.");
break;
}
}
}

View file

@ -89,6 +89,10 @@ void GuiCollectionSystemsOptions::initializeMenu()
sortFavFirstCustomSwitch->setState(Settings::getInstance()->getBool("FavFirstCustom"));
mMenu.addWithLabel("SORT FAVORITES ON TOP FOR CUSTOM COLLECTIONS", sortFavFirstCustomSwitch);
favoriteStarCustomSwitch = std::make_shared<SwitchComponent>(mWindow);
favoriteStarCustomSwitch->setState(Settings::getInstance()->getBool("FavStarCustom"));
mMenu.addWithLabel("DISPLAY STAR MARKINGS FOR CUSTOM COLLECTIONS", favoriteStarCustomSwitch);
bundleCustomCollections = std::make_shared<SwitchComponent>(mWindow);
bundleCustomCollections->setState(Settings::getInstance()->
getBool("UseCustomCollectionsSystem"));
@ -199,12 +203,14 @@ void GuiCollectionSystemsOptions::applySettings()
std::string prevCustom = Settings::getInstance()->getString("CollectionSystemsCustom");
bool outSort = sortFavFirstCustomSwitch->getState();
bool prevSort = Settings::getInstance()->getBool("FavFirstCustom");
bool outFavStar = favoriteStarCustomSwitch->getState();
bool prevFavStar = Settings::getInstance()->getBool("FavStarCustom");
bool outBundle = bundleCustomCollections->getState();
bool prevBundle = Settings::getInstance()->getBool("UseCustomCollectionsSystem");
bool prevShow = Settings::getInstance()->getBool("CollectionShowSystemInfo");
bool outShow = toggleSystemNameInCollections->getState();
bool needUpdateSettings = prevAuto != outAuto || prevCustom != outCustom || outSort !=
prevSort || outBundle != prevBundle || prevShow != outShow ;
prevSort || outFavStar != prevFavStar || outBundle != prevBundle || prevShow != outShow;
if (needUpdateSettings)
updateSettings(outAuto, outCustom);
@ -218,6 +224,7 @@ void GuiCollectionSystemsOptions::updateSettings(std::string newAutoSettings,
Settings::getInstance()->setString("CollectionSystemsAuto", newAutoSettings);
Settings::getInstance()->setString("CollectionSystemsCustom", newCustomSettings);
Settings::getInstance()->setBool("FavFirstCustom", sortFavFirstCustomSwitch->getState());
Settings::getInstance()->setBool("FavStarCustom", favoriteStarCustomSwitch->getState());
Settings::getInstance()->setBool("UseCustomCollectionsSystem",
bundleCustomCollections->getState());
Settings::getInstance()->setBool("CollectionShowSystemInfo",
@ -227,6 +234,7 @@ void GuiCollectionSystemsOptions::updateSettings(std::string newAutoSettings,
CollectionSystemManager::get()->updateSystemsList();
ViewController::get()->goToStart();
ViewController::get()->reloadAll();
mWindow->invalidateCachedBackground();
}
bool GuiCollectionSystemsOptions::input(InputConfig* config, Input input)

View file

@ -40,6 +40,7 @@ private:
std::shared_ptr<OptionListComponent<std::string>> customOptionList;
std::shared_ptr<SwitchComponent> bundleCustomCollections;
std::shared_ptr<SwitchComponent> sortFavFirstCustomSwitch;
std::shared_ptr<SwitchComponent> favoriteStarCustomSwitch;
std::shared_ptr<SwitchComponent> toggleSystemNameInCollections;
MenuComponent mMenu;
SystemData* mSystem;

View file

@ -482,6 +482,17 @@ void GuiMenu::openUISettings()
}
});
// Enable gamelist star markings for favorite games.
auto favorites_stars = std::make_shared<SwitchComponent>(mWindow);
favorites_stars->setState(Settings::getInstance()->getBool("FavoritesStar"));
s->addWithLabel("ADD STAR MARKINGS TO FAVORITE GAMES", favorites_stars);
s->addSaveFunc([favorites_stars] {
if (Settings::getInstance()->getBool("FavoritesStar") != favorites_stars->getState()) {
Settings::getInstance()->setBool("FavoritesStar", favorites_stars->getState());
ViewController::get()->reloadAll();
}
});
// Enable filters (ForceDisableFilters).
auto enable_filter = std::make_shared<SwitchComponent>(mWindow);
enable_filter->setState(!Settings::getInstance()->getBool("ForceDisableFilters"));

View file

@ -52,6 +52,16 @@ void BasicGameListView::onFileChanged(FileData* file, FileChangeType change)
void BasicGameListView::populateList(const std::vector<FileData*>& files)
{
firstGameEntry = nullptr;
bool favoriteStar = true;
// Read the settings that control whether a unicode star character should be added
// as a prefix to the game name.
if (files.size() > 0) {
if (files.front()->getSystem()->isCustomCollection())
favoriteStar = Settings::getInstance()->getBool("FavStarCustom");
else
favoriteStar = Settings::getInstance()->getBool("FavoritesStar");
}
mList.clear();
mHeaderText.setText(mRoot->getSystem()->getFullName());
@ -60,7 +70,7 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files)
if (!firstGameEntry && (*it)->getType() == GAME)
firstGameEntry = (*it);
if ((*it)->getFavorite() &&
if ((*it)->getFavorite() && favoriteStar &&
mRoot->getSystem()->getName() != "favorites") {
mList.add(FAVORITE_CHAR + " " + (*it)->getName(),
*it, ((*it)->getType() == FOLDER));

View file

@ -91,6 +91,7 @@ void Settings::setDefaults()
mBoolMap["GamelistVideoScanlines"] = true;
mBoolMap["FoldersOnTop"] = true;
mBoolMap["FavoritesFirst"] = true;
mBoolMap["FavoritesStar"] = true;
mBoolMap["ForceDisableFilters"] = false;
mBoolMap["QuickSystemSelect"] = true;
mBoolMap["ShowHelpPrompts"] = true;
@ -151,6 +152,7 @@ void Settings::setDefaults()
mStringMap["CollectionSystemsCustom"] = "";
mBoolMap["UseCustomCollectionsSystem"] = true;
mBoolMap["FavFirstCustom"] = false;
mBoolMap["FavStarCustom"] = false;
mBoolMap["CollectionShowSystemInfo"] = true;
// Scraper.