From dbc1c79f4961c213ec70e4e4869087864f7cfc9b Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 1 Jan 2019 23:44:28 +0100 Subject: [PATCH] Support album artist and vendor --- CMakeLists.txt | 2 +- application/knownfieldmodel.cpp | 67 ++++++++++++++++++--------------- cli/fieldmapping.cpp | 2 + cli/mainfeatures.cpp | 2 +- 4 files changed, 40 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b672ef2..6abcfcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,7 +216,7 @@ if(WIDGETS_GUI OR QUICK_GUI) endif() # find tagparser -find_package(tagparser 8.0.0 REQUIRED) +find_package(tagparser 8.1.0 REQUIRED) use_tag_parser() list(APPEND TEST_LIBRARIES ${TAG_PARSER_SHARED_LIB}) diff --git a/application/knownfieldmodel.cpp b/application/knownfieldmodel.cpp index 55b1129..f47a3c8 100644 --- a/application/knownfieldmodel.cpp +++ b/application/knownfieldmodel.cpp @@ -76,6 +76,8 @@ const char *KnownFieldModel::fieldName(KnownField field) return QT_TR_NOOP("Description"); case KnownField::Vendor: return QT_TR_NOOP("Vendor"); + case KnownField::AlbumArtist: + return QT_TR_NOOP("Album artist"); default: return ""; } @@ -95,37 +97,40 @@ QString KnownFieldModel::labelForId(const QVariant &id) const KnownFieldModel::KnownFieldModel(QObject *parent, DefaultSelection defaultSelection) : ChecklistModel(parent) { - QList items; - items.reserve(27); - Qt::CheckState defaultSelected = defaultSelection == DefaultSelection::CommonFields ? Qt::Checked : Qt::Unchecked; - items << mkItem(KnownField::Title, defaultSelected); - items << mkItem(KnownField::Album, defaultSelected); - items << mkItem(KnownField::Artist, defaultSelected); - items << mkItem(KnownField::Genre, defaultSelected); - items << mkItem(KnownField::Year, defaultSelected); - items << mkItem(KnownField::Comment, defaultSelected); - items << mkItem(KnownField::Bpm, Qt::Unchecked); - items << mkItem(KnownField::Bps, Qt::Unchecked); - items << mkItem(KnownField::Lyricist, defaultSelected); - items << mkItem(KnownField::TrackPosition, defaultSelected); - items << mkItem(KnownField::DiskPosition, defaultSelected); - items << mkItem(KnownField::PartNumber, defaultSelected); - items << mkItem(KnownField::TotalParts, defaultSelected); - items << mkItem(KnownField::Encoder, defaultSelected); - items << mkItem(KnownField::RecordDate, defaultSelected); - items << mkItem(KnownField::Performers, defaultSelected); - items << mkItem(KnownField::Length, Qt::Unchecked); - items << mkItem(KnownField::Language, Qt::Unchecked); - items << mkItem(KnownField::EncoderSettings, Qt::Unchecked); - items << mkItem(KnownField::Lyrics, defaultSelected); - items << mkItem(KnownField::SynchronizedLyrics, Qt::Unchecked); - items << mkItem(KnownField::Grouping, Qt::Unchecked); - items << mkItem(KnownField::RecordLabel, Qt::Unchecked); - items << mkItem(KnownField::Cover, defaultSelected); - items << mkItem(KnownField::Composer, Qt::Unchecked); - items << mkItem(KnownField::Rating, Qt::Unchecked); - items << mkItem(KnownField::Description, Qt::Unchecked); - setItems(std::move(items)); + const auto defaultSelected = defaultSelection == DefaultSelection::CommonFields ? Qt::Checked : Qt::Unchecked; + // clang-format off + setItems({ + mkItem(KnownField::Title, defaultSelected), + mkItem(KnownField::Album, defaultSelected), + mkItem(KnownField::Artist, defaultSelected), + mkItem(KnownField::Genre, defaultSelected), + mkItem(KnownField::Year, defaultSelected), + mkItem(KnownField::Comment, defaultSelected), + mkItem(KnownField::AlbumArtist, defaultSelected), + mkItem(KnownField::Bpm, Qt::Unchecked), + mkItem(KnownField::Bps, Qt::Unchecked), + mkItem(KnownField::Lyricist, defaultSelected), + mkItem(KnownField::TrackPosition, defaultSelected), + mkItem(KnownField::DiskPosition, defaultSelected), + mkItem(KnownField::PartNumber, defaultSelected), + mkItem(KnownField::TotalParts, defaultSelected), + mkItem(KnownField::Encoder, defaultSelected), + mkItem(KnownField::RecordDate, defaultSelected), + mkItem(KnownField::Performers, defaultSelected), + mkItem(KnownField::Length, Qt::Unchecked), + mkItem(KnownField::Language, Qt::Unchecked), + mkItem(KnownField::EncoderSettings, Qt::Unchecked), + mkItem(KnownField::Lyrics, defaultSelected), + mkItem(KnownField::SynchronizedLyrics, Qt::Unchecked), + mkItem(KnownField::Grouping, Qt::Unchecked), + mkItem(KnownField::RecordLabel, Qt::Unchecked), + mkItem(KnownField::Cover, defaultSelected), + mkItem(KnownField::Composer, Qt::Unchecked), + mkItem(KnownField::Rating, Qt::Unchecked), + mkItem(KnownField::Description, Qt::Unchecked), + mkItem(KnownField::Vendor, Qt::Unchecked), + }); + // clang-format on } KnownFieldModel::KnownFieldModel(const QList &items, QObject *parent) diff --git a/cli/fieldmapping.cpp b/cli/fieldmapping.cpp index abe88cd..eeb7035 100644 --- a/cli/fieldmapping.cpp +++ b/cli/fieldmapping.cpp @@ -38,6 +38,8 @@ static constexpr struct { { "composer", KnownField::Composer }, { "rating", KnownField::Rating }, { "description", KnownField::Description }, + { "vendor", KnownField::Vendor }, + { "albumartist", KnownField::AlbumArtist }, }; const char *fieldDenotation(TagParser::KnownField knownField) diff --git a/cli/mainfeatures.cpp b/cli/mainfeatures.cpp index b64b26b..f6f5c27 100644 --- a/cli/mainfeatures.cpp +++ b/cli/mainfeatures.cpp @@ -70,7 +70,7 @@ namespace Cli { #define FIELD_NAMES \ "title album artist genre year comment bpm bps lyricist disk part totalparts encoder\n" \ " recorddate performers duration language encodersettings lyrics synchronizedlyrics grouping\n" \ - " recordlabel cover composer rating description" + " recordlabel cover composer rating description vendor albumartist" #define TRACK_ATTRIBUTE_NAMES "name tracknumber enabled=yes enabled=no forced=yes forced=no default=yes default=no"