From 6b3fdbc99f17803845fa355ddf29a3a94720a746 Mon Sep 17 00:00:00 2001 From: tomaszkrosnowski Date: Fri, 23 Apr 2021 13:17:07 +0200 Subject: [PATCH] [EGD-6613] Audio assets tags are not displayed When selecting ring/sms/notification sound the title from audio tags is displayed. If tags are empty the filename is shown. --- .../models/SoundsModel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/module-apps/application-settings-new/models/SoundsModel.cpp b/module-apps/application-settings-new/models/SoundsModel.cpp index fcce94ea43aebf14f11e7db5fe7f4f44fa51b9be..58c2f4c3686857cc17b0aafe7f64a06d43bf5e74 100644 --- a/module-apps/application-settings-new/models/SoundsModel.cpp +++ b/module-apps/application-settings-new/models/SoundsModel.cpp @@ -94,10 +94,17 @@ void SoundsModel::applyItems(const std::vector &sounds, isSelected = true; } - std::string fileName = sound.filename(); - std::string fileRelativePath = sound.lexically_relative(purefs::dir::getCurrentOSPath()); + std::string itemTitle; + auto fileTags = AudioServiceAPI::GetFileTags(app, sound); + if (fileTags) { + itemTitle = fileTags->title; + } + + if (itemTitle.empty()) { + itemTitle = sound.filename(); + } - auto item = new gui::SettingsSoundItem(fileName, isSelected); + auto item = new gui::SettingsSoundItem(itemTitle, isSelected); switch (model->getPlaybackType()) { @@ -105,6 +112,7 @@ void SoundsModel::applyItems(const std::vector &sounds, case audio::PlaybackType::TextMessageRingtone: case audio::PlaybackType::Notifications: item->activatedCallback = [=](gui::Item &) { + auto fileRelativePath = sound.lexically_relative(purefs::dir::getCurrentOSPath()); LOG_INFO("Setting sound to %s", fileRelativePath.c_str()); model->setSound(fileRelativePath); app->returnToPreviousWindow();