From 95995606cfff716a771cf0f252f097386c4bc77b Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 19 Jun 2022 14:25:12 +0200 Subject: [PATCH] Allow editing popularity value as string --- gui/tagfieldedit.cpp | 12 +++++++----- misc/utility.cpp | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gui/tagfieldedit.cpp b/gui/tagfieldedit.cpp index 8df0773..ac0ddc6 100644 --- a/gui/tagfieldedit.cpp +++ b/gui/tagfieldedit.cpp @@ -123,6 +123,7 @@ TagValue TagFieldEdit::value(TagTextEncoding encoding, bool includeDescription) case TagDataType::Text: case TagDataType::TimeSpan: case TagDataType::DateTime: + case TagDataType::Popularity: switch (m_field) { case KnownField::Genre: if (m_comboBox) { @@ -248,9 +249,9 @@ void TagFieldEdit::setCoverButtonsHidden(bool hideCoverButtons) */ TagDataType TagFieldEdit::determineDataType() { - TagDataType proposedDataType = TagDataType::Undefined; - for (const Tag *const tag : tags()) { - TagDataType type = tag->proposedDataType(m_field); + auto proposedDataType = TagDataType::Undefined; + for (const auto *const tag : tags()) { + auto type = tag->proposedDataType(m_field); if (proposedDataType == TagDataType::Undefined) { proposedDataType = type; } else if ((proposedDataType == TagDataType::PositionInSet && type == TagDataType::Integer) @@ -285,6 +286,7 @@ void TagFieldEdit::setupUi() case TagDataType::Text: case TagDataType::TimeSpan: case TagDataType::DateTime: + case TagDataType::Popularity: switch (m_field) { case KnownField::Genre: setupGenreComboBox(); @@ -866,13 +868,13 @@ void TagFieldEdit::clear() */ void TagFieldEdit::apply() { - for (Tag *const tag : *m_tags) { + for (auto *const tag : *m_tags) { if (m_dataType == TagDataType::Picture) { if (m_pictureSelection) { m_pictureSelection->apply(); } } else { - TagTextEncoding encoding = Settings::values().tagPocessing.preferredEncoding; + auto encoding = Settings::values().tagPocessing.preferredEncoding; if (!tag->canEncodingBeUsed(encoding)) { encoding = tag->proposedTextEncoding(); } diff --git a/misc/utility.cpp b/misc/utility.cpp index a8be788..5400617 100644 --- a/misc/utility.cpp +++ b/misc/utility.cpp @@ -61,6 +61,7 @@ QString tagValueToQString(const TagValue &value) case TagDataType::TimeSpan: case TagDataType::DateTime: case TagDataType::PositionInSet: + case TagDataType::Popularity: return QString::fromStdString(value.toString()); default:; }