~aleteoryx/muditaos

cc0fceaedf7371f88ac9d4d8a7138ad143217255 — Lefucjusz 2 years ago 59efb79
[BH-1826] Implement new countdown progress bar design

Implemented new countdown progress bar design,
used in Relaxation, Meditation and Power Nap
apps. New implementation shows progress
bar as decrementing as the time passes instead
of incrementing.
Cleanups.
M harmony_changelog.md => harmony_changelog.md +2 -1
@@ 17,7 17,8 @@
* Disabled Address Sanitizer for the Linux simulator
* Changed misleading factory reset translations in Polish
* Time setting updated
* Factory reset removes user files 
* Factory reset removes user files
* Changed countdown progress bar design in Relaxation, Meditation and Power Nap apps

## [2.2.3 2023-11-30]


M module-apps/apps-common/widgets/ProgressTimerWithBarGraphAndCounter.cpp => module-apps/apps-common/widgets/ProgressTimerWithBarGraphAndCounter.cpp +5 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ProgressTimerWithBarGraphAndCounter.hpp"


@@ 10,8 10,9 @@

namespace
{
    inline constexpr auto increasingModePrefix = "-";
    constexpr auto increasingModePrefix = "-";
}

namespace app
{
    void ProgressTimerWithBarGraphAndCounter::update()


@@ 31,7 32,8 @@ namespace app
        const auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(duration - elapsed);
        const Duration remainingDuration{secondsRemaining};
        UTF8 timerText;
        if (countdownMode == ProgressCountdownMode::Increasing && secondsRemaining != std::chrono::seconds::zero()) {
        if ((countdownMode == ProgressCountdownMode::Increasing) &&
            (secondsRemaining != std::chrono::seconds::zero())) {
            timerText += increasingModePrefix;
        }
        timerText += remainingDuration.str(displayFormat);

M module-apps/apps-common/widgets/ProgressTimerWithBarGraphAndCounter.hpp => module-apps/apps-common/widgets/ProgressTimerWithBarGraphAndCounter.hpp +1 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once



@@ 36,5 36,4 @@ namespace app
        void attach(gui::Text *_text);
        void attach(gui::TimeFixedWidget *_timeWidget);
    };

} // namespace app

M module-apps/apps-common/widgets/TimeFixedWidget.hpp => module-apps/apps-common/widgets/TimeFixedWidget.hpp +2 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 11,7 11,6 @@

namespace gui
{

    class TimeFixedWidget : public Rect
    {
      public:


@@ 71,5 70,4 @@ namespace gui
        LeftBox leftBox;
        RightBox rightBox;
    };

} /* namespace gui */
} // namespace gui

M module-gui/gui/widgets/ProgressBar.cpp => module-gui/gui/widgets/ProgressBar.cpp +33 -24
@@ 1,7 1,6 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <log/log.hpp>
#include <Math.hpp>

#include "DrawCommand.hpp"


@@ 9,7 8,8 @@

namespace gui
{
    ProgressBar::ProgressBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h) : Rect{parent, x, y, w, h}
    ProgressBar::ProgressBar(Item *parent, std::uint32_t x, std::uint32_t y, std::uint32_t w, std::uint32_t h)
        : Rect{parent, x, y, w, h}
    {
        setFillColor(ColorFullBlack);
        setPenWidth(2);


@@ 19,7 19,7 @@ namespace gui

    void ProgressBar::createWidgets()
    {
        // fillRect is smaller, to avoid border overlaping
        // fillRect is smaller, to avoid border overlapping
        fillRect = new gui::Rect(this, 0, 1, widgetArea.w, widgetArea.h - 2);
        fillRect->setRadius(widgetArea.h / 2 - 1);
        fillRect->setFilled(true);


@@ 60,7 60,7 @@ namespace gui
        gui::Rect::buildDrawListImplementation(commands);
    }

    bool ProgressBar::onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim)
    bool ProgressBar::onDimensionChanged([[maybe_unused]] const BoundingBox &oldDim, const BoundingBox &newDim)
    {
        fillRect->setSize(newDim.w, newDim.h);
        return true;


@@ 122,6 122,7 @@ namespace gui
        const auto absoluteValue = std::lround(static_cast<float>(maxValue) * percent);
        setValue(absoluteValue);
    }

    int CircularProgressBar::getMaximum() const noexcept
    {
        return maxValue;


@@ 145,17 146,21 @@ namespace gui
        Circle::buildDrawListImplementation(commands);
    }

    bool CircularProgressBar::onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim)
    bool CircularProgressBar::onDimensionChanged([[maybe_unused]] const BoundingBox &oldDim,
                                                 [[maybe_unused]] const BoundingBox &newDim)
    {
        return true;
    }

    ArcProgressBar::ArcProgressBar(Item *parent, const Arc::ShapeParams &shape, ProgressDirection direction)
        : Arc{parent, shape}, direction{direction}
    ArcProgressBar::ArcProgressBar(Item *parent,
                                   const Arc::ShapeParams &shape,
                                   ProgressDirection direction,
                                   ProgressChange change)
        : Arc{parent, shape}, direction{direction}, change{change}
    {
        if (direction == ProgressDirection::CounterClockwise) {
            start -= sweep;
        };
        }
        createWidgets();
        updateDrawArea();
    }


