2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
// GuiSlideshowScreensaverOptions.cpp
|
|
|
|
//
|
|
|
|
// User interface for the slideshow screensaver options.
|
|
|
|
// Submenu to GuiGeneralScreensaverOptions.
|
|
|
|
//
|
|
|
|
|
2017-09-09 03:45:50 +00:00
|
|
|
#include "guis/GuiSlideshowScreensaverOptions.h"
|
|
|
|
|
|
|
|
#include "components/SliderComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/SwitchComponent.h"
|
2017-09-09 03:45:50 +00:00
|
|
|
#include "guis/GuiTextEditPopup.h"
|
2018-01-27 17:04:28 +00:00
|
|
|
#include "utils/StringUtil.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "Settings.h"
|
|
|
|
#include "Window.h"
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, const char* title)
|
|
|
|
: GuiScreensaverOptions(window, title)
|
2017-09-09 03:45:50 +00:00
|
|
|
{
|
2020-06-23 18:07:00 +00:00
|
|
|
ComponentListRow row;
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Image duration (in seconds).
|
|
|
|
auto sss_image_sec = std::make_shared<SliderComponent>(mWindow, 1.f, 60.f, 1.f, "s");
|
|
|
|
sss_image_sec->setValue((float)(Settings::getInstance()->
|
|
|
|
getInt("ScreenSaverSwapImageTimeout") / (1000)));
|
|
|
|
addWithLabel(row, "SWAP IMAGE AFTER (SECS)", sss_image_sec);
|
|
|
|
addSaveFunc([sss_image_sec] {
|
|
|
|
int playNextTimeout = (int)Math::round(sss_image_sec->getValue()) * (1000);
|
|
|
|
Settings::getInstance()->setInt("ScreenSaverSwapImageTimeout", playNextTimeout);
|
|
|
|
PowerSaver::updateTimeouts();
|
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Stretch image.
|
|
|
|
auto sss_stretch = std::make_shared<SwitchComponent>(mWindow);
|
2020-07-27 18:38:22 +00:00
|
|
|
sss_stretch->setState(Settings::getInstance()->getBool("ScreenSaverStretchImages"));
|
2020-07-28 09:10:14 +00:00
|
|
|
addWithLabel(row, "STRETCH IMAGES TO SCREEN RESOLUTION", sss_stretch);
|
2020-06-23 18:07:00 +00:00
|
|
|
addSaveFunc([sss_stretch] {
|
2020-07-27 18:38:22 +00:00
|
|
|
Settings::getInstance()->setBool("ScreenSaverStretchImages", sss_stretch->getState());
|
2020-06-23 18:07:00 +00:00
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Background audio file.
|
|
|
|
auto sss_bg_audio_file = std::make_shared<TextComponent>(mWindow, "",
|
|
|
|
Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
|
|
|
addEditableTextComponent(row, "BACKGROUND AUDIO", sss_bg_audio_file,
|
|
|
|
Settings::getInstance()->getString("SlideshowScreenSaverBackgroundAudioFile"));
|
|
|
|
addSaveFunc([sss_bg_audio_file] {
|
|
|
|
Settings::getInstance()->setString("SlideshowScreenSaverBackgroundAudioFile",
|
|
|
|
sss_bg_audio_file->getValue());
|
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Image source.
|
|
|
|
auto sss_custom_source = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
sss_custom_source->setState(Settings::getInstance()->
|
|
|
|
getBool("SlideshowScreenSaverCustomImageSource"));
|
|
|
|
addWithLabel(row, "USE CUSTOM IMAGES", sss_custom_source);
|
|
|
|
addSaveFunc([sss_custom_source] { Settings::getInstance()->
|
|
|
|
setBool("SlideshowScreenSaverCustomImageSource", sss_custom_source->getState()); });
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Custom image directory.
|
|
|
|
auto sss_image_dir = std::make_shared<TextComponent>(mWindow, "",
|
|
|
|
Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
|
|
|
addEditableTextComponent(row, "CUSTOM IMAGE DIR", sss_image_dir,
|
|
|
|
Settings::getInstance()->getString("SlideshowScreenSaverImageDir"));
|
|
|
|
addSaveFunc([sss_image_dir] {
|
|
|
|
Settings::getInstance()->setString("SlideshowScreenSaverImageDir",
|
|
|
|
sss_image_dir->getValue());
|
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Recurse custom image directory.
|
|
|
|
auto sss_recurse = std::make_shared<SwitchComponent>(mWindow);
|
|
|
|
sss_recurse->setState(Settings::getInstance()->getBool("SlideshowScreenSaverRecurse"));
|
|
|
|
addWithLabel(row, "CUSTOM IMAGE DIR RECURSIVE", sss_recurse);
|
|
|
|
addSaveFunc([sss_recurse] {
|
|
|
|
Settings::getInstance()->setBool("SlideshowScreenSaverRecurse", sss_recurse->getState());
|
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Custom image filter (file extensions).
|
|
|
|
auto sss_image_filter = std::make_shared<TextComponent>(mWindow, "",
|
|
|
|
Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
|
|
|
addEditableTextComponent(row, "CUSTOM IMAGE FILTER", sss_image_filter,
|
|
|
|
Settings::getInstance()->getString("SlideshowScreenSaverImageFilter"));
|
|
|
|
addSaveFunc([sss_image_filter] {
|
|
|
|
Settings::getInstance()->setString("SlideshowScreenSaverImageFilter",
|
|
|
|
sss_image_filter->getValue());
|
|
|
|
});
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GuiSlideshowScreensaverOptions::~GuiSlideshowScreensaverOptions()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row,
|
|
|
|
const std::string label, std::shared_ptr<GuiComponent> component)
|
2017-09-09 03:45:50 +00:00
|
|
|
{
|
2020-06-23 18:07:00 +00:00
|
|
|
row.elements.clear();
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
auto lbl = std::make_shared<TextComponent>(mWindow, Utils::String::toUpper(label),
|
|
|
|
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
2017-09-09 03:45:50 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
row.addElement(lbl, true); // Label.
|
|
|
|
row.addElement(component, false, true);
|
|
|
|
addRow(row);
|
2017-09-09 03:45:50 +00:00
|
|
|
}
|