Allow editing popularity value as string

This commit is contained in:
Martchus 2022-06-19 14:25:12 +02:00
parent c3f471c168
commit 95995606cf
2 changed files with 8 additions and 5 deletions

View File

@ -123,6 +123,7 @@ TagValue TagFieldEdit::value(TagTextEncoding encoding, bool includeDescription)
case TagDataType::Text: case TagDataType::Text:
case TagDataType::TimeSpan: case TagDataType::TimeSpan:
case TagDataType::DateTime: case TagDataType::DateTime:
case TagDataType::Popularity:
switch (m_field) { switch (m_field) {
case KnownField::Genre: case KnownField::Genre:
if (m_comboBox) { if (m_comboBox) {
@ -248,9 +249,9 @@ void TagFieldEdit::setCoverButtonsHidden(bool hideCoverButtons)
*/ */
TagDataType TagFieldEdit::determineDataType() TagDataType TagFieldEdit::determineDataType()
{ {
TagDataType proposedDataType = TagDataType::Undefined; auto proposedDataType = TagDataType::Undefined;
for (const Tag *const tag : tags()) { for (const auto *const tag : tags()) {
TagDataType type = tag->proposedDataType(m_field); auto type = tag->proposedDataType(m_field);
if (proposedDataType == TagDataType::Undefined) { if (proposedDataType == TagDataType::Undefined) {
proposedDataType = type; proposedDataType = type;
} else if ((proposedDataType == TagDataType::PositionInSet && type == TagDataType::Integer) } else if ((proposedDataType == TagDataType::PositionInSet && type == TagDataType::Integer)
@ -285,6 +286,7 @@ void TagFieldEdit::setupUi()
case TagDataType::Text: case TagDataType::Text:
case TagDataType::TimeSpan: case TagDataType::TimeSpan:
case TagDataType::DateTime: case TagDataType::DateTime:
case TagDataType::Popularity:
switch (m_field) { switch (m_field) {
case KnownField::Genre: case KnownField::Genre:
setupGenreComboBox(); setupGenreComboBox();
@ -866,13 +868,13 @@ void TagFieldEdit::clear()
*/ */
void TagFieldEdit::apply() void TagFieldEdit::apply()
{ {
for (Tag *const tag : *m_tags) { for (auto *const tag : *m_tags) {
if (m_dataType == TagDataType::Picture) { if (m_dataType == TagDataType::Picture) {
if (m_pictureSelection) { if (m_pictureSelection) {
m_pictureSelection->apply(); m_pictureSelection->apply();
} }
} else { } else {
TagTextEncoding encoding = Settings::values().tagPocessing.preferredEncoding; auto encoding = Settings::values().tagPocessing.preferredEncoding;
if (!tag->canEncodingBeUsed(encoding)) { if (!tag->canEncodingBeUsed(encoding)) {
encoding = tag->proposedTextEncoding(); encoding = tag->proposedTextEncoding();
} }

View File

@ -61,6 +61,7 @@ QString tagValueToQString(const TagValue &value)
case TagDataType::TimeSpan: case TagDataType::TimeSpan:
case TagDataType::DateTime: case TagDataType::DateTime:
case TagDataType::PositionInSet: case TagDataType::PositionInSet:
case TagDataType::Popularity:
return QString::fromStdString(value.toString()); return QString::fromStdString(value.toString());
default:; default:;
} }