@@ 175,13 180,6 @@ namespace gui
            .setSweepAngle(0)
            .setPenWidth(progressArcWidth)
            .setBorderColor(ColorFullBlack);

        if (direction == ProgressDirection::Clockwise) {
            arcParams.setStartAngle(start);
        }
        else {
            arcParams.setStartAngle(start + sweep);
        }
        progressArc = new Arc(this, arcParams);

        Circle::ShapeParams indicatorStartParams;


@@ 227,7 225,17 @@ namespace gui

    bool ArcProgressBar::setValue(unsigned int value) noexcept
    {
        currentValue = std::clamp(value, 0U, maxValue);
        switch (change) {
        case ProgressChange::IncrementFromZero:
            currentValue = std::clamp(value, 0U, maxValue);
            break;
        case ProgressChange::DecrementFromFull:
            currentValue = maxValue - std::clamp(value, 0U, maxValue);
            break;
        default:
            break;
        }

        return value == currentValue;
    }



@@ 252,13 260,14 @@ namespace gui

    void ArcProgressBar::buildDrawListImplementation(std::list<Command> &commands)
    {
        if (direction == ProgressDirection::Clockwise) {
            progressArc->setSweepAngle(std::ceil(getPercentageValue() * sweep));
        const auto dTheta = std::ceil(getPercentageValue() * sweep);

        progressArc->setSweepAngle(dTheta);
        if ((direction == ProgressDirection::Clockwise) != (change == ProgressChange::IncrementFromZero)) {
            progressArc->setStartAngle(start + sweep - dTheta);
        }
        else {
            progressArc->setStartAngle(start + sweep -
                                       std::ceil(getPercentageValue() * sweep)); // Start drawing the circle from top.
            progressArc->setSweepAngle(std::ceil(getPercentageValue() * sweep));
            progressArc->setStartAngle(start);
        }
        progressStartIndicator->setCenter(calculateStartIndicatorCenter());
        progressEndIndicator->setCenter(calculateEndIndicatorCenter());


@@ 266,9 275,9 @@ namespace gui
        Arc::buildDrawListImplementation(commands);
    }

    bool ArcProgressBar::onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim)
    bool ArcProgressBar::onDimensionChanged([[maybe_unused]] const BoundingBox &oldDim,
                                            [[maybe_unused]] const BoundingBox &newDim)
    {
        return true;
    }

} /* namespace gui */

M module-gui/gui/widgets/ProgressBar.hpp => module-gui/gui/widgets/ProgressBar.hpp +13 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 76,9 76,17 @@ namespace gui
            Clockwise,
            CounterClockwise
        };

        enum class ProgressChange
        {
            IncrementFromZero,
            DecrementFromFull
        };

        ArcProgressBar(Item *parent,
                       const Arc::ShapeParams &shape,
                       ProgressDirection direction = ProgressDirection::Clockwise);
                       ProgressDirection direction = ProgressDirection::Clockwise,
                       ProgressChange change       = ProgressChange::IncrementFromZero);

        void setMaximum(unsigned int value) noexcept override;
        auto setValue(unsigned int value) noexcept -> bool override;


@@ 97,9 105,12 @@ namespace gui

        unsigned int maxValue       = 0U;
        unsigned int currentValue   = 0U;

        Arc *progressArc            = nullptr;
        Arc *progressStartIndicator = nullptr;
        Arc *progressEndIndicator   = nullptr;

        ProgressDirection direction = ProgressDirection::Clockwise;
        ProgressChange change       = ProgressChange::IncrementFromZero;
    };
} // namespace gui

