mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
Merge pull request #8558 from luis-pereira/containter-anti-pattern
Don't create temporary containers just to iterate over them
This commit is contained in:
@@ -405,7 +405,8 @@ void CategoryFilterModel::populate()
|
||||
, [](Torrent *torrent) { return torrent->category().isEmpty(); })));
|
||||
|
||||
using Torrent = BitTorrent::TorrentHandle;
|
||||
foreach (const QString &category, session->categories().keys()) {
|
||||
for (auto i = session->categories().cbegin(); i != session->categories().cend(); ++i) {
|
||||
const QString &category = i.key();
|
||||
if (m_isSubcategoriesEnabled) {
|
||||
CategoryModelItem *parent = m_rootItem;
|
||||
foreach (const QString &subcat, session->expandCategory(category)) {
|
||||
|
||||
@@ -232,8 +232,10 @@ void CategoryFilterWidget::removeCategory()
|
||||
void CategoryFilterWidget::removeUnusedCategories()
|
||||
{
|
||||
auto session = BitTorrent::Session::instance();
|
||||
foreach (const QString &category, session->categories().keys())
|
||||
for (auto i = session->categories().cbegin(); i != session->categories().cend(); ++i) {
|
||||
const QString &category = i.key();
|
||||
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)
|
||||
session->removeCategory(category);
|
||||
}
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
@@ -424,10 +424,10 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (const QString &pluginName, updateInfo.keys()) {
|
||||
for (auto i = updateInfo.cbegin(); i != updateInfo.cend(); ++i) {
|
||||
startAsyncOp();
|
||||
m_pendingUpdates++;
|
||||
m_pluginManager->updatePlugin(pluginName);
|
||||
m_pluginManager->updatePlugin(i.key());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,8 @@ void TrackerFiltersList::setDownloadTrackerFavicon(bool value)
|
||||
m_downloadTrackerFavicon = value;
|
||||
|
||||
if (m_downloadTrackerFavicon) {
|
||||
foreach (const QString &tracker, m_trackers.keys()) {
|
||||
for (auto i = m_trackers.cbegin(); i != m_trackers.cend(); ++i) {
|
||||
const QString &tracker = i.key();
|
||||
if (!tracker.isEmpty())
|
||||
downloadFavicon(QString("http://%1/favicon.ico").arg(tracker));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user