From 265fcd41f1c945454202e405b62b0a69fd285f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jo=C5=84ski?= Date: Tue, 21 Dec 2021 12:57:21 +0100 Subject: [PATCH] [BH-1339] Homescreen snooze time format Homescreen snooze time format --- .../presenters/HomeScreenPresenter.cpp | 1 + .../presenters/HomeScreenPresenter.hpp | 1 + .../application-bell-main/widgets/SnoozeTimer.cpp | 11 ++++++++--- .../application-bell-main/widgets/SnoozeTimer.hpp | 4 +++- .../windows/BellHomeScreenWindow.cpp | 5 +++++ .../windows/BellHomeScreenWindow.hpp | 1 + 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp index 9fe8bca57447e552fd5e9c7a6f20f523bfb944ac..b93616bfef5f8ce7a47c4df0fd1429fdbac07606 100644 --- a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp @@ -72,6 +72,7 @@ namespace app::home_screen getView()->setTimeFormat(timeModel->getTimeFormat()); getView()->setTime(timeModel->getCurrentTime()); getView()->setAlarmTimeFormat(timeModel->getTimeFormat()); + getView()->setSnoozeFormat(timeModel->getTimeFormat()); getView()->setTemperature(temperatureModel->getTemperature()); } void HomeScreenPresenter::createData() diff --git a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp index 1b574f9482edf83c67c4428bd502fc51c487961f..fb60bbd95f9f75d19ec68b0dcc667be22fe14f81 100644 --- a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp +++ b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp @@ -61,6 +61,7 @@ namespace app::home_screen virtual std::time_t getAlarmTime() const = 0; virtual void setAlarmTime(std::time_t time) = 0; virtual void setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) = 0; + virtual void setSnoozeFormat(utils::time::Locale::TimeFormat fmt) = 0; virtual void incAlarmMinute() = 0; virtual void decAlarmMinute() = 0; diff --git a/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp b/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp index 549492ae04e78d9a900b7f5c18e3d30057102259..6d0c074002df7da28ffb019c7394d8aa97e07269 100644 --- a/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp +++ b/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp @@ -6,7 +6,6 @@ #include #include #include -#include namespace gui { @@ -20,7 +19,7 @@ namespace gui alarmImg->setMargins(Margins(10U, 0, 10U, 0)); alarmImg->setMinimumSizeToFitImage(); - timeSpinner = new TimeSetSpinner(this); + timeSpinner = new TimeSetFmtSpinner(this); timeSpinner->setFont(style::window::font::largelight); timeSpinner->setEditMode(EditMode::Browse); timeSpinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center)); @@ -38,11 +37,17 @@ namespace gui auto SnoozeTimer::setTime(std::uint8_t mins, std::uint8_t secs) noexcept -> void { - timeSpinner->setTime(mins, secs); + timeSpinner->setHour(mins); + timeSpinner->setMinute(secs); } auto SnoozeTimer::setTime(std::time_t time) noexcept -> void { timeSpinner->setTime(time); } + auto SnoozeTimer::setTimeFormat(utils::time::Locale::TimeFormat fmt) noexcept -> void + { + timeSpinner->setTimeFormat(fmt); + } + } /* namespace gui */ diff --git a/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp b/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp index a498d063e18cd41c3b625ff03bafbab480dd28db..9bec0781905b27708c83329821e5e7f65de4a470 100644 --- a/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp +++ b/products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp @@ -3,6 +3,7 @@ #pragma once +#include #include #include #include @@ -32,9 +33,10 @@ namespace gui auto setFont(std::string newFontName) noexcept -> void; auto setTime(std::uint8_t mins, std::uint8_t secs) noexcept -> void; auto setTime(std::time_t time) noexcept -> void; + auto setTimeFormat(utils::time::Locale::TimeFormat fmt) noexcept -> void; private: - TimeSetSpinner *timeSpinner = nullptr; + TimeSetFmtSpinner *timeSpinner = nullptr; Status alarmStatus = Status::DEACTIVATED; std::string fontName = style::window::font::largelight; diff --git a/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp b/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp index 34dbb909ba586826c92b8809022bea78efc77cbc..13bb41eca940011ff6b942fdcb8fdc4a180114ef 100644 --- a/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +++ b/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp @@ -242,6 +242,11 @@ namespace gui alarm->setTimeFormat(fmt); } + void BellHomeScreenWindow::setSnoozeFormat(utils::time::Locale::TimeFormat fmt) + { + snoozeTimer->setTimeFormat(fmt); + } + void BellHomeScreenWindow::setAlarmEdit(bool val) { if (not val) { diff --git a/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp b/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp index 29e72fc2a642fcc60b7d8c70fe485f84b4a9e10b..0a8f891002d554df69ef2e8afd5d128b76908430 100644 --- a/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp +++ b/products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp @@ -62,6 +62,7 @@ namespace gui void setTime(std::time_t newTime) override; void setTimeFormat(utils::time::Locale::TimeFormat fmt) override; void setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) override; + void setSnoozeFormat(utils::time::Locale::TimeFormat fmt) override; void switchToMenu() override; void switchToBatteryStatus() override;