M products/BellHybrid/apps/application-bell-meditation-timer/MeditationTimer.cpp => products/BellHybrid/apps/application-bell-meditation-timer/MeditationTimer.cpp +1 -1
@@ 30,7 30,7 @@ namespace app
                                     std::string parent,
                                     StatusIndicators statusIndicators,
                                     StartInBackground startInBackground,
                                     uint32_t stackDepth)
                                     std::uint32_t stackDepth)
        : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth)
    {
        getPopupFilter().addAppDependentFilter([&](const gui::PopupRequestParams &params) {

M products/BellHybrid/apps/application-bell-meditation-timer/data/MeditationStyle.hpp => products/BellHybrid/apps/application-bell-meditation-timer/data/MeditationStyle.hpp +15 -36
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 7,21 7,7 @@

namespace app::meditationStyle
{
    namespace icStyle
    {
        namespace text
        {
            constexpr inline auto font = style::window::font::supersizemelight;
        } // namespace text

        namespace minute
        {
            constexpr inline auto font = style::window::font::largelight;
        } // namespace minute

    } // namespace icStyle

    namespace mrStyle
    namespace runningStyle
    {
        namespace progress
        {


@@ 52,23 38,23 @@ namespace app::meditationStyle
            constexpr inline auto maxSizeX  = 340;
            constexpr inline auto maxSizeY  = 84;
        } // namespace clock
    }     // namespace mrStyle
    }     // namespace runningStyle

    namespace mcStyle
    namespace countdownStyle
    {
        namespace progress
        {
            constexpr inline auto radius                   = mrStyle::progress::radius;
            constexpr inline auto penWidth                 = mrStyle::progress::penWidth;
            constexpr inline auto verticalDeviationDegrees = mrStyle::progress::verticalDeviationDegrees;
            constexpr inline auto radius                   = runningStyle::progress::radius;
            constexpr inline auto penWidth                 = 9;
            constexpr inline auto verticalDeviationDegrees = runningStyle::progress::verticalDeviationDegrees;
        } // namespace progress

        namespace timer
        {
            constexpr inline auto marginTop = 23;
            constexpr inline auto font      = mrStyle::timer::font;
            constexpr inline auto maxSizeX  = mrStyle::timer::maxSizeX;
            constexpr inline auto maxSizeY  = mrStyle::timer::maxSizeY;
            constexpr inline auto font      = runningStyle::timer::font;
            constexpr inline auto maxSizeX  = runningStyle::timer::maxSizeX;
            constexpr inline auto maxSizeY  = runningStyle::timer::maxSizeY;
        } // namespace timer

        namespace description


@@ 78,25 64,18 @@ namespace app::meditationStyle
            constexpr inline auto maxSizeX  = 380;
            constexpr inline auto maxSizeY  = 102;
        } // namespace description
    }     // namespace mcStyle
    }     // namespace countdownStyle

    namespace mtStyle
    namespace timerStyle
    {
        namespace text
        {
            constexpr inline auto font = style::window::font::supersizemelight;
        } // namespace text
        }

        namespace minute
        {
            constexpr inline auto font = style::window::font::largelight;
        } // namespace minute

        namespace list
        {
            constexpr inline auto timeUnitSingular = "common_minute_lower";
            constexpr inline auto timeUnitPlural   = "common_minutes_lower";
            constexpr inline auto timeUnitGenitive = "common_minutes_lower_genitive";
        } // namespace list
    }     // namespace mtStyle
        }
    } // namespace timerStyle
} // namespace app::meditationStyle

M products/BellHybrid/apps/application-bell-meditation-timer/include/application-bell-meditation-timer/MeditationTimer.hpp => products/BellHybrid/apps/application-bell-meditation-timer/include/application-bell-meditation-timer/MeditationTimer.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 25,7 25,7 @@ namespace app
                                 std::string parent                  = "",
                                 StatusIndicators statusIndicators   = StatusIndicators{},
                                 StartInBackground startInBackground = {false},
                                 uint32_t stackDepth                 = 4096 * 2);
                                 std::uint32_t stackDepth            = 1024 * 8);
        ~MeditationTimer();

        sys::ReturnCodes InitHandler() override;

M products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationTimerPresenter.cpp => products/BellHybrid/apps/application-bell-meditation-timer/presenter/MeditationTimerPresenter.cpp +6 -9
@@ 1,9 1,7 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationTimer.hpp"
#include "MeditationCommon.hpp"
#include "MeditationStyle.hpp"
#include "MeditationTimerPresenter.hpp"

