mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Replace QPair with std::pair
This commit is contained in:
parent
781d7fbf1a
commit
3ea4c66d41
@ -31,6 +31,7 @@
|
||||
#include "rss_feed.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <QDir>
|
||||
@ -461,19 +462,19 @@ int Feed::updateArticles(const QList<QVariantHash> &loadedArticles)
|
||||
if (newArticles.empty())
|
||||
return 0;
|
||||
|
||||
using ArticleSortAdaptor = QPair<QDateTime, const QVariantHash *>;
|
||||
using ArticleSortAdaptor = std::pair<QDateTime, const QVariantHash *>;
|
||||
std::vector<ArticleSortAdaptor> sortData;
|
||||
const QList<Article *> existingArticles = articles();
|
||||
sortData.reserve(existingArticles.size() + newArticles.size());
|
||||
std::transform(existingArticles.begin(), existingArticles.end(), std::back_inserter(sortData)
|
||||
, [](const Article *article)
|
||||
{
|
||||
return qMakePair(article->date(), nullptr);
|
||||
return std::make_pair(article->date(), nullptr);
|
||||
});
|
||||
std::transform(newArticles.begin(), newArticles.end(), std::back_inserter(sortData)
|
||||
, [](const QVariantHash &article)
|
||||
{
|
||||
return qMakePair(article[Article::KeyDate].toDateTime(), &article);
|
||||
return std::make_pair(article[Article::KeyDate].toDateTime(), &article);
|
||||
});
|
||||
|
||||
// Sort article list in reverse chronological order
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPair>
|
||||
#include <QRegularExpression>
|
||||
#include <QShortcut>
|
||||
#include <QSignalBlocker>
|
||||
@ -664,7 +663,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
|
||||
// Insert the articles
|
||||
for (const QString &article : articles)
|
||||
{
|
||||
QPair<QString, QString> key(feed->name(), article);
|
||||
const std::pair<QString, QString> key(feed->name(), article);
|
||||
|
||||
if (!m_treeListEntries.contains(key))
|
||||
{
|
||||
|
@ -29,9 +29,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QHash>
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
|
||||
#include "base/rss/rss_autodownloadrule.h"
|
||||
@ -101,7 +102,7 @@ private:
|
||||
|
||||
Ui::AutomatedRssDownloader *m_ui;
|
||||
QListWidgetItem *m_currentRuleItem;
|
||||
QSet<QPair<QString, QString>> m_treeListEntries;
|
||||
QSet<std::pair<QString, QString>> m_treeListEntries;
|
||||
RSS::AutoDownloadRule m_currentRule;
|
||||
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
||||
QRegularExpression *m_episodeRegex;
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
@ -182,10 +184,10 @@ void SearchWidget::fillCatCombobox()
|
||||
m_ui->comboCategory->clear();
|
||||
m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName("all"), "all");
|
||||
|
||||
using QStrPair = QPair<QString, QString>;
|
||||
using QStrPair = std::pair<QString, QString>;
|
||||
QVector<QStrPair> tmpList;
|
||||
for (const QString &cat : asConst(SearchPluginManager::instance()->getPluginCategories(selectedPlugin())))
|
||||
tmpList << qMakePair(SearchPluginManager::categoryFullName(cat), cat);
|
||||
tmpList << std::make_pair(SearchPluginManager::categoryFullName(cat), cat);
|
||||
std::sort(tmpList.begin(), tmpList.end(), [](const QStrPair &l, const QStrPair &r) { return (QString::localeAwareCompare(l.first, r.first) < 0); });
|
||||
|
||||
for (const QStrPair &p : asConst(tmpList))
|
||||
@ -205,10 +207,10 @@ void SearchWidget::fillPluginComboBox()
|
||||
m_ui->selectPlugin->addItem(tr("All plugins"), "all");
|
||||
m_ui->selectPlugin->addItem(tr("Select..."), "multi");
|
||||
|
||||
using QStrPair = QPair<QString, QString>;
|
||||
using QStrPair = std::pair<QString, QString>;
|
||||
QVector<QStrPair> tmpList;
|
||||
for (const QString &name : asConst(SearchPluginManager::instance()->enabledPlugins()))
|
||||
tmpList << qMakePair(SearchPluginManager::instance()->pluginFullName(name), name);
|
||||
tmpList << std::make_pair(SearchPluginManager::instance()->pluginFullName(name), name);
|
||||
std::sort(tmpList.begin(), tmpList.end(), [](const QStrPair &l, const QStrPair &r) { return (l.first < r.first); } );
|
||||
|
||||
for (const QStrPair &p : asConst(tmpList))
|
||||
|
Loading…
Reference in New Issue
Block a user