PowerSaver: force-disable sounds for INSTANT profile

This commit is contained in:
Conn O'Griofa 2017-09-14 04:45:28 +01:00
parent 1bfcfb1f16
commit 35abc91d30

View file

@ -119,7 +119,16 @@ void GuiMenu::openSoundSettings()
auto sounds_enabled = std::make_shared<SwitchComponent>(mWindow);
sounds_enabled->setState(Settings::getInstance()->getBool("EnableSounds"));
s->addWithLabel("ENABLE NAVIGATION SOUNDS", sounds_enabled);
s->addSaveFunc([sounds_enabled] { Settings::getInstance()->setBool("EnableSounds", sounds_enabled->getState()); });
s->addSaveFunc([sounds_enabled] {
if (sounds_enabled->getState()
&& !Settings::getInstance()->getBool("EnableSounds")
&& PowerSaver::getMode() == PowerSaver::INSTANT)
{
Settings::getInstance()->setString("PowerSaverMode", "default");
PowerSaver::init();
}
Settings::getInstance()->setBool("EnableSounds", sounds_enabled->getState());
});
auto video_audio = std::make_shared<SwitchComponent>(mWindow);
video_audio->setState(Settings::getInstance()->getBool("VideoAudio"));
@ -300,6 +309,7 @@ void GuiMenu::openOtherSettings()
if (Settings::getInstance()->getString("PowerSaverMode") != "instant" && power_saver->getSelected() == "instant") {
Settings::getInstance()->setString("TransitionStyle", "instant");
Settings::getInstance()->setBool("MoveCarousel", false);
Settings::getInstance()->setBool("EnableSounds", false);
}
Settings::getInstance()->setString("PowerSaverMode", power_saver->getSelected());
PowerSaver::init();