~aleteoryx/muditaos

265fcd41f1c945454202e405b62b0a69fd285f93 — Paweł Joński 3 years ago 24f27ac
[BH-1339] Homescreen snooze time format

Homescreen snooze time format
M products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp => products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp +1 -0
@@ 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()

M products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp => products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.hpp +1 -0
@@ 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;


M products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp => products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.cpp +8 -3
@@ 6,7 6,6 @@
#include <RawFont.hpp>
#include <gui/widgets/Label.hpp>
#include <gui/widgets/ImageBox.hpp>
#include <apps-common/widgets/TimeSetSpinner.hpp>

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 */

M products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp => products/BellHybrid/apps/application-bell-main/widgets/SnoozeTimer.hpp +3 -1
@@ 3,6 3,7 @@

#pragma once

#include <apps-common/widgets/TimeSetFmtSpinner.hpp>
#include <gui/widgets/BoxLayout.hpp>
#include <gui/widgets/Style.hpp>
#include <gui/widgets/text/TextFixedSize.hpp>


@@ 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;

M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +5 -0
@@ 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) {

M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp +1 -0
@@ 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;