diff --git a/autotests/propertyinfotest.cpp b/autotests/propertyinfotest.cpp --- a/autotests/propertyinfotest.cpp +++ b/autotests/propertyinfotest.cpp @@ -101,6 +101,9 @@ QStringList artistList = {QStringLiteral("Artist1"), QStringLiteral("Artist2"), QStringLiteral("Artist3")}; QStringList authorList = {QStringLiteral("Author1")}; + QVariantList arrangerList = {QStringLiteral("Arranger1"), QStringLiteral("Arranger2")}; + QVariantList bitRateList = {128000, 130000}; + QVariantList titleList = {QStringLiteral("Title1"), QStringLiteral("Title2")}; struct { KFileMetaData::Property::Property property; @@ -110,13 +113,16 @@ } rows[] = { { Property::DiscNumber, true, 2018, QStringLiteral("2018")}, { Property::Title, false, QStringLiteral("Title"), QStringLiteral("Title")}, + { Property::Title, false, titleList, QStringLiteral("Title1 and Title2")}, { Property::Artist, true, artistList, QStringLiteral("Artist1, Artist2, and Artist3")}, { Property::Author, true, authorList, QStringLiteral("Author1")}, + { Property::Arranger, true, arrangerList, QStringLiteral("Arranger1 and Arranger2")}, { Property::Duration, true, 1800, QStringLiteral("0:30:00")}, { Property::SampleRate, true, 44100, QStringLiteral("44.1 kHz")}, { Property::BitRate, true, 128000, QStringLiteral("128 kbit/s")}, { Property::BitRate, true, 1350000, QStringLiteral("1.35 Mbit/s")}, { Property::BitRate, true, 14700000, QStringLiteral("14.7 Mbit/s")}, + { Property::BitRate, true, bitRateList, QStringLiteral("128 kbit/s and 130 kbit/s")}, { Property::ImageOrientation, true, 5, QStringLiteral("Transposed")}, { Property::PhotoFlash, true, 0x00, QStringLiteral("No flash")}, { Property::PhotoFlash, true, 0x50, QStringLiteral("No, red-eye reduction")}, diff --git a/src/propertyinfo.cpp b/src/propertyinfo.cpp --- a/src/propertyinfo.cpp +++ b/src/propertyinfo.cpp @@ -640,7 +640,20 @@ QString PropertyInfo::formatAsDisplayString(const QVariant &value) const { - return (d->formatAsString)(value); + if (value.type() == QVariant::List) { + if (d->valueType == QVariant::StringList || d->valueType == QVariant::String) { + return QLocale().createSeparatedList(value.toStringList()); + } else { + QStringList displayList; + const auto valueList = value.toList(); + for (const auto& entry : valueList) { + displayList << d->formatAsString(entry); + } + return QLocale().createSeparatedList(displayList); + } + } else { + return (d->formatAsString)(value); + } } PropertyInfo PropertyInfo::fromName(const QString& name)