#include <common/LanguageUtils.hpp>


@@ 11,11 9,11 @@

namespace
{
    constexpr inline auto spinnerMax   = 180U;
    constexpr inline auto spinnerMin   = 1U;
    constexpr inline auto spinnerStep  = 1U;
    constexpr inline auto emptyValue   = 0U;
    constexpr inline auto defaultValue = 15U;
    constexpr auto spinnerMax   = 180U;
    constexpr auto spinnerMin   = 1U;
    constexpr auto spinnerStep  = 1U;
    constexpr auto emptyValue   = 0U;
    constexpr auto defaultValue = 15U;
} // namespace

namespace app::meditation


@@ 51,7 49,6 @@ namespace app::meditation

    std::string MeditationTimerPresenter::getTimeUnitName(std::uint32_t value)
    {
        using namespace app::meditationStyle::mtStyle::list;
        return utils::language::getCorrectMinutesNumeralForm(value);
    }


M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationCountdownWindow.cpp +16 -17
@@ 13,9 13,9 @@

namespace
{
    inline constexpr auto meditationCountdownTimerName = "MeditationCountdownTimer";
    inline constexpr std::chrono::seconds baseTick{1};
    inline constexpr auto meditationCountdownMode = app::ProgressCountdownMode::Increasing;
    constexpr auto meditationCountdownTimerName{"MeditationCountdownTimer"};
    constexpr std::chrono::seconds meditationCountdownTimerPeriod{1};
    constexpr auto meditationCountdownMode{app::ProgressCountdownMode::Increasing};
} // namespace

namespace gui


@@ 44,10 44,10 @@ namespace gui
    void MeditationCountdownWindow::buildLayout()
    {
        using namespace app::meditationStyle;
        const auto progressArcRadius = mcStyle::progress::radius;
        const auto progressArcWidth  = mcStyle::progress::penWidth;
        const auto arcStartAngle     = -90 + mcStyle::progress::verticalDeviationDegrees;
        const auto arcSweepAngle     = 360 - (2 * mcStyle::progress::verticalDeviationDegrees);
        const auto progressArcRadius = countdownStyle::progress::radius;
        const auto progressArcWidth  = countdownStyle::progress::penWidth;
        const auto arcStartAngle     = -90 + countdownStyle::progress::verticalDeviationDegrees;
        const auto arcSweepAngle     = 360 - (2 * countdownStyle::progress::verticalDeviationDegrees);

        Arc::ShapeParams arcParams;
        arcParams.setCenterPoint(Point(getWidth() / 2, getHeight() / 2))


@@ 63,22 63,22 @@ namespace gui

        description = new Text(mainVBox, 0, 0, 0, 0);
        description->setText(utils::translate("app_meditation_countdown_desc"));
        description->setMaximumSize(mcStyle::description::maxSizeX, mcStyle::description::maxSizeY);
        description->setFont(mcStyle::description::font);
        description->setMaximumSize(countdownStyle::description::maxSizeX, countdownStyle::description::maxSizeY);
        description->setFont(countdownStyle::description::font);
        description->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        description->setMargins(gui::Margins(0, mcStyle::description::marginTop, 0, 0));
        description->setMargins(gui::Margins(0, countdownStyle::description::marginTop, 0, 0));

        timer = new gui::TimeFixedWidget(mainVBox,
                                         0,
                                         0,
                                         mrStyle::timer::maxSizeX,
                                         mrStyle::timer::maxSizeY,
                                         runningStyle::timer::maxSizeX,
                                         runningStyle::timer::maxSizeY,
                                         true,
                                         1,
                                         TimeFixedWidget::RightBox::defaultSize);
        timer->setFontAndDimensions(mcStyle::timer::font);
        timer->setMinimumSize(mcStyle::timer::maxSizeX, mcStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, mcStyle::timer::marginTop, 0, 0));
        timer->setFontAndDimensions(countdownStyle::timer::font);
        timer->setMinimumSize(countdownStyle::timer::maxSizeX, countdownStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, countdownStyle::timer::marginTop, 0, 0));
        timer->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));

        mainVBox->resizeItems();


@@ 112,9 112,8 @@ namespace gui
    void MeditationCountdownWindow::configureTimer()
    {
        auto progressTimer = std::make_unique<app::ProgressTimerWithBarGraphAndCounter>(
            application, *this, meditationCountdownTimerName, baseTick, meditationCountdownMode);
            application, *this, meditationCountdownTimerName, meditationCountdownTimerPeriod, meditationCountdownMode);
        progressTimer->attach(timer);
        presenter->setTimer(std::move(progressTimer));
    }

} // namespace gui

M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationMainWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationMainWindow.cpp +1 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationMainWindow.hpp"


@@ 54,5 54,4 @@ namespace app::meditation

        return settingsOptionList;
    }

} // namespace app::meditation

M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp +25 -21
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationTimer.hpp"


@@ 13,9 13,9 @@

namespace
{
    inline constexpr auto meditationProgressTimerName = "MeditationProgressTimer";
    inline constexpr std::chrono::seconds baseTick{1};
    inline constexpr auto meditationProgressMode = app::ProgressCountdownMode::Increasing;
    constexpr auto meditationProgressTimerName{"MeditationProgressTimer"};
    constexpr std::chrono::seconds meditationProgressTimerPeriod{1};
    constexpr auto meditationProgressMode{app::ProgressCountdownMode::Increasing};
} // namespace

namespace gui


@@ 44,41 44,45 @@ namespace gui
    void MeditationRunningWindow::buildLayout()
    {
        using namespace app::meditationStyle;
        const auto progressArcRadius = mrStyle::progress::radius;
        const auto progressArcWidth  = mrStyle::progress::penWidth;
        const auto arcStartAngle     = -90 - mrStyle::progress::verticalDeviationDegrees;
        const auto arcSweepAngle     = 360 - (2 * mrStyle::progress::verticalDeviationDegrees);
        const auto progressArcRadius = runningStyle::progress::radius;
        const auto progressArcWidth  = runningStyle::progress::penWidth;
        const auto arcStartAngle =
            -90 - runningStyle::progress::verticalDeviationDegrees; // -90 to start drawing the circle from top
        const auto arcSweepAngle     = 360 - (2 * runningStyle::progress::verticalDeviationDegrees);
        const auto arcProgressSteps  = 1000;

        Arc::ShapeParams arcParams;
        arcParams.setCenterPoint(Point(getWidth() / 2, getHeight() / 2))
            .setRadius(progressArcRadius)
            .setStartAngle(arcStartAngle) // Start drawing the circle from top.
            .setStartAngle(arcStartAngle)
            .setSweepAngle(arcSweepAngle)
            .setPenWidth(progressArcWidth)
            .setBorderColor(ColorFullBlack);

        progress = new ArcProgressBar(this, arcParams, ArcProgressBar::ProgressDirection::CounterClockwise);
        progress = new ArcProgressBar(this,
                                      arcParams,
                                      ArcProgressBar::ProgressDirection::CounterClockwise,
                                      ArcProgressBar::ProgressChange::DecrementFromFull);
        progress->setMaximum(arcProgressSteps);

        mainVBox = new VBox(this, 0, 0, style::window_width, style::window_height);

        clock = new BellStatusClock(mainVBox);
        clock->setMaximumSize(mrStyle::clock::maxSizeX, mrStyle::clock::maxSizeY);
        clock->setMaximumSize(runningStyle::clock::maxSizeX, runningStyle::clock::maxSizeY);
        clock->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        clock->setMargins(gui::Margins(0, mrStyle::clock::marginTop, 0, 0));
        clock->setMargins(gui::Margins(0, runningStyle::clock::marginTop, 0, 0));

        timer = new gui::TimeFixedWidget(mainVBox, 0, 0, mrStyle::timer::maxSizeX, mrStyle::timer::maxSizeY);
        timer->setFontAndDimensions(mrStyle::timer::font);
        timer->setMinimumSize(mrStyle::timer::maxSizeX, mrStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, mrStyle::timer::marginTop, 0, 0));
        timer = new gui::TimeFixedWidget(mainVBox, 0, 0, runningStyle::timer::maxSizeX, runningStyle::timer::maxSizeY);
        timer->setFontAndDimensions(runningStyle::timer::font);
        timer->setMinimumSize(runningStyle::timer::maxSizeX, runningStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, runningStyle::timer::marginTop, 0, 0));
        timer->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));

        icon = new Icon(mainVBox, 0, 0, 0, 0, {}, {});
        icon->setMinimumSize(mrStyle::pauseIcon::maxSizeX, mrStyle::pauseIcon::maxSizeY);
        icon->setMargins(gui::Margins(0, mrStyle::pauseIcon::marginTop, 0, 0));
        icon->setMinimumSize(runningStyle::pauseIcon::maxSizeX, runningStyle::pauseIcon::maxSizeY);
        icon->setMargins(gui::Margins(0, runningStyle::pauseIcon::marginTop, 0, 0));
        icon->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        icon->image->set(mrStyle::pauseIcon::image, ImageTypeSpecifier::W_G);
        icon->image->set(runningStyle::pauseIcon::image, ImageTypeSpecifier::W_G);
        icon->setVisible(false);

        mainVBox->resizeItems();


@@ 108,7 112,7 @@ namespace gui
            return true;
        }
        if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF)) {
            reinterpret_cast<app::Application *>(application)->resumeIdleTimer();
            static_cast<app::Application *>(application)->resumeIdleTimer();
            presenter->abandon();
            return true;
        }


@@ 143,7 147,7 @@ namespace gui
    void MeditationRunningWindow::configureTimer()
    {
        auto progressTimer = std::make_unique<app::ProgressTimerWithBarGraphAndCounter>(
            application, *this, meditationProgressTimerName, baseTick, meditationProgressMode);
            application, *this, meditationProgressTimerName, meditationProgressTimerPeriod, meditationProgressMode);
        progressTimer->attach(progress);
        progressTimer->attach(timer);
        presenter->setTimer(std::move(progressTimer));

M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationTimerWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationTimerWindow.cpp +5 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "MeditationTimer.hpp"


@@ 20,6 20,8 @@ namespace app::meditation

    void MeditationTimerWindow::buildInterface()
    {
        using namespace app::meditationStyle;

        AppWindow::buildInterface();

        statusBar->setVisible(false);


@@ 42,7 44,7 @@ namespace app::meditation
            gui::Boundaries::Fixed);
        spinner->onValueChanged = [this](const auto val) { this->onValueChanged(val); };
        spinner->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::h);
        spinner->setFont(app::meditationStyle::mtStyle::text::font);
        spinner->setFont(timerStyle::text::font);
        spinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        spinner->setEdges(RectangleEdge::None);
        spinner->setFocusEdges(RectangleEdge::None);


@@ 55,7 57,7 @@ namespace app::meditation

        bottomDescription = new Label(body->lastBox);
        bottomDescription->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);
        bottomDescription->setFont(app::meditationStyle::mtStyle::minute::font);
        bottomDescription->setFont(timerStyle::minute::font);
        bottomDescription->setEdges(RectangleEdge::None);
        bottomDescription->activeItem = false;
        bottomDescription->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));

M products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp => products/BellHybrid/apps/application-bell-powernap/data/PowerNapStyle.hpp +3 -17
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 7,12 7,9 @@

namespace gui::powerNapStyle
{
    inline constexpr auto descriptionFont = style::window::font::largelight;
    inline constexpr auto napTimerFont    = style::window::font::verybig;
    inline constexpr auto napPeriodFont   = style::window::font::supersizeme;
    inline constexpr auto clockFont       = style::window::font::verybiglight;
    inline constexpr auto napPeriodFont = style::window::font::supersizeme;

    namespace pnStyle
    namespace progressStyle
    {
        namespace progress
        {


@@ 52,16 49,5 @@ namespace gui::powerNapStyle
            constexpr inline auto maxSizeX  = 340;
            constexpr inline auto maxSizeY  = 84;
        } // namespace clock
    }     // namespace pnStyle

    namespace progress
    {
        inline constexpr auto bottomDescTopMargin = 20U;
        inline constexpr auto boxesCount          = 16;
    } // namespace progress

    namespace sessionEnd
    {
        inline constexpr auto textH = 200U;
    }
} // namespace gui::powerNapStyle

M products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp => products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp +23 -19
@@ 10,8 10,8 @@

namespace
{
    constexpr auto powerNapTimerName   = "PowerNapTimer";
    constexpr auto powerNapTimerPeriod = std::chrono::seconds{1};
    constexpr auto powerNapTimerName{"PowerNapTimer"};
    constexpr auto powerNapTimerPeriod{std::chrono::seconds{1}};
} // namespace

namespace gui


@@ 40,10 40,10 @@ namespace gui
    void PowerNapProgressWindow::buildLayout()
    {
        using namespace gui::powerNapStyle;
        const auto progressArcRadius = pnStyle::progress::radius;
        const auto progressArcWidth  = pnStyle::progress::penWidth;
        const auto arcStartAngle     = -90 - pnStyle::progress::verticalDeviationDegrees;
        const auto arcSweepAngle     = 360 - (2 * pnStyle::progress::verticalDeviationDegrees);
        const auto progressArcRadius = progressStyle::progress::radius;
        const auto progressArcWidth  = progressStyle::progress::penWidth;
        const auto arcStartAngle     = -90 - progressStyle::progress::verticalDeviationDegrees;
        const auto arcSweepAngle     = 360 - (2 * progressStyle::progress::verticalDeviationDegrees);
        const auto arcProgressSteps  = 1000;

        Arc::ShapeParams arcParams;


@@ 54,34 54,38 @@ namespace gui
            .setPenWidth(progressArcWidth)
            .setBorderColor(ColorFullBlack);

        progress = new ArcProgressBar(this, arcParams, ArcProgressBar::ProgressDirection::CounterClockwise);
        progress = new ArcProgressBar(this,
                                      arcParams,
                                      ArcProgressBar::ProgressDirection::CounterClockwise,
                                      ArcProgressBar::ProgressChange::DecrementFromFull);
        progress->setMaximum(arcProgressSteps);

        mainVBox = new VBox(this, 0, 0, style::window_width, style::window_height);

        clock = new BellStatusClock(mainVBox);
        clock->setMaximumSize(pnStyle::clock::maxSizeX, pnStyle::clock::maxSizeY);
        clock->setMaximumSize(progressStyle::clock::maxSizeX, progressStyle::clock::maxSizeY);
        clock->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        clock->setMargins(gui::Margins(0, pnStyle::clock::marginTop, 0, 0));
        clock->setMargins(gui::Margins(0, progressStyle::clock::marginTop, 0, 0));

        timer = new gui::TimeFixedWidget(mainVBox, 0, 0, pnStyle::timer::maxSizeX, pnStyle::timer::maxSizeY, true);
        timer->setFontAndDimensions(pnStyle::timer::font);
        timer->setMinimumSize(pnStyle::timer::maxSizeX, pnStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, pnStyle::timer::marginTop, pnStyle::timer::marginRight, 0));
        timer = new gui::TimeFixedWidget(
            mainVBox, 0, 0, progressStyle::timer::maxSizeX, progressStyle::timer::maxSizeY, true);
        timer->setFontAndDimensions(progressStyle::timer::font);
        timer->setMinimumSize(progressStyle::timer::maxSizeX, progressStyle::timer::maxSizeY);
        timer->setMargins(gui::Margins(0, progressStyle::timer::marginTop, progressStyle::timer::marginRight, 0));
        timer->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));

        iconPause = new Icon(mainVBox, 0, 0, 0, 0, {}, {});
        iconPause->setMinimumSize(pnStyle::pauseIcon::maxSizeX, pnStyle::pauseIcon::maxSizeY);
        iconPause->setMargins(gui::Margins(0, pnStyle::pauseIcon::marginTop, 0, 0));
        iconPause->setMinimumSize(progressStyle::pauseIcon::maxSizeX, progressStyle::pauseIcon::maxSizeY);
        iconPause->setMargins(gui::Margins(0, progressStyle::pauseIcon::marginTop, 0, 0));
        iconPause->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        iconPause->image->set(pnStyle::pauseIcon::image, ImageTypeSpecifier::W_G);
        iconPause->image->set(progressStyle::pauseIcon::image, ImageTypeSpecifier::W_G);
        iconPause->setVisible(false);

        iconRing = new Icon(mainVBox, 0, 0, 0, 0, {}, {});
        iconRing->setMinimumSize(pnStyle::ringIcon::maxSizeX, pnStyle::ringIcon::maxSizeY);
        iconRing->setMargins(gui::Margins(0, pnStyle::ringIcon::marginTop, 0, 0));
        iconRing->setMinimumSize(progressStyle::ringIcon::maxSizeX, progressStyle::ringIcon::maxSizeY);
        iconRing->setMargins(gui::Margins(0, progressStyle::ringIcon::marginTop, 0, 0));
        iconRing->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        iconRing->image->set(pnStyle::ringIcon::image, ImageTypeSpecifier::W_G);
        iconRing->image->set(progressStyle::ringIcon::image, ImageTypeSpecifier::W_G);
        iconRing->setVisible(false);

        mainVBox->resizeItems();

