From 8550b2b9eda6ebf16981d726c371ae9a09290347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jo=C5=84ski?= Date: Fri, 8 Oct 2021 12:44:26 +0200 Subject: [PATCH] [BH-992] Correct clock widget in powernap Correct clock widget in powernap application --- .../ApplicationBellPowerNap.cpp | 13 +++++---- .../data/PowerNapStyle.hpp | 4 ++- .../presenter/PowerNapProgressPresenter.cpp | 11 ++++++-- .../presenter/PowerNapProgressPresenter.hpp | 18 +++++++++--- .../windows/PowerNapProgressWindow.cpp | 28 ++++++++++++++++++- .../windows/PowerNapProgressWindow.hpp | 6 ++++ .../windows/PowerNapSessionEndedWindow.cpp | 1 + .../BellHybrid/apps/common/CMakeLists.txt | 2 ++ .../include/common/data/StyleCommon.hpp | 7 +++-- .../common/widgets/BellStatusClock.hpp | 22 +++++++++++++++ .../common/src/widgets/BellStatusClock.cpp | 21 ++++++++++++++ 11 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 products/BellHybrid/apps/common/include/common/widgets/BellStatusClock.hpp create mode 100644 products/BellHybrid/apps/common/src/widgets/BellStatusClock.cpp diff --git a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp index 3e067d88e4fcf1f176aeed92693375af1986febb..4270b51c599c8b46fa2b9b94f7ea1142d43bd341 100644 --- a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp @@ -9,6 +9,7 @@ #include "windows/PowerNapMainWindow.hpp" #include "windows/PowerNapProgressWindow.hpp" #include "windows/PowerNapSessionEndedWindow.hpp" +#include #include namespace app @@ -39,11 +40,13 @@ namespace app auto presenter = std::make_unique(app, settings.get()); return std::make_unique(app, std::move(presenter)); }); - windowsFactory.attach( - gui::window::name::powernapProgress, [this](ApplicationCommon *app, const std::string &name) { - auto presenter = std::make_unique(app, settings.get(), *alarm); - return std::make_unique(app, std::move(presenter)); - }); + windowsFactory.attach(gui::window::name::powernapProgress, + [this](ApplicationCommon *app, const std::string &name) { + auto timeModel = std::make_unique(); + auto presenter = std::make_unique( + app, settings.get(), *alarm, std::move(timeModel)); + return std::make_unique(app, std::move(presenter)); + }); windowsFactory.attach(gui::window::name::powernapSessionEnded, [](ApplicationCommon *app, const std::string &name) { auto presenter = std::make_unique(app); diff --git a/products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp b/products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp index 36de3a90098e6da8558ed4b1af8b34f5b73ee7e3..30e4b3470d06f1ebeb00594f868168256218a20a 100644 --- a/products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp @@ -8,7 +8,9 @@ namespace gui::powerNapStyle { inline constexpr auto descriptionFont = style::window::font::largelight; - inline constexpr auto napPeriodFont = style::window::font::supersizemelight; + inline constexpr auto napTimerFont = style::window::font::verybig; + inline constexpr auto napPeriodFont = style::window::font::supersizeme; + inline constexpr auto clockFont = style::window::font::verybiglight; namespace listItem { inline constexpr auto timeUnitSingular = "common_minute_lower"; diff --git a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp index 2c501f67580d5e866b8f987fb2b80eba64ccf6f0..67f72c03b77575114512b76b289321eec61085e6 100644 --- a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp @@ -7,6 +7,7 @@ #include "widgets/PowerNapAlarm.hpp" #include +#include #include #include #include @@ -22,8 +23,9 @@ namespace app::powernap { PowerNapProgressPresenter::PowerNapProgressPresenter(app::ApplicationCommon *app, settings::Settings *settings, - PowerNapAlarm &alarm) - : app{app}, settings{settings}, alarm{alarm}, + PowerNapAlarm &alarm, + std::unique_ptr timeModel) + : app{app}, settings{settings}, alarm{alarm}, timeModel{std::move(timeModel)}, napAlarmTimer{sys::TimerFactory::createSingleShotTimer( app, powernapAlarmTimerName, powernapAlarmTimeout, [this](sys::Timer &) { onNapAlarmFinished(); })} @@ -59,4 +61,9 @@ namespace app::powernap getView()->napEnded(); } + void PowerNapProgressPresenter::handleUpdateTimeEvent() + { + getView()->setTime(timeModel->getCurrentTime()); + } + } // namespace app::powernap diff --git a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp index 38bfa3738bdd69b95f2a3d355c81ae57f7af7691..73ba1c9cda0eba432d65c9d9eaaaf597b147a356 100644 --- a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp @@ -5,10 +5,12 @@ #include #include +#include