1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Replace deprecated Qt functions

QSet::toList() is replaced by QSet::values()
This commit is contained in:
Chocobo1 2019-10-31 12:38:11 +08:00
parent c1e0207454
commit 6fd678195c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
6 changed files with 9 additions and 9 deletions

View File

@ -296,7 +296,7 @@ void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) c
program.replace("%N", torrent->name()); program.replace("%N", torrent->name());
program.replace("%L", torrent->category()); program.replace("%L", torrent->category());
QStringList tags = torrent->tags().toList(); QStringList tags = torrent->tags().values();
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>); std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
program.replace("%G", tags.join(',')); program.replace("%G", tags.join(','));

View File

@ -726,7 +726,7 @@ bool Session::addTag(const QString &tag)
if (!hasTag(tag)) { if (!hasTag(tag)) {
m_tags.insert(tag); m_tags.insert(tag);
m_storedTags = m_tags.toList(); m_storedTags = m_tags.values();
emit tagAdded(tag); emit tagAdded(tag);
return true; return true;
} }
@ -738,7 +738,7 @@ bool Session::removeTag(const QString &tag)
if (m_tags.remove(tag)) { if (m_tags.remove(tag)) {
for (TorrentHandle *const torrent : asConst(torrents())) for (TorrentHandle *const torrent : asConst(torrents()))
torrent->removeTag(tag); torrent->removeTag(tag);
m_storedTags = m_tags.toList(); m_storedTags = m_tags.values();
emit tagRemoved(tag); emit tagRemoved(tag);
return true; return true;
} }
@ -3752,7 +3752,7 @@ void Session::startUpTorrents()
} }
if (!queue.empty()) if (!queue.empty())
fastresumes = queue + fastresumes.toSet().subtract(queue.toSet()).toList(); fastresumes = queue + fastresumes.toSet().subtract(queue.toSet()).values();
} }
for (const QString &fastresumeName : asConst(fastresumes)) { for (const QString &fastresumeName : asConst(fastresumes)) {

View File

@ -157,7 +157,7 @@ QStringList SearchPluginManager::getPluginCategories(const QString &pluginName)
categories << category; categories << category;
} }
return categories.toList(); return categories.values();
} }
PluginInfo *SearchPluginManager::pluginInfo(const QString &name) const PluginInfo *SearchPluginManager::pluginInfo(const QString &name) const

View File

@ -79,7 +79,7 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
if (isDownloadable(str)) if (isDownloadable(str))
uniqueURLs << str; uniqueURLs << str;
} }
m_ui->textUrls->setText(uniqueURLs.toList().join('\n')); m_ui->textUrls->setText(uniqueURLs.values().join('\n'));
Utils::Gui::resize(this); Utils::Gui::resize(this);
show(); show();
@ -108,6 +108,6 @@ void DownloadFromURLDialog::downloadButtonClicked()
return; return;
} }
emit urlsReadyToBeDownloaded(uniqueURLs.toList()); emit urlsReadyToBeDownloaded(uniqueURLs.values());
accept(); accept();
} }

View File

@ -200,7 +200,7 @@ QVariant TransferListModel::data(const QModelIndex &index, const int role) const
case TR_CATEGORY: case TR_CATEGORY:
return torrent->category(); return torrent->category();
case TR_TAGS: { case TR_TAGS: {
QStringList tagsList = torrent->tags().toList(); QStringList tagsList = torrent->tags().values();
tagsList.sort(); tagsList.sort();
return tagsList.join(", "); return tagsList.join(", ");
} }

View File

@ -102,7 +102,7 @@ QVariantMap serialize(const BitTorrent::TorrentHandle &torrent)
{KEY_TORRENT_FIRST_LAST_PIECE_PRIO, torrent.hasFirstLastPiecePriority()}, {KEY_TORRENT_FIRST_LAST_PIECE_PRIO, torrent.hasFirstLastPiecePriority()},
{KEY_TORRENT_CATEGORY, torrent.category()}, {KEY_TORRENT_CATEGORY, torrent.category()},
{KEY_TORRENT_TAGS, torrent.tags().toList().join(", ")}, {KEY_TORRENT_TAGS, torrent.tags().values().join(", ")},
{KEY_TORRENT_SUPER_SEEDING, torrent.superSeeding()}, {KEY_TORRENT_SUPER_SEEDING, torrent.superSeeding()},
{KEY_TORRENT_FORCE_START, torrent.isForced()}, {KEY_TORRENT_FORCE_START, torrent.isForced()},
{KEY_TORRENT_SAVE_PATH, Utils::Fs::toNativePath(torrent.savePath())}, {KEY_TORRENT_SAVE_PATH, Utils::Fs::toNativePath(torrent.savePath())},