From aa4221e0fb07419e2b0a82c4bd5c19183d883d0c Mon Sep 17 00:00:00 2001 From: Bartosz Date: Thu, 24 Nov 2022 14:14:36 +0100 Subject: [PATCH] [MOS-000] Rebase fixes Fixes for master -> UDM rebase --- products/BellHybrid/alarms/CMakeLists.txt | 1 + .../alarms/include/AlarmSoundPaths.hpp | 22 ++++++ .../BellHybrid/alarms/src/AlarmSoundPaths.cpp | 71 +++++++++++++++++++ .../ApplicationBellRelaxation.cpp | 4 +- .../RelaxationMainWindowPresenter.cpp | 3 - 5 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 products/BellHybrid/alarms/include/AlarmSoundPaths.hpp create mode 100644 products/BellHybrid/alarms/src/AlarmSoundPaths.cpp diff --git a/products/BellHybrid/alarms/CMakeLists.txt b/products/BellHybrid/alarms/CMakeLists.txt index 97f53da8cc35f50fe1f8d7c02a0d76c0fbc92c2d..c799117af5812043a1e91e61f3c94d2ee98f59f7 100644 --- a/products/BellHybrid/alarms/CMakeLists.txt +++ b/products/BellHybrid/alarms/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(bell::alarms ALIAS alarms) target_sources(alarms PRIVATE BellAlarmHandler.cpp + src/AlarmSoundPaths.cpp src/actions/PlayAudioActions.cpp src/actions/NotifyGUIAction.cpp src/actions/NotifyGUIBedtimeReminderAction.cpp diff --git a/products/BellHybrid/alarms/include/AlarmSoundPaths.hpp b/products/BellHybrid/alarms/include/AlarmSoundPaths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..380856a258026e8deb8b29aef73c57fadbae2413 --- /dev/null +++ b/products/BellHybrid/alarms/include/AlarmSoundPaths.hpp @@ -0,0 +1,22 @@ + +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include +#include + +namespace alarms::paths +{ + std::filesystem::path getAlarmDir() noexcept; + std::filesystem::path getMusicDir() noexcept; + std::filesystem::path getPreWakeUpChimesDir() noexcept; + std::filesystem::path getSnoozeChimesDir() noexcept; + std::filesystem::path getBedtimeReminderChimesDir() noexcept; + std::filesystem::path getBackgroundSoundsDir() noexcept; + std::filesystem::path getMeditationSoundsDir() noexcept; + + /// Check if system paths exist. In case of error, returns vector of missing entries. + std::vector validate() noexcept; +} // namespace alarms::paths \ No newline at end of file diff --git a/products/BellHybrid/alarms/src/AlarmSoundPaths.cpp b/products/BellHybrid/alarms/src/AlarmSoundPaths.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d74cacd64523b39a93474cdcdac1b5a8408c52a2 --- /dev/null +++ b/products/BellHybrid/alarms/src/AlarmSoundPaths.cpp @@ -0,0 +1,71 @@ +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include + +#include + +namespace alarms::paths +{ + std::filesystem::path getAlarmDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/alarm"; + } + + std::filesystem::path getMusicDir() noexcept + { + return purefs::dir::getUserDiskPath() / "music"; + } + + std::filesystem::path getPreWakeUpChimesDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/prewakeup"; + } + + std::filesystem::path getSnoozeChimesDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/chimes"; + } + + std::filesystem::path getBedtimeReminderChimesDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/evening_reminder"; + } + + std::filesystem::path getBackgroundSoundsDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/bg_sounds"; + } + + std::filesystem::path getMeditationSoundsDir() noexcept + { + return purefs::dir::getAssetsDirPath() / "audio/meditation"; + } + + std::vector validate() noexcept + { + std::vector ret; + if (not std::filesystem::exists(getAlarmDir())) { + ret.push_back(getAlarmDir()); + } + if (not std::filesystem::exists(getMusicDir())) { + ret.push_back(getMusicDir()); + } + if (not std::filesystem::exists(getPreWakeUpChimesDir())) { + ret.push_back(getPreWakeUpChimesDir()); + } + if (not std::filesystem::exists(getSnoozeChimesDir())) { + ret.push_back(getSnoozeChimesDir()); + } + if (not std::filesystem::exists(getBedtimeReminderChimesDir())) { + ret.push_back(getBedtimeReminderChimesDir()); + } + if (not std::filesystem::exists(getBackgroundSoundsDir())) { + ret.push_back(getBackgroundSoundsDir()); + } + if (not std::filesystem::exists(getMeditationSoundsDir())) { + ret.push_back(getMeditationSoundsDir()); + } + return ret; + } +} // namespace alarms::paths \ No newline at end of file diff --git a/products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp b/products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp index cb2c615a3a27fd24f189c74c39689d55a52bca4b..6fcfccb1566d2cbd216fd6e010495da34d221497 100644 --- a/products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +++ b/products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp @@ -62,8 +62,8 @@ namespace app { windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) { auto tagsFetcher = std::make_unique(app); - auto soundsRepository = std::make_unique( - app, std::move(tagsFetcher), alarms::paths::getBackgroundSoundsDir()); + const auto paths = std::vector{alarms::paths::getBackgroundSoundsDir()}; + auto soundsRepository = std::make_unique(app, std::move(tagsFetcher), paths); auto presenter = std::make_unique(std::move(soundsRepository)); return std::make_unique(app, std::move(presenter)); }); diff --git a/products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp b/products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp index 6a757f49a85775966b04b419edd1cc0eb688bd8f..c6065b69c2c7aaf2f7849c5b8d82b14a6a2d2dbb 100644 --- a/products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp @@ -2,9 +2,6 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "RelaxationMainWindowPresenter.hpp" -#include "data/BGSoundsAudioData.hpp" -#include "widgets/SoundListItem.hpp" -#include "ApplicationBellBackgroundSounds.hpp" #include namespace