mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Added options to the video and slideshow screensavers to only include favorite games
This commit is contained in:
parent
67b84434db
commit
30ca0497aa
|
@ -433,6 +433,9 @@ void Screensaver::update(int deltaTime)
|
||||||
|
|
||||||
void Screensaver::generateImageList()
|
void Screensaver::generateImageList()
|
||||||
{
|
{
|
||||||
|
const bool favoritesOnly {
|
||||||
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")};
|
||||||
|
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||||
it != SystemData::sSystemVector.cend(); ++it) {
|
it != SystemData::sSystemVector.cend(); ++it) {
|
||||||
// We only want nodes from game systems that are not collections.
|
// We only want nodes from game systems that are not collections.
|
||||||
|
@ -445,6 +448,8 @@ void Screensaver::generateImageList()
|
||||||
if (UIModeController::getInstance()->isUIModeKid() &&
|
if (UIModeController::getInstance()->isUIModeKid() &&
|
||||||
(*it2)->metadata.get("kidgame") != "true")
|
(*it2)->metadata.get("kidgame") != "true")
|
||||||
continue;
|
continue;
|
||||||
|
if (favoritesOnly && (*it2)->metadata.get("favorite") != "true")
|
||||||
|
continue;
|
||||||
std::string imagePath {(*it2)->getImagePath()};
|
std::string imagePath {(*it2)->getImagePath()};
|
||||||
if (imagePath != "")
|
if (imagePath != "")
|
||||||
mImageFiles.push_back((*it2));
|
mImageFiles.push_back((*it2));
|
||||||
|
@ -454,6 +459,8 @@ void Screensaver::generateImageList()
|
||||||
|
|
||||||
void Screensaver::generateVideoList()
|
void Screensaver::generateVideoList()
|
||||||
{
|
{
|
||||||
|
const bool favoritesOnly {Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")};
|
||||||
|
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||||
it != SystemData::sSystemVector.cend(); ++it) {
|
it != SystemData::sSystemVector.cend(); ++it) {
|
||||||
// We only want nodes from game systems that are not collections.
|
// We only want nodes from game systems that are not collections.
|
||||||
|
@ -466,6 +473,8 @@ void Screensaver::generateVideoList()
|
||||||
if (UIModeController::getInstance()->isUIModeKid() &&
|
if (UIModeController::getInstance()->isUIModeKid() &&
|
||||||
(*it2)->metadata.get("kidgame") != "true")
|
(*it2)->metadata.get("kidgame") != "true")
|
||||||
continue;
|
continue;
|
||||||
|
if (favoritesOnly && (*it2)->metadata.get("favorite") != "true")
|
||||||
|
continue;
|
||||||
std::string videoPath {(*it2)->getVideoPath()};
|
std::string videoPath {(*it2)->getVideoPath()};
|
||||||
if (videoPath != "")
|
if (videoPath != "")
|
||||||
mVideoFiles.push_back((*it2));
|
mVideoFiles.push_back((*it2));
|
||||||
|
@ -604,8 +613,15 @@ void Screensaver::generateOverlayInfo()
|
||||||
float posX {mRenderer->getScreenWidth() * 0.023f};
|
float posX {mRenderer->getScreenWidth() * 0.023f};
|
||||||
float posY {mRenderer->getScreenHeight() * 0.02f};
|
float posY {mRenderer->getScreenHeight() * 0.02f};
|
||||||
|
|
||||||
|
const bool favoritesOnly {
|
||||||
|
(mScreensaverType == "video" &&
|
||||||
|
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")) ||
|
||||||
|
(mScreensaverType == "slideshow" &&
|
||||||
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites"))};
|
||||||
|
|
||||||
std::string favoriteChar;
|
std::string favoriteChar;
|
||||||
if (mCurrentGame && mCurrentGame->getFavorite())
|
// Don't add the favorites character if only displaying favorite games.
|
||||||
|
if (!favoritesOnly && mCurrentGame && mCurrentGame->getFavorite())
|
||||||
favoriteChar.append(" ").append(ViewController::FAVORITE_CHAR);
|
favoriteChar.append(" ").append(ViewController::FAVORITE_CHAR);
|
||||||
|
|
||||||
const std::string gameName {Utils::String::toUpper(mGameName) + favoriteChar};
|
const std::string gameName {Utils::String::toUpper(mGameName) + favoriteChar};
|
||||||
|
|
|
@ -121,6 +121,20 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Only include favorite games.
|
||||||
|
auto screensaverSlideshowOnlyFavorites = std::make_shared<SwitchComponent>();
|
||||||
|
screensaverSlideshowOnlyFavorites->setState(
|
||||||
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites"));
|
||||||
|
s->addWithLabel("ONLY INCLUDE FAVORITE GAMES", screensaverSlideshowOnlyFavorites);
|
||||||
|
s->addSaveFunc([screensaverSlideshowOnlyFavorites, s] {
|
||||||
|
if (screensaverSlideshowOnlyFavorites->getState() !=
|
||||||
|
Settings::getInstance()->getBool("ScreensaverSlideshowOnlyFavorites")) {
|
||||||
|
Settings::getInstance()->setBool("ScreensaverSlideshowOnlyFavorites",
|
||||||
|
screensaverSlideshowOnlyFavorites->getState());
|
||||||
|
s->setNeedsSaving();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Stretch images to screen resolution.
|
// Stretch images to screen resolution.
|
||||||
auto screensaverStretchImages = std::make_shared<SwitchComponent>();
|
auto screensaverStretchImages = std::make_shared<SwitchComponent>();
|
||||||
screensaverStretchImages->setState(
|
screensaverStretchImages->setState(
|
||||||
|
@ -231,6 +245,20 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Only include favorite games.
|
||||||
|
auto screensaverVideoOnlyFavorites = std::make_shared<SwitchComponent>();
|
||||||
|
screensaverVideoOnlyFavorites->setState(
|
||||||
|
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites"));
|
||||||
|
s->addWithLabel("ONLY INCLUDE FAVORITE GAMES", screensaverVideoOnlyFavorites);
|
||||||
|
s->addSaveFunc([screensaverVideoOnlyFavorites, s] {
|
||||||
|
if (screensaverVideoOnlyFavorites->getState() !=
|
||||||
|
Settings::getInstance()->getBool("ScreensaverVideoOnlyFavorites")) {
|
||||||
|
Settings::getInstance()->setBool("ScreensaverVideoOnlyFavorites",
|
||||||
|
screensaverVideoOnlyFavorites->getState());
|
||||||
|
s->setNeedsSaving();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Stretch videos to screen resolution.
|
// Stretch videos to screen resolution.
|
||||||
auto screensaverStretchVideos = std::make_shared<SwitchComponent>();
|
auto screensaverStretchVideos = std::make_shared<SwitchComponent>();
|
||||||
screensaverStretchVideos->setState(
|
screensaverStretchVideos->setState(
|
||||||
|
|
|
@ -190,6 +190,7 @@ void Settings::setDefaults()
|
||||||
|
|
||||||
// UI settings -> screensaver settings -> slideshow screensaver settings.
|
// UI settings -> screensaver settings -> slideshow screensaver settings.
|
||||||
mIntMap["ScreensaverSwapImageTimeout"] = {10000, 10000};
|
mIntMap["ScreensaverSwapImageTimeout"] = {10000, 10000};
|
||||||
|
mBoolMap["ScreensaverSlideshowOnlyFavorites"] = {false, false};
|
||||||
mBoolMap["ScreensaverStretchImages"] = {false, false};
|
mBoolMap["ScreensaverStretchImages"] = {false, false};
|
||||||
mBoolMap["ScreensaverSlideshowGameInfo"] = {true, true};
|
mBoolMap["ScreensaverSlideshowGameInfo"] = {true, true};
|
||||||
mBoolMap["ScreensaverSlideshowScanlines"] = {true, true};
|
mBoolMap["ScreensaverSlideshowScanlines"] = {true, true};
|
||||||
|
@ -200,6 +201,7 @@ void Settings::setDefaults()
|
||||||
|
|
||||||
// UI settings -> screensaver settings -> video screensaver settings.
|
// UI settings -> screensaver settings -> video screensaver settings.
|
||||||
mIntMap["ScreensaverSwapVideoTimeout"] = {0, 0};
|
mIntMap["ScreensaverSwapVideoTimeout"] = {0, 0};
|
||||||
|
mBoolMap["ScreensaverVideoOnlyFavorites"] = {false, false};
|
||||||
mBoolMap["ScreensaverStretchVideos"] = {false, false};
|
mBoolMap["ScreensaverStretchVideos"] = {false, false};
|
||||||
mBoolMap["ScreensaverVideoGameInfo"] = {true, true};
|
mBoolMap["ScreensaverVideoGameInfo"] = {true, true};
|
||||||
#if defined(RASPBERRY_PI)
|
#if defined(RASPBERRY_PI)
|
||||||
|
|
Loading…
Reference in a new issue