From b7f4ba33e3f5a35eeb431b67d7fdd3a304a32543 Mon Sep 17 00:00:00 2001 From: Mateusz Piesta Date: Fri, 1 Oct 2021 08:44:40 +0200 Subject: [PATCH] [BH-765] Turn off the device From now on, Bell can be switched off from: - settings - by back long press(5s) from any screen --- image/assets/lang/English.json | 2 + module-apps/apps-common/popups/Popups.cpp | 2 + module-apps/apps-common/popups/Popups.hpp | 3 +- .../popups/presenter/PowerOffPresenter.hpp | 11 +- .../AbstractBatteryCharger.hpp | 1 + products/BellHybrid/apps/Application.cpp | 19 +- .../ApplicationBellAlarm.cpp | 2 +- .../windows/BellAlarmWindow.cpp | 3 +- .../ApplicationBellBackgroundSounds.cpp | 2 + .../ApplicationBellMain.cpp | 2 +- .../ApplicationBellOnBoarding.cpp | 7 +- .../CMakeLists.txt | 2 - .../windows/OnBoardingFinalizeWindow.hpp | 2 +- .../windows/OnBoardingWelcomeWindow.hpp | 25 - .../ApplicationBellPowerNap.cpp | 2 +- .../ApplicationBellSettings.cpp | 15 +- .../application-bell-settings/CMakeLists.txt | 3 - .../ApplicationBellSettings.hpp | 1 - .../windows/BellSettingsFrontlight.cpp | 2 +- .../windows/BellSettingsTurnOffWindow.cpp | 29 -- .../windows/BellSettingsTurnOffWindow.hpp | 21 - .../windows/BellSettingsWindow.cpp | 3 +- .../advanced/BellSettingsTimeUnitsWindow.cpp | 2 +- .../BellSettingsAlarmSettingsSnoozeWindow.cpp | 2 +- .../BellSettingsAlarmSettingsWindow.cpp | 2 +- .../BellSettingsPrewakeUpWindow.cpp | 2 +- .../BellHybrid/apps/common/CMakeLists.txt | 12 +- .../include/common/BellPowerOffPresenter.hpp | 19 + .../include/common/data/StyleCommon.hpp | 1 + .../common/popups/BellTurnOffOptionWindow.hpp | 22 + .../{ => windows}/BellFinishedWindow.hpp | 0 .../common/windows/BellTurnOffWindow.hpp | 28 ++ .../common/windows/BellWelcomeWindow.hpp | 37 ++ .../apps/common/src/BellPowerOffPresenter.cpp | 22 + .../src/popups/BellTurnOffOptionWindow.cpp | 43 ++ .../src/{ => windows}/BellFinishedWindow.cpp | 2 +- .../common/src/windows/BellTurnOffWindow.cpp | 46 ++ .../src/windows/BellWelcomeWindow.cpp} | 26 +- .../keymap/include/keymap/KeyMap.hpp | 60 ++- .../BellHybrid/services/appmgr/CMakeLists.txt | 2 + .../messages/PowerOffPopupRequestParams.hpp | 16 + .../BellHybrid/services/evtmgr/CMakeLists.txt | 16 +- .../services/evtmgr/EventManager.cpp | 58 ++- .../evtmgr/include/evtmgr/EventManager.hpp | 5 + .../key_sequences/AbstractKeySequence.hpp | 66 +++ .../key_sequences/AlarmActivateSequence.hpp | 13 + .../key_sequences/AlarmDeactivateSequence.hpp | 13 + .../internal/key_sequences/KeySequenceMgr.cpp | 70 +++ .../internal/key_sequences/KeySequenceMgr.hpp | 32 ++ .../key_sequences/LongPressSequence.cpp | 39 ++ .../key_sequences/LongPressSequence.hpp | 30 ++ .../key_sequences/PowerOffSequence.hpp | 15 + .../key_sequences/ReleaseSequence.hpp | 28 ++ .../services/evtmgr/tests/CMakeLists.txt | 10 + .../evtmgr/tests/unittest_KeySequenceMgr.cpp | 429 ++++++++++++++++++ products/BellHybrid/sys/CMakeLists.txt | 2 +- 56 files changed, 1179 insertions(+), 150 deletions(-) delete mode 100644 products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingWelcomeWindow.hpp delete mode 100644 products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.cpp delete mode 100644 products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.hpp create mode 100644 products/BellHybrid/apps/common/include/common/BellPowerOffPresenter.hpp create mode 100644 products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp rename products/BellHybrid/apps/common/include/common/{ => windows}/BellFinishedWindow.hpp (100%) create mode 100644 products/BellHybrid/apps/common/include/common/windows/BellTurnOffWindow.hpp create mode 100644 products/BellHybrid/apps/common/include/common/windows/BellWelcomeWindow.hpp create mode 100644 products/BellHybrid/apps/common/src/BellPowerOffPresenter.cpp create mode 100644 products/BellHybrid/apps/common/src/popups/BellTurnOffOptionWindow.cpp rename products/BellHybrid/apps/common/src/{ => windows}/BellFinishedWindow.cpp (97%) create mode 100644 products/BellHybrid/apps/common/src/windows/BellTurnOffWindow.cpp rename products/BellHybrid/apps/{application-bell-onboarding/windows/OnBoardingWelcomeWindow.cpp => common/src/windows/BellWelcomeWindow.cpp} (76%) create mode 100644 products/BellHybrid/services/appmgr/include/appmgr/messages/PowerOffPopupRequestParams.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/AbstractKeySequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/AlarmActivateSequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/AlarmDeactivateSequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/KeySequenceMgr.cpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/KeySequenceMgr.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/LongPressSequence.cpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/LongPressSequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/PowerOffSequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/internal/key_sequences/ReleaseSequence.hpp create mode 100644 products/BellHybrid/services/evtmgr/tests/CMakeLists.txt create mode 100644 products/BellHybrid/services/evtmgr/tests/unittest_KeySequenceMgr.cpp diff --git a/image/assets/lang/English.json b/image/assets/lang/English.json index 0896d6d2e325d17f9bd7f13608fa752adcb946f2..3d5b565cbf6b98637ccb9bb2ef675ebd14b4879d 100644 --- a/image/assets/lang/English.json +++ b/image/assets/lang/English.json @@ -624,6 +624,8 @@ "app_bell_powernap_session_ended_message": "Hello!
Rise & shine
", "app_bell_background_sounds_timer_off": "OFF", "app_bell_background_sounds_timer_title": "Timer", + "app_bell_turn_off_question": "Turn off the device?", + "app_bell_goodbye": "Goodbye", "app_bell_greeting_msg": [ "Good Morning!
It's a Beautiful Day!
", "Happy Day!
It's a brand new morning!
", diff --git a/module-apps/apps-common/popups/Popups.cpp b/module-apps/apps-common/popups/Popups.cpp index f5f36ef1787124ff6743ce56e6614a821f433c59..69bca227c0a6ae865c8c8ae755e317308447380b 100644 --- a/module-apps/apps-common/popups/Popups.cpp +++ b/module-apps/apps-common/popups/Popups.cpp @@ -38,6 +38,8 @@ namespace gui::popup return gui::popup::window::alarm_deactivated_window; case ID::Alarm: return gui::popup::window::alarm_window; + case ID::PowerOff: + return gui::popup::window::power_off_window; } return {}; diff --git a/module-apps/apps-common/popups/Popups.hpp b/module-apps/apps-common/popups/Popups.hpp index 6cc493200fba26a8eb33213f8bb4a09302fe12a7..1cba9f20febfd9c3f3e28663bee67b3c74d990d8 100644 --- a/module-apps/apps-common/popups/Popups.hpp +++ b/module-apps/apps-common/popups/Popups.hpp @@ -25,7 +25,8 @@ namespace gui SimNotReady, AlarmActivated, AlarmDeactivated, - Alarm + Alarm, + PowerOff, }; namespace window diff --git a/module-apps/apps-common/popups/presenter/PowerOffPresenter.hpp b/module-apps/apps-common/popups/presenter/PowerOffPresenter.hpp index ca76b8285a216e430014c578fe888ae8fc60935d..bbbf31d3348d16bacee523ed4cb1e3f498f76949 100644 --- a/module-apps/apps-common/popups/presenter/PowerOffPresenter.hpp +++ b/module-apps/apps-common/popups/presenter/PowerOffPresenter.hpp @@ -10,11 +10,18 @@ namespace app namespace gui { - class PowerOffPresenter + class AbstractPowerOffPresenter + { + public: + virtual ~AbstractPowerOffPresenter() = default; + virtual void powerOff() = 0; + }; + + class PowerOffPresenter : public AbstractPowerOffPresenter { public: PowerOffPresenter(app::ApplicationCommon *app); - void powerOff(); + void powerOff() override; private: app::ApplicationCommon *application; diff --git a/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp b/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp index f6d45b0b96d4386d5ca5c8e8684bdc66239b02e0..f51f188ea5c66cd3629d2583e972da3665818337 100644 --- a/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp +++ b/module-bsp/hal/include/hal/battery_charger/AbstractBatteryCharger.hpp @@ -7,6 +7,7 @@ #include #include +#include namespace hal::battery { diff --git a/products/BellHybrid/apps/Application.cpp b/products/BellHybrid/apps/Application.cpp index c49fd90ae2b7b863a87c3d2fc85c7bf8fdfa085a..47227869a43d5b18062d013f8248bf66121df9b4 100644 --- a/products/BellHybrid/apps/Application.cpp +++ b/products/BellHybrid/apps/Application.cpp @@ -5,16 +5,19 @@ #include +#include #include #include #include +#include +#include +#include namespace app { void Application::attachPopups(const std::vector &popupsList) { using namespace gui::popup; - app::ApplicationCommon::attachPopups(popupsList); for (auto popup : popupsList) { switch (popup) { case ID::AlarmActivated: @@ -33,6 +36,20 @@ namespace app return std::make_unique(app, std::move(presenter)); }); break; + case ID::PowerOff: + windowsFactory.attach(window::power_off_window, [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app, window::power_off_window); + }); + windowsFactory.attach(gui::BellTurnOffWindow::name, + [](ApplicationCommon *app, const std::string &name) { + return std::make_unique( + app, std::make_unique(app)); + }); + windowsFactory.attach(gui::BellWelcomeWindow::defaultName, + [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app); + }); + break; default: break; } diff --git a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp index c1f7924d9b7ad2f5a0212c91057e6e1865556e62..60a96e64082171069d1e5e07688aebab841be10e 100644 --- a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp +++ b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp @@ -62,7 +62,7 @@ namespace app return std::make_unique(app, priv->alarmSetPresenter); }); - attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated}); + attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated, gui::popup::ID::PowerOff}); } sys::MessagePointer ApplicationBellAlarm::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp b/products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp index 8c00db547ac6f502dfe9301487a216d63e0e225a..a40636836d35b8bd63961645bf312655f65292a0 100644 --- a/products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp +++ b/products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmWindow.cpp @@ -11,9 +11,8 @@ #include #include #include -#include -#include +#include namespace gui { diff --git a/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp b/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp index f098b98d34b68ecd08176ccf3a9574649de7894b..4793611f30077e6c1b1b6e8455a55d8487121bf5 100644 --- a/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp +++ b/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp @@ -55,6 +55,8 @@ namespace app auto presenter = std::make_unique(); return std::make_unique(app, std::move(presenter)); }); + + attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated, gui::popup::ID::PowerOff}); } sys::MessagePointer ApplicationBellBackgroundSounds::DataReceivedHandler(sys::DataMessage *msgl, diff --git a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp index 83c2759e2dd877d82ffaf13ce7cf32c567e8986e..97d6f094ea6737f5ace281cb6d7205d6bf31446c 100644 --- a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +++ b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp @@ -61,7 +61,7 @@ namespace app gui::window::name::bell_main_menu_dialog, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app, name); }); - attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated}); + attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated, gui::popup::ID::PowerOff}); } sys::MessagePointer ApplicationBellMain::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp b/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp index f8371b8dcc54f8817e76e76ac99c565ca0a58525..1e76fc6b7546e23ed5c6d550e76d559a6031950b 100644 --- a/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp +++ b/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp @@ -7,13 +7,13 @@ #include #include #include -#include #include #include #include -#include +#include +#include #include #include @@ -50,7 +50,8 @@ namespace app void ApplicationBellOnBoarding::createUserInterface() { windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) { - return std::make_unique(app, name); + return std::make_unique( + app, name, [app]() { app->switchWindow(gui::window::name::onBoardingLanguageWindow); }); }); windowsFactory.attach( diff --git a/products/BellHybrid/apps/application-bell-onboarding/CMakeLists.txt b/products/BellHybrid/apps/application-bell-onboarding/CMakeLists.txt index 4d99d096f2679e8847830cb91db29c0ad490e287..939bad496e7ff68c84c775679c90a5750d63b2b9 100644 --- a/products/BellHybrid/apps/application-bell-onboarding/CMakeLists.txt +++ b/products/BellHybrid/apps/application-bell-onboarding/CMakeLists.txt @@ -16,7 +16,6 @@ target_sources(application-bell-onboarding windows/OnBoardingLanguageWindow.cpp windows/OnBoardingSettingsWindow.cpp windows/OnBoardingFinalizeWindow.cpp - windows/OnBoardingWelcomeWindow.cpp presenter/OnBoardingLanguageWindowPresenter.cpp presenter/OnBoardingFinalizeWindowPresenter.cpp @@ -24,7 +23,6 @@ target_sources(application-bell-onboarding presenter/OnBoardingFinalizeWindowPresenter.hpp windows/OnBoardingLanguageWindow.hpp windows/OnBoardingSettingsWindow.hpp - windows/OnBoardingWelcomeWindow.hpp data/OnBoardingStyle.hpp PUBLIC diff --git a/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingFinalizeWindow.hpp b/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingFinalizeWindow.hpp index 141ccc60429708dba0ed7b43b292a48fe8d51bbb..cfbc8809930446cd837a589f6241a334d8b3b0dc 100644 --- a/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingFinalizeWindow.hpp +++ b/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingFinalizeWindow.hpp @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace gui { diff --git a/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingWelcomeWindow.hpp b/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingWelcomeWindow.hpp deleted file mode 100644 index 7144c20c4fceec2b19523b63b1703917dbe3d73c..0000000000000000000000000000000000000000 --- a/products/BellHybrid/apps/application-bell-onboarding/windows/OnBoardingWelcomeWindow.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once - -#include -#include - -namespace gui -{ - class BellBaseLayout; - - class OnBoardingWelcomeWindow : public AppWindow - { - public: - explicit OnBoardingWelcomeWindow(app::ApplicationCommon *app, - const std::string &name = gui::window::name::onBoardingLanguageWindow); - - void buildInterface() override; - bool onInput(const InputEvent &inputEvent) override; - - private: - BellBaseLayout *body{nullptr}; - }; -} /* namespace gui */ diff --git a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp index 02762a280ea5b5ecae2cd04ce1ced0bc0a6450c9..7247016dd969e6779982f80e0b58a4955623be50 100644 --- a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp @@ -50,7 +50,7 @@ namespace app return std::make_unique(app, std::move(presenter)); }); - attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated}); + attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated, gui::popup::ID::PowerOff}); } sys::MessagePointer ApplicationBellPowerNap::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp b/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp index c6b7a07b10ffa711b24cfa8111a717ac93f99114..75d67ea169c3f70bc4824f19ac11fc0809a7f2db 100644 --- a/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +++ b/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp @@ -26,11 +26,12 @@ #include "windows/BellSettingsBedtimeToneWindow.hpp" #include "windows/BellSettingsFrontlight.hpp" #include "windows/BellSettingsHomeViewWindow.hpp" -#include "windows/BellSettingsTurnOffWindow.hpp" #include "windows/BellSettingsWindow.hpp" #include -#include +#include +#include +#include #include #include #include @@ -120,11 +121,15 @@ namespace app return std::make_unique(app); }); - windowsFactory.attach(gui::window::name::bellSettingsTurnOff, + windowsFactory.attach(gui::BellTurnOffOptionWindow::defaultName, [](ApplicationCommon *app, const std::string &name) { - return std::make_unique(app); + return std::make_unique(app); }); + windowsFactory.attach(gui::BellTurnOffWindow::name, [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app, std::make_unique(app)); + }); + windowsFactory.attach( gui::BellSettingsPrewakeUpWindow::name, [this](ApplicationCommon *app, const std::string &name) { auto chimeDurationModel = std::make_unique(this); @@ -186,7 +191,7 @@ namespace app return std::make_unique(app, std::move(aboutYourBellPresenter)); }); - attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated}); + attachPopups({gui::popup::ID::AlarmActivated, gui::popup::ID::AlarmDeactivated, gui::popup::ID::PowerOff}); } sys::MessagePointer ApplicationBellSettings::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/products/BellHybrid/apps/application-bell-settings/CMakeLists.txt b/products/BellHybrid/apps/application-bell-settings/CMakeLists.txt index 8b95796487b059e81c640811dc91ece7cf621aba..8fc07912c15647f8a48502a02546caaf4bbba4f9 100644 --- a/products/BellHybrid/apps/application-bell-settings/CMakeLists.txt +++ b/products/BellHybrid/apps/application-bell-settings/CMakeLists.txt @@ -52,7 +52,6 @@ target_sources(application-bell-settings windows/BellSettingsBedtimeToneWindow.cpp windows/BellSettingsFrontlight.cpp windows/BellSettingsHomeViewWindow.cpp - windows/BellSettingsTurnOffWindow.cpp windows/BellSettingsWindow.cpp windows/advanced/AboutYourBellWindow.cpp windows/advanced/BellSettingsAdvancedWindow.cpp @@ -95,7 +94,6 @@ target_sources(application-bell-settings windows/BellSettingsBedtimeToneWindow.hpp windows/BellSettingsFrontlight.hpp windows/BellSettingsHomeViewWindow.hpp - windows/BellSettingsTurnOffWindow.hpp windows/BellSettingsWindow.hpp windows/advanced/AboutYourBellWindow.hpp windows/advanced/BellSettingsLanguageWindow.hpp @@ -118,7 +116,6 @@ target_link_libraries(application-bell-settings PRIVATE app bellgui - bell::app-common bell::db bell::alarms service-appmgr diff --git a/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp b/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp index 0beb12454781a25531c462336dba003f2cce68b3..3d0a4a8cbc889b50d83538fd02364e88db4e3cb4 100644 --- a/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp +++ b/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp @@ -17,7 +17,6 @@ namespace gui::window::name inline constexpr auto bellSettingsHomeView = "BellSettingsHomeView"; inline constexpr auto bellSettingsLanguage = "BellSettingsLanguage"; inline constexpr auto bellSettingsBedtimeTone = "BellSettingsBedtimeTone"; - inline constexpr auto bellSettingsTurnOff = "BellSettingsTurnOff"; } // namespace gui::window::name namespace app diff --git a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp index 9eaf6807e7587f5311b5dac8e57e5753fae1cd3f..5febeb6afde1cc47d2a95d246a681374f86067ff 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsFrontlight.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include diff --git a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.cpp deleted file mode 100644 index 61e49e557272acfd34eb8c7aae02b973a8d2b286..0000000000000000000000000000000000000000 --- a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#include "BellSettingsTurnOffWindow.hpp" - -#include - -namespace gui -{ - BellSettingsTurnOffWindow::BellSettingsTurnOffWindow(app::ApplicationCommon *app, std::string name) - : AppWindow(app, std::move(name)) - { - buildInterface(); - } - - void BellSettingsTurnOffWindow::rebuild() - { - erase(); - buildInterface(); - } - - void BellSettingsTurnOffWindow::buildInterface() - { - AppWindow::buildInterface(); - statusBar->setVisible(false); - header->setTitleVisibility(false); - bottomBar->setVisible(false); - } -} /* namespace gui */ diff --git a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.hpp b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.hpp deleted file mode 100644 index e7c305a9e4db6df6da70c6655745169d1e20bca7..0000000000000000000000000000000000000000 --- a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsTurnOffWindow.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once - -#include - -#include - -namespace gui -{ - class BellSettingsTurnOffWindow : public AppWindow - { - public: - explicit BellSettingsTurnOffWindow(app::ApplicationCommon *app, - std::string name = gui::window::name::bellSettingsTurnOff); - - void buildInterface() override; - void rebuild() override; - }; -} /* namespace gui */ diff --git a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp index 3903215ef6d209353e592b864de8e1cc6cbddaee..e3e362fa9b2b3c5688ec252db58eb2d7201eef04 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/BellSettingsWindow.cpp @@ -9,6 +9,7 @@ #include #include +#include #include namespace gui @@ -46,7 +47,7 @@ namespace gui addWinSettings(utils::translate("app_bell_settings_alarm_settings"), BellSettingsAlarmSettingsMenuWindow::name); addWinSettings(utils::translate("app_bell_settings_bedtime_tone"), window::name::bellSettingsBedtimeTone); addWinSettings(utils::translate("app_bell_settings_advanced"), window::name::bellSettingsAdvanced); - addWinSettings(utils::translate("app_bell_settings_turn_off"), window::name::bellSettingsTurnOff); + addWinSettings(utils::translate("app_bell_settings_turn_off"), BellTurnOffOptionWindow::defaultName); return settingsOptionList; } diff --git a/products/BellHybrid/apps/application-bell-settings/windows/advanced/BellSettingsTimeUnitsWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/advanced/BellSettingsTimeUnitsWindow.cpp index 55bf840df5324b1d0c5071b0f19738f8b7c7142a..e1444993af6ebe116956394f239fe412432ac554 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/advanced/BellSettingsTimeUnitsWindow.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/advanced/BellSettingsTimeUnitsWindow.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include namespace gui diff --git a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.cpp index 0c00020c77c46e3814998c6a0e91fad709cbb0dd..559212444e60814b2242e05a95fc56b811a9d1fa 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsSnoozeWindow.cpp @@ -8,7 +8,7 @@ #include "presenter/alarm_settings/SnoozePresenter.hpp" #include -#include +#include #include #include diff --git a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsWindow.cpp index 00c731c4c7436a7622a59d2826e1c0fde335d875..517ad8ad1372b0784bb31a1ce1f141aeacb980d9 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsWindow.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsAlarmSettingsWindow.cpp @@ -5,7 +5,7 @@ #include "BellSettingsAlarmSettingsMenuWindow.hpp" #include "BellSettingsAlarmSettingsWindow.hpp" #include "BellSettingsStyle.hpp" -#include +#include #include #include diff --git a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsPrewakeUpWindow.cpp b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsPrewakeUpWindow.cpp index d8cf54e475ace3df7bb765e1c3ed73585cad0ce6..cd64cccd43026ea242c59e647b3d6e9f971b75ef 100644 --- a/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsPrewakeUpWindow.cpp +++ b/products/BellHybrid/apps/application-bell-settings/windows/alarm_settings/BellSettingsPrewakeUpWindow.cpp @@ -5,7 +5,7 @@ #include "BellSettingsAlarmSettingsMenuWindow.hpp" #include "BellSettingsPrewakeUpWindow.hpp" #include "BellSettingsStyle.hpp" -#include +#include #include #include diff --git a/products/BellHybrid/apps/common/CMakeLists.txt b/products/BellHybrid/apps/common/CMakeLists.txt index c5ec2c3b7bc5ee5c7d60a93ce22f70d19b66da2e..876384c8ff88fc5da5b3c06ae63cefcdfc305d1c 100644 --- a/products/BellHybrid/apps/common/CMakeLists.txt +++ b/products/BellHybrid/apps/common/CMakeLists.txt @@ -10,21 +10,28 @@ target_include_directories(application-bell-common target_sources(application-bell-common PRIVATE + src/BellPowerOffPresenter.cpp src/AlarmModel.cpp src/TimeModel.cpp - src/BellFinishedWindow.cpp + src/windows/BellFinishedWindow.cpp + src/windows/BellTurnOffWindow.cpp + src/windows/BellWelcomeWindow.cpp src/BellSideListItemWithCallbacks.cpp src/TimeUtils.cpp src/popups/presenter/AlarmActivatedPresenter.cpp src/popups/AlarmActivatedWindow.cpp src/popups/AlarmDeactivatedWindow.cpp + src/popups/BellTurnOffOptionWindow.cpp src/widgets/ListItems.cpp src/options/BellOptionWindow.cpp src/options/BellShortOptionWindow.cpp src/options/OptionBellMenu.cpp PUBLIC - include/common/BellFinishedWindow.hpp + include/common/BellPowerOffPresenter.hpp + include/common/windows/BellFinishedWindow.hpp + include/common/windows/BellTurnOffWindow.hpp + include/common/windows/BellWelcomeWindow.hpp include/common/TimeUtils.hpp include/common/models/AbstractAlarmModel.hpp include/common/models/AbstractSettingsModel.hpp @@ -33,6 +40,7 @@ target_sources(application-bell-common include/common/popups/presenter/AlarmActivatedPresenter.hpp include/common/popups/AlarmActivatedWindow.hpp include/common/popups/AlarmDeactivatedWindow.hpp + include/common/popups/BellTurnOffOptionWindow.hpp include/common/widgets/BellSideListItemWithCallbacks.hpp include/common/widgets/ListItems.hpp include/common/options/BellOptionWindow.hpp diff --git a/products/BellHybrid/apps/common/include/common/BellPowerOffPresenter.hpp b/products/BellHybrid/apps/common/include/common/BellPowerOffPresenter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f443a4f46c2dd44bcd4c4ccc6942d204a9c8975 --- /dev/null +++ b/products/BellHybrid/apps/common/include/common/BellPowerOffPresenter.hpp @@ -0,0 +1,19 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include + +namespace gui +{ + class BellPowerOffPresenter : public gui::AbstractPowerOffPresenter + { + public: + explicit BellPowerOffPresenter(app::ApplicationCommon *app); + void powerOff() override; + + private: + app::ApplicationCommon *application; + }; +} // namespace gui diff --git a/products/BellHybrid/apps/common/include/common/data/StyleCommon.hpp b/products/BellHybrid/apps/common/include/common/data/StyleCommon.hpp index 5878c17d115e18242f2bee83d504922ed16f544a..1d8b961dc5801b5a949a719d2589085b6a82fc4f 100644 --- a/products/BellHybrid/apps/common/include/common/data/StyleCommon.hpp +++ b/products/BellHybrid/apps/common/include/common/data/StyleCommon.hpp @@ -10,4 +10,5 @@ namespace gui::bell_style { inline constexpr auto font = ::style::window::font::supersizemelight; inline constexpr auto font_center = ::style::window::font::largelight; + inline constexpr auto font_top = ::style::window::font::largelight; } // namespace gui::bell_style diff --git a/products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp b/products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..279a9659fd60a71b0f0221d02b0717a472cb8474 --- /dev/null +++ b/products/BellHybrid/apps/common/include/common/popups/BellTurnOffOptionWindow.hpp @@ -0,0 +1,22 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include + +namespace gui +{ + class BellTurnOffOptionWindow : public BellShortOptionWindow + { + public: + static constexpr auto defaultName = "BellTurnOffOptionWindow"; + explicit BellTurnOffOptionWindow(app::ApplicationCommon *app, const char *name = defaultName); + + private: + std::list