M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningLoopWindow.cpp +15 -12
@@ 13,14 13,14 @@

namespace
{
    inline constexpr auto relaxationTimerName = "RelaxationLoopTimer";
    inline constexpr std::chrono::seconds timerTick{1};
    inline constexpr units::SOC dischargingLevelShowTop = 20;
    inline constexpr units::SOC dischargingLowBattery   = 10;
    inline constexpr auto ellipsisSpace                 = 2u;
    inline constexpr auto ellipsis                      = "...";
    constexpr auto relaxationLoopTimerName{"RelaxationLoopTimer"};
    constexpr std::chrono::seconds relaxationLoopTimerPeriod{1};
    constexpr units::SOC dischargingLevelShowTop{20};
    constexpr units::SOC dischargingLowBattery{10};
    constexpr auto ellipsisSpace{2U};
    constexpr auto ellipsis{"..."};
    /* charsMultiplier is set a little bit less than max lines which is 2, because of final text formatting */
    inline constexpr auto charsMultiplier = 1.8f;
    constexpr auto charsMultiplier{1.8f};

    bool isBatteryCharging(const Store::Battery::State state)
    {


@@ 81,10 81,10 @@ namespace
        if (title.length() <= maxTitleLength) {
            return title;
        }
        auto newTittle = title.substr(0, maxTitleLength - ellipsisSpace);
        newTittle += ellipsis;

        return newTittle;
        auto newTitle = title.substr(0, maxTitleLength - ellipsisSpace);
        newTitle += ellipsis;
        return newTitle;
    }
} // namespace



@@ 153,8 153,11 @@ namespace gui

    void RelaxationRunningLoopWindow::configureTimer()
    {
        auto timer = std::make_unique<app::ProgressTimer>(
            application, *this, relaxationTimerName, timerTick, app::ProgressCountdownMode::Increasing);
        auto timer = std::make_unique<app::ProgressTimer>(application,
                                                          *this,
                                                          relaxationLoopTimerName,
                                                          relaxationLoopTimerPeriod,
                                                          app::ProgressCountdownMode::Increasing);
        presenter->setTimer(std::move(timer));
    }


M products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationRunningProgressWindow.cpp +9 -5
@@ 12,9 12,9 @@

namespace
{
    inline constexpr auto relaxationProgressTimerName = "RelaxationProgressTimer";
    inline constexpr std::chrono::seconds baseTick{1};
    inline constexpr auto relaxationProgressMode = app::ProgressCountdownMode::Increasing;
    constexpr auto relaxationProgressTimerName{"RelaxationProgressTimer"};
    constexpr std::chrono::seconds relaxationProgressTimerPeriod{1};
    constexpr auto relaxationProgressMode{app::ProgressCountdownMode::Increasing};
} // namespace

namespace gui


@@ 57,7 57,10 @@ namespace gui
            .setPenWidth(progressArcWidth)
            .setBorderColor(ColorFullBlack);

        progress = new ArcProgressBar(this, arcParams, ArcProgressBar::ProgressDirection::CounterClockwise);
        progress = new ArcProgressBar(this,
                                      arcParams,
                                      ArcProgressBar::ProgressDirection::CounterClockwise,
                                      ArcProgressBar::ProgressChange::DecrementFromFull);
        progress->setMaximum(arcProgressSteps);

        mainVBox = new VBox(this, 0, 0, style::window_width, style::window_height);


@@ 147,7 150,7 @@ namespace gui
    void RelaxationRunningProgressWindow::configureTimer()
    {
        auto progressTimer = std::make_unique<app::ProgressTimerWithBarGraphAndCounter>(
            application, *this, relaxationProgressTimerName, baseTick, relaxationProgressMode);
            application, *this, relaxationProgressTimerName, relaxationProgressTimerPeriod, relaxationProgressMode);
        progressTimer->attach(progress);
        progressTimer->attach(timer);
        presenter->setTimer(std::move(progressTimer));


@@ 177,6 180,7 @@ namespace gui
        auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::UnsupportedMediaType);
        application->switchWindow(gui::window::name::relaxationError, std::move(switchData));
    }

    void RelaxationRunningProgressWindow::handleDeletedFile()
    {
        auto switchData = std::make_unique<RelaxationErrorData>(RelaxationErrorType::FileDeleted);