Deluge Firmware 1.3.0
Build date: 2026.10.08
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) const override {
52 return display->haveOLED();
53 }
54};
55
57class ScreensaverTimeout final : public Integer {
58public:
59 using Integer::Integer;
60 [[nodiscard]] int32_t getMinValue() const override { return kMinScreensaverTimeoutMinutes; }
61 [[nodiscard]] int32_t getMaxValue() const override { return kMaxScreensaverTimeoutMinutes; }
62 void readCurrentValue() override { this->setValue(FlashStorage::screensaverTimeoutMinutes); }
63 void writeCurrentValue() override {
64 FlashStorage::screensaverTimeoutMinutes = this->getValue();
66 }
67 const char* getUnit() override { return " MIN"; }
68 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) const override {
69 return display->haveOLED();
70 }
71};
72
75class ScreensaverSubmenu final : public Submenu {
76public:
77 using Submenu::Submenu;
78 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) const override {
79 return display->haveOLED();
80 }
81};
82
83} // 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) const 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:75
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) const override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition screensaver.h:78
Sets the number of minutes without physical input before the screensaver appears.
Definition screensaver.h:57
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) const override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition screensaver.h:68
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition screensaver.h:62
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