diff --git a/src/core/song.cpp b/src/core/song.cpp index e21a3a561..408d9d05d 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -816,6 +816,31 @@ bool Song::lyrics_supported() const { return additional_tags_supported() || d->filetype_ == FileType::ASF; } +bool Song::albumartistsort_supported() const { + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis || d->filetype_ == FileType::MPEG; +} + +bool Song::albumsort_supported() const { + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis || d->filetype_ == FileType::MPEG; +} + +bool Song::artistsort_supported() const { + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis || d->filetype_ == FileType::MPEG; +} + +bool Song::composersort_supported() const { + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis || d->filetype_ == FileType::MPEG; +} + +bool Song::performersort_supported() const { + // Performer sort is a rare custom field even in vorbis comments, no write support in MPEG formats + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis; +} + +bool Song::titlesort_supported() const { + return d->filetype_ == FileType::FLAC || d->filetype_ == FileType::OggFlac || d->filetype_ == FileType::OggVorbis || d->filetype_ == FileType::MPEG; +} + 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 091e46613..2cdd0c88f 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -421,6 +421,13 @@ class Song { bool comment_supported() const; bool lyrics_supported() const; + bool albumartistsort_supported() const; + bool albumsort_supported() const; + bool artistsort_supported() const; + bool composersort_supported() const; + bool performersort_supported() const; + bool titlesort_supported() const; + 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(); }; diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp index e29311cc5..35aff82a7 100644 --- a/src/dialogs/edittagdialog.cpp +++ b/src/dialogs/edittagdialog.cpp @@ -274,12 +274,18 @@ EditTagDialog::EditTagDialog(const SharedPtr network, QKeySequence(QKeySequence::MoveToNextPage).toString(QKeySequence::NativeText))); new TagCompleter(collection_backend, Playlist::Column::Artist, ui_->artist); + new TagCompleter(collection_backend, Playlist::Column::ArtistSort, ui_->artistsort); new TagCompleter(collection_backend, Playlist::Column::Album, ui_->album); + new TagCompleter(collection_backend, Playlist::Column::AlbumSort, ui_->albumsort); new TagCompleter(collection_backend, Playlist::Column::AlbumArtist, ui_->albumartist); + new TagCompleter(collection_backend, Playlist::Column::AlbumArtistSort, ui_->albumartistsort); new TagCompleter(collection_backend, Playlist::Column::Genre, ui_->genre); new TagCompleter(collection_backend, Playlist::Column::Composer, ui_->composer); + new TagCompleter(collection_backend, Playlist::Column::ComposerSort, ui_->composersort); new TagCompleter(collection_backend, Playlist::Column::Performer, ui_->performer); + new TagCompleter(collection_backend, Playlist::Column::PerformerSort, ui_->performersort); new TagCompleter(collection_backend, Playlist::Column::Grouping, ui_->grouping); + new TagCompleter(collection_backend, Playlist::Column::TitleSort, ui_->titlesort); } @@ -493,11 +499,17 @@ void EditTagDialog::SetSongListVisibility(bool visible) { QVariant EditTagDialog::Data::value(const Song &song, const QString &id) { if (id == "title"_L1) return song.title(); + if (id == "titlesort"_L1) return song.titlesort(); if (id == "artist"_L1) return song.artist(); + if (id == "artistsort"_L1) return song.artistsort(); if (id == "album"_L1) return song.album(); + if (id == "albumsort"_L1) return song.albumsort(); if (id == "albumartist"_L1) return song.albumartist(); + if (id == "albumartistsort"_L1) return song.albumartistsort(); if (id == "composer"_L1) return song.composer(); + if (id == "composersort"_L1) return song.composersort(); if (id == "performer"_L1) return song.performer(); + if (id == "performersort"_L1) return song.performersort(); if (id == "grouping"_L1) return song.grouping(); if (id == "genre"_L1) return song.genre(); if (id == "comment"_L1) return song.comment(); @@ -515,11 +527,17 @@ QVariant EditTagDialog::Data::value(const Song &song, const QString &id) { void EditTagDialog::Data::set_value(const QString &id, const QVariant &value) { if (id == "title"_L1) current_.set_title(value.toString()); + else if (id == "titlesort"_L1) current_.set_titlesort(value.toString()); else if (id == "artist"_L1) current_.set_artist(value.toString()); + else if (id == "artistsort"_L1) current_.set_artistsort(value.toString()); else if (id == "album"_L1) current_.set_album(value.toString()); + else if (id == "albumsort"_L1) current_.set_albumsort(value.toString()); else if (id == "albumartist"_L1) current_.set_albumartist(value.toString()); + else if (id == "albumartistsort"_L1) current_.set_albumartistsort(value.toString()); else if (id == "composer"_L1) current_.set_composer(value.toString()); + else if (id == "composersort"_L1) current_.set_composersort(value.toString()); else if (id == "performer"_L1) current_.set_performer(value.toString()); + else if (id == "performersort"_L1) current_.set_performersort(value.toString()); else if (id == "grouping"_L1) current_.set_grouping(value.toString()); else if (id == "genre"_L1) current_.set_genre(value.toString()); else if (id == "comment"_L1) current_.set_comment(value.toString()); @@ -675,14 +693,20 @@ void EditTagDialog::SelectionChanged() { bool art_different = false; bool action_different = false; bool albumartist_enabled = false; + bool albumartistsort_enabled = false; bool composer_enabled = false; + bool composersort_enabled = false; bool performer_enabled = false; + bool performersort_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; + bool titlesort_enabled = false; + bool artistsort_enabled = false; + bool albumsort_enabled = false; for (const QModelIndex &idx : indexes) { if (data_.value(idx.row()).cover_action_ == UpdateCoverAction::None) { data_[idx.row()].cover_result_ = AlbumCoverImageResult(); @@ -702,12 +726,21 @@ void EditTagDialog::SelectionChanged() { if (song.albumartist_supported()) { albumartist_enabled = true; } + if (song.albumartistsort_supported()) { + albumartistsort_enabled = true; + } if (song.composer_supported()) { composer_enabled = true; } + if (song.composersort_supported()) { + composersort_enabled = true; + } if (song.performer_supported()) { performer_enabled = true; } + if (song.performersort_supported()) { + performersort_enabled = true; + } if (song.grouping_supported()) { grouping_enabled = true; } @@ -726,6 +759,15 @@ void EditTagDialog::SelectionChanged() { if (song.lyrics_supported()) { lyrics_enabled = true; } + if (song.titlesort_supported()) { + titlesort_enabled = true; + } + if (song.artistsort_supported()) { + artistsort_enabled = true; + } + if (song.albumsort_supported()) { + albumsort_enabled = true; + } } QString summary; @@ -782,14 +824,20 @@ void EditTagDialog::SelectionChanged() { album_cover_choice_controller_->set_save_embedded_cover_override(embedded_cover); ui_->albumartist->setEnabled(albumartist_enabled); + ui_->albumartistsort->setEnabled(albumartistsort_enabled); ui_->composer->setEnabled(composer_enabled); + ui_->composersort->setEnabled(composersort_enabled); ui_->performer->setEnabled(performer_enabled); + ui_->performersort->setEnabled(performersort_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); + ui_->titlesort->setEnabled(titlesort_enabled); + ui_->artistsort->setEnabled(artistsort_enabled); + ui_->albumsort->setEnabled(albumsort_enabled); } diff --git a/src/dialogs/edittagdialog.ui b/src/dialogs/edittagdialog.ui index c9dc2716f..0c0e0ea3d 100644 --- a/src/dialogs/edittagdialog.ui +++ b/src/dialogs/edittagdialog.ui @@ -31,8 +31,8 @@ 0 0 - 801 - 918 + 781 + 1047 @@ -700,54 +700,35 @@ QLayout::SetMinimumSize - - - - QAbstractSpinBox::CorrectToNearestValue - - - 9999 - - - false - - - true - - - - - - - true - - - false - - - - + - Disc + Year - disc + year - - - - true + + + + Complete tags automatically - - false + + + :/pictures/musicbrainz.png:/pictures/musicbrainz.png + + + + 38 + 22 + - + 80 @@ -755,14 +736,56 @@ - Grouping + Performer sort - grouping + performersort - + + + + + 80 + 0 + + + + Compilation + + + compilation + + + + + + + true + + + false + + + + + + + + 80 + 0 + + + + Title sort + + + titlesort + + + + @@ -778,7 +801,130 @@ - + + + + true + + + false + + + + + + + + 80 + 0 + + + + Performer + + + performer + + + + + + + true + + + false + + + + + + + QAbstractSpinBox::CorrectToNearestValue + + + 9999 + + + false + + + true + + + + + + + + 140 + 16777215 + + + + true + + + false + + + + + + + true + + + false + + + + + + + + 0 + 0 + + + + true + + + true + + + false + + + + + + + true + + + false + + + + + + + + 80 + 0 + + + + Title + + + title + + + + true @@ -788,7 +934,63 @@ - + + + + QAbstractSpinBox::CorrectToNearestValue + + + 9999 + + + false + + + true + + + + + + + true + + + false + + + + + + + true + + + false + + + + + + + Rating + + + rating + + + + + + + Disc + + + disc + + + + true @@ -798,26 +1000,6 @@ - - - - true - - - false - - - - - - - true - - - false - - - @@ -834,7 +1016,49 @@ + + + + + 80 + 0 + + + + Album artist sort + + + albumartistsort + + + + + + + true + + + false + + + + + + + 80 + 0 + + + + Artist sort + + + artistsort + + + + @@ -850,18 +1074,18 @@ - - + + - Year + Track - year + track - - + + 80 @@ -869,10 +1093,72 @@ - Title + Composer - title + composer + + + + + + + true + + + false + + + + + + + true + + + false + + + + + + + true + + + false + + + + + + + + 80 + 0 + + + + Grouping + + + grouping + + + + + + + + 80 + 0 + + + + Album sort + + + albumsort @@ -892,66 +1178,7 @@ - - - - - 80 - 0 - - - - Composer - - - composer - - - - - - - Complete tags automatically - - - - :/pictures/musicbrainz.png:/pictures/musicbrainz.png - - - - 38 - 22 - - - - - - - - QAbstractSpinBox::CorrectToNearestValue - - - 9999 - - - false - - - true - - - - - - - true - - - false - - - - + @@ -967,7 +1194,17 @@ - + + + + true + + + false + + + + @@ -983,47 +1220,8 @@ - - - - true - - - false - - - - - - - true - - - false - - - - - - - - 0 - 0 - - - - true - - - true - - - false - - - - - + + 80 @@ -1031,57 +1229,15 @@ - Performer + Composer sort - performer + composersort - - - - - 80 - 0 - - - - Compilation - - - compilation - - - - - - - Track - - - track - - - - - - - Rating - - - rating - - - - - - - - 140 - 16777215 - - + + true @@ -1147,12 +1303,12 @@ - - - - Complete lyrics automatically - - + + + + Complete lyrics automatically + + @@ -1215,25 +1371,32 @@ summary filename path + art_embedded art_manual art_automatic + art_unset playcount_reset tags_summary tags_art_button checkbox_embedded_cover title track - artist + titlesort disc - album + artist year + artistsort + album + albumsort albumartist + albumartistsort composer + composersort performer + performersort grouping genre compilation - rating fetch_tag comment lyrics