diff --git a/src/core/song.cpp b/src/core/song.cpp index 1d155af5..512c93c8 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -351,6 +351,73 @@ void Song::set_embedded_cover() { d->art_automatic_ = QUrl::fromLocalFile(kEmbed void Song::clear_art_automatic() { d->art_automatic_.clear(); } void Song::clear_art_manual() { d->art_manual_.clear(); } +bool Song::additional_tags_supported() const { + return d->filetype_ == FileType_FLAC || + d->filetype_ == FileType_WavPack || + d->filetype_ == FileType_OggFlac || + d->filetype_ == FileType_OggVorbis || + d->filetype_ == FileType_OggOpus || + d->filetype_ == FileType_OggSpeex || + d->filetype_ == FileType_MPEG || + d->filetype_ == FileType_MP4 || + d->filetype_ == FileType_MPC || + d->filetype_ == FileType_APE; +} + +bool Song::albumartist_supported() const { + return additional_tags_supported(); +} + +bool Song::composer_supported() const { + return additional_tags_supported(); +} + +bool Song::performer_supported() const { + return d->filetype_ == FileType_FLAC || + d->filetype_ == FileType_WavPack || + d->filetype_ == FileType_OggFlac || + d->filetype_ == FileType_OggVorbis || + d->filetype_ == FileType_OggOpus || + d->filetype_ == FileType_OggSpeex || + d->filetype_ == FileType_MPEG || + d->filetype_ == FileType_MPC || + d->filetype_ == FileType_APE; +} + +bool Song::grouping_supported() const { + return additional_tags_supported(); +} + +bool Song::genre_supported() const { + return additional_tags_supported(); +} + +bool Song::compilation_supported() const { + return additional_tags_supported(); +} + +bool Song::rating_supported() const { + return d->filetype_ == FileType_FLAC || + d->filetype_ == FileType_WavPack || + d->filetype_ == FileType_OggFlac || + d->filetype_ == FileType_OggVorbis || + d->filetype_ == FileType_OggOpus || + d->filetype_ == FileType_OggSpeex || + d->filetype_ == FileType_MPEG || + d->filetype_ == FileType_MP4 || + d->filetype_ == FileType_ASF || + d->filetype_ == FileType_MPC || + d->filetype_ == FileType_APE; +} + +bool Song::comment_supported() const { + return additional_tags_supported(); +} + +bool Song::lyrics_supported() const { + return additional_tags_supported(); +} + bool Song::save_embedded_cover_supported(const FileType filetype) { return filetype == FileType_FLAC || diff --git a/src/core/song.h b/src/core/song.h index 03ba5220..aab043fc 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -298,6 +298,17 @@ class Song { static bool save_embedded_cover_supported(const FileType filetype); bool save_embedded_cover_supported() const { return url().isLocalFile() && save_embedded_cover_supported(filetype()) && !has_cue(); }; + bool additional_tags_supported() const; + bool albumartist_supported() const; + bool composer_supported() const; + bool performer_supported() const; + bool grouping_supported() const; + bool genre_supported() const; + bool compilation_supported() const; + bool rating_supported() const; + bool comment_supported() const; + bool lyrics_supported() const; + const QUrl &stream_url() const; const QUrl &effective_stream_url() const; bool init_from_file() const; diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp index ba6b6ff2..80a522f6 100644 --- a/src/dialogs/edittagdialog.cpp +++ b/src/dialogs/edittagdialog.cpp @@ -624,6 +624,15 @@ void EditTagDialog::SelectionChanged() { UpdateCoverAction first_cover_action = data_[indexes.first().row()].cover_action_; bool art_different = false; bool action_different = false; + bool albumartist_enabled = false; + bool composer_enabled = false; + bool performer_enabled = false; + bool grouping_enabled = false; + bool genre_enabled = false; + bool compilation_enabled = false; + bool rating_enabled = false; + bool comment_enabled = false; + bool lyrics_enabled = false; for (const QModelIndex &idx : indexes) { if (data_[idx.row()].cover_action_ == UpdateCoverAction_None) { data_[idx.row()].cover_result_ = AlbumCoverImageResult(); @@ -639,7 +648,33 @@ void EditTagDialog::SelectionChanged() { (song.has_embedded_cover() && first_song.has_embedded_cover() && (first_song.effective_albumartist() != song.effective_albumartist() || first_song.album() != song.album())) ) { art_different = true; - break; + } + if (song.albumartist_supported()) { + albumartist_enabled = true; + } + if (song.composer_supported()) { + composer_enabled = true; + } + if (song.performer_supported()) { + performer_enabled = true; + } + if (song.grouping_supported()) { + grouping_enabled = true; + } + if (song.genre_supported()) { + genre_enabled = true; + } + if (song.compilation_supported()) { + compilation_enabled = true; + } + if (song.rating_supported()) { + rating_enabled = true; + } + if (song.comment_supported()) { + comment_enabled = true; + } + if (song.lyrics_supported()) { + lyrics_enabled = true; } } @@ -695,6 +730,16 @@ void EditTagDialog::SelectionChanged() { ui_->checkbox_embedded_cover->setChecked(embedded_cover); album_cover_choice_controller_->set_save_embedded_cover_override(embedded_cover); + ui_->albumartist->setEnabled(albumartist_enabled); + ui_->composer->setEnabled(composer_enabled); + ui_->performer->setEnabled(performer_enabled); + ui_->grouping->setEnabled(grouping_enabled); + ui_->genre->setEnabled(genre_enabled); + ui_->compilation->setEnabled(compilation_enabled); + ui_->rating->setEnabled(rating_enabled); + ui_->comment->setEnabled(comment_enabled); + ui_->lyrics->setEnabled(lyrics_enabled); + } void EditTagDialog::UpdateUI(const QModelIndexList &indexes) {