diff --git a/CMakeLists.txt b/CMakeLists.txt index d0cacab..44a3eeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,12 +196,7 @@ if (WIDGETS_GUI OR QUICK_GUI) endif () # find tagparser -set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL) -if (CMAKE_VERSION VERSION_LESS 3.19) - find_package(tagparser${CONFIGURATION_PACKAGE_SUFFIX} 9.3.0 REQUIRED) -else () - find_package(tagparser${CONFIGURATION_PACKAGE_SUFFIX} 9.3.0...10.0.0 REQUIRED) -endif () +find_package(tagparser${CONFIGURATION_PACKAGE_SUFFIX} 10.0.0 REQUIRED) use_tag_parser() # enable experimental JSON export diff --git a/cli/mainfeatures.cpp b/cli/mainfeatures.cpp index 37912b8..04a9f51 100644 --- a/cli/mainfeatures.cpp +++ b/cli/mainfeatures.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -199,8 +199,8 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const printProperty("ID", track->id(), nullptr, true); printProperty("Name", track->name()); printProperty("Type", track->mediaTypeName()); - if (isLanguageDefined(track->language())) { - printProperty("Language", languageNameFromIsoWithFallback(track->language())); + if (const auto &language = track->locale().fullOrSomeAbbreviatedName(); !language.empty()) { + printProperty("Language", language); } const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation(); printProperty("Format", fmtName); @@ -662,7 +662,7 @@ void setTagInfo(const SetTagInfoArgs &args) if (field.denotes("name")) { track->setName(value); } else if (field.denotes("language")) { - track->setLanguage(value); + track->setLocale(Locale(std::string_view(value), LocaleFormat::Unknown)); } else if (field.denotes("tracknumber")) { track->setTrackNumber(stringToNumber(value)); } else if (field.denotes("enabled")) { diff --git a/gui/fileinfomodel.cpp b/gui/fileinfomodel.cpp index 5536f22..5875d9d 100644 --- a/gui/fileinfomodel.cpp +++ b/gui/fileinfomodel.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -428,8 +428,8 @@ void FileInfoModel::updateCache() if (!track->modificationTime().isNull()) { trackHelper.appendRow(tr("Modification time"), track->modificationTime()); } - if (!track->language().empty()) { - trackHelper.appendRow(tr("Language"), languageNameFromIsoWithFallback(track->language())); + if (!track->locale().empty()) { + trackHelper.appendRow(tr("Language"), track->locale().fullOrSomeAbbreviatedName()); } if (!track->compressorName().empty()) { trackHelper.appendRow(tr("Compressor name"), track->compressorName()); @@ -533,11 +533,7 @@ void FileInfoModel::updateCache() ItemHelper chapterHelper(chapterItem); chapterHelper.appendRow(tr("ID"), chapter->id()); for (const LocaleAwareString &name : chapter->names()) { - static const string delim(", "); - const string locale = joinStrings( - initializer_list{ joinStrings(name.languages(), delim, true), joinStrings(name.countries(), delim, true) }, delim, - true); - chapterHelper.appendRow(tr("Name (%1)").arg(QString::fromUtf8(locale.data())), name); + chapterHelper.appendRow(tr("Name (%1)").arg(QString::fromUtf8(name.locale().toString())), name); } if (!chapter->startTime().isNegative()) { chapterHelper.appendRow(tr("Start time"), chapter->startTime()); diff --git a/misc/htmlinfo.cpp b/misc/htmlinfo.cpp index 12007f6..e6b9c67 100644 --- a/misc/htmlinfo.cpp +++ b/misc/htmlinfo.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -589,8 +589,8 @@ public: rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Modification time"), qstr(track->modificationTime().toString(DateTimeOutputFormat::DateAndTime, true))); } - if (!track->language().empty()) { - rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(languageNameFromIsoWithFallback(track->language()))); + if (const auto &language = track->locale().fullOrSomeAbbreviatedName(); !language.empty()) { + rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(language)); } if (!track->compressorName().empty()) { rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Compressor name"), qstr(track->compressorName())); @@ -709,10 +709,7 @@ public: rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "ID"), QString::number(chapter.id())); } for (const LocaleAwareString &name : chapter.names()) { - static const string delim(", "); - const string locale = joinStrings( - initializer_list{ joinStrings(name.languages(), delim, true), joinStrings(name.countries(), delim, true) }, delim, true); - rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name (%1)").arg(qstr(locale)), qstr(name)); + rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name (%1)").arg(qstr(name.locale().toString())), qstr(name)); } if (!chapter.startTime().isNegative()) { rowMaker.mkRow( diff --git a/renamingutility/tageditorobject.cpp b/renamingutility/tageditorobject.cpp index 303206f..011a6c7 100644 --- a/renamingutility/tageditorobject.cpp +++ b/renamingutility/tageditorobject.cpp @@ -209,7 +209,7 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName) trackObject.setProperty(QStringLiteral("format"), QString::fromUtf8(track.formatName())); trackObject.setProperty(QStringLiteral("formatAbbreviation"), QString::fromUtf8(track.formatAbbreviation())); trackObject.setProperty(QStringLiteral("version"), QString::number(track.version())); - trackObject.setProperty(QStringLiteral("language"), QString::fromStdString(track.language())); + trackObject.setProperty(QStringLiteral("language"), QString::fromStdString(track.locale().someAbbreviatedName())); trackObject.setProperty(QStringLiteral("description"), QString::fromStdString(track.description())); trackObject.setProperty(QStringLiteral("shortDescription"), QString::fromStdString(track.shortDescription())); tracksObject.setProperty(trackIndex, trackObject TAGEDITOR_JS_READONLY);