Deluge Firmware 1.3.0
Build date: 2026.08.23
Loading...
Searching...
No Matches
screensaver.h
1/*
2 * Copyright © 2026 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19#include "definitions_cxx.hpp"
20#include "gui/l10n/l10n.h"
21#include "gui/l10n/strings.h"
22#include "gui/menu_item/integer.h"
23#include "gui/menu_item/selection.h"
24#include "gui/menu_item/submenu.h"
25#include "hid/display/display.h"
26#include "hid/display/screensaver.h"
27#include "storage/flash_storage.h"
28
29namespace deluge::gui::menu_item::defaults {
30
34class ScreensaverModeMenu final : public Selection {
35public:
36 using Selection::Selection;
37 void readCurrentValue() override { this->setValue(FlashStorage::screensaverMode); }
38 void writeCurrentValue() override {
39 FlashStorage::screensaverMode = this->getValue<::ScreensaverMode>();
41 }
44 deluge::vector<std::string_view> getOptions(OptType optType) override {
45 (void)optType;
46 return {l10n::getView(l10n::String::STRING_FOR_OFF),
47 l10n::getView(l10n::String::STRING_FOR_SCREENSAVER_MODE_BLANK),
48 l10n::getView(l10n::String::STRING_FOR_SCREENSAVER_MODE_STARSCAPE),
49 l10n::getView(l10n::String::STRING_FOR_SCREENSAVER_MODE_DELUGE)};
50 }
51 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override { return display->haveOLED(); }
52};
53
55class ScreensaverTimeout final : public Integer {
56public:
57 using Integer::Integer;
58 [[nodiscard]] int32_t getMinValue() const override { return kMinScreensaverTimeoutMinutes; }
59 [[nodiscard]] int32_t getMaxValue() const override { return kMaxScreensaverTimeoutMinutes; }
60 void readCurrentValue() override { this->setValue(FlashStorage::screensaverTimeoutMinutes); }
61 void writeCurrentValue() override {
62 FlashStorage::screensaverTimeoutMinutes = this->getValue();
64 }
65 const char* getUnit() override { return " MIN"; }
66 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override { return display->haveOLED(); }
67};
68
71class ScreensaverSubmenu final : public Submenu {
72public:
73 using Submenu::Submenu;
74 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override { return display->haveOLED(); }
75};
76
77} // namespace deluge::gui::menu_item::defaults
Definition mod_controllable_audio.h:47
Definition integer.h:24
Definition selection.h:26
Picks what the screensaver shows: off, blank, the starscape, or the rain.
Definition screensaver.h:34
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition screensaver.h:37
deluge::vector< std::string_view > getOptions(OptType optType) override
Definition screensaver.h:44
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition screensaver.h:51
Holds the screensaver settings, and hides the whole submenu on 7SEG units rather than showing an empt...
Definition screensaver.h:71
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition screensaver.h:74
Sets the number of minutes without physical input before the screensaver appears.
Definition screensaver.h:55
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition screensaver.h:66
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition screensaver.h:60
static void settingsChanged()
Apply a change to the mode or timeout setting: wake if showing, then re-arm or cancel the timer for t...
Definition screensaver.cpp:165