mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-02-07 04:42:15 -05:00
Due to vfs deprecation there is need to remove all vfs calls from code. This PR covers module gui. There are some modifications in other modules included which are necessary because of build system issues.
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "KeypadLightWindow.hpp"
|
|
|
|
#include "application-settings-new/ApplicationSettings.hpp"
|
|
#include "windows/OptionSetting.hpp"
|
|
|
|
#include <i18n/i18n.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
|
|
KeypadLightWindow::KeypadLightWindow(app::Application *app) : BaseSettingsWindow(app, window::name::keypad_light)
|
|
{
|
|
setTitle(utils::localize.get("app_settings_display_keypad_light"));
|
|
}
|
|
|
|
void KeypadLightWindow::switchHandler(bool &toggleSwitch)
|
|
{
|
|
isActiveSwitchOn = false;
|
|
isOffSwitchOn = false;
|
|
isAlwaysOnSwitchOn = false;
|
|
|
|
toggleSwitch = !toggleSwitch;
|
|
rebuildOptionList();
|
|
}
|
|
|
|
auto KeypadLightWindow::buildOptionsList() -> std::list<gui::Option>
|
|
{
|
|
std::list<gui::Option> optionsList;
|
|
|
|
auto addCheckOption = [&](UTF8 text, bool &Switch) {
|
|
optionsList.emplace_back(std::make_unique<gui::OptionSettings>(
|
|
text,
|
|
[&](gui::Item &item) mutable {
|
|
switchHandler(Switch);
|
|
return true;
|
|
},
|
|
[=](gui::Item &item) {
|
|
if (item.focus) {
|
|
this->setBottomBarText(utils::translateI18(style::strings::common::Switch),
|
|
BottomBar::Side::CENTER);
|
|
}
|
|
return true;
|
|
},
|
|
this,
|
|
Switch ? RightItem::Checked : RightItem::Disabled));
|
|
};
|
|
|
|
addCheckOption(utils::translateI18("app_settings_display_keypad_light_on"), isAlwaysOnSwitchOn);
|
|
addCheckOption(utils::translateI18("app_settings_display_keypad_light_off"), isOffSwitchOn);
|
|
addCheckOption(utils::translateI18("app_settings_display_keypad_light_active"), isActiveSwitchOn);
|
|
|
|
return optionsList;
|
|
} // namespace gui
|
|
|
|
} // namespace gui
|