Revise tag related implementations

Fix #12690.
This commit is contained in:
Chocobo1 2021-04-02 13:45:50 +08:00
parent ab6141edb7
commit fdc186c92f
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
20 changed files with 257 additions and 50 deletions

View file

@ -323,13 +323,6 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
, Utils::Misc::userFriendlyDuration(seedingTime));
};
const auto tagsString = [](const QSet<QString> &tags) -> QString
{
QStringList tagsList = tags.values();
tagsList.sort();
return tagsList.join(", ");
};
const auto progressString = [](const qreal progress) -> QString
{
return (progress >= 1)
@ -373,7 +366,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
case TR_CATEGORY:
return torrent->category();
case TR_TAGS:
return tagsString(torrent->tags());
return torrent->tags().join(QLatin1String(", "));
case TR_ADD_DATE:
return QLocale().toString(torrent->addedTime().toLocalTime(), QLocale::ShortFormat);
case TR_SEED_DATE:
@ -442,7 +435,7 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co
case TR_CATEGORY:
return torrent->category();
case TR_TAGS:
return QStringList {torrent->tags().values()};
return QVariant::fromValue(torrent->tags());
case TR_ADD_DATE:
return torrent->addedTime();
case TR_SEED_DATE: