~aleteoryx/muditaos

6b3fdbc99f17803845fa355ddf29a3a94720a746 — tomaszkrosnowski 4 years ago ef12b04
[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.
1 files changed, 11 insertions(+), 3 deletions(-)

M module-apps/application-settings-new/models/SoundsModel.cpp
M module-apps/application-settings-new/models/SoundsModel.cpp => module-apps/application-settings-new/models/SoundsModel.cpp +11 -3
@@ 94,10 94,17 @@ void SoundsModel::applyItems(const std::vector<std::filesystem::path> &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<std::filesystem::path> &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();