From a38685be9188ffe883c97382fb2824646aece02c Mon Sep 17 00:00:00 2001 From: Tigran Soghbatyan Date: Mon, 22 Nov 2021 15:22:50 +0100 Subject: [PATCH] [BH-1225] Fix clock formats in apps Set time format onBeforeShow in applications --- .../presenter/MeditationProgressPresenter.cpp | 5 +++++ .../presenter/MeditationProgressPresenter.hpp | 2 ++ .../windows/MeditationRunningWindow.cpp | 2 +- .../presenter/PowerNapProgressPresenter.cpp | 5 +++++ .../presenter/PowerNapProgressPresenter.hpp | 2 ++ .../windows/PowerNapProgressWindow.cpp | 5 +++++ .../windows/PowerNapProgressWindow.hpp | 2 ++ 7 files changed, 22 insertions(+), 1 deletion(-) diff --git a/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.cpp b/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.cpp index eba05cbf57fb1b6c42f70263566c8de6c0057981..057bdd60f87b5446ff43ac60693817c8058a700a 100644 --- a/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.cpp @@ -92,4 +92,9 @@ namespace app::meditation getView()->intervalReached(); } } + + void MeditationProgressPresenter::onBeforeShow() + { + getView()->setTimeFormat(timeModel->getTimeFormat()); + } } // namespace app::meditation diff --git a/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.hpp b/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.hpp index 45678fa37b6486fa830da8b0c3c21633c01e9c09..d323aeb52bcd7303c28b31d2ce6208da09ee710f 100644 --- a/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.hpp +++ b/products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationProgressPresenter.hpp @@ -51,6 +51,7 @@ namespace app::meditation virtual void resume() = 0; virtual void abandon() = 0; virtual void finish() = 0; + virtual void onBeforeShow() = 0; }; }; @@ -82,5 +83,6 @@ namespace app::meditation void resume() override; void abandon() override; void finish() override; + void onBeforeShow() override; }; } // namespace app::meditation diff --git a/products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp b/products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp index cd113fe064da979fc492df600ab366c82f700cab..64282892aa106d46d0677cfe7d03965f0626c17f 100644 --- a/products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp +++ b/products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp @@ -108,7 +108,7 @@ namespace gui void MeditationRunningWindow::onBeforeShow(ShowMode mode, SwitchData *data) { AppWindow::onBeforeShow(mode, data); - + presenter->onBeforeShow(); if (mode == ShowMode::GUI_SHOW_INIT) { playGong(); presenter->start(); diff --git a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp index 2d397615f7d651051dabde9f2f730ca9e0d37ff1..bc2b5363978e5ba0c56e7f1b207a774962920942 100644 --- a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.cpp @@ -78,4 +78,9 @@ namespace app::powernap return napFinished; } + void PowerNapProgressPresenter::onBeforeShow() + { + getView()->setTimeFormat(timeModel->getTimeFormat()); + } + } // 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 0a8b62a2b487978be9f5af65954c765f621f44db..b0b77b8b845f6bcef107d6105a1f04209669f039 100644 --- a/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/presenter/PowerNapProgressPresenter.hpp @@ -46,6 +46,7 @@ namespace app::powernap virtual void setTimer(std::unique_ptr &&timer) = 0; virtual void handleUpdateTimeEvent() = 0; virtual bool isNapFinished() = 0; + virtual void onBeforeShow() = 0; }; }; @@ -68,6 +69,7 @@ namespace app::powernap void onNapFinished(); void onNapAlarmFinished(); + void onBeforeShow() override; public: PowerNapProgressPresenter(app::ApplicationCommon *app, diff --git a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp index e362083b7b822e9ca79497ca7458d119341cc1fb..73397d4d4ee8af63703c462ab4b9ac5ced98cd6a 100644 --- a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp @@ -141,4 +141,9 @@ namespace gui } return true; } + + void PowerNapProgressWindow::onBeforeShow(ShowMode mode, SwitchData *data) + { + presenter->onBeforeShow(); + } } // namespace gui diff --git a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp index 606a7cea3bdc0e44c048bbe8a91230f077bd8b78..fcc9f79bd96f53bb5e41ae3555f139b2fe2d9338 100644 --- a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp @@ -30,6 +30,8 @@ namespace gui void napEnded() override; + void onBeforeShow(ShowMode mode, SwitchData *data) override; + public: PowerNapProgressWindow(app::ApplicationCommon *app, std::shared_ptr presenter);