diff --git a/src/app/main.cpp b/src/app/main.cpp index a26c167d1..b17f6ce7a 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) return app->exec(params.paramList()); } - catch (CommandLineParameterError &er) { + catch (const CommandLineParameterError &er) { displayBadArgMessage(er.messageForUser()); return EXIT_FAILURE; } diff --git a/src/base/algorithm.h b/src/base/algorithm.h index 01aa39324..6eb9089b6 100644 --- a/src/base/algorithm.h +++ b/src/base/algorithm.h @@ -50,7 +50,7 @@ namespace Algorithm // To be used with associative array types, such as QMap, QHash and it's variants template ::value, int> = 0> - void removeIf(T &dict, BinaryPredicate p) + void removeIf(T &dict, BinaryPredicate &&p) { auto it = dict.begin(); while (it != dict.end()) @@ -60,7 +60,7 @@ namespace Algorithm // To be used with set types, such as QSet, std::set template ::value, int> = 0> - void removeIf(T &set, UnaryPredicate p) + void removeIf(T &set, UnaryPredicate &&p) { auto it = set.begin(); while (it != set.end()) diff --git a/src/base/bittorrent/magneturi.cpp b/src/base/bittorrent/magneturi.cpp index f15ff39d0..cff9bb6cf 100644 --- a/src/base/bittorrent/magneturi.cpp +++ b/src/base/bittorrent/magneturi.cpp @@ -34,6 +34,7 @@ #include #include +#include #include "infohash.h" diff --git a/src/base/bittorrent/magneturi.h b/src/base/bittorrent/magneturi.h index e2b8757c3..f82dfc8d6 100644 --- a/src/base/bittorrent/magneturi.h +++ b/src/base/bittorrent/magneturi.h @@ -29,15 +29,16 @@ #ifndef BITTORRENT_MAGNETURI_H #define BITTORRENT_MAGNETURI_H +#include + #include #include -#include - -#include #include "infohash.h" #include "trackerentry.h" +class QUrl; + namespace BitTorrent { class MagnetUri diff --git a/src/base/bittorrent/peerinfo.h b/src/base/bittorrent/peerinfo.h index 6aae66f75..6fb3114af 100644 --- a/src/base/bittorrent/peerinfo.h +++ b/src/base/bittorrent/peerinfo.h @@ -29,12 +29,12 @@ #ifndef BITTORRENT_PEERINFO_H #define BITTORRENT_PEERINFO_H +#include + #include #include #include -#include - namespace BitTorrent { class TorrentHandle; diff --git a/src/base/bittorrent/private/bandwidthscheduler.cpp b/src/base/bittorrent/private/bandwidthscheduler.cpp index 308b3217e..a541a2427 100644 --- a/src/base/bittorrent/private/bandwidthscheduler.cpp +++ b/src/base/bittorrent/private/bandwidthscheduler.cpp @@ -33,6 +33,7 @@ #include #include +#include #include "base/preferences.h" diff --git a/src/base/bittorrent/private/filterparserthread.cpp b/src/base/bittorrent/private/filterparserthread.cpp index cf7b19b81..ba275384c 100644 --- a/src/base/bittorrent/private/filterparserthread.cpp +++ b/src/base/bittorrent/private/filterparserthread.cpp @@ -245,7 +245,7 @@ int FilterParserThread::parseDATFilterFile() m_filter.add_rule(startAddr, endAddr, lt::ip_filter::blocked); ++ruleCount; } - catch (std::exception &e) { + catch (const std::exception &e) { ++parseErrorCount; addLog(tr("IP filter exception thrown for line %1. Exception is: %2") .arg(nbLine).arg(QString::fromLocal8Bit(e.what()))); @@ -383,7 +383,7 @@ int FilterParserThread::parseP2PFilterFile() m_filter.add_rule(startAddr, endAddr, lt::ip_filter::blocked); ++ruleCount; } - catch (std::exception &e) { + catch (const std::exception &e) { ++parseErrorCount; addLog(tr("IP filter exception thrown for line %1. Exception is: %2") .arg(nbLine).arg(QString::fromLocal8Bit(e.what()))); @@ -468,7 +468,7 @@ int FilterParserThread::parseP2BFilterFile() m_filter.add_rule(first, last, lt::ip_filter::blocked); ++ruleCount; } - catch (std::exception &) {} + catch (const std::exception &) {} } } else if (version == 3) { @@ -518,7 +518,7 @@ int FilterParserThread::parseP2BFilterFile() m_filter.add_rule(first, last, lt::ip_filter::blocked); ++ruleCount; } - catch (std::exception &) {} + catch (const std::exception &) {} if (m_abort) return ruleCount; } @@ -577,7 +577,7 @@ void FilterParserThread::run() try { emit IPFilterParsed(ruleCount); } - catch (std::exception &) { + catch (const std::exception &) { emit IPFilterError(); } diff --git a/src/base/bittorrent/private/filterparserthread.h b/src/base/bittorrent/private/filterparserthread.h index 0f374bbf5..7b86aa4f6 100644 --- a/src/base/bittorrent/private/filterparserthread.h +++ b/src/base/bittorrent/private/filterparserthread.h @@ -29,10 +29,10 @@ #ifndef FILTERPARSERTHREAD_H #define FILTERPARSERTHREAD_H -#include - #include +#include + class QDataStream; class FilterParserThread : public QThread diff --git a/src/base/bittorrent/private/portforwarderimpl.cpp b/src/base/bittorrent/private/portforwarderimpl.cpp index 23d8d6dbd..1a7eb02bf 100644 --- a/src/base/bittorrent/private/portforwarderimpl.cpp +++ b/src/base/bittorrent/private/portforwarderimpl.cpp @@ -28,10 +28,10 @@ #include "portforwarderimpl.h" -#include - #include +#include + #include "base/logger.h" #include "base/settingsstorage.h" diff --git a/src/base/bittorrent/private/resumedatasavingmanager.cpp b/src/base/bittorrent/private/resumedatasavingmanager.cpp index f9dc7b847..4fd93722d 100644 --- a/src/base/bittorrent/private/resumedatasavingmanager.cpp +++ b/src/base/bittorrent/private/resumedatasavingmanager.cpp @@ -28,6 +28,7 @@ #include "resumedatasavingmanager.h" +#include #include #include diff --git a/src/base/bittorrent/private/resumedatasavingmanager.h b/src/base/bittorrent/private/resumedatasavingmanager.h index 3f27d94a0..ffef21e91 100644 --- a/src/base/bittorrent/private/resumedatasavingmanager.h +++ b/src/base/bittorrent/private/resumedatasavingmanager.h @@ -28,10 +28,11 @@ #pragma once -#include #include #include +class QByteArray; + class ResumeDataSavingManager : public QObject { Q_OBJECT diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index e2ea1d689..184c2dbae 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1400,7 +1400,7 @@ void Session::configurePeerClasses() , lt::address_v6::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff") , 1 << lt::session::global_peer_class_id); } - catch (std::exception &) {} + catch (const std::exception &) {} #endif // TORRENT_USE_IPV6 if (ignoreLimitsOnLAN()) { // local networks @@ -1439,7 +1439,7 @@ void Session::configurePeerClasses() , lt::address_v6::from_string("::1") , 1 << lt::session::local_peer_class_id); } - catch (std::exception &) {} + catch (const std::exception &) {} #endif // TORRENT_USE_IPV6 } m_nativeSession->set_peer_class_filter(f); @@ -1870,7 +1870,7 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne #endif handle.pause(); } - catch (std::exception &) {} + catch (const std::exception &) {} adjustLimits(); @@ -3856,7 +3856,7 @@ void Session::handleAlert(const lt::alert *a) break; } } - catch (std::exception &exc) { + catch (const std::exception &exc) { qWarning() << "Caught exception in " << Q_FUNC_INFO << ": " << QString::fromStdString(exc.what()); } } @@ -4374,7 +4374,7 @@ namespace try { handle.queue_position_up(); } - catch (std::exception &exc) { + catch (const std::exception &exc) { qDebug() << Q_FUNC_INFO << " fails: " << exc.what(); } } @@ -4384,7 +4384,7 @@ namespace try { handle.queue_position_down(); } - catch (std::exception &exc) { + catch (const std::exception &exc) { qDebug() << Q_FUNC_INFO << " fails: " << exc.what(); } } @@ -4394,7 +4394,7 @@ namespace try { handle.queue_position_top(); } - catch (std::exception &exc) { + catch (const std::exception &exc) { qDebug() << Q_FUNC_INFO << " fails: " << exc.what(); } } @@ -4404,7 +4404,7 @@ namespace try { handle.queue_position_bottom(); } - catch (std::exception &exc) { + catch (const std::exception &exc) { qDebug() << Q_FUNC_INFO << " fails: " << exc.what(); } } diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index d2c91b7e8..65a540414 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -43,7 +43,6 @@ #include #include "base/settingvalue.h" -#include "base/tristatebool.h" #include "base/types.h" #include "addtorrentparams.h" #include "cachestatus.h" diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 09847116c..36be7b90c 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1174,10 +1174,8 @@ QBitArray TorrentHandle::downloadingPieces() const std::vector queue; m_nativeHandle.get_download_queue(queue); - std::vector::const_iterator it = queue.begin(); - std::vector::const_iterator itend = queue.end(); - for (; it != itend; ++it) - result.setBit(it->piece_index); + for (const lt::partial_piece_info &info : queue) + result.setBit(info.piece_index); return result; } @@ -1577,8 +1575,7 @@ void TorrentHandle::handleTrackerReplyAlert(const lt::tracker_reply_alert *p) const QString trackerUrl(p->tracker_url()); qDebug("Received a tracker reply from %s (Num_peers = %d)", qUtf8Printable(trackerUrl), p->num_peers); // Connection was successful now. Remove possible old errors - m_trackerInfos[trackerUrl].lastMessage.clear(); // Reset error/warning message - m_trackerInfos[trackerUrl].numPeers = p->num_peers; + m_trackerInfos[trackerUrl] = {{}, p->num_peers}; m_session->handleTorrentTrackerReply(this, trackerUrl); } diff --git a/src/base/bittorrent/torrenthandle.h b/src/base/bittorrent/torrenthandle.h index 725ff24f6..14a218965 100644 --- a/src/base/bittorrent/torrenthandle.h +++ b/src/base/bittorrent/torrenthandle.h @@ -94,7 +94,7 @@ namespace BitTorrent struct TrackerInfo { QString lastMessage; - quint32 numPeers = 0; + int numPeers = 0; }; enum class TorrentState diff --git a/src/base/bittorrent/torrentinfo.h b/src/base/bittorrent/torrentinfo.h index 207736954..f06f64765 100644 --- a/src/base/bittorrent/torrentinfo.h +++ b/src/base/bittorrent/torrentinfo.h @@ -29,7 +29,6 @@ #ifndef BITTORRENT_TORRENTINFO_H #define BITTORRENT_TORRENTINFO_H -#include #include #include diff --git a/src/base/filesystemwatcher.h b/src/base/filesystemwatcher.h index ac17d7124..af4c96163 100644 --- a/src/base/filesystemwatcher.h +++ b/src/base/filesystemwatcher.h @@ -32,9 +32,11 @@ #include #include #include -#include +#include #include +class QStringList; + /* * Subclassing QFileSystemWatcher in order to support Network File * System watching (NFS, CIFS) on Linux and Mac OS. diff --git a/src/base/http/requestparser.cpp b/src/base/http/requestparser.cpp index fa5ded1c8..524c57772 100644 --- a/src/base/http/requestparser.cpp +++ b/src/base/http/requestparser.cpp @@ -253,7 +253,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data) // split data by "dash-boundary" const QByteArray dashDelimiter = QByteArray("--") + delimiter + CRLF; - QList multipart = splitToViews(data, dashDelimiter, QString::SkipEmptyParts); + QVector multipart = splitToViews(data, dashDelimiter, QString::SkipEmptyParts); if (multipart.isEmpty()) { qWarning() << Q_FUNC_INFO << "multipart empty"; return false; @@ -275,7 +275,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data) bool RequestParser::parseFormData(const QByteArray &data) { - const QList list = splitToViews(data, EOH, QString::KeepEmptyParts); + const QVector list = splitToViews(data, EOH, QString::KeepEmptyParts); if (list.size() != 2) { qWarning() << Q_FUNC_INFO << "multipart/form-data format error"; diff --git a/src/base/iconprovider.h b/src/base/iconprovider.h index 3bba13361..b6ea47f8c 100644 --- a/src/base/iconprovider.h +++ b/src/base/iconprovider.h @@ -31,7 +31,8 @@ #define ICONPROVIDER_H #include -#include + +class QString; class IconProvider : public QObject { diff --git a/src/base/net/smtp.cpp b/src/base/net/smtp.cpp index 4cffa215c..1e009069a 100644 --- a/src/base/net/smtp.cpp +++ b/src/base/net/smtp.cpp @@ -33,10 +33,12 @@ #include "smtp.h" #include +#include #include #include #include #include + #ifndef QT_NO_OPENSSL #include #else diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index a96522f5c..81ac30e1f 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -29,9 +29,21 @@ #include "preferences.h" +#ifdef Q_OS_MAC +#include +#endif +#ifdef Q_OS_WIN +#include +#endif + +#include #include #include +#include #include +#include +#include +#include #ifndef DISABLE_GUI #include @@ -40,14 +52,9 @@ #endif #ifdef Q_OS_WIN -#include #include #endif -#ifdef Q_OS_MAC -#include -#endif - #include "algorithm.h" #include "global.h" #include "settingsstorage.h" diff --git a/src/base/preferences.h b/src/base/preferences.h index d8aaab2e2..26ed99dbc 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -30,16 +30,17 @@ #ifndef PREFERENCES_H #define PREFERENCES_H -#include #include -#include -#include #include -#include -#include #include "base/utils/net.h" +class QDateTime; +class QNetworkCookie; +class QSize; +class QTime; +class QVariant; + enum SchedulerDays { EVERY_DAY, @@ -74,8 +75,6 @@ namespace DNS }; } -class SettingsStorage; - class Preferences : public QObject { Q_OBJECT diff --git a/src/base/private/profile_p.cpp b/src/base/private/profile_p.cpp index 656beeebf..e5a211cc8 100644 --- a/src/base/private/profile_p.cpp +++ b/src/base/private/profile_p.cpp @@ -31,8 +31,6 @@ #include -#include "base/utils/fs.h" - Private::Profile::Profile(const QString &configurationName) : m_configurationSuffix {configurationName.isEmpty() ? QString() : QLatin1Char('_') + configurationName} { diff --git a/src/base/profile.h b/src/base/profile.h index 34b627a10..290248105 100644 --- a/src/base/profile.h +++ b/src/base/profile.h @@ -33,8 +33,8 @@ #include #include -#include +class QString; class Application; namespace Private diff --git a/src/base/rss/rss_autodownloader.cpp b/src/base/rss/rss_autodownloader.cpp index 4a8609b3f..10513ac9d 100644 --- a/src/base/rss/rss_autodownloader.cpp +++ b/src/base/rss/rss_autodownloader.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/src/base/rss/rss_autodownloadrule.h b/src/base/rss/rss_autodownloadrule.h index 15fd113fb..15e22b735 100644 --- a/src/base/rss/rss_autodownloadrule.h +++ b/src/base/rss/rss_autodownloadrule.h @@ -29,10 +29,10 @@ #pragma once -#include #include #include +class QDateTime; class QJsonObject; class QRegularExpression; class TriStateBool; diff --git a/src/base/scanfoldersmodel.cpp b/src/base/scanfoldersmodel.cpp index 119b3eea9..8bee1d533 100644 --- a/src/base/scanfoldersmodel.cpp +++ b/src/base/scanfoldersmodel.cpp @@ -341,7 +341,7 @@ void ScanFoldersModel::configure() { const QVariantHash dirs = Preferences::instance()->getScanDirs(); - for (QVariantHash::const_iterator i = dirs.begin(), e = dirs.end(); i != e; ++i) { + for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) { if (i.value().type() == QVariant::Int) addPath(i.key(), static_cast(i.value().toInt()), QString()); else diff --git a/src/base/search/searchhandler.h b/src/base/search/searchhandler.h index fae52d05c..3cf71318a 100644 --- a/src/base/search/searchhandler.h +++ b/src/base/search/searchhandler.h @@ -32,6 +32,7 @@ #include #include #include +#include class QProcess; class QTimer; diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index d751cdf80..12d5280b4 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -494,13 +493,13 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info) QHash updateInfo; int numCorrectData = 0; - const QList lines = Utils::ByteArray::splitToViews(info, "\n", QString::SkipEmptyParts); + const QVector lines = Utils::ByteArray::splitToViews(info, "\n", QString::SkipEmptyParts); for (QByteArray line : lines) { line = line.trimmed(); if (line.isEmpty()) continue; if (line.startsWith('#')) continue; - const QList list = Utils::ByteArray::splitToViews(line, ":", QString::SkipEmptyParts); + const QVector list = Utils::ByteArray::splitToViews(line, ":", QString::SkipEmptyParts); if (list.size() != 2) continue; const QString pluginName = list.first().trimmed(); diff --git a/src/base/settingvalue.h b/src/base/settingvalue.h index e3ff237c1..64998e2d4 100644 --- a/src/base/settingvalue.h +++ b/src/base/settingvalue.h @@ -33,7 +33,6 @@ #include #include -#include #include "settingsstorage.h" @@ -51,7 +50,7 @@ public: // T proxyFunc(const T &a); template explicit CachedSettingValue(const char *keyName, const T &defaultValue - , ProxyFunc proxyFunc) + , ProxyFunc &&proxyFunc) : m_keyName(QLatin1String(keyName)) , m_value(proxyFunc(loadValue(defaultValue))) { diff --git a/src/base/utils/bytearray.cpp b/src/base/utils/bytearray.cpp index 9ef543e25..128aa93a3 100644 --- a/src/base/utils/bytearray.cpp +++ b/src/base/utils/bytearray.cpp @@ -28,15 +28,17 @@ #include "bytearray.h" -#include +#include -QList Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior) +QVector Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior) { if (sep.isEmpty()) return {in}; - QList ret; - + QVector ret; + ret.reserve((behavior == QString::KeepEmptyParts) + ? (1 + (in.size() / sep.size())) + : (1 + (in.size() / (sep.size() + 1)))); int head = 0; while (head < in.size()) { int end = in.indexOf(sep, head); diff --git a/src/base/utils/bytearray.h b/src/base/utils/bytearray.h index a9e6e89ea..f0d055ecf 100644 --- a/src/base/utils/bytearray.h +++ b/src/base/utils/bytearray.h @@ -28,15 +28,17 @@ #pragma once -#include #include +#include + +class QByteArray; namespace Utils { namespace ByteArray { - // Mimic QString::split(sep, behavior) - QList splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts); + // Mimic QString::splitRef(sep, behavior) + QVector splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts); // Mimic QByteArray::mid(pos, len) but instead of returning a full-copy, // we only return a partial view diff --git a/src/base/utils/foreignapps.cpp b/src/base/utils/foreignapps.cpp index 8047a827d..f32b55e45 100644 --- a/src/base/utils/foreignapps.cpp +++ b/src/base/utils/foreignapps.cpp @@ -43,6 +43,7 @@ #endif #include "base/logger.h" +#include "base/utils/bytearray.h" using namespace Utils::ForeignApps; @@ -61,7 +62,7 @@ namespace // Software 'Anaconda' installs its own python interpreter // and `python --version` returns a string like this: // "Python 3.4.3 :: Anaconda 2.3.0 (64-bit)" - const QList outputSplit = procOutput.split(' '); + const QVector outputSplit = Utils::ByteArray::splitToViews(procOutput, " ", QString::SkipEmptyParts); if (outputSplit.size() <= 1) return false; diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index ae9d1d31a..ab29a9a2c 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -34,15 +34,6 @@ #include #endif -#include -#include -#include -#include -#include -#include -#include -#include - #include #include @@ -58,6 +49,15 @@ #include #endif +#include +#include +#include +#include +#include +#include +#include +#include + #include "base/bittorrent/torrenthandle.h" #include "base/global.h" diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index ee87c3e1d..39c066f75 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -28,9 +28,6 @@ #include "misc.h" -#include -#include - #ifdef Q_OS_WIN #include #include @@ -44,7 +41,9 @@ #include #endif +#include #include +#include #include #include @@ -361,30 +360,6 @@ QString Utils::Misc::getUserIDString() return uid; } -QStringList Utils::Misc::toStringList(const QList &l) -{ - QStringList ret; - for (const bool b : l) - ret << (b ? "1" : "0"); - return ret; -} - -QList Utils::Misc::intListfromStringList(const QStringList &l) -{ - QList ret; - for (const QString &s : l) - ret << s.toInt(); - return ret; -} - -QList Utils::Misc::boolListfromStringList(const QStringList &l) -{ - QList ret; - for (const QString &s : l) - ret << (s == "1"); - return ret; -} - QString Utils::Misc::parseHtmlLinks(const QString &rawText) { QString result = rawText; diff --git a/src/base/utils/misc.h b/src/base/utils/misc.h index a8ca900f0..7c9a0e371 100644 --- a/src/base/utils/misc.h +++ b/src/base/utils/misc.h @@ -36,9 +36,7 @@ #include #endif -#include -#include - +class QString; enum class ShutdownDialogAction; /* Miscellaneous functions that can be useful */ @@ -87,11 +85,6 @@ namespace Utils QString userFriendlyDuration(qlonglong seconds); QString getUserIDString(); - // Convert functions - QStringList toStringList(const QList &l); - QList intListfromStringList(const QStringList &l); - QList boolListfromStringList(const QStringList &l); - #ifdef Q_OS_WIN QString windowsSystemPath(); diff --git a/src/base/utils/password.cpp b/src/base/utils/password.cpp index ec9257ab5..e7bf0cbf6 100644 --- a/src/base/utils/password.cpp +++ b/src/base/utils/password.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include "bytearray.h" @@ -99,7 +98,7 @@ bool Utils::Password::PBKDF2::verify(const QByteArray &secret, const QString &pa bool Utils::Password::PBKDF2::verify(const QByteArray &secret, const QByteArray &password) { - const QList list = ByteArray::splitToViews(secret, ":", QString::SkipEmptyParts); + const QVector list = ByteArray::splitToViews(secret, ":", QString::SkipEmptyParts); if (list.size() != 2) return false; diff --git a/src/base/utils/random.cpp b/src/base/utils/random.cpp index fde12462e..ef46fe860 100644 --- a/src/base/utils/random.cpp +++ b/src/base/utils/random.cpp @@ -43,6 +43,8 @@ #include #endif +#include + #include "misc.h" namespace diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 14a7d34b7..5368ee190 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -29,6 +29,7 @@ #include "optionsdialog.h" #include +#include #include #include @@ -62,8 +63,8 @@ #include "advancedsettings.h" #include "app/application.h" #include "banlistoptionsdialog.h" -#include "ipsubnetwhitelistoptionsdialog.h" #include "guiiconprovider.h" +#include "ipsubnetwhitelistoptionsdialog.h" #include "rss/automatedrssdownloader.h" #include "scanfoldersdelegate.h" #include "ui_optionsdialog.h" @@ -297,7 +298,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) .arg(tr("Supported parameters (case sensitive):") , tr("%N: Torrent name") , tr("%L: Category") - , tr("%G: Tags (seperated by comma)") + , tr("%G: Tags (separated by comma)") , tr("%F: Content path (same as root path for multifile torrent)") , tr("%R: Root path (first torrent subdirectory path)") , tr("%D: Save path") diff --git a/src/gui/optionsdialog.h b/src/gui/optionsdialog.h index 4e3a2d841..1565fdd19 100644 --- a/src/gui/optionsdialog.h +++ b/src/gui/optionsdialog.h @@ -29,7 +29,6 @@ #ifndef OPTIONSDIALOG_H #define OPTIONSDIALOG_H -#include #include class QAbstractButton; diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index eb10e0d0c..b6e60dd06 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -29,12 +29,14 @@ #include "propertieswidget.h" #include +#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/gui/properties/propertieswidget.h b/src/gui/properties/propertieswidget.h index de8b22d2d..c0c5750d3 100644 --- a/src/gui/properties/propertieswidget.h +++ b/src/gui/properties/propertieswidget.h @@ -29,14 +29,13 @@ #ifndef PROPERTIESWIDGET_H #define PROPERTIESWIDGET_H -#include +#include #include #include "base/bittorrent/torrenthandle.h" -class QAction; class QPushButton; -class QTimer; +class QShortcut; class QTreeView; class DownloadedPiecesBar; @@ -45,8 +44,6 @@ class PeerListWidget; class PieceAvailabilityBar; class PropListDelegate; class PropTabBar; -class SpeedWidget; -class torrent_file; class TorrentContentFilterModel; class TrackerListWidget; diff --git a/src/gui/properties/speedwidget.cpp b/src/gui/properties/speedwidget.cpp index 0ab151413..b3a1d3b3a 100644 --- a/src/gui/properties/speedwidget.cpp +++ b/src/gui/properties/speedwidget.cpp @@ -28,13 +28,12 @@ #include "speedwidget.h" -#include +#include #include #include #include #include - -#include +#include #include "base/bittorrent/session.h" #include "base/bittorrent/sessionstatus.h" diff --git a/src/gui/properties/speedwidget.h b/src/gui/properties/speedwidget.h index 148e40f55..79979b2a0 100644 --- a/src/gui/properties/speedwidget.h +++ b/src/gui/properties/speedwidget.h @@ -34,10 +34,10 @@ #include "speedplotview.h" -class QVBoxLayout; class QHBoxLayout; class QLabel; class QMenu; +class QVBoxLayout; class PropertiesWidget; class ComboBoxMenuButton : public QComboBox diff --git a/src/gui/torrentcontenttreeview.cpp b/src/gui/torrentcontenttreeview.cpp index 3d9149508..712964a95 100644 --- a/src/gui/torrentcontenttreeview.cpp +++ b/src/gui/torrentcontenttreeview.cpp @@ -69,9 +69,8 @@ void TorrentContentTreeView::keyPressEvent(QKeyEvent *event) const QModelIndexList selection = selectionModel()->selectedRows(TorrentContentModelItem::COL_NAME); - for (QModelIndexList::const_iterator i = selection.begin(); i != selection.end(); ++i) { - QModelIndex index = *i; - Q_ASSERT(i->column() == TorrentContentModelItem::COL_NAME); + for (const QModelIndex &index : selection) { + Q_ASSERT(index.column() == TorrentContentModelItem::COL_NAME); model()->setData(index, state, Qt::CheckStateRole); } } diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index d64d74e35..7a314310f 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -29,6 +29,7 @@ #include "transferlistdelegate.h" #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #endif -#include "base/bittorrent/session.h" #include "base/bittorrent/torrenthandle.h" #include "base/preferences.h" #include "base/types.h" diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index d62942a30..57ca4aa46 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -112,7 +112,7 @@ void AppController::preferencesAction() // Automatically add torrents from const QVariantHash dirs = pref->getScanDirs(); QVariantMap nativeDirs; - for (QVariantHash::const_iterator i = dirs.cbegin(), e = dirs.cend(); i != e; ++i) { + for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) { if (i.value().type() == QVariant::Int) nativeDirs.insert(Utils::Fs::toNativePath(i.key()), i.value().toInt()); else @@ -299,7 +299,7 @@ void AppController::setPreferencesAction() QVariantHash oldScanDirs = pref->getScanDirs(); QVariantHash scanDirs; ScanFoldersModel *model = ScanFoldersModel::instance(); - for (QVariantMap::const_iterator i = nativeDirs.cbegin(), e = nativeDirs.cend(); i != e; ++i) { + for (auto i = nativeDirs.cbegin(); i != nativeDirs.cend(); ++i) { QString folder = Utils::Fs::fromNativePath(i.key()); int downloadType; QString downloadPath; diff --git a/src/webui/api/authcontroller.cpp b/src/webui/api/authcontroller.cpp index 5798f77ec..1a34f163c 100644 --- a/src/webui/api/authcontroller.cpp +++ b/src/webui/api/authcontroller.cpp @@ -28,6 +28,9 @@ #include "authcontroller.h" +#include +#include + #include "base/logger.h" #include "base/preferences.h" #include "base/utils/password.h" diff --git a/src/webui/api/authcontroller.h b/src/webui/api/authcontroller.h index 287aee3da..0dd896473 100644 --- a/src/webui/api/authcontroller.h +++ b/src/webui/api/authcontroller.h @@ -29,10 +29,11 @@ #pragma once #include -#include #include "apicontroller.h" +class QString; + class AuthController : public APIController { Q_OBJECT diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index c0b15b001..07bbb68ec 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -29,10 +29,6 @@ #include "webapplication.h" #include -#include -#include -#include -#include #include #include @@ -41,13 +37,13 @@ #include #include #include +#include #include #include #include "base/algorithm.h" #include "base/global.h" #include "base/http/httperror.h" -#include "base/iconprovider.h" #include "base/logger.h" #include "base/preferences.h" #include "base/utils/bytearray.h" diff --git a/src/webui/www/private/preferences_content.html b/src/webui/www/private/preferences_content.html index 068413703..69b380061 100644 --- a/src/webui/www/private/preferences_content.html +++ b/src/webui/www/private/preferences_content.html @@ -214,7 +214,7 @@
  • QBT_TR(%N: Torrent name)QBT_TR[CONTEXT=OptionsDialog]
  • QBT_TR(%L: Category)QBT_TR[CONTEXT=OptionsDialog]
  • -
  • QBT_TR(%G: Tags (seperated by comma))QBT_TR[CONTEXT=OptionsDialog]
  • +
  • QBT_TR(%G: Tags (separated by comma))QBT_TR[CONTEXT=OptionsDialog]
  • QBT_TR(%F: Content path (same as root path for multifile torrent))QBT_TR[CONTEXT=OptionsDialog]
  • QBT_TR(%R: Root path (first torrent subdirectory path))QBT_TR[CONTEXT=OptionsDialog]
  • QBT_TR(%D: Save path)QBT_TR[CONTEXT=OptionsDialog]