From 4452d078f91dc0c6ba4c80f24e7171156b987a0d Mon Sep 17 00:00:00 2001 From: rrandomsky Date: Mon, 29 Apr 2024 14:53:05 +0200 Subject: [PATCH] [BH-1942][BH-1944] New countdown timer in the Power Nap and the Relaxation app The countdown timer in in the Power Nap and the Relaxation app has been changed according to the new design. Now the countdown timer only shows the minutes. --- harmony_changelog.md | 2 ++ .../windows/PowerNapProgressWindow.cpp | 11 ++++++---- .../windows/PowerNapProgressWindow.hpp | 20 +++++++++---------- .../RelaxationRunningProgressWindow.cpp | 8 ++++++-- .../RelaxationRunningProgressWindow.hpp | 14 ++++++------- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/harmony_changelog.md b/harmony_changelog.md index 9cab7649d4611ef7d644c82bfb11ab20f601fc3f..19ac7e01458d9cdf1721fdc0dae1f573a4988ed3 100644 --- a/harmony_changelog.md +++ b/harmony_changelog.md @@ -15,6 +15,8 @@ ### Changed / Improved * Updated button handling during pre-wake up * Updated the countdown timer in Meditation app according to the new design +* Updated the countdown timer in Power nap app according to the new design +* Updated the countdown timer in Relaxation app according to the new design ## [2.6.1 2024-04-02] diff --git a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp index 24f3baecba014e9b4f424ee467ead2ae9f91372b..9c8bff7dad9f3fab805d3ab5759da64bbd2dc2f1 100644 --- a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "PowerNapProgressWindow.hpp" @@ -67,9 +67,12 @@ namespace gui clock->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center)); clock->setMargins(gui::Margins(0, progressStyle::clock::marginTop, 0, 0)); - timer = - new gui::TimeFixedWidget(mainVBox, 0, 0, progressStyle::timer::maxSizeX, progressStyle::timer::maxSizeY); - timer->setFontAndDimensions(progressStyle::timer::font); + timer = new TimeMinuteSecondWidget(mainVBox, + 0, + 0, + progressStyle::timer::maxSizeX, + progressStyle::timer::maxSizeY, + TimeMinuteSecondWidget::DisplayType::OnlyMinutes); timer->setMinimumSize(progressStyle::timer::maxSizeX, progressStyle::timer::maxSizeY); timer->setMargins(gui::Margins(0, progressStyle::timer::marginTop, 0, 0)); timer->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center)); diff --git a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp index 8f7a594eaea7f9c03afef06910efdd26ba39e832..6f6be7c7ab75136d2c0c77ff29ba8e7d494e4e72 100644 --- a/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp @@ -1,11 +1,11 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once #include "presenter/PowerNapProgressPresenter.hpp" #include -#include +#include #include #include #include @@ -32,15 +32,15 @@ namespace gui private: std::shared_ptr presenter; - gui::VBox *mainVBox = nullptr; - gui::ArcProgressBar *progress = nullptr; - gui::TimeFixedWidget *timer = nullptr; - gui::BellStatusClock *clock = nullptr; - gui::Icon *iconPause = nullptr; - gui::Icon *iconRing = nullptr; + VBox *mainVBox{nullptr}; + ArcProgressBar *progress{nullptr}; + TimeMinuteSecondWidget *timer{nullptr}; + BellStatusClock *clock{nullptr}; + Icon *iconPause{nullptr}; + Icon *iconRing{nullptr}; - void setTime(std::time_t newTime); - void setTimeFormat(utils::time::Locale::TimeFormat fmt); + void setTime(std::time_t newTime) override; + void setTimeFormat(utils::time::Locale::TimeFormat fmt) override; RefreshModes updateTime() override; void buildLayout(); void configureTimer(); diff --git a/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp b/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp index b688b0aacaded3a7c62b65f930ed37814473ba30..37b37644c6e0a57863ef13de208746db918f4ba7 100644 --- a/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp +++ b/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp @@ -70,8 +70,12 @@ namespace gui clock->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center)); clock->setMargins(Margins(0, relStyle::clock::marginTop, 0, 0)); - timer = new TimeFixedWidget(mainVBox, 0, 0, relStyle::timer::maxSizeX, relStyle::timer::maxSizeY); - timer->setFontAndDimensions(relStyle::timer::font); + timer = new TimeMinuteSecondWidget(mainVBox, + 0, + 0, + relStyle::timer::maxSizeX, + relStyle::timer::maxSizeY, + TimeMinuteSecondWidget::DisplayType::OnlyMinutes); timer->setMinimumSize(relStyle::timer::maxSizeX, relStyle::timer::maxSizeY); timer->setMargins(Margins(0, relStyle::timer::marginTop, 0, 0)); timer->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center)); diff --git a/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp b/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp index 36846df79e95a75de501bf6556efc89b41da0519..d1a233cb8122754a54a98086c608077131915351 100644 --- a/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp +++ b/products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -26,11 +26,11 @@ namespace gui std::unique_ptr presenter; std::unique_ptr audioContext; - gui::VBox *mainVBox = nullptr; - gui::ArcProgressBar *progress = nullptr; - gui::TimeFixedWidget *timer = nullptr; - gui::Icon *icon = nullptr; - gui::BellStatusClock *clock = nullptr; + VBox *mainVBox{nullptr}; + ArcProgressBar *progress{nullptr}; + TimeMinuteSecondWidget *timer{nullptr}; + Icon *icon{nullptr}; + BellStatusClock *clock{nullptr}; void setTime(std::time_t newTime) override; void setTimeFormat(utils::time::Locale::TimeFormat fmt) override;