Fixed the screensaver controls.

It's now possible to start a game directly from the slideshow screensaver. Also fixed toggling of the video screensaver which was not working as expected.
This commit is contained in:
Leon Styhre 2020-07-27 16:53:54 +02:00
parent 41c3c66eb7
commit c906881957
5 changed files with 12 additions and 12 deletions

View file

@ -2,7 +2,7 @@
// SystemScreenSaver.cpp // SystemScreenSaver.cpp
// //
// Screensaver, supporting the following modes: // Screensaver, supporting the following modes:
// Dim, black, video, slideshow. // Dim, black, slideshow, video.
// //
#include "SystemScreenSaver.h" #include "SystemScreenSaver.h"

View file

@ -2,7 +2,7 @@
// SystemScreenSaver.h // SystemScreenSaver.h
// //
// Screensaver, supporting the following modes: // Screensaver, supporting the following modes:
// Dim, black, video, slideshow. // Dim, black, slideshow, video.
// //
#pragma once #pragma once

View file

@ -54,10 +54,8 @@ GuiGeneralScreensaverOptions::GuiGeneralScreensaverOptions(Window* window, const
"random video" && screensaver_behavior->getSelected() == "random video") { "random video" && screensaver_behavior->getSelected() == "random video") {
// If before it wasn't risky but now there's a risk of problems, show warning. // If before it wasn't risky but now there's a risk of problems, show warning.
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(), mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(),
"THE \"RANDOM VIDEO\" SCREENSAVER SHOWS\nVIDEOS FROM YOUR GAMELISTS.\n\nIF YOU DO NOT " "THE \"RANDOM VIDEO\" SCREENSAVER\nSHOWS VIDEOS FROM YOUR GAMELISTS.\n\nIF YOU DO NOT "
"HAVE ANY VIDEOS, THE SCREENSAVER\nWILL DEFAULT TO \"BLACK\".\n\nSEE MORE " "HAVE ANY VIDEOS, THE\nSCREENSAVER WILL DEFAULT TO \"BLACK\"",
"OPTIONS IN THE MENU \"UI SETTINGS\" >\n\"SCREENSAVER SETTINGS\" > "
"\"VIDEO SCREENSAVER SETTINGS\".",
"OK", [] { return; })); "OK", [] { return; }));
} }
Settings::getInstance()->setString("ScreenSaverBehavior", Settings::getInstance()->setString("ScreenSaverBehavior",

View file

@ -17,7 +17,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
: GuiScreensaverOptions(window, title) : GuiScreensaverOptions(window, title)
{ {
// Timer for swapping videos. // Timer for swapping videos.
auto swap = std::make_shared<SliderComponent>(mWindow, 10.f, 1000.f, 1.f, "s"); auto swap = std::make_shared<SliderComponent>(mWindow, 10.f, 300.f, 5.f, "s");
swap->setValue((float)(Settings::getInstance()-> swap->setValue((float)(Settings::getInstance()->
getInt("ScreenSaverSwapVideoTimeout") / (1000))); getInt("ScreenSaverSwapVideoTimeout") / (1000)));
addWithLabel("SWAP VIDEO AFTER (SECS)", swap); addWithLabel("SWAP VIDEO AFTER (SECS)", swap);

View file

@ -131,18 +131,20 @@ void Window::input(InputConfig* config, Input input)
if (mScreenSaver) { if (mScreenSaver) {
if (mScreenSaver->isScreenSaverActive() && if (mScreenSaver->isScreenSaverActive() &&
Settings::getInstance()->getBool("ScreenSaverControls") && Settings::getInstance()->getBool("ScreenSaverControls") &&
(Settings::getInstance()->getString("ScreenSaverBehavior") == "random video")) { ((Settings::getInstance()->getString("ScreenSaverBehavior") == "random video") ||
(Settings::getInstance()->getString("ScreenSaverBehavior") == "slideshow"))) {
if (mScreenSaver->getCurrentGame() != nullptr && if (mScreenSaver->getCurrentGame() != nullptr &&
(config->isMappedLike("right", input) || (config->isMappedTo("a", input) ||
config->isMappedTo("start", input) || config->isMappedTo("select", input))) { config->isMappedLike("left", input) || config->isMappedLike("right", input))) {
if (config->isMappedLike("right", input) || config->isMappedTo("select", input)) { // Left or right browses to the next video or image.
if (config->isMappedLike("left", input) || config->isMappedLike("right", input)) {
if (input.value != 0) { if (input.value != 0) {
// Handle screensaver control. // Handle screensaver control.
mScreenSaver->nextVideo(); mScreenSaver->nextVideo();
} }
return; return;
} }
else if (config->isMappedTo("start", input) && input.value != 0) { else if (config->isMappedTo("a", input) && input.value != 0) {
// Launch game. // Launch game.
cancelScreenSaver(); cancelScreenSaver();
mScreenSaver->launchGame(); mScreenSaver->launchGame();