M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 13,6 13,7 @@
* Added brightness fade in functionality
* Added labels to Relaxation
* Added date format setting
+* Added colors of noise to Relaxation
### Changed / Improved
* Optimize the way Relaxation is loading music files
M image/system_a/data/lang/Deutsch.json => image/system_a/data/lang/Deutsch.json +1 -0
@@ 60,6 60,7 @@
"app_bell_relaxation_once_description": "das Lied wird einmal abgespielt",
"app_bell_relaxation_timer_title": "Timer",
"app_bell_relaxation_sounds": "Entspannende Sounds",
+ "app_bell_relaxation_noises": "Farben des Rauschens",
"app_bell_relaxation_uploaded_sounds": "Hochgeladene Sounds",
"app_bell_settings_about": "Information",
"app_bell_settings_about_info_text": "www.mudita.com",
M image/system_a/data/lang/English.json => image/system_a/data/lang/English.json +1 -0
@@ 93,6 93,7 @@
"app_bell_relaxation_once_description": "the song will play one time",
"app_bell_relaxation_timer_title": "Relaxation time",
"app_bell_relaxation_sounds": "Relaxation sounds",
+ "app_bell_relaxation_noises": "Colors of noise",
"app_bell_relaxation_uploaded_sounds": "Uploaded sounds",
"app_bell_reset_message": "<text>Resetting Mudita<br />Harmony</text>",
"app_bell_settings_about": "About",
M image/system_a/data/lang/Espanol.json => image/system_a/data/lang/Espanol.json +1 -0
@@ 59,6 59,7 @@
"app_bell_relaxation_once_description": "la canci\u00f3n se reproducir\u00e1 una vez",
"app_bell_relaxation_timer_title": "Temporizador",
"app_bell_relaxation_sounds": "Sonidos de relajaci\u00f3n",
+ "app_bell_relaxation_noises": "Colores de ruido",
"app_bell_relaxation_uploaded_sounds": "Sonidos subidos",
"app_bell_settings_about": "Informaci\u00f3n",
"app_bell_settings_about_info_text": "www.mudita.com",
M image/system_a/data/lang/Francais.json => image/system_a/data/lang/Francais.json +1 -0
@@ 61,6 61,7 @@
"app_bell_relaxation_once_description": "le morceau sera lu une fois",
"app_bell_relaxation_timer_title": "Minuterie",
"app_bell_relaxation_sounds": "Sons de relaxation",
+ "app_bell_relaxation_noises": "Couleurs du bruit",
"app_bell_relaxation_uploaded_sounds": "Sons t\u00e9l\u00e9charg\u00e9s",
"app_bell_settings_about": "\u00c0 propos",
"app_bell_settings_about_info_text": "www.mudita.com",
M image/system_a/data/lang/Polski.json => image/system_a/data/lang/Polski.json +1 -0
@@ 60,6 60,7 @@
"app_bell_relaxation_once_description": "utw\u00f3r zostanie odtworzony jeden raz",
"app_bell_relaxation_timer_title": "Wy\u0142\u0105cznik czasowy",
"app_bell_relaxation_sounds": "D\u017Awi\u0119ki relaksacji",
+ "app_bell_relaxation_noises": "Kolory szum\u00f3w",
"app_bell_relaxation_uploaded_sounds": "Przes\u0142ane d\u017awi\u0119ki",
"app_bell_settings_about": "O produkcie",
"app_bell_settings_about_info_text": "www.mudita.com",
M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +2 -2
@@ 143,14 143,14 @@ download_asset_release_json(json-common-target
${CMAKE_CURRENT_SOURCE_DIR}/assets/assets_common.json
${SYSROOT_PATH}/system_a/
MuditaOSPublicAssets
- 0.0.18
+ 0.0.19
${MUDITA_CACHE_DIR}
)
download_asset_release_json(json-community-target
${CMAKE_CURRENT_SOURCE_DIR}/assets/assets_community.json
${SYSROOT_PATH}/system_a/
MuditaOSPublicAssets
- 0.0.18
+ 0.0.19
${MUDITA_CACHE_DIR}
)
download_asset_json(json-rt1051-target
M products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp => products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +1 -0
@@ 80,6 80,7 @@ namespace app
windowsFactory.attach(gui::name::window::main_window, [](ApplicationCommon *app, const std::string &name) {
const auto paths = std::map<relaxation::MusicType, std::string>{
{relaxation::MusicType::Relaxation, paths::audio::proprietary() / paths::audio::relaxation()},
+ {relaxation::MusicType::ColorsOfNoise, paths::audio::proprietary() / paths::audio::colorOfNoises()},
{relaxation::MusicType::User, paths::audio::userApp() / paths::audio::relaxation()}};
auto soundsRepository = std::make_unique<relaxation::RelaxationSongsRepository>(app, paths);
M products/BellHybrid/apps/application-bell-relaxation/data/RelaxationCommon.hpp => products/BellHybrid/apps/application-bell-relaxation/data/RelaxationCommon.hpp +1 -0
@@ 10,6 10,7 @@ namespace app::relaxation
enum class MusicType
{
Relaxation,
+ ColorsOfNoise,
User,
Undefined
};
M products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsModel.cpp => products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsModel.cpp +20 -12
@@ 20,7 20,6 @@ namespace
} // namespace
namespace app::relaxation
{
-
RelaxationSongsProvider::RelaxationSongsProvider(ApplicationCommon *app) : DatabaseModel(app)
{}
@@ 49,24 48,33 @@ namespace app::relaxation
{
return style::bell_options::h + 2 * style::bell_options::option_margin;
}
+ bool RelaxationSongsModel::nextRecordExist(gui::Order order)
+ {
+ const auto getOppositeOrder = [order]() {
+ return order == gui::Order::Next ? gui::Order::Previous : gui::Order::Next;
+ };
+
+ auto exist = getRecord(order) != nullptr;
+ getRecord(getOppositeOrder());
+ return exist;
+ }
gui::ListItem *RelaxationSongsModel::getItem(gui::Order order)
{
const auto sound = getRecord(order);
if (!sound) {
return nullptr;
}
+ auto item =
+ gui::option::RelaxationOption{getTypeFromPath(sound->fileInfo.path, songsRepository->getPathPrefixes()),
+ sound->tags.title,
+ [=]([[maybe_unused]] gui::Item &item) {
+ activateCallback(*sound);
+ return true;
+ },
+ [=]([[maybe_unused]] gui::Item &item) { return true; },
+ nullptr};
- auto item = new gui::option::RelaxationOption(
- getTypeFromPath(sound->fileInfo.path, songsRepository->getPathPrefixes()),
- sound->tags.title,
- [=]([[maybe_unused]] gui::Item &item) {
- activateCallback(*sound);
- return true;
- },
- [=]([[maybe_unused]] gui::Item &item) { return true; },
- nullptr);
-
- return item->build();
+ return item.build();
}
void RelaxationSongsModel::requestRecords(std::uint32_t offset, std::uint32_t limit)
{
M products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsModel.hpp => products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsModel.hpp +4 -0
@@ 14,6 14,7 @@ namespace app::relaxation
public gui::ListItemProvider
{
public:
+ virtual ~RelaxationSongsProvider() = default;
using OnActivateCallback =
std::function<bool(const db::multimedia_files::MultimediaFilesRecord &selectedSound)>;
explicit RelaxationSongsProvider(ApplicationCommon *application);
@@ 32,6 33,8 @@ namespace app::relaxation
[[nodiscard]] bool updateRecords(std::vector<db::multimedia_files::MultimediaFilesRecord> records) override;
public:
+ virtual ~RelaxationSongsModel() = default;
+
explicit RelaxationSongsModel(ApplicationCommon *application,
std::unique_ptr<RelaxationSongsRepository> soundsRepository);
@@ 45,5 48,6 @@ namespace app::relaxation
void createData(OnActivateCallback activateCallback) override;
void updateRecordsCount();
+ bool nextRecordExist(gui::Order order);
};
} // namespace app::relaxation
M products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsRepository.cpp => products/BellHybrid/apps/application-bell-relaxation/model/RelaxationSongsRepository.cpp +3 -0
@@ 118,6 118,9 @@ namespace app::relaxation
}
for (const auto &[type, filesCount] : filesPerType) {
+ if (filesCount == 0) {
+ continue;
+ }
totalFilesCount += filesCount;
if (const auto newOffset = calculateOffset(offset, filesCount); newOffset != offset) {
offset = newOffset;
M products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationItem.hpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationItem.hpp +2 -0
@@ 15,6 15,7 @@ namespace gui
public:
explicit RelaxationItem(app::relaxation::MusicType musicType);
+ virtual ~RelaxationItem() = default;
app::relaxation::MusicType getMusicType();
};
@@ 22,5 23,6 @@ namespace gui
{
public:
explicit RelaxationMarkerItem(const UTF8 &labelText);
+ virtual ~RelaxationMarkerItem() = default;
};
} // namespace gui
M products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationListView.cpp => products/BellHybrid/apps/application-bell-relaxation/widgets/RelaxationListView.cpp +10 -4
@@ 3,6 3,7 @@
#include "RelaxationListView.hpp"
#include "widgets/RelaxationOption.hpp"
+#include "model/RelaxationSongsModel.hpp"
#include "RelaxationItem.hpp"
#include <TextFixedSize.hpp>
@@ 13,6 14,7 @@ namespace
const std::map<app::relaxation::MusicType, std::string> typeToLabel{
{app::relaxation::MusicType::Relaxation, "app_bell_relaxation_sounds"},
+ {app::relaxation::MusicType::ColorsOfNoise, "app_bell_relaxation_noises"},
{app::relaxation::MusicType::User, "app_bell_relaxation_uploaded_sounds"}};
gui::RelaxationMarkerItem *createMarkerItem(app::relaxation::MusicType musicType)
@@ 41,7 43,6 @@ namespace gui
currentPageSize = 0;
itemsOnPage = 0;
labelAdded = false;
- getSlotsLeft();
ListItem *item = nullptr;
while ((item = provider->getItem(getOrderFromDirection())) != nullptr) {
@@ 56,6 57,9 @@ namespace gui
itemsOnPage++;
}
else {
+ // Add invisible item to list to avoid memory leak
+ item->setVisible(false);
+ body->addWidget(item);
break;
}
/* If direction is bottom-to-top, add label mark after adding relaxation item. */
@@ 108,13 112,15 @@ namespace gui
}
}
else {
- const auto nextItemExist = provider->getItem(getOrderFromDirection()) != nullptr;
+ const auto relaxationProvider = dynamic_cast<app::relaxation::RelaxationSongsModel *>(provider.get());
+ if (relaxationProvider == nullptr) {
+ break;
+ }
+ const auto nextItemExist = relaxationProvider->nextRecordExist(getOrderFromDirection());
if (!nextItemExist && getSlotsLeft() == 1) {
body->addWidget(createMarkerItem(currentType));
updateState(currentType);
}
- // Setting back iterator to proper position
- provider->getItem(getOppositeOrderFromDirection());
}
break;
}
M products/BellHybrid/assets/assets_common.json => products/BellHybrid/assets/assets_common.json +7 -1
@@ 105,6 105,12 @@
{"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/evening_reminder/Evening_Horizon.mp3", "output": "assets/audio/evening_reminder/Evening_Horizon.mp3"},
{"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/evening_reminder/Evolving_Dusk.mp3", "output": "assets/audio/evening_reminder/Evolving_Dusk.mp3"},
{"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/evening_reminder/Melodic_Mirth.mp3", "output": "assets/audio/evening_reminder/Melodic_Mirth.mp3"},
- {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/evening_reminder/Twilight_Gleam.mp3", "output": "assets/audio/evening_reminder/Twilight_Gleam.mp3"}
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/evening_reminder/Twilight_Gleam.mp3", "output": "assets/audio/evening_reminder/Twilight_Gleam.mp3"},
+
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/noises/Brown_Noise.mp3", "output": "assets/audio/noises/Brown_Noise.mp3"},
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/noises/Pink_Noise.mp3", "output": "assets/audio/noises/Pink_Noise.mp3"},
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/noises/White_Noise.mp3", "output": "assets/audio/noises/White_Noise.mp3"},
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/noises/Grey_Noise.mp3", "output": "assets/audio/noises/Grey_Noise.mp3"},
+ {"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/noises/Ultra_Noise.mp3", "output": "assets/audio/noises/Ultra_Noise.mp3"}
]
}
M products/BellHybrid/paths/Paths.cpp => products/BellHybrid/paths/Paths.cpp +4 -0
@@ 36,3 36,7 @@ std::filesystem::path paths::audio::meditation() noexcept
{
return "meditation";
}
+std::filesystem::path paths::audio::colorOfNoises() noexcept
+{
+ return "noises";
+}
M products/BellHybrid/paths/Paths.hpp => products/BellHybrid/paths/Paths.hpp +1 -0
@@ 17,6 17,7 @@ namespace paths
std::filesystem::path bedtimeReminder() noexcept;
std::filesystem::path relaxation() noexcept;
std::filesystem::path meditation() noexcept;
+ std::filesystem::path colorOfNoises() noexcept;
} // namespace audio
} // namespace paths