M products/BellHybrid/alarms/CMakeLists.txt => products/BellHybrid/alarms/CMakeLists.txt +1 -0
@@ 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
A products/BellHybrid/alarms/include/AlarmSoundPaths.hpp => products/BellHybrid/alarms/include/AlarmSoundPaths.hpp +22 -0
@@ 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 <filesystem>
+#include <vector>
+
+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<std::filesystem::path> validate() noexcept;
+} // namespace alarms::paths<
\ No newline at end of file
A products/BellHybrid/alarms/src/AlarmSoundPaths.cpp => products/BellHybrid/alarms/src/AlarmSoundPaths.cpp +71 -0
@@ 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 <AlarmSoundPaths.hpp>
+
+#include <purefs/filesystem_paths.hpp>
+
+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<std::filesystem::path> validate() noexcept
+ {
+ std::vector<std::filesystem::path> 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
M products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp => products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +2 -2
@@ 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::music::ServiceAudioTagsFetcher>(app);
- auto soundsRepository = std::make_unique<app::music::SongsRepository>(
- app, std::move(tagsFetcher), alarms::paths::getBackgroundSoundsDir());
+ const auto paths = std::vector<std::string>{alarms::paths::getBackgroundSoundsDir()};
+ auto soundsRepository = std::make_unique<app::music::SongsRepository>(app, std::move(tagsFetcher), paths);
auto presenter = std::make_unique<relaxation::RelaxationMainWindowPresenter>(std::move(soundsRepository));
return std::make_unique<gui::RelaxationMainWindow>(app, std::move(presenter));
});
M products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp => products/BellHybrid/apps/application-bell-relaxation/presenter/RelaxationMainWindowPresenter.cpp +0 -3
@@ 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 <apps-common/models/SongsRepository.hpp>
namespace