~aleteoryx/muditaos

29c49d2007a16ae3f23011e735522a45cf58e2b0 — Dawid Wojtas 3 years ago 89962fa
[BH-1603] Rename BGSounds to Relaxation

Rename all files and classes. Only
filesystem paths have old name due to legacy.
38 files changed, 339 insertions(+), 337 deletions(-)

M image/assets/lang/Deutsch.json
M image/assets/lang/English.json
M image/assets/lang/Espanol.json
M image/assets/lang/Francais.json
M image/assets/lang/Polski.json
M module-apps/tests/widgets/test-DigitsContainer.cpp
M products/BellHybrid/BellHybridMain.cpp
M products/BellHybrid/CMakeLists.txt
M products/BellHybrid/apps/CMakeLists.txt
D products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt
M products/BellHybrid/apps/application-bell-main/CMakeLists.txt
M products/BellHybrid/apps/application-bell-main/windows/BellMainMenuWindow.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/ApplicationBellBackgroundSounds => application-bell-relaxation/ApplicationBellRelaxation}.cpp
A products/BellHybrid/apps/application-bell-relaxation/CMakeLists.txt
R products/BellHybrid/apps/{application-bell-background-sounds/data/BGSoundsAudioData => application-bell-relaxation/data/RelaxationAudioData}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/data/BGSoundsCommon => application-bell-relaxation/data/RelaxationCommon}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/data/BGSoundsStyle => application-bell-relaxation/data/RelaxationStyle}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds => application-bell-relaxation/include/application-bell-relaxation/ApplicationBellRelaxation}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter => application-bell-relaxation/presenter/RelaxationMainWindowPresenter}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter => application-bell-relaxation/presenter/RelaxationMainWindowPresenter}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsProgressPresenter => application-bell-relaxation/presenter/RelaxationProgressPresenter}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsProgressPresenter => application-bell-relaxation/presenter/RelaxationProgressPresenter}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsTimerSelectPresenter => application-bell-relaxation/presenter/RelaxationTimerSelectPresenter}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsTimerSelectPresenter => application-bell-relaxation/presenter/RelaxationTimerSelectPresenter}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsVolumePresenter => application-bell-relaxation/presenter/RelaxationVolumePresenter}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/presenter/BGSoundsVolumePresenter => application-bell-relaxation/presenter/RelaxationVolumePresenter}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/widgets/BGSoundsPlayer => application-bell-relaxation/widgets/RelaxationPlayer}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/widgets/BGSoundsPlayer => application-bell-relaxation/widgets/RelaxationPlayer}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsMainWindow => application-bell-relaxation/windows/RelaxationMainWindow}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsMainWindow => application-bell-relaxation/windows/RelaxationMainWindow}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsPausedWindow => application-bell-relaxation/windows/RelaxationPausedWindow}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsPausedWindow => application-bell-relaxation/windows/RelaxationPausedWindow}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsProgressWindow => application-bell-relaxation/windows/RelaxationProgressWindow}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsProgressWindow => application-bell-relaxation/windows/RelaxationProgressWindow}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsTimerSelectWindow => application-bell-relaxation/windows/RelaxationTimerSelectWindow}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsTimerSelectWindow => application-bell-relaxation/windows/RelaxationTimerSelectWindow}.hpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsVolumeWindow => application-bell-relaxation/windows/RelaxationVolumeWindow}.cpp
R products/BellHybrid/apps/{application-bell-background-sounds/windows/BGSoundsVolumeWindow => application-bell-relaxation/windows/RelaxationVolumeWindow}.hpp
M image/assets/lang/Deutsch.json => image/assets/lang/Deutsch.json +3 -3
@@ 644,13 644,13 @@
  "app_bellmain_alarm": "Alarm",
  "app_bellmain_power_nap": "Kraft-Schläfchen",
  "app_bellmain_meditation_timer": "Meditation",
  "app_bellmain_background_sounds": "Entspannung",
  "app_bellmain_relaxation": "Entspannung",
  "app_bellmain_bedtime": "Schlafenzeit",
  "app_bellmain_settings": "Einstellungen",
  "app_bell_bedtime_notification": "Schlafenszeit",
  "app_bell_alarm_set_not_active": "<text>Alarm eingestellt.<br />Tief drücken, um zu aktivieren.</text>",
  "app_bell_background_sounds_timer_title": "Timer",
  "app_bell_background_sounds_timer_off": "AUS",
  "app_bell_relaxation_timer_title": "Timer",
  "app_bell_relaxation_timer_off": "AUS",
  "app_bell_onboarding_welcome_message": "<text>Mudita Harmony<br/>ist ausgeschaltet</text>",
  "app_bell_onboarding_info_rotate": "<text weight='regular' size='38'>Drehen </text><text weight='light' size='38'> um auszuwählen</text>",
  "app_bell_onboarding_info_light_click": "<text weight='regular' size='38'>Leichter Klick </text><text weight='light' size='38'>um fortzufahren</text>",

M image/assets/lang/English.json => image/assets/lang/English.json +2 -2
@@ 620,7 620,7 @@
  "app_bell_bedtime_notification": "It is your bedtime",
  "app_bellmain_power_nap": "Power nap",
  "app_bellmain_meditation_timer": "Meditation",
  "app_bellmain_background_sounds": "Relaxation",
  "app_bellmain_relaxation": "Relaxation",
  "app_bellmain_settings": "Settings",
  "app_bellmain_main_window_title": "Mudita Harmony",
  "app_bell_meditation_timer": "Meditation",


@@ 700,7 700,7 @@
  "app_bell_settings_frontlight_mode_top_message": "Frontlight mode",
  "app_bell_settings_frontlight_mode_auto": "auto",
  "app_bell_settings_frontlight_mode_on_demand": "on demand",
  "app_bell_background_sounds_timer_title": "Auto turn off",
  "app_bell_relaxation_timer_title": "Auto turn off",
  "app_bell_turn_off_question": "Turn off Mudita Harmony?",
  "app_bell_goodbye": "Goodbye",
  "app_bell_reset_message": "<text>Resetting Mudita<br />Harmony</text>",

M image/assets/lang/Espanol.json => image/assets/lang/Espanol.json +3 -3
@@ 650,12 650,12 @@
  "app_bellmain_alarm": "Alarma",
  "app_bellmain_power_nap": "Siesta",
  "app_bellmain_meditation_timer": "Meditación",
  "app_bellmain_background_sounds": "Relajación",
  "app_bellmain_relaxation": "Relajación",
  "app_bellmain_bedtime": "Hora de dormir",
  "app_bellmain_settings": "Ajustes",
  "app_bell_bedtime_notification": "Es tu hora de dormir",
  "app_bell_background_sounds_timer_title": "Temporizador",
  "app_bell_background_sounds_timer_off": "OFF",
  "app_bell_relaxation_timer_title": "Temporizador",
  "app_bell_relaxation_timer_off": "OFF",
  "app_bell_settings_home_view": "Vista de inicio",
  "app_bell_settings_alarm_settings": "Ajustes de alarma",
  "app_bell_settings_alarm_settings_title": "Ajustes de alarma",

M image/assets/lang/Francais.json => image/assets/lang/Francais.json +3 -3
@@ 623,10 623,10 @@
  "app_bell_onboarding_welcome": "Bienvenu",
  "app_bellmain_home_screen_bottom_desc_dp": "Appuyer fort pour activer",
  "app_bellmain_alarm": "Alarme",
  "app_bellmain_background_sounds": "Bruits de fond",
  "app_bellmain_relaxation": "Bruits de fond",
  "app_bell_alarm_set_not_active": "<text>Alarme réglée.<br />Appuyer fort pour activer.</text>",
  "app_bell_background_sounds_timer_title": "Minuterie",
  "app_bell_background_sounds_timer_off": "OFF",
  "app_bell_relaxation_timer_title": "Minuterie",
  "app_bell_relaxation_timer_off": "OFF",
  "app_bell_settings_home_view": "Écran d'accueil",
  "app_bell_settings_alarm_settings": "Alarme",
  "app_bell_settings_alarm_settings_title": "Alarme",

M image/assets/lang/Polski.json => image/assets/lang/Polski.json +3 -3
@@ 655,7 655,7 @@
  "app_bell_bedtime_notification": "Pora na sen",
  "app_bellmain_power_nap": "Drzemka",
  "app_bellmain_meditation_timer": "Medytacja",
  "app_bellmain_background_sounds": "Relaks",
  "app_bellmain_relaxation": "Relaks",
  "app_bellmain_settings": "Ustawienia",
  "app_bellmain_main_window_title": "Mudita Harmony",
  "app_bell_onboarding_welcome_message": "<text>Mudita Harmony<br/>jest wyłączony</text>",


@@ 696,8 696,8 @@
    "<text>Dzień dobry!<br />Pobudka</text>"
  ],
  "app_bell_alarm_set_not_active": "Naciśnij głęboko, aby aktywować.",
  "app_bell_background_sounds_timer_title": "Wyłącznik czasowy",
  "app_bell_background_sounds_timer_off": "Wyłączony",
  "app_bell_relaxation_timer_title": "Wyłącznik czasowy",
  "app_bell_relaxation_timer_off": "Wyłączony",
  "app_bell_settings_alarm_settings_prewake_up": "Wstępne budzenie",
  "app_bell_settings_alarm_settings_prewake_up_chime_top_description": "Wstępne budzenie",
  "app_bell_settings_alarm_settings_prewake_up_chime_bottom_description": "przed alarmem",

M module-apps/tests/widgets/test-DigitsContainer.cpp => module-apps/tests/widgets/test-DigitsContainer.cpp +1 -1
@@ 4,7 4,7 @@
#include <gtest/gtest.h>
#include <apps-common/widgets/TimeFixedWidget.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>
#include <products/BellHybrid/apps/application-bell-background-sounds/data/BGSoundsStyle.hpp>
#include <products/BellHybrid/apps/application-bell-background-sounds/data/RelaxationStyle.hpp>
#include <gui/core/FontManager.hpp>
#include <mock/InitializedFontManager.hpp>


M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +2 -2
@@ 7,7 7,7 @@
// applications
#include <application-bell-alarm/ApplicationBellAlarm.hpp>
#include <application-bell-onboarding/ApplicationBellOnBoarding.hpp>
#include <application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp>
#include <application-bell-relaxation/ApplicationBellRelaxation.hpp>
#include <application-bell-bedtime/ApplicationBellBedtime.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>
#include <application-bell-meditation-timer/MeditationTimer.hpp>


@@ 134,7 134,7 @@ int main()
            applications.push_back(
                app::CreateLauncher<app::ApplicationBellOnBoarding>(app::applicationBellOnBoardingName));
            applications.push_back(
                app::CreateLauncher<app::ApplicationBellBackgroundSounds>(app::applicationBellBackgroundSoundsName));
                app::CreateLauncher<app::ApplicationBellRelaxation>(app::applicationBellRelaxationName));
            applications.push_back(app::CreateLauncher<app::MeditationTimer>(app::MeditationTimer::defaultName));
            // start application manager
            return sysmgr->RunSystemService(

M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +1 -1
@@ 42,7 42,7 @@ target_link_libraries(BellHybrid
        appmgr
        bell::app-alarm
        bell::app-onboarding
        bell::app-background-sounds
        bell::app-relaxation
        bell::app-bedtime
        bell::app-common
        bell::app-main

M products/BellHybrid/apps/CMakeLists.txt => products/BellHybrid/apps/CMakeLists.txt +1 -1
@@ 24,7 24,7 @@ target_link_libraries(app

add_subdirectory(application-bell-main)
add_subdirectory(application-bell-onboarding)
add_subdirectory(application-bell-background-sounds)
add_subdirectory(application-bell-relaxation)
add_subdirectory(application-bell-alarm)
add_subdirectory(application-bell-bedtime)
add_subdirectory(application-bell-meditation-timer)

D products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt => products/BellHybrid/apps/application-bell-background-sounds/CMakeLists.txt +0 -56
@@ 1,56 0,0 @@
add_library(application-bell-background-sounds STATIC)
add_library(bell::app-background-sounds ALIAS application-bell-background-sounds)

target_include_directories(application-bell-background-sounds
    PRIVATE
        $<BUILD_INTERFACE:
            include/application-bell-background-sounds
        >
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_sources(application-bell-background-sounds
    PRIVATE
        ApplicationBellBackgroundSounds.cpp
        presenter/BGSoundsMainWindowPresenter.cpp
        presenter/BGSoundsProgressPresenter.cpp
        presenter/BGSoundsTimerSelectPresenter.cpp
        presenter/BGSoundsVolumePresenter.cpp
        widgets/BGSoundsPlayer.cpp
        windows/BGSoundsMainWindow.cpp
        windows/BGSoundsPausedWindow.cpp
        windows/BGSoundsProgressWindow.cpp
        windows/BGSoundsTimerSelectWindow.cpp
        windows/BGSoundsVolumeWindow.cpp

        data/BGSoundsCommon.hpp
        data/BGSoundsStyle.hpp
        data/BGSoundsAudioData.hpp
        widgets/BGSoundsPlayer.hpp
        windows/BGSoundsMainWindow.hpp
        presenter/BGSoundsMainWindowPresenter.hpp
        presenter/BGSoundsProgressPresenter.hpp
        presenter/BGSoundsTimerSelectPresenter.hpp
        presenter/BGSoundsVolumePresenter.hpp
        windows/BGSoundsMainWindow.hpp
        windows/BGSoundsPausedWindow.hpp
        windows/BGSoundsProgressWindow.hpp
        windows/BGSoundsTimerSelectWindow.hpp
        windows/BGSoundsVolumeWindow.hpp

    PUBLIC
        include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp
)

target_link_libraries(application-bell-background-sounds
    PRIVATE
        apps-common
        bell::audio
        bell::alarms
        Microsoft.GSL::GSL

    PUBLIC
        module-gui
        bell::app-common
)

M products/BellHybrid/apps/application-bell-main/CMakeLists.txt => products/BellHybrid/apps/application-bell-main/CMakeLists.txt +1 -1
@@ 52,7 52,7 @@ target_link_libraries(application-bell-main
        bell::evtmgr
        bell::app-alarm
        bell::app-onboarding
        bell::app-background-sounds
        bell::app-relaxation
        bell::app-bedtime
        bell::app-meditation-timer
        bell::app-settings

M products/BellHybrid/apps/application-bell-main/windows/BellMainMenuWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellMainMenuWindow.cpp +2 -2
@@ 4,7 4,7 @@
#include "BellMainMenuWindow.hpp"

#include <application-bell-alarm/ApplicationBellAlarm.hpp>
#include <application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp>
#include <application-bell-relaxation/ApplicationBellRelaxation.hpp>
#include <application-bell-bedtime/ApplicationBellBedtime.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>
#include <application-bell-meditation-timer/MeditationTimer.hpp>


@@ 48,7 48,7 @@ namespace gui

        addAppMenu(utils::translate("app_bellmain_alarm"), app::applicationBellAlarmName);
        addAppMenu(utils::translate("app_bellmain_power_nap"), app::applicationBellPowerNapName);
        addAppMenu(utils::translate("app_bellmain_background_sounds"), app::applicationBellBackgroundSoundsName);
        addAppMenu(utils::translate("app_bellmain_relaxation"), app::applicationBellRelaxationName);
        addAppMenu(utils::translate("app_bellmain_meditation_timer"), app::MeditationTimer::defaultName);
        addAppMenu(utils::translate("app_bellmain_bedtime"), app::applicationBellBedtimeName);
        addAppMenu(utils::translate("app_bellmain_settings"), app::applicationBellSettingsName);

R products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp => products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +38 -38
@@ 1,17 1,17 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ApplicationBellBackgroundSounds.hpp"
#include "presenter/BGSoundsMainWindowPresenter.hpp"
#include "presenter/BGSoundsTimerSelectPresenter.hpp"
#include "presenter/BGSoundsProgressPresenter.hpp"
#include "presenter/BGSoundsVolumePresenter.hpp"
#include "windows/BGSoundsMainWindow.hpp"
#include "windows/BGSoundsPausedWindow.hpp"
#include "windows/BGSoundsProgressWindow.hpp"
#include "windows/BGSoundsTimerSelectWindow.hpp"
#include "windows/BGSoundsVolumeWindow.hpp"
#include "widgets/BGSoundsPlayer.hpp"
#include "ApplicationBellRelaxation.hpp"
#include "presenter/RelaxationMainWindowPresenter.hpp"
#include "presenter/RelaxationTimerSelectPresenter.hpp"
#include "presenter/RelaxationProgressPresenter.hpp"
#include "presenter/RelaxationVolumePresenter.hpp"
#include "windows/RelaxationMainWindow.hpp"
#include "windows/RelaxationPausedWindow.hpp"
#include "windows/RelaxationProgressWindow.hpp"
#include "windows/RelaxationTimerSelectWindow.hpp"
#include "windows/RelaxationVolumeWindow.hpp"
#include "widgets/RelaxationPlayer.hpp"
#include <AlarmSoundPaths.hpp>
#include <apps-common/messages/AppMessage.hpp>
#include <apps-common/models/SongsRepository.hpp>


@@ 23,20 23,20 @@

namespace app
{
    ApplicationBellBackgroundSounds::ApplicationBellBackgroundSounds(std::string name,
                                                                     std::string parent,
                                                                     StatusIndicators statusIndicators,
                                                                     StartInBackground startInBackground,
                                                                     uint32_t stackDepth)
    ApplicationBellRelaxation::ApplicationBellRelaxation(std::string name,
                                                         std::string parent,
                                                         StatusIndicators statusIndicators,
                                                         StartInBackground startInBackground,
                                                         uint32_t stackDepth)
        : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth),
          audioModel{std::make_unique<AudioModel>(this)}
    {
        player = std::make_unique<bgSounds::BGSoundsPlayer>(*audioModel);
        player = std::make_unique<relaxation::RelaxationPlayer>(*audioModel);
        bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications);
    }
    ApplicationBellBackgroundSounds::~ApplicationBellBackgroundSounds() = default;
    ApplicationBellRelaxation::~ApplicationBellRelaxation() = default;

    sys::ReturnCodes ApplicationBellBackgroundSounds::InitHandler()
    sys::ReturnCodes ApplicationBellRelaxation::InitHandler()
    {
        auto ret = Application::InitHandler();
        if (ret != sys::ReturnCodes::Success) {


@@ 47,35 47,35 @@ namespace app
        return sys::ReturnCodes::Success;
    }

    void ApplicationBellBackgroundSounds::createUserInterface()
    void ApplicationBellRelaxation::createUserInterface()
    {
        windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) {
            auto tagsFetcher      = std::make_unique<app::music::ServiceAudioTagsFetcher>(app);
            auto soundsRepository = std::make_unique<app::music::SongsRepository>(
                app, std::move(tagsFetcher), alarms::paths::getBackgroundSoundsDir());
            auto presenter = std::make_unique<bgSounds::BGSoundsMainWindowPresenter>(std::move(soundsRepository));
            return std::make_unique<gui::BGSoundsMainWindow>(app, std::move(presenter));
            auto presenter = std::make_unique<relaxation::RelaxationMainWindowPresenter>(std::move(soundsRepository));
            return std::make_unique<gui::RelaxationMainWindow>(app, std::move(presenter));
        });
        windowsFactory.attach(
            gui::window::name::bgSoundsTimerSelect, [this](ApplicationCommon *app, const std::string &name) {
                auto presenter = std::make_unique<bgSounds::BGSoundsTimerSelectPresenter>(settings.get());
                return std::make_unique<gui::BGSoundsTimerSelectWindow>(app, std::move(presenter));
            gui::window::name::relaxationTimerSelect, [this](ApplicationCommon *app, const std::string &name) {
                auto presenter = std::make_unique<relaxation::RelaxationTimerSelectPresenter>(settings.get());
                return std::make_unique<gui::RelaxationTimerSelectWindow>(app, std::move(presenter));
            });
        windowsFactory.attach(gui::window::name::bgSoundsProgress,
        windowsFactory.attach(gui::window::name::relaxationProgress,
                              [this](ApplicationCommon *app, const std::string &name) {
                                  auto timeModel = std::make_unique<app::TimeModel>();
                                  auto presenter = std::make_unique<bgSounds::BGSoundsProgressPresenter>(
                                  auto presenter = std::make_unique<relaxation::RelaxationProgressPresenter>(
                                      settings.get(), *player, std::move(timeModel));
                                  return std::make_unique<gui::BGSoundsProgressWindow>(app, std::move(presenter));
                                  return std::make_unique<gui::RelaxationProgressWindow>(app, std::move(presenter));
                              });
        windowsFactory.attach(gui::window::name::bgSoundsPaused, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::BGSoundsPausedWindow>(app);
        windowsFactory.attach(gui::window::name::relaxationPaused, [](ApplicationCommon *app, const std::string &name) {
            return std::make_unique<gui::RelaxationPausedWindow>(app);
        });

        windowsFactory.attach(gui::popup::window::volume_window,
                              [this](ApplicationCommon *app, const std::string &name) {
                                  auto presenter = std::make_unique<bgSounds::BGSoundsVolumePresenter>(*audioModel);
                                  return std::make_unique<gui::BGSoundsVolumeWindow>(app, std::move(presenter));
                                  auto presenter = std::make_unique<relaxation::RelaxationVolumePresenter>(*audioModel);
                                  return std::make_unique<gui::RelaxationVolumeWindow>(app, std::move(presenter));
                              });

        attachPopups({gui::popup::ID::AlarmActivated,


@@ 85,8 85,8 @@ namespace app
                      gui::popup::ID::BedtimeNotification});
    }

    sys::MessagePointer ApplicationBellBackgroundSounds::DataReceivedHandler(sys::DataMessage *msgl,
                                                                             sys::ResponseMessage *resp)
    sys::MessagePointer ApplicationBellRelaxation::DataReceivedHandler(sys::DataMessage *msgl,
                                                                       sys::ResponseMessage *resp)
    {
        auto retMsg = Application::DataReceivedHandler(msgl);
        if (auto response = dynamic_cast<sys::ResponseMessage *>(retMsg.get());


@@ 97,12 97,12 @@ namespace app
        return handleAsyncResponse(resp);
    }

    sys::MessagePointer ApplicationBellBackgroundSounds::handleSwitchWindow(sys::Message *msgl)
    sys::MessagePointer ApplicationBellRelaxation::handleSwitchWindow(sys::Message *msgl)
    {
        if (auto msg = dynamic_cast<AppSwitchWindowMessage *>(msgl); msg) {
            const auto newWindowName = msg->getWindowName();
            if (newWindowName == gui::window::name::bgSoundsProgress ||
                newWindowName == gui::window::name::bgSoundsPaused) {
            if (newWindowName == gui::window::name::relaxationProgress ||
                newWindowName == gui::window::name::relaxationPaused) {
                stopIdleTimer();
            }
            else {


@@ 112,7 112,7 @@ namespace app
        return ApplicationCommon::handleSwitchWindow(msgl);
    }

    void ApplicationBellBackgroundSounds::onStop()
    void ApplicationBellRelaxation::onStop()
    {
        Application::onStop();
        audioModel->stopPlayedByThis({});

A products/BellHybrid/apps/application-bell-relaxation/CMakeLists.txt => products/BellHybrid/apps/application-bell-relaxation/CMakeLists.txt +56 -0
@@ 0,0 1,56 @@
add_library(application-bell-relaxation STATIC)
add_library(bell::app-relaxation ALIAS application-bell-relaxation)

target_include_directories(application-bell-relaxation
    PRIVATE
        $<BUILD_INTERFACE:
            include/application-bell-relaxation
        >
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_sources(application-bell-relaxation
    PRIVATE
        ApplicationBellRelaxation.cpp
        presenter/RelaxationMainWindowPresenter.cpp
        presenter/RelaxationProgressPresenter.cpp
        presenter/RelaxationTimerSelectPresenter.cpp
        presenter/RelaxationVolumePresenter.cpp
        widgets/RelaxationPlayer.cpp
        windows/RelaxationMainWindow.cpp
        windows/RelaxationPausedWindow.cpp
        windows/RelaxationProgressWindow.cpp
        windows/RelaxationTimerSelectWindow.cpp
        windows/RelaxationVolumeWindow.cpp

        data/RelaxationCommon.hpp
        data/RelaxationStyle.hpp
        data/RelaxationAudioData.hpp
        widgets/RelaxationPlayer.hpp
        windows/RelaxationMainWindow.hpp
        presenter/RelaxationMainWindowPresenter.hpp
        presenter/RelaxationProgressPresenter.hpp
        presenter/RelaxationTimerSelectPresenter.hpp
        presenter/RelaxationVolumePresenter.hpp
        windows/RelaxationMainWindow.hpp
        windows/RelaxationPausedWindow.hpp
        windows/RelaxationProgressWindow.hpp
        windows/RelaxationTimerSelectWindow.hpp
        windows/RelaxationVolumeWindow.hpp

    PUBLIC
        include/application-bell-relaxation/ApplicationBellRelaxation.hpp
)

target_link_libraries(application-bell-relaxation
    PRIVATE
        apps-common
        bell::audio
        bell::alarms
        Microsoft.GSL::GSL

    PUBLIC
        module-gui
        bell::app-common
)

R products/BellHybrid/apps/application-bell-background-sounds/data/BGSoundsAudioData.hpp => products/BellHybrid/apps/application-bell-relaxation/data/RelaxationAudioData.hpp +6 -6
@@ 12,12 12,12 @@

namespace gui
{
    class BGSoundsAudioContext
    class RelaxationAudioContext
    {
        db::multimedia_files::MultimediaFilesRecord sound;

      public:
        explicit BGSoundsAudioContext(const db::multimedia_files::MultimediaFilesRecord &sound) : sound{sound}
        explicit RelaxationAudioContext(const db::multimedia_files::MultimediaFilesRecord &sound) : sound{sound}
        {}
        [[nodiscard]] const db::multimedia_files::MultimediaFilesRecord &getSound() const noexcept
        {


@@ 25,16 25,16 @@ namespace gui
        }
    };

    class BGSoundsSwitchData : public SwitchData
    class RelaxationSwitchData : public SwitchData
    {
        std::unique_ptr<BGSoundsAudioContext> audioContext;
        std::unique_ptr<RelaxationAudioContext> audioContext;

      public:
        explicit BGSoundsSwitchData(std::unique_ptr<BGSoundsAudioContext> audioContext)
        explicit RelaxationSwitchData(std::unique_ptr<RelaxationAudioContext> audioContext)
            : audioContext{std::move(audioContext)}
        {}

        [[nodiscard]] std::unique_ptr<BGSoundsAudioContext> getAudioContext()
        [[nodiscard]] std::unique_ptr<RelaxationAudioContext> getAudioContext()
        {
            return std::move(audioContext);
        }

R products/BellHybrid/apps/application-bell-background-sounds/data/BGSoundsCommon.hpp => products/BellHybrid/apps/application-bell-relaxation/data/RelaxationCommon.hpp +2 -2
@@ 3,7 3,7 @@

#pragma once

namespace app::bgSounds
namespace app::relaxation
{
    constexpr auto timerValueDBRecordName = "BGSoundsTimerValue";
    constexpr auto timerValueDBRecordName = "RelaxationTimerValue";
}

R products/BellHybrid/apps/application-bell-background-sounds/data/BGSoundsStyle.hpp => products/BellHybrid/apps/application-bell-relaxation/data/RelaxationStyle.hpp +2 -2
@@ 5,7 5,7 @@

#include <Style.hpp>

namespace gui::bgSoundsStyle
namespace gui::relaxationStyle
{
    inline constexpr auto descriptionFont = style::window::font::verybiglight;
    inline constexpr auto titleFont       = style::window::font::largelight;


@@ 24,4 24,4 @@ namespace gui::bgSoundsStyle
    {
        inline constexpr auto textH = 200U;
    }
} // namespace gui::bgSoundsStyle
} // namespace gui::relaxationStyle

R products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp => products/BellHybrid/apps/application-bell-relaxation/include/application-bell-relaxation/ApplicationBellRelaxation.hpp +15 -15
@@ 9,34 9,34 @@

namespace gui::window::name
{
    inline constexpr auto bgSoundsPaused      = "BGSoundsPausedWindow";
    inline constexpr auto bgSoundsProgress    = "BGSoundsProgressWindow";
    inline constexpr auto bgSoundsTimerSelect = "BGSoundsTimerSelectWindow";
    inline constexpr auto relaxationPaused      = "RelaxationPausedWindow";
    inline constexpr auto relaxationProgress    = "RelaxationProgressWindow";
    inline constexpr auto relaxationTimerSelect = "RelaxationTimerSelectWindow";
} // namespace gui::window::name
namespace app
{
    namespace bgSounds
    namespace relaxation
    {
        class BGSoundsPlayer;
        class RelaxationPlayer;
    }
    inline constexpr auto applicationBellBackgroundSoundsName = "ApplicationBellBackgroundSounds";
    inline constexpr auto applicationBellRelaxationName = "ApplicationBellRelaxation";

    class ApplicationBellBackgroundSounds : public Application
    class ApplicationBellRelaxation : public Application
    {
      private:
        std::unique_ptr<AbstractAudioModel> audioModel;
        std::unique_ptr<bgSounds::BGSoundsPlayer> player;
        std::unique_ptr<relaxation::RelaxationPlayer> player;

        void onStop() override;
        sys::MessagePointer handleSwitchWindow(sys::Message *msgl) override;

      public:
        ApplicationBellBackgroundSounds(std::string name                    = applicationBellBackgroundSoundsName,
                                        std::string parent                  = "",
                                        StatusIndicators statusIndicators   = StatusIndicators{},
                                        StartInBackground startInBackground = {false},
                                        uint32_t stackDepth                 = 4096 * 2);
        ~ApplicationBellBackgroundSounds();
        ApplicationBellRelaxation(std::string name                    = applicationBellRelaxationName,
                                  std::string parent                  = "",
                                  StatusIndicators statusIndicators   = StatusIndicators{},
                                  StartInBackground startInBackground = {false},
                                  uint32_t stackDepth                 = 4096 * 2);
        ~ApplicationBellRelaxation();
        sys::ReturnCodes InitHandler() override;

        void createUserInterface() override;


@@ 52,7 52,7 @@ namespace app
    };

    template <>
    struct ManifestTraits<ApplicationBellBackgroundSounds>
    struct ManifestTraits<ApplicationBellRelaxation>
    {
        static auto GetManifest() -> manager::ApplicationManifest
        {

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp +5 -5
@@ 1,7 1,7 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsMainWindowPresenter.hpp"
#include "RelaxationMainWindowPresenter.hpp"
#include <apps-common/models/SongsRepository.hpp>
#include <purefs/filesystem_paths.hpp>



@@ 11,13 11,13 @@ namespace
    constexpr auto soundsRepoLimit  = 100;
} // namespace

namespace app::bgSounds
namespace app::relaxation
{
    BGSoundsMainWindowPresenter::BGSoundsMainWindowPresenter(
    RelaxationMainWindowPresenter::RelaxationMainWindowPresenter(
        std::unique_ptr<app::music::AbstractSongsRepository> soundsRepository)
        : soundsRepository{std::move(soundsRepository)}
    {}
    void BGSoundsMainWindowPresenter::loadAudioRecords()
    void RelaxationMainWindowPresenter::loadAudioRecords()
    {
        soundsRepository->getMusicFilesList(
            soundsRepoOffset,


@@ 28,4 28,4 @@ namespace app::bgSounds
                return true;
            });
    }
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsMainWindowPresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.hpp +6 -6
@@ 14,9 14,9 @@ namespace app::music
{
    class AbstractSongsRepository;
}
namespace app::bgSounds
namespace app::relaxation
{
    class BGSoundsMainWindowContract
    class RelaxationMainWindowContract
    {
      public:
        class View


@@ 27,20 27,20 @@ namespace app::bgSounds
            virtual void setSoundsList(std::vector<db::multimedia_files::MultimediaFilesRecord> songs) = 0;
        };

        class Presenter : public BasePresenter<BGSoundsMainWindowContract::View>
        class Presenter : public BasePresenter<RelaxationMainWindowContract::View>
        {
          public:
            virtual void loadAudioRecords() = 0;
        };
    };

    class BGSoundsMainWindowPresenter : public BGSoundsMainWindowContract::Presenter
    class RelaxationMainWindowPresenter : public RelaxationMainWindowContract::Presenter
    {
        std::unique_ptr<app::music::AbstractSongsRepository> soundsRepository;
        void loadAudioRecords() override;

      public:
        explicit BGSoundsMainWindowPresenter(std::unique_ptr<app::music::AbstractSongsRepository> soundsRepository);
        explicit RelaxationMainWindowPresenter(std::unique_ptr<app::music::AbstractSongsRepository> soundsRepository);
    };

} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsProgressPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationProgressPresenter.cpp +21 -21
@@ 1,10 1,10 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsProgressPresenter.hpp"
#include "data/BGSoundsCommon.hpp"
#include "widgets/BGSoundsPlayer.hpp"
#include <ApplicationBellBackgroundSounds.hpp>
#include "RelaxationProgressPresenter.hpp"
#include "data/RelaxationCommon.hpp"
#include "widgets/RelaxationPlayer.hpp"
#include <ApplicationBellRelaxation.hpp>
#include <apps-common/widgets/ProgressTimerWithBarGraphAndCounter.hpp>
#include <common/models/TimeModel.hpp>
#include <service-db/Settings.hpp>


@@ 13,32 13,32 @@

#include <gsl/assert>

namespace app::bgSounds
namespace app::relaxation
{
    BGSoundsProgressPresenter::BGSoundsProgressPresenter(settings::Settings *settings,
                                                         AbstractBGSoundsPlayer &player,
                                                         std::unique_ptr<AbstractTimeModel> timeModel)
    RelaxationProgressPresenter::RelaxationProgressPresenter(settings::Settings *settings,
                                                             AbstractRelaxationPlayer &player,
                                                             std::unique_ptr<AbstractTimeModel> timeModel)
        : settings{settings}, player{player}, timeModel{std::move(timeModel)}
    {}

    void BGSoundsProgressPresenter::setTimer(std::unique_ptr<app::TimerWithCallbacks> &&_timer)
    void RelaxationProgressPresenter::setTimer(std::unique_ptr<app::TimerWithCallbacks> &&_timer)
    {
        timer = std::move(_timer);
        timer->registerOnFinishedCallback([this]() { onFinished(); });
    }

    void BGSoundsProgressPresenter::activate(const db::multimedia_files::MultimediaFilesRecord &song)
    void RelaxationProgressPresenter::activate(const db::multimedia_files::MultimediaFilesRecord &song)
    {
        Expects(timer != nullptr);
        AbstractBGSoundsPlayer::PlaybackMode mode;
        AbstractRelaxationPlayer::PlaybackMode mode;
        const auto value = settings->getValue(timerValueDBRecordName, settings::SettingsScope::AppLocal);
        if (utils::is_number(value) && utils::getNumericValue<int>(value) != 0) {
            timer->reset(std::chrono::minutes{utils::getNumericValue<int>(value)});
            mode = AbstractBGSoundsPlayer::PlaybackMode::Looped;
            mode = AbstractRelaxationPlayer::PlaybackMode::Looped;
        }
        else {
            timer->reset(std::chrono::seconds{song.audioProperties.songLength});
            mode = AbstractBGSoundsPlayer::PlaybackMode::SingleShot;
            mode = AbstractRelaxationPlayer::PlaybackMode::SingleShot;
        }
        auto onStartCallback = [this](audio::RetCode retCode) {
            if (retCode == audio::RetCode::Success) {


@@ 47,12 47,12 @@ namespace app::bgSounds
        };
        player.start(song.fileInfo.path, mode, std::move(onStartCallback));
    }
    void BGSoundsProgressPresenter::stop()
    void RelaxationProgressPresenter::stop()
    {
        onFinished();
        timer->stop();
    }
    void BGSoundsProgressPresenter::onFinished()
    void RelaxationProgressPresenter::onFinished()
    {
        auto onStopCallback = [this](audio::RetCode retCode) {
            if (retCode == audio::RetCode::Success) {


@@ 61,7 61,7 @@ namespace app::bgSounds
        };
        player.stop(std::move(onStopCallback));
    }
    void BGSoundsProgressPresenter::pause()
    void RelaxationProgressPresenter::pause()
    {
        if (not timer->isStopped()) {
            auto onPauseCallback = [this](audio::RetCode retCode) {


@@ 73,7 73,7 @@ namespace app::bgSounds
            player.pause(std::move(onPauseCallback));
        }
    }
    void BGSoundsProgressPresenter::resume()
    void RelaxationProgressPresenter::resume()
    {
        if (timer->isStopped()) {
            auto onResumeCallback = [this](audio::RetCode retCode) {


@@ 84,16 84,16 @@ namespace app::bgSounds
            player.resume(std::move(onResumeCallback));
        }
    }
    void BGSoundsProgressPresenter::handleUpdateTimeEvent()
    void RelaxationProgressPresenter::handleUpdateTimeEvent()
    {
        getView()->setTime(timeModel->getCurrentTime());
    }
    bool BGSoundsProgressPresenter::isPaused()
    bool RelaxationProgressPresenter::isPaused()
    {
        return player.isPaused();
    }
    void BGSoundsProgressPresenter::onBeforeShow()
    void RelaxationProgressPresenter::onBeforeShow()
    {
        getView()->setTimeFormat(timeModel->getTimeFormat());
    }
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsProgressPresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationProgressPresenter.hpp +10 -10
@@ 23,9 23,9 @@ namespace settings
    class Settings;
}

namespace app::bgSounds
namespace app::relaxation
{
    class BGSoundsProgressContract
    class RelaxationProgressContract
    {
      public:
        class View


@@ 38,7 38,7 @@ namespace app::bgSounds
            virtual void setTimeFormat(utils::time::Locale::TimeFormat fmt) = 0;
        };

        class Presenter : public BasePresenter<BGSoundsProgressContract::View>
        class Presenter : public BasePresenter<RelaxationProgressContract::View>
        {
          public:
            virtual void activate(const db::multimedia_files::MultimediaFilesRecord &tags) = 0;


@@ 52,12 52,12 @@ namespace app::bgSounds
        };
    };

    class AbstractBGSoundsPlayer;
    class AbstractRelaxationPlayer;

    class BGSoundsProgressPresenter : public BGSoundsProgressContract::Presenter
    class RelaxationProgressPresenter : public RelaxationProgressContract::Presenter
    {
        settings::Settings *settings = nullptr;
        AbstractBGSoundsPlayer &player;
        AbstractRelaxationPlayer &player;
        std::unique_ptr<app::TimerWithCallbacks> timer;
        std::unique_ptr<AbstractTimeModel> timeModel;



@@ 73,8 73,8 @@ namespace app::bgSounds
        void onFinished();

      public:
        BGSoundsProgressPresenter(settings::Settings *settings,
                                  AbstractBGSoundsPlayer &player,
                                  std::unique_ptr<AbstractTimeModel> timeModel);
        RelaxationProgressPresenter(settings::Settings *settings,
                                    AbstractRelaxationPlayer &player,
                                    std::unique_ptr<AbstractTimeModel> timeModel);
    };
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsTimerSelectPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationTimerSelectPresenter.cpp +9 -9
@@ 1,10 1,10 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsTimerSelectPresenter.hpp"
#include "data/BGSoundsCommon.hpp"
#include "RelaxationTimerSelectPresenter.hpp"
#include "data/RelaxationCommon.hpp"

#include <ApplicationBellBackgroundSounds.hpp>
#include <ApplicationBellRelaxation.hpp>
#include <apps-common/ApplicationCommon.hpp>
#include <service-db/agents/settings/SystemSettings.hpp>
#include <service-db/Settings.hpp>


@@ 16,15 16,15 @@ namespace
    const static std::vector<std::chrono::minutes> valuesRange{0min, 5min, 10min, 15min, 30min, 45min, 60min, 90min};
} // namespace

namespace app::bgSounds
namespace app::relaxation
{
    BGSoundsTimerSelectPresenter::BGSoundsTimerSelectPresenter(settings::Settings *settings) : settings{settings}
    RelaxationTimerSelectPresenter::RelaxationTimerSelectPresenter(settings::Settings *settings) : settings{settings}
    {}
    const BGSoundsTimerSelectContract::Range &BGSoundsTimerSelectPresenter::getTimerValuesRange() const noexcept
    const RelaxationTimerSelectContract::Range &RelaxationTimerSelectPresenter::getTimerValuesRange() const noexcept
    {
        return valuesRange;
    }
    std::chrono::minutes BGSoundsTimerSelectPresenter::getCurrentTimerValue() const
    std::chrono::minutes RelaxationTimerSelectPresenter::getCurrentTimerValue() const
    {
        const auto value = settings->getValue(timerValueDBRecordName, settings::SettingsScope::AppLocal);
        if (not value.empty()) {


@@ 32,8 32,8 @@ namespace app::bgSounds
        }
        return timerDefaultValue;
    }
    void BGSoundsTimerSelectPresenter::setTimerValue(std::chrono::minutes value)
    void RelaxationTimerSelectPresenter::setTimerValue(std::chrono::minutes value)
    {
        settings->setValue(timerValueDBRecordName, utils::to_string(value.count()), settings::SettingsScope::AppLocal);
    }
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsTimerSelectPresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationTimerSelectPresenter.hpp +7 -7
@@ 21,9 21,9 @@ namespace settings
{
    class Settings;
}
namespace app::bgSounds
namespace app::relaxation
{
    class BGSoundsTimerSelectContract
    class RelaxationTimerSelectContract
    {
      public:
        using Range = std::vector<std::chrono::minutes>;


@@ 33,7 33,7 @@ namespace app::bgSounds
            virtual ~View() = default;
        };

        class Presenter : public BasePresenter<BGSoundsTimerSelectContract::View>
        class Presenter : public BasePresenter<RelaxationTimerSelectContract::View>
        {
          public:
            virtual ~Presenter()                                      = default;


@@ 43,15 43,15 @@ namespace app::bgSounds
        };
    };

    class BGSoundsTimerSelectPresenter : public BGSoundsTimerSelectContract::Presenter
    class RelaxationTimerSelectPresenter : public RelaxationTimerSelectContract::Presenter
    {
        settings::Settings *settings = nullptr;

        const BGSoundsTimerSelectContract::Range &getTimerValuesRange() const noexcept override;
        const RelaxationTimerSelectContract::Range &getTimerValuesRange() const noexcept override;
        std::chrono::minutes getCurrentTimerValue() const override;
        void setTimerValue(std::chrono::minutes) override;

      public:
        explicit BGSoundsTimerSelectPresenter(settings::Settings *settings);
        explicit RelaxationTimerSelectPresenter(settings::Settings *settings);
    };
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsVolumePresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationVolumePresenter.cpp +8 -8
@@ 1,24 1,24 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsVolumePresenter.hpp"
#include "RelaxationVolumePresenter.hpp"

namespace app::bgSounds
namespace app::relaxation
{
    BGSoundsVolumePresenter::BGSoundsVolumePresenter(AbstractAudioModel &audioModel) : audioModel{audioModel}
    RelaxationVolumePresenter::RelaxationVolumePresenter(AbstractAudioModel &audioModel) : audioModel{audioModel}
    {}

    VolumeData BGSoundsVolumePresenter::getVolumeData()
    VolumeData RelaxationVolumePresenter::getVolumeData()
    {
        return volumeData;
    }

    void BGSoundsVolumePresenter::setVolume(AbstractAudioModel::Volume volume)
    void RelaxationVolumePresenter::setVolume(AbstractAudioModel::Volume volume)
    {
        audioModel.setVolume(volume, AbstractAudioModel::PlaybackType::Multimedia, {});
    }
    AbstractAudioModel::Volume BGSoundsVolumePresenter::getVolume()
    AbstractAudioModel::Volume RelaxationVolumePresenter::getVolume()
    {
        return audioModel.getVolume(AbstractAudioModel::PlaybackType::Multimedia).value_or(defaultVolume);
    }
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/presenter/BGSoundsVolumePresenter.hpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationVolumePresenter.hpp +6 -6
@@ 9,7 9,7 @@ namespace app
{
    class ApplicationCommon;
}
namespace app::bgSounds
namespace app::relaxation
{
    using VolumeData = struct VolumeData
    {


@@ 18,16 18,16 @@ namespace app::bgSounds
        AbstractAudioModel::Volume step;
    };

    class AbstractBGSoundsVolumePresenter
    class AbstractRelaxationVolumePresenter
    {
      public:
        virtual ~AbstractBGSoundsVolumePresenter()                = default;
        virtual ~AbstractRelaxationVolumePresenter()              = default;
        virtual VolumeData getVolumeData()                        = 0;
        virtual void setVolume(AbstractAudioModel::Volume volume) = 0;
        virtual AbstractAudioModel::Volume getVolume()            = 0;
    };

    class BGSoundsVolumePresenter : public AbstractBGSoundsVolumePresenter
    class RelaxationVolumePresenter : public AbstractRelaxationVolumePresenter
    {
        constexpr static struct VolumeData volumeData
        {


@@ 42,6 42,6 @@ namespace app::bgSounds
        AbstractAudioModel::Volume getVolume() override;

      public:
        explicit BGSoundsVolumePresenter(AbstractAudioModel &audioModel);
        explicit RelaxationVolumePresenter(AbstractAudioModel &audioModel);
    };
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/widgets/BGSoundsPlayer.cpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.cpp +12 -12
@@ 1,20 1,20 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsPlayer.hpp"
#include "RelaxationPlayer.hpp"
#include <audio/AudioMessage.hpp>

namespace app::bgSounds
namespace app::relaxation
{
    AbstractBGSoundsPlayer::PlaybackMode BGSoundsPlayer::getCurrentMode() const noexcept
    AbstractRelaxationPlayer::PlaybackMode RelaxationPlayer::getCurrentMode() const noexcept
    {
        return playbackMode;
    }
    BGSoundsPlayer::BGSoundsPlayer(AbstractAudioModel &audioModel) : audioModel{audioModel}
    RelaxationPlayer::RelaxationPlayer(AbstractAudioModel &audioModel) : audioModel{audioModel}
    {}
    void BGSoundsPlayer::start(const std::string &filePath,
                               AbstractBGSoundsPlayer::PlaybackMode mode,
                               AbstractAudioModel::OnStateChangeCallback &&callback)
    void RelaxationPlayer::start(const std::string &filePath,
                                 AbstractRelaxationPlayer::PlaybackMode mode,
                                 AbstractAudioModel::OnStateChangeCallback &&callback)
    {
        recentFilePath = filePath;
        playbackMode   = mode;


@@ 25,23 25,23 @@ namespace app::bgSounds
            }
        });
    }
    void BGSoundsPlayer::stop(AbstractAudioModel::OnStateChangeCallback &&callback)
    void RelaxationPlayer::stop(AbstractAudioModel::OnStateChangeCallback &&callback)
    {
        paused = false;
        audioModel.stopPlayedByThis(std::move(callback));
    }
    void BGSoundsPlayer::pause(AbstractAudioModel::OnStateChangeCallback &&callback)
    void RelaxationPlayer::pause(AbstractAudioModel::OnStateChangeCallback &&callback)
    {
        paused = true;
        audioModel.pause(std::move(callback));
    }
    void BGSoundsPlayer::resume(AbstractAudioModel::OnStateChangeCallback &&callback)
    void RelaxationPlayer::resume(AbstractAudioModel::OnStateChangeCallback &&callback)
    {
        paused = false;
        audioModel.resume(std::move(callback));
    }
    bool BGSoundsPlayer::isPaused()
    bool RelaxationPlayer::isPaused()
    {
        return paused;
    }
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/widgets/BGSoundsPlayer.hpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationPlayer.hpp +6 -6
@@ 14,9 14,9 @@ namespace service
    class AudioEOFNotification;
}

namespace app::bgSounds
namespace app::relaxation
{
    class AbstractBGSoundsPlayer
    class AbstractRelaxationPlayer
    {
      public:
        enum class PlaybackMode


@@ 25,7 25,7 @@ namespace app::bgSounds
            SingleShot
        };

        virtual ~AbstractBGSoundsPlayer()                                         = default;
        virtual ~AbstractRelaxationPlayer()                                       = default;
        virtual void start(const std::string &filePath,
                           PlaybackMode mode,
                           AbstractAudioModel::OnStateChangeCallback &&callback)  = 0;


@@ 36,10 36,10 @@ namespace app::bgSounds
        virtual bool isPaused()                                                   = 0;
    };

    class BGSoundsPlayer : public AbstractBGSoundsPlayer
    class RelaxationPlayer : public AbstractRelaxationPlayer
    {
      public:
        explicit BGSoundsPlayer(AbstractAudioModel &audioModel);
        explicit RelaxationPlayer(AbstractAudioModel &audioModel);

      private:
        void start(const std::string &filePath,


@@ 56,4 56,4 @@ namespace app::bgSounds
        PlaybackMode playbackMode = PlaybackMode::SingleShot;
        bool paused{false};
    };
} // namespace app::bgSounds
} // namespace app::relaxation

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsMainWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.cpp +13 -13
@@ 1,25 1,25 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsMainWindow.hpp"
#include "data/BGSoundsAudioData.hpp"
#include <application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp>
#include <ApplicationBellBackgroundSounds.hpp>
#include "RelaxationMainWindow.hpp"
#include "data/RelaxationAudioData.hpp"
#include <application-bell-relaxation/ApplicationBellRelaxation.hpp>
#include <module-gui/gui/input/InputEvent.hpp>
#include <common/options/OptionBellMenu.hpp>
#include <i18n/i18n.hpp>

namespace gui
{
    BGSoundsMainWindow::BGSoundsMainWindow(
        app::ApplicationCommon *app, std::unique_ptr<app::bgSounds::BGSoundsMainWindowContract::Presenter> &&presenter)
    RelaxationMainWindow::RelaxationMainWindow(
        app::ApplicationCommon *app,
        std::unique_ptr<app::relaxation::RelaxationMainWindowContract::Presenter> &&presenter)
        : BellOptionWindow(app, gui::name::window::main_window), presenter{std::move(presenter)}
    {
        this->presenter->attach(this);
        buildInterface();
        setListTitle(utils::translate("app_bellmain_background_sounds"));
        setListTitle(utils::translate("app_bellmain_relaxation"));
    }
    void BGSoundsMainWindow::setSoundsList(std::vector<db::multimedia_files::MultimediaFilesRecord> sounds)
    void RelaxationMainWindow::setSoundsList(std::vector<db::multimedia_files::MultimediaFilesRecord> sounds)
    {
        std::list<gui::Option> menuOptionList;
        auto addRecord = [&](const db::multimedia_files::MultimediaFilesRecord &sound) {


@@ 38,17 38,17 @@ namespace gui

        addOptions(std::move(menuOptionList));
    }
    void BGSoundsMainWindow::buildInterface()
    void RelaxationMainWindow::buildInterface()
    {
        BellOptionWindow::buildInterface();
        presenter->loadAudioRecords();
    }

    void BGSoundsMainWindow::onActivated(const db::multimedia_files::MultimediaFilesRecord &selectedSound)
    void RelaxationMainWindow::onActivated(const db::multimedia_files::MultimediaFilesRecord &selectedSound)
    {
        auto audioContext = std::make_unique<BGSoundsAudioContext>(selectedSound);
        auto switchData   = std::make_unique<BGSoundsSwitchData>(std::move(audioContext));
        application->switchWindow(gui::window::name::bgSoundsTimerSelect, std::move(switchData));
        auto audioContext = std::make_unique<RelaxationAudioContext>(selectedSound);
        auto switchData   = std::make_unique<RelaxationSwitchData>(std::move(audioContext));
        application->switchWindow(gui::window::name::relaxationTimerSelect, std::move(switchData));
    }

} // namespace gui

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsMainWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationMainWindow.hpp +5 -5
@@ 3,13 3,13 @@

#pragma once

#include "presenter/BGSoundsMainWindowPresenter.hpp"
#include "presenter/RelaxationMainWindowPresenter.hpp"
#include <common/options/BellOptionWindow.hpp>
namespace gui
{
    class BGSoundsMainWindow : public BellOptionWindow, public app::bgSounds::BGSoundsMainWindowContract::View
    class RelaxationMainWindow : public BellOptionWindow, public app::relaxation::RelaxationMainWindowContract::View
    {
        std::unique_ptr<app::bgSounds::BGSoundsMainWindowContract::Presenter> presenter;
        std::unique_ptr<app::relaxation::RelaxationMainWindowContract::Presenter> presenter;

        void setSoundsList(std::vector<db::multimedia_files::MultimediaFilesRecord> soundsTags);
        void buildInterface() override;


@@ 17,7 17,7 @@ namespace gui
        void onActivated(const db::multimedia_files::MultimediaFilesRecord &selectedSound);

      public:
        BGSoundsMainWindow(app::ApplicationCommon *app,
                           std::unique_ptr<app::bgSounds::BGSoundsMainWindowContract::Presenter> &&presenter);
        RelaxationMainWindow(app::ApplicationCommon *app,
                             std::unique_ptr<app::relaxation::RelaxationMainWindowContract::Presenter> &&presenter);
    };
} // namespace gui

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsPausedWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationPausedWindow.cpp +9 -9
@@ 1,9 1,9 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsPausedWindow.hpp"
#include "data/BGSoundsStyle.hpp"
#include <ApplicationBellBackgroundSounds.hpp>
#include "RelaxationPausedWindow.hpp"
#include "data/RelaxationStyle.hpp"
#include <ApplicationBellRelaxation.hpp>

#include <BoxLayout.hpp>
#include <Image.hpp>


@@ 13,13 13,13 @@

namespace gui
{
    BGSoundsPausedWindow::BGSoundsPausedWindow(app::ApplicationCommon *app)
        : AppWindow(app, gui::window::name::bgSoundsPaused)
    RelaxationPausedWindow::RelaxationPausedWindow(app::ApplicationCommon *app)
        : AppWindow(app, gui::window::name::relaxationPaused)
    {
        buildInterface();
    }

    void BGSoundsPausedWindow::buildInterface()
    void RelaxationPausedWindow::buildInterface()
    {
        AppWindow::buildInterface();



@@ 29,14 29,14 @@ namespace gui

        new gui::Image(body, "big_pause_W_G");

        auto text = new gui::Text(body, 0, 0, body->getWidth(), bgSoundsStyle::pause::textH);
        text->setFont(bgSoundsStyle::descriptionFont);
        auto text = new gui::Text(body, 0, 0, body->getWidth(), relaxationStyle::pause::textH);
        text->setFont(relaxationStyle::descriptionFont);
        text->setText(utils::translate("common_paused"));
        text->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
        text->setVisible(true);
    }

    auto BGSoundsPausedWindow::onInput(const InputEvent &inputEvent) -> bool
    auto RelaxationPausedWindow::onInput(const InputEvent &inputEvent) -> bool
    {
        if (inputEvent.isShortRelease(KeyCode::KEY_ENTER)) {
            application->returnToPreviousWindow();

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsPausedWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationPausedWindow.hpp +2 -2
@@ 7,13 7,13 @@

namespace gui
{
    class BGSoundsPausedWindow : public AppWindow
    class RelaxationPausedWindow : public AppWindow
    {
        void buildInterface() override;
        auto onInput(const InputEvent &inputEvent) -> bool override;

      public:
        explicit BGSoundsPausedWindow(app::ApplicationCommon *app);
        explicit RelaxationPausedWindow(app::ApplicationCommon *app);
    };

} // namespace gui

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationProgressWindow.cpp +28 -28
@@ 1,9 1,9 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsProgressWindow.hpp"
#include <ApplicationBellBackgroundSounds.hpp>
#include "data/BGSoundsStyle.hpp"
#include "RelaxationProgressWindow.hpp"
#include <ApplicationBellRelaxation.hpp>
#include "data/RelaxationStyle.hpp"
#include <apps-common/widgets/BellBaseLayout.hpp>
#include <apps-common/widgets/BarGraph.hpp>
#include <apps-common/widgets/ProgressTimerWithBarGraphAndCounter.hpp>


@@ 12,7 12,7 @@
#include <time/dateCommon.hpp>
namespace
{
    inline constexpr auto bgSoundsTimerName = "BGSoundsProgressTimer";
    inline constexpr auto relaxationTimerName = "RelaxationProgressTimer";
    inline constexpr std::chrono::seconds timerTick{1};

    void decorateProgressItem(gui::Rect *item, gui::Alignment::Vertical alignment)


@@ 23,11 23,11 @@ namespace
    }
    gui::Text *createTitle(gui::VBox *parent)
    {
        namespace bgStyle = gui::bgSoundsStyle;
        auto title        = new gui::TextFixedSize(parent, 0, 0, 0, 0);
        title->setFont(bgStyle::titleFont);
        title->setMinimumWidth(bgStyle::progress::titleWidth);
        title->setMinimumHeightToFitText(bgStyle::progress::titleMaxLines);
        namespace relaxationStyle = gui::relaxationStyle;
        auto title                = new gui::TextFixedSize(parent, 0, 0, 0, 0);
        title->setFont(relaxationStyle::titleFont);
        title->setMinimumWidth(relaxationStyle::progress::titleWidth);
        title->setMinimumHeightToFitText(relaxationStyle::progress::titleMaxLines);
        title->drawUnderline(false);

        decorateProgressItem(title, gui::Alignment::Vertical::Top);


@@ 39,14 39,14 @@ namespace
        decorateProgressItem(progressBox, gui::Alignment::Vertical::Bottom);
        progressBox->setMaximumSize(parent->getWidth(), parent->getHeight() / 2);
        auto progressBar = new gui::HBarGraph(
            progressBox, 0, 0, gui::bgSoundsStyle::progress::maxProgressValue, gui::BarGraphStyle::Heavy);
            progressBox, 0, 0, gui::relaxationStyle::progress::maxProgressValue, gui::BarGraphStyle::Heavy);
        decorateProgressItem(progressBar, gui::Alignment::Vertical::Center);
        return progressBar;
    }
    gui::TimeFixedWidget *createTimer(gui::Item *parent)
    {
        using namespace style;
        using namespace gui::bgSoundsStyle;
        using namespace gui::relaxationStyle;

        auto timer = new gui::TimeFixedWidget(parent,
                                              0,


@@ 69,15 69,15 @@ namespace

namespace gui
{
    BGSoundsProgressWindow::BGSoundsProgressWindow(
        app::ApplicationCommon *app, std::shared_ptr<app::bgSounds::BGSoundsProgressContract::Presenter> presenter)
        : AppWindow(app, gui::window::name::bgSoundsProgress), presenter{std::move(presenter)}
    RelaxationProgressWindow::RelaxationProgressWindow(
        app::ApplicationCommon *app, std::shared_ptr<app::relaxation::RelaxationProgressContract::Presenter> presenter)
        : AppWindow(app, gui::window::name::relaxationProgress), presenter{std::move(presenter)}
    {
        this->presenter->attach(this);
        buildInterface();
    }

    void BGSoundsProgressWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    void RelaxationProgressWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        presenter->onBeforeShow();
        updateTime();


@@ 87,21 87,21 @@ namespace gui
            return;
        }

        if (data && typeid(*data) == typeid(BGSoundsSwitchData)) {
            auto *audioSwitchData = static_cast<BGSoundsSwitchData *>(data);
        if (data && typeid(*data) == typeid(RelaxationSwitchData)) {
            auto *audioSwitchData = static_cast<RelaxationSwitchData *>(data);
            audioContext          = audioSwitchData->getAudioContext();
            title->setText(audioContext->getSound().tags.title);
            presenter->activate(audioContext->getSound());
        }
    }

    void BGSoundsProgressWindow::buildInterface()
    void RelaxationProgressWindow::buildInterface()
    {
        AppWindow::buildInterface();
        buildLayout();
        configureTimer();
    }
    void BGSoundsProgressWindow::buildLayout()
    void RelaxationProgressWindow::buildLayout()
    {
        statusBar->setVisible(false);
        auto body = new gui::BellBaseLayout(this, 0, 0, style::bell_base_layout::w, style::bell_base_layout::h, false);


@@ 124,16 124,16 @@ namespace gui
            return true;
        };
    }
    void BGSoundsProgressWindow::configureTimer()
    void RelaxationProgressWindow::configureTimer()
    {
        auto timer = std::make_unique<app::ProgressTimerWithBarGraphAndCounter>(
            application, *this, bgSoundsTimerName, timerTick, app::ProgressCountdownMode::Increasing);
            application, *this, relaxationTimerName, timerTick, app::ProgressCountdownMode::Increasing);
        timer->attach(progressBar);
        timer->attach(timerText);
        presenter->setTimer(std::move(timer));
    }

    auto BGSoundsProgressWindow::onInput(const InputEvent &inputEvent) -> bool
    auto RelaxationProgressWindow::onInput(const InputEvent &inputEvent) -> bool
    {
        if (inputEvent.isShortRelease()) {
            if (inputEvent.is(KeyCode::KEY_RF)) {


@@ 151,26 151,26 @@ namespace gui
        }
        return AppWindow::onInput(inputEvent);
    }
    void BGSoundsProgressWindow::onFinished()
    void RelaxationProgressWindow::onFinished()
    {
        application->returnToPreviousWindow();
    }
    void BGSoundsProgressWindow::onPaused()
    void RelaxationProgressWindow::onPaused()
    {
        application->switchWindow(gui::window::name::bgSoundsPaused);
        application->switchWindow(gui::window::name::relaxationPaused);
    }
    void BGSoundsProgressWindow::setTime(std::time_t newTime)
    void RelaxationProgressWindow::setTime(std::time_t newTime)
    {
        time->setTime(newTime);
        time->setTimeFormatSpinnerVisibility(true);
    }

    void BGSoundsProgressWindow::setTimeFormat(utils::time::Locale::TimeFormat fmt)
    void RelaxationProgressWindow::setTimeFormat(utils::time::Locale::TimeFormat fmt)
    {
        time->setTimeFormat(fmt);
    }

    RefreshModes BGSoundsProgressWindow::updateTime()
    RefreshModes RelaxationProgressWindow::updateTime()
    {
        if (presenter) {
            presenter->handleUpdateTimeEvent();

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationProgressWindow.hpp +7 -7
@@ 3,8 3,8 @@

#pragma once

#include "presenter/BGSoundsProgressPresenter.hpp"
#include "data/BGSoundsAudioData.hpp"
#include "presenter/RelaxationProgressPresenter.hpp"
#include "data/RelaxationAudioData.hpp"
#include <apps-common/widgets/TimeFixedWidget.hpp>
#include <AppWindow.hpp>
#include <common/widgets/BellStatusClock.hpp>


@@ 13,14 13,14 @@ namespace gui
{
    class HBarGraph;
    class Text;
    class BGSoundsProgressWindow : public AppWindow, public app::bgSounds::BGSoundsProgressContract::View
    class RelaxationProgressWindow : public AppWindow, public app::relaxation::RelaxationProgressContract::View
    {
        std::shared_ptr<app::bgSounds::BGSoundsProgressContract::Presenter> presenter;
        std::shared_ptr<app::relaxation::RelaxationProgressContract::Presenter> presenter;
        gui::Text *title                = nullptr;
        gui::HBarGraph *progressBar     = nullptr;
        gui::TimeFixedWidget *timerText = nullptr;
        gui::BellStatusClock *time      = nullptr;
        std::unique_ptr<BGSoundsAudioContext> audioContext;
        std::unique_ptr<RelaxationAudioContext> audioContext;

        void buildInterface() override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;


@@ 37,7 37,7 @@ namespace gui
        void onPaused() override;

      public:
        BGSoundsProgressWindow(app::ApplicationCommon *app,
                               std::shared_ptr<app::bgSounds::BGSoundsProgressContract::Presenter> presenter);
        RelaxationProgressWindow(app::ApplicationCommon *app,
                                 std::shared_ptr<app::relaxation::RelaxationProgressContract::Presenter> presenter);
    };
} // namespace gui

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsTimerSelectWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationTimerSelectWindow.cpp +22 -21
@@ 1,10 1,10 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsTimerSelectWindow.hpp"
#include <application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp>
#include "RelaxationTimerSelectWindow.hpp"
#include <application-bell-relaxation/ApplicationBellRelaxation.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>
#include <data/BGSoundsStyle.hpp>
#include <data/RelaxationStyle.hpp>
#include <gui/input/InputEvent.hpp>
#include <common/LanguageUtils.hpp>
#include <i18n/i18n.hpp>


@@ 49,15 49,16 @@ namespace
namespace gui
{

    BGSoundsTimerSelectWindow::BGSoundsTimerSelectWindow(
        app::ApplicationCommon *app, std::unique_ptr<app::bgSounds::BGSoundsTimerSelectContract::Presenter> &&presenter)
        : AppWindow(app, gui::window::name::bgSoundsTimerSelect), presenter(std::move(presenter))
    RelaxationTimerSelectWindow::RelaxationTimerSelectWindow(
        app::ApplicationCommon *app,
        std::unique_ptr<app::relaxation::RelaxationTimerSelectContract::Presenter> &&presenter)
        : AppWindow(app, gui::window::name::relaxationTimerSelect), presenter(std::move(presenter))
    {
        this->presenter->attach(this);
        buildInterface();
    }

    void BGSoundsTimerSelectWindow::buildInterface()
    void RelaxationTimerSelectWindow::buildInterface()
    {
        AppWindow::buildInterface();
        statusBar->setVisible(false);


@@ 69,7 70,7 @@ namespace gui
        registerCallbacks();
    }

    void BGSoundsTimerSelectWindow::createTopMessage()
    void RelaxationTimerSelectWindow::createTopMessage()
    {
        auto topMessage = new TextFixedSize(body->firstBox);
        topMessage->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::outer_layouts_h);


@@ 77,17 78,17 @@ namespace gui
        topMessage->setEdges(gui::RectangleEdge::None);
        topMessage->activeItem = false;
        topMessage->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
        topMessage->setText(utils::translate("app_bell_background_sounds_timer_title"));
        topMessage->setText(utils::translate("app_bell_relaxation_timer_title"));
        topMessage->drawUnderline(false);
    }

    void BGSoundsTimerSelectWindow::createSpinner()
    void RelaxationTimerSelectWindow::createSpinner()
    {
        auto range = presenter->getTimerValuesRange();

        spinner = new StringSpinner(toUTF8Range(range), Boundaries::Fixed);
        spinner->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::h);
        spinner->setFont(bgSoundsStyle::timerValueFont);
        spinner->setFont(relaxationStyle::timerValueFont);
        spinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        spinner->setEdges(RectangleEdge::None);
        spinner->setFocusEdges(RectangleEdge::None);


@@ 101,12 102,12 @@ namespace gui
        body->setMinMaxArrowsVisibility(spinner->is_min(), spinner->is_max());
    }

    void BGSoundsTimerSelectWindow::createBottomDescription()
    void RelaxationTimerSelectWindow::createBottomDescription()
    {
        bottomDescription = new gui::Text();
        bottomDescription->setMinimumSize(style::bell_base_layout::outer_layouts_w,
                                          style::bell_base_layout::outer_layouts_h);
        bottomDescription->setFont(bgSoundsStyle::descriptionFont);
        bottomDescription->setFont(relaxationStyle::descriptionFont);
        bottomDescription->setEdges(RectangleEdge::All);
        bottomDescription->activeItem = false;
        bottomDescription->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));


@@ 114,7 115,7 @@ namespace gui
        body->lastBox->addWidget(bottomDescription);
        updateBottomDescription();
    }
    void BGSoundsTimerSelectWindow::updateBottomDescription()
    void RelaxationTimerSelectWindow::updateBottomDescription()
    {
        const auto currentVal = spinner->value();
        bottomDescription->setText(utils::language::getCorrectMinutesNumeralForm(UTF8ToTimerValue(currentVal).count()));


@@ 123,7 124,7 @@ namespace gui
        bottomDescription->setVisible(isDescriptionVisible);
    }

    void BGSoundsTimerSelectWindow::registerCallbacks()
    void RelaxationTimerSelectWindow::registerCallbacks()
    {
        dimensionChangedCallback = [&](Item &, const BoundingBox &newDim) -> bool {
            body->setArea({0, 0, newDim.w, newDim.h});


@@ 142,15 143,15 @@ namespace gui
        };
    }

    void BGSoundsTimerSelectWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    void RelaxationTimerSelectWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        if (data && typeid(*data) == typeid(BGSoundsSwitchData)) {
            auto *audioSwitchData = static_cast<BGSoundsSwitchData *>(data);
        if (data && typeid(*data) == typeid(RelaxationSwitchData)) {
            auto *audioSwitchData = static_cast<RelaxationSwitchData *>(data);
            audioContext          = audioSwitchData->getAudioContext();
        }
    }

    bool BGSoundsTimerSelectWindow::onInput(const gui::InputEvent &inputEvent)
    bool RelaxationTimerSelectWindow::onInput(const gui::InputEvent &inputEvent)
    {
        if (spinner->onInput(inputEvent)) {
            updateBottomDescription();


@@ 160,9 161,9 @@ namespace gui
            auto currentValue = UTF8ToTimerValue(spinner->value());
            presenter->setTimerValue(currentValue);

            auto audioSwitchData                        = std::make_unique<BGSoundsSwitchData>(std::move(audioContext));
            auto audioSwitchData = std::make_unique<RelaxationSwitchData>(std::move(audioContext));
            audioSwitchData->ignoreCurrentWindowOnStack = true;
            application->switchWindow(gui::window::name::bgSoundsProgress, std::move(audioSwitchData));
            application->switchWindow(gui::window::name::relaxationProgress, std::move(audioSwitchData));

            return true;
        }

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsTimerSelectWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationTimerSelectWindow.hpp +8 -7
@@ 3,8 3,8 @@

#pragma once

#include "presenter/BGSoundsTimerSelectPresenter.hpp"
#include "data/BGSoundsAudioData.hpp"
#include "presenter/RelaxationTimerSelectPresenter.hpp"
#include "data/RelaxationAudioData.hpp"
#include <AppWindow.hpp>
#include <apps-common/widgets/spinners/Spinners.hpp>



@@ 14,13 14,13 @@ namespace gui
    class BellBaseLayout;
    class Text;

    class BGSoundsTimerSelectWindow : public AppWindow, public app::bgSounds::BGSoundsTimerSelectContract::View
    class RelaxationTimerSelectWindow : public AppWindow, public app::relaxation::RelaxationTimerSelectContract::View
    {
        std::unique_ptr<app::bgSounds::BGSoundsTimerSelectContract::Presenter> presenter;
        std::unique_ptr<app::relaxation::RelaxationTimerSelectContract::Presenter> presenter;
        BellBaseLayout *body    = nullptr;
        StringSpinner *spinner  = nullptr;
        Text *bottomDescription = nullptr;
        std::unique_ptr<BGSoundsAudioContext> audioContext;
        std::unique_ptr<RelaxationAudioContext> audioContext;

        void buildInterface() override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;


@@ 33,8 33,9 @@ namespace gui
        void registerCallbacks();

      public:
        BGSoundsTimerSelectWindow(app::ApplicationCommon *app,
                                  std::unique_ptr<app::bgSounds::BGSoundsTimerSelectContract::Presenter> &&presenter);
        RelaxationTimerSelectWindow(
            app::ApplicationCommon *app,
            std::unique_ptr<app::relaxation::RelaxationTimerSelectContract::Presenter> &&presenter);
    };

} // namespace gui

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsVolumeWindow.cpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationVolumeWindow.cpp +9 -9
@@ 1,22 1,22 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "BGSoundsVolumeWindow.hpp"
#include <ApplicationBellBackgroundSounds.hpp>
#include "RelaxationVolumeWindow.hpp"
#include <ApplicationBellRelaxation.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>
#include <data/BGSoundsStyle.hpp>
#include <data/RelaxationStyle.hpp>
#include <popups/data/PopupData.hpp>

namespace gui
{
    BGSoundsVolumeWindow::BGSoundsVolumeWindow(
        app::ApplicationCommon *app, std::unique_ptr<app::bgSounds::AbstractBGSoundsVolumePresenter> &&presenter)
    RelaxationVolumeWindow::RelaxationVolumeWindow(
        app::ApplicationCommon *app, std::unique_ptr<app::relaxation::AbstractRelaxationVolumePresenter> &&presenter)
        : WindowWithTimer(app, gui::popup::window::volume_window), presenter{std::move(presenter)}
    {
        buildInterface();
    }

    void BGSoundsVolumeWindow::buildInterface()
    void RelaxationVolumeWindow::buildInterface()
    {
        WindowWithTimer::buildInterface();



@@ 41,7 41,7 @@ namespace gui
                                        static_cast<U8IntegerSpinner::value_type>(data.step)},
                                       Boundaries::Fixed);
        spinner->setMaximumSize(style::bell_base_layout::w, style::bell_base_layout::center_layout_h);
        spinner->setFont(bgSoundsStyle::valumeValueFont);
        spinner->setFont(relaxationStyle::valumeValueFont);
        spinner->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        spinner->setFocusEdges(RectangleEdge::None);
        spinner->set_value(static_cast<U8IntegerSpinner::value_type>(presenter->getVolume()));


@@ 54,7 54,7 @@ namespace gui
        body->resize();
    }

    bool BGSoundsVolumeWindow::onInput(const InputEvent &inputEvent)
    bool RelaxationVolumeWindow::onInput(const InputEvent &inputEvent)
    {
        if (inputEvent.isShortRelease(KeyCode::KEY_ENTER) || inputEvent.isShortRelease(KeyCode::KEY_RF)) {
            application->returnToPreviousWindow();

R products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsVolumeWindow.hpp => products/BellHybrid/apps/application-bell-relaxation/windows/RelaxationVolumeWindow.hpp +5 -5
@@ 3,7 3,7 @@

#pragma once

#include "presenter/BGSoundsVolumePresenter.hpp"
#include "presenter/RelaxationVolumePresenter.hpp"

#include <apps-common/popups/WindowWithTimer.hpp>
#include <apps-common/widgets/spinners/Spinners.hpp>


@@ 12,9 12,9 @@
namespace gui
{
    class BellBaseLayout;
    class BGSoundsVolumeWindow : public WindowWithTimer
    class RelaxationVolumeWindow : public WindowWithTimer
    {
        std::unique_ptr<app::bgSounds::AbstractBGSoundsVolumePresenter> presenter;
        std::unique_ptr<app::relaxation::AbstractRelaxationVolumePresenter> presenter;
        BellBaseLayout *body{};
        U8IntegerSpinner *spinner = nullptr;



@@ 22,7 22,7 @@ namespace gui
        bool onInput(const gui::InputEvent &inputEvent) override;

      public:
        BGSoundsVolumeWindow(app::ApplicationCommon *app,
                             std::unique_ptr<app::bgSounds::AbstractBGSoundsVolumePresenter> &&windowPresenter);
        RelaxationVolumeWindow(app::ApplicationCommon *app,
                               std::unique_ptr<app::relaxation::AbstractRelaxationVolumePresenter> &&windowPresenter);
    };
} // namespace gui