mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-02-07 04:42:15 -05:00
54 lines
1.8 KiB
C++
54 lines
1.8 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 "CheckBoxWithLabel.hpp"
|
|
|
|
#include <application-settings-new/ApplicationSettings.hpp>
|
|
#include <i18/i18.hpp>
|
|
#include <BoxLayout.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
|
|
KeypadLightWindow::KeypadLightWindow(app::Application *app) : BaseSettingsWindow(app, window::name::keypad_light)
|
|
{
|
|
buildInterface();
|
|
}
|
|
|
|
void KeypadLightWindow::buildInterface()
|
|
{
|
|
BaseSettingsWindow::buildInterface();
|
|
setTitle(utils::localize.get("app_settings_display_keypad_light"));
|
|
|
|
auto body =
|
|
new VBox(nullptr,
|
|
0,
|
|
title->offset_h() + style::margins::big,
|
|
this->getWidth(),
|
|
this->getHeight() - style::margins::big - this->title->offset_h() - bottomBar->getHeight());
|
|
body->setEdges(gui::RectangleEdge::None);
|
|
|
|
auto toggleBoxes = [this](CheckBoxWithLabel &active) {
|
|
for (CheckBoxWithLabel *box : boxes) {
|
|
box->setChecked(false);
|
|
if (&active == box) {
|
|
box->setChecked(!box->isChecked());
|
|
}
|
|
}
|
|
};
|
|
|
|
boxes.push_back(new CheckBoxWithLabel(
|
|
body, 0, 0, utils::localize.get("app_settings_display_keypad_light_on"), toggleBoxes));
|
|
boxes.push_back(new CheckBoxWithLabel(
|
|
body, 0, 0, utils::localize.get("app_settings_display_keypad_light_active"), toggleBoxes));
|
|
boxes.push_back(new CheckBoxWithLabel(
|
|
body, 0, 0, utils::localize.get("app_settings_display_keypad_light_off"), toggleBoxes));
|
|
|
|
addWidget(body);
|
|
setFocusItem(body);
|
|
}
|
|
|
|
} // namespace gui
|