From dfafd1fb5f2daf000eb41c726f66e1877132a336 Mon Sep 17 00:00:00 2001 From: Przemyslaw Brudny Date: Thu, 18 Nov 2021 17:13:05 +0100 Subject: [PATCH] [EGD-7987] Closing window refactor Closing window refactor. --- .../ApplicationDesktop.cpp | 8 ++--- .../application-desktop/CMakeLists.txt | 4 +-- .../include/application-desktop/Names.hpp | 2 +- .../windows/ClosingWindow.cpp | 20 +++++++++++ .../{LogoWindow.hpp => ClosingWindow.hpp} | 7 ++-- .../windows/LogoWindow.cpp | 35 ------------------- 6 files changed, 29 insertions(+), 47 deletions(-) create mode 100644 module-apps/application-desktop/windows/ClosingWindow.cpp rename module-apps/application-desktop/windows/{LogoWindow.hpp => ClosingWindow.hpp} (61%) delete mode 100644 module-apps/application-desktop/windows/LogoWindow.cpp diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index dd7e570f769a3214d8ae309abf0c53f8021cefa4..55b28a2b0bcf445bda854a07b000a9bea804bc18 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -6,7 +6,7 @@ #include "DeadBatteryWindow.hpp" #include "DesktopData.hpp" #include "DesktopMainWindow.hpp" -#include "LogoWindow.hpp" +#include "ClosingWindow.hpp" #include "MenuWindow.hpp" #include "MmiInternalMsgWindow.hpp" #include "MmiPullWindow.hpp" @@ -74,8 +74,8 @@ namespace app }); addActionReceiver(app::manager::actions::DisplayLogoAtExit, [this](auto &&data) { + switchWindow(app::window::name::closing_window, std::move(data)); setSystemCloseInProgress(); - switchWindow(app::window::name::logo_window, std::move(data)); return actionHandled(); }); } @@ -153,8 +153,8 @@ namespace app windowsFactory.attach(dead_battery, [](ApplicationCommon *app, const std::string newname) { return std::make_unique(app); }); - windowsFactory.attach(logo_window, [](ApplicationCommon *app, const std::string newname) { - return std::make_unique(app); + windowsFactory.attach(closing_window, [](ApplicationCommon *app, const std::string newname) { + return std::make_unique(app); }); windowsFactory.attach(charging_battery, [](ApplicationCommon *app, const std::string newname) { return std::make_unique(app); diff --git a/module-apps/application-desktop/CMakeLists.txt b/module-apps/application-desktop/CMakeLists.txt index 649ccfccf1bc08159c58880af28adc4255b6fcf4..e63fc0c9b07bb1d794ad326a04e24e3668e3c427 100644 --- a/module-apps/application-desktop/CMakeLists.txt +++ b/module-apps/application-desktop/CMakeLists.txt @@ -32,8 +32,8 @@ target_sources(application-desktop windows/DeadBatteryWindow.hpp windows/DesktopMainWindow.cpp windows/DesktopMainWindow.hpp - windows/LogoWindow.cpp - windows/LogoWindow.hpp + windows/ClosingWindow.cpp + windows/ClosingWindow.hpp windows/MenuWindow.cpp windows/MenuWindow.hpp windows/MmiInternalMsgWindow.cpp diff --git a/module-apps/application-desktop/include/application-desktop/Names.hpp b/module-apps/application-desktop/include/application-desktop/Names.hpp index f27b484533e5cc7f42899331a8df434b41dad72e..b177cb78b3a36a480de1bc4163879a527e3cccbb 100644 --- a/module-apps/application-desktop/include/application-desktop/Names.hpp +++ b/module-apps/application-desktop/include/application-desktop/Names.hpp @@ -12,7 +12,7 @@ namespace app::window::name inline constexpr auto desktop_reboot = "Reboot"; inline constexpr auto dead_battery = "DeadBatteryWindow"; inline constexpr auto charging_battery = "CharginBatteryWindow"; - inline constexpr auto logo_window = "LogoWindow"; + inline constexpr auto closing_window = "ClosingWindow"; inline constexpr auto desktop_pin_lock = "PinLockWindow"; inline constexpr auto desktop_update = "Update"; inline constexpr auto desktop_update_progress = "UpdateProgress"; diff --git a/module-apps/application-desktop/windows/ClosingWindow.cpp b/module-apps/application-desktop/windows/ClosingWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67347dc48c7342eccc3292fea9ebab15129c0c86 --- /dev/null +++ b/module-apps/application-desktop/windows/ClosingWindow.cpp @@ -0,0 +1,20 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "ClosingWindow.hpp" +#include "Names.hpp" + +namespace gui +{ + ClosingWindow::ClosingWindow(app::ApplicationCommon *app) : AppWindow(app, app::window::name::closing_window) + { + buildInterface(); + } + + void ClosingWindow::buildInterface() + { + AppWindow::buildInterface(); + navBar->setVisible(false); + statusBar->setVisible(false); + } +} /* namespace gui */ diff --git a/module-apps/application-desktop/windows/LogoWindow.hpp b/module-apps/application-desktop/windows/ClosingWindow.hpp similarity index 61% rename from module-apps/application-desktop/windows/LogoWindow.hpp rename to module-apps/application-desktop/windows/ClosingWindow.hpp index 0b51fe353cec333a9c16406e462a363f069f28dc..e5451b6c229753c78a680e577b6c1a3866d36d1f 100644 --- a/module-apps/application-desktop/windows/LogoWindow.hpp +++ b/module-apps/application-desktop/windows/ClosingWindow.hpp @@ -7,13 +7,10 @@ namespace gui { - class LogoWindow : public AppWindow + class ClosingWindow : public AppWindow { public: - explicit LogoWindow(app::ApplicationCommon *app); - void rebuild() override; + explicit ClosingWindow(app::ApplicationCommon *app); void buildInterface() override; - void destroyInterface() override; }; - } /* namespace gui */ diff --git a/module-apps/application-desktop/windows/LogoWindow.cpp b/module-apps/application-desktop/windows/LogoWindow.cpp deleted file mode 100644 index 0e7cde28a51debd0b419d61d01a7ab900abb62b4..0000000000000000000000000000000000000000 --- a/module-apps/application-desktop/windows/LogoWindow.cpp +++ /dev/null @@ -1,35 +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 "LogoWindow.hpp" -#include "Names.hpp" - -#include -#include - -namespace gui -{ - LogoWindow::LogoWindow(app::ApplicationCommon *app) : AppWindow(app, app::window::name::logo_window) - { - buildInterface(); - } - - void LogoWindow::rebuild() - { - destroyInterface(); - buildInterface(); - } - - void LogoWindow::buildInterface() - { - AppWindow::buildInterface(); - navBar->setVisible(false); - statusBar->setVisible(false); - new gui::Image(this, 0, 0, 0, 0, "logo"); - } - - void LogoWindow::destroyInterface() - { - erase(); - } -} /* namespace gui */