Browse Source

Merge pull request #18931 from Chocobo1/tidy

Clean up code
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
b185153254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 82
      .clang-tidy
  2. 2
      src/app/application.cpp
  3. 4
      src/app/qtlocalpeer/qtlocalpeer.cpp
  4. 2
      src/base/bittorrent/customstorage.cpp
  5. 4
      src/base/bittorrent/filterparserthread.cpp
  6. 4
      src/base/bittorrent/filterparserthread.h
  7. 4
      src/base/bittorrent/infohash.cpp
  8. 2
      src/base/bittorrent/session.h
  9. 7
      src/base/bittorrent/sessionimpl.cpp
  10. 40
      src/base/bittorrent/sessionimpl.h
  11. 13
      src/base/bittorrent/torrent.h
  12. 2
      src/base/bittorrent/torrentcreatorthread.h
  13. 6
      src/base/bittorrent/torrentimpl.cpp
  14. 6
      src/base/bittorrent/torrentinfo.cpp
  15. 2
      src/base/bittorrent/torrentinfo.h
  16. 4
      src/base/digest32.h
  17. 2
      src/base/global.h
  18. 2
      src/base/http/irequesthandler.h
  19. 4
      src/base/http/requestparser.cpp
  20. 2
      src/base/http/requestparser.h
  21. 2
      src/base/iconprovider.cpp
  22. 2
      src/base/iconprovider.h
  23. 2
      src/base/net/downloadhandlerimpl.cpp
  24. 4
      src/base/net/downloadmanager.cpp
  25. 2
      src/base/net/smtp.cpp
  26. 2
      src/base/preferences.h
  27. 4
      src/base/profile_p.cpp
  28. 4
      src/base/rss/rss_autodownloader.cpp
  29. 7
      src/base/rss/rss_autodownloadrule.cpp
  30. 4
      src/base/rss/rss_autodownloadrule.h
  31. 2
      src/base/rss/rss_feed.cpp
  32. 6
      src/base/rss/rss_folder.cpp
  33. 2
      src/base/rss/rss_folder.h
  34. 2
      src/base/rss/rss_item.cpp
  35. 2
      src/base/rss/rss_item.h
  36. 2
      src/base/rss/rss_parser.cpp
  37. 2
      src/base/rss/rss_parser.h
  38. 24
      src/base/rss/rss_session.cpp
  39. 2
      src/base/search/searchdownloadhandler.cpp
  40. 2
      src/base/search/searchhandler.cpp
  41. 2
      src/base/search/searchpluginmanager.cpp
  42. 4
      src/base/search/searchpluginmanager.h
  43. 1
      src/base/torrentfileguard.cpp
  44. 3
      src/base/torrentfilter.cpp
  45. 2
      src/base/utils/bytearray.h
  46. 2
      src/base/utils/io.h
  47. 2
      src/gui/advancedsettings.cpp
  48. 3
      src/gui/desktopintegration.cpp
  49. 2
      src/gui/desktopintegration.h
  50. 2
      src/gui/fspathedit_p.cpp
  51. 2
      src/gui/mainwindow.cpp
  52. 18
      src/gui/optionsdialog.cpp
  53. 4
      src/gui/powermanagement/powermanagement.cpp
  54. 2
      src/gui/powermanagement/powermanagement.h
  55. 4
      src/gui/powermanagement/powermanagement_x11.cpp
  56. 2
      src/gui/powermanagement/powermanagement_x11.h
  57. 2
      src/gui/previewselectdialog.cpp
  58. 2
      src/gui/properties/downloadedpiecesbar.h
  59. 2
      src/gui/properties/piecesbar.h
  60. 8
      src/gui/properties/propertieswidget.h
  61. 5
      src/gui/properties/trackerlistwidget.cpp
  62. 2
      src/gui/properties/trackersadditiondialog.h
  63. 8
      src/gui/rss/articlelistwidget.cpp
  64. 11
      src/gui/rss/automatedrssdownloader.cpp
  65. 10
      src/gui/rss/feedlistwidget.cpp
  66. 4
      src/gui/rss/htmlbrowser.cpp
  67. 2
      src/gui/rss/htmlbrowser.h
  68. 12
      src/gui/rss/rsswidget.cpp
  69. 2
      src/gui/search/searchjobwidget.cpp
  70. 4
      src/gui/search/searchwidget.cpp
  71. 2
      src/gui/statusbar.cpp
  72. 2
      src/gui/torrentcategorydialog.cpp
  73. 6
      src/gui/torrentcontentwidget.cpp
  74. 2
      src/gui/transferlistfilters/basefilterwidget.h
  75. 25
      src/gui/transferlistfilters/categoryfiltermodel.cpp
  76. 4
      src/gui/transferlistfilters/categoryfiltermodel.h
  77. 2
      src/gui/transferlistfilters/categoryfilterwidget.cpp
  78. 2
      src/gui/transferlistfilters/statusfilterwidget.cpp
  79. 4
      src/gui/transferlistfilters/statusfilterwidget.h
  80. 6
      src/gui/transferlistfilters/tagfiltermodel.h
  81. 2
      src/gui/transferlistfilters/tagfilterwidget.cpp
  82. 2
      src/gui/transferlistfilters/trackersfilterwidget.h
  83. 6
      src/gui/transferlistmodel.h
  84. 10
      src/gui/transferlistwidget.cpp
  85. 2
      src/gui/transferlistwidget.h
  86. 2
      src/gui/uithemedialog.cpp
  87. 12
      src/gui/uithemesource.h
  88. 4
      src/webui/api/appcontroller.cpp
  89. 2
      src/webui/api/torrentscontroller.cpp

82
.clang-tidy

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
Checks: >
bugprone-*,
cert-*,
concurrency-*,
cppcoreguidelines-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-# not applicable at all,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-macro-parentheses,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-virtual-class-destructor,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-unused-parameters,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
-modernize-use-auto,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-modernize-use-using,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-named-parameter,
-readability-redundant-access-specifiers,
-readability-simplify-boolean-expr,
-readability-uppercase-literal-suffix,
-# only sometimes useful,
-bugprone-narrowing-conversions,
-cert-dcl58-cpp,
-cert-err33-c,
-cert-err58-cpp,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-concurrency-mt-unsafe,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-pro-type-static-cast-downcast,
-misc-definitions-in-headers,
-modernize-concat-nested-namespaces,
-modernize-loop-convert,
-modernize-raw-string-literal,
-modernize-unary-static-assert,
-performance-no-automatic-move,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-redundant-declaration,
-# obsoleted,
-cert-dcl21-cpp
CheckOptions:
- { key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors, value: true }
- { key: modernize-use-override.IgnoreDestructors, value: true }
- { key: performance-for-range-copy.AllowedTypes, value: "QJsonValue" }
- { key: performance-for-range-copy.WarnOnAllAutoCopies, value: true }
- { key: readability-braces-around-statements.ShortStatementLines, value: 3 }
HeaderFilterRegex: ".+/src/.*\\.h"
WarningsAsErrors: "*"

2
src/app/application.cpp

@ -225,7 +225,7 @@ namespace @@ -225,7 +225,7 @@ namespace
Application::Application(int &argc, char **argv)
: BaseApplication(argc, argv)
, m_shutdownAct(ShutdownDialogAction::Exit)
, m_commandLineArgs(parseCommandLine(this->arguments()))
, m_commandLineArgs(parseCommandLine(Application::arguments()))
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs))
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs))
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_qs))

4
src/app/qtlocalpeer/qtlocalpeer.cpp

@ -152,10 +152,10 @@ bool QtLocalPeer::sendMessage(const QString &message, const int timeout) @@ -152,10 +152,10 @@ bool QtLocalPeer::sendMessage(const QString &message, const int timeout)
break;
int ms = 250;
#if defined(Q_OS_WIN)
Sleep(DWORD(ms));
::Sleep(DWORD(ms));
#else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
::nanosleep(&ts, nullptr);
#endif
}
if (!connOk)

2
src/base/bittorrent/customstorage.cpp

@ -171,7 +171,7 @@ void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt @@ -171,7 +171,7 @@ void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt
, std::function<void (const lt::storage_error &, lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler)
{
m_nativeDiskIO->async_set_file_priority(storage, priorities
, [=, handler = std::move(handler)](const lt::storage_error &error, lt::aux::vector<lt::download_priority_t, lt::file_index_t> priorities)
, [=, handler = std::move(handler)](const lt::storage_error &error, const lt::aux::vector<lt::download_priority_t, lt::file_index_t> &priorities)
{
m_storageData[storage].filePriorities = priorities;
handler(error, priorities);

4
src/base/bittorrent/filterparserthread.cpp

@ -484,9 +484,9 @@ int FilterParserThread::parseP2BFilterFile() @@ -484,9 +484,9 @@ int FilterParserThread::parseP2BFilterFile()
char buf[7];
unsigned char version;
if (!stream.readRawData(buf, sizeof(buf))
|| memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7)
|| (memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7) != 0)
|| !stream.readRawData(reinterpret_cast<char*>(&version), sizeof(version)))
{
{
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL);
return ruleCount;
}

4
src/base/bittorrent/filterparserthread.h

@ -55,8 +55,8 @@ protected: @@ -55,8 +55,8 @@ protected:
void run() override;
private:
int findAndNullDelimiter(char *const data, char delimiter, int start, int end, bool reverse = false);
int trim(char *const data, int start, int end);
int findAndNullDelimiter(char *data, char delimiter, int start, int end, bool reverse = false);
int trim(char *data, int start, int end);
int parseDATFilterFile();
int parseP2PFilterFile();
int getlineInStream(QDataStream &stream, std::string &name, char delim);

4
src/base/bittorrent/infohash.cpp

@ -93,7 +93,7 @@ BitTorrent::InfoHash::operator WrappedType() const @@ -93,7 +93,7 @@ BitTorrent::InfoHash::operator WrappedType() const
BitTorrent::TorrentID BitTorrent::TorrentID::fromString(const QString &hashString)
{
return TorrentID(BaseType::fromString(hashString));
return {BaseType::fromString(hashString)};
}
BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::InfoHash &infoHash)
@ -103,7 +103,7 @@ BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::Info @@ -103,7 +103,7 @@ BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::Info
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA1Hash(const SHA1Hash &hash)
{
return TorrentID(hash);
return {hash};
}
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA256Hash(const SHA256Hash &hash)

2
src/base/bittorrent/session.h

@ -400,7 +400,7 @@ namespace BitTorrent @@ -400,7 +400,7 @@ namespace BitTorrent
virtual bool isTrackerFilteringEnabled() const = 0;
virtual void setTrackerFilteringEnabled(bool enabled) = 0;
virtual bool isExcludedFileNamesEnabled() const = 0;
virtual void setExcludedFileNamesEnabled(const bool enabled) = 0;
virtual void setExcludedFileNamesEnabled(bool enabled) = 0;
virtual QStringList excludedFileNames() const = 0;
virtual void setExcludedFileNames(const QStringList &newList) = 0;
virtual bool isFilenameExcluded(const QString &fileName) const = 0;

7
src/base/bittorrent/sessionimpl.cpp

@ -72,7 +72,6 @@ @@ -72,7 +72,6 @@
#endif
#include <QNetworkInterface>
#include <QRegularExpression>
#include <QScopeGuard>
#include <QString>
#include <QThread>
#include <QThreadPool>
@ -1651,7 +1650,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const @@ -1651,7 +1650,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
if (Preferences::instance()->useProxyForBT())
{
const auto proxyManager = Net::ProxyConfigurationManager::instance();
const auto *proxyManager = Net::ProxyConfigurationManager::instance();
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
switch (proxyConfig.type)
@ -4986,7 +4985,7 @@ void SessionImpl::upgradeCategories() @@ -4986,7 +4985,7 @@ void SessionImpl::upgradeCategories()
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
{
const QString categoryName = it.key();
const QString &categoryName = it.key();
CategoryOptions categoryOptions;
categoryOptions.savePath = Path(it.value().toString());
m_categories[categoryName] = categoryOptions;
@ -5229,7 +5228,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts) @@ -5229,7 +5228,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
if (a->type() != lt::add_torrent_alert::alert_type)
continue;
auto alert = static_cast<const lt::add_torrent_alert *>(a);
const auto *alert = static_cast<const lt::add_torrent_alert *>(a);
if (alert->error)
{
const QString msg = QString::fromStdString(alert->message());

40
src/base/bittorrent/sessionimpl.h

@ -378,9 +378,9 @@ namespace BitTorrent @@ -378,9 +378,9 @@ namespace BitTorrent
bool isTrackerFilteringEnabled() const override;
void setTrackerFilteringEnabled(bool enabled) override;
bool isExcludedFileNamesEnabled() const override;
void setExcludedFileNamesEnabled(const bool enabled) override;
void setExcludedFileNamesEnabled(bool enabled) override;
QStringList excludedFileNames() const override;
void setExcludedFileNames(const QStringList &newList) override;
void setExcludedFileNames(const QStringList &excludedFileNames) override;
bool isFilenameExcluded(const QString &fileName) const override;
QStringList bannedIPs() const override;
void setBannedIPs(const QStringList &newList) override;
@ -420,24 +420,24 @@ namespace BitTorrent @@ -420,24 +420,24 @@ namespace BitTorrent
void handleTorrentNeedSaveResumeData(const TorrentImpl *torrent);
void handleTorrentSaveResumeDataRequested(const TorrentImpl *torrent);
void handleTorrentSaveResumeDataFailed(const TorrentImpl *torrent);
void handleTorrentShareLimitChanged(TorrentImpl *const torrent);
void handleTorrentNameChanged(TorrentImpl *const torrent);
void handleTorrentSavePathChanged(TorrentImpl *const torrent);
void handleTorrentCategoryChanged(TorrentImpl *const torrent, const QString &oldCategory);
void handleTorrentTagAdded(TorrentImpl *const torrent, const QString &tag);
void handleTorrentTagRemoved(TorrentImpl *const torrent, const QString &tag);
void handleTorrentSavingModeChanged(TorrentImpl *const torrent);
void handleTorrentMetadataReceived(TorrentImpl *const torrent);
void handleTorrentPaused(TorrentImpl *const torrent);
void handleTorrentResumed(TorrentImpl *const torrent);
void handleTorrentChecked(TorrentImpl *const torrent);
void handleTorrentFinished(TorrentImpl *const torrent);
void handleTorrentTrackersAdded(TorrentImpl *const torrent, const QVector<TrackerEntry> &newTrackers);
void handleTorrentTrackersRemoved(TorrentImpl *const torrent, const QStringList &deletedTrackers);
void handleTorrentTrackersChanged(TorrentImpl *const torrent);
void handleTorrentUrlSeedsAdded(TorrentImpl *const torrent, const QVector<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentImpl *const torrent, const LoadTorrentParams &data);
void handleTorrentShareLimitChanged(TorrentImpl *torrent);
void handleTorrentNameChanged(TorrentImpl *torrent);
void handleTorrentSavePathChanged(TorrentImpl *torrent);
void handleTorrentCategoryChanged(TorrentImpl *torrent, const QString &oldCategory);
void handleTorrentTagAdded(TorrentImpl *torrent, const QString &tag);
void handleTorrentTagRemoved(TorrentImpl *torrent, const QString &tag);
void handleTorrentSavingModeChanged(TorrentImpl *torrent);
void handleTorrentMetadataReceived(TorrentImpl *torrent);
void handleTorrentPaused(TorrentImpl *torrent);
void handleTorrentResumed(TorrentImpl *torrent);
void handleTorrentChecked(TorrentImpl *torrent);
void handleTorrentFinished(TorrentImpl *torrent);
void handleTorrentTrackersAdded(TorrentImpl *torrent, const QVector<TrackerEntry> &newTrackers);
void handleTorrentTrackersRemoved(TorrentImpl *torrent, const QStringList &deletedTrackers);
void handleTorrentTrackersChanged(TorrentImpl *torrent);
void handleTorrentUrlSeedsAdded(TorrentImpl *torrent, const QVector<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentImpl *torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentImpl *torrent, const LoadTorrentParams &data);
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
bool addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, MoveStorageMode mode, MoveStorageContext context);

13
src/base/bittorrent/torrent.h

@ -192,7 +192,6 @@ namespace BitTorrent @@ -192,7 +192,6 @@ namespace BitTorrent
virtual void setSavePath(const Path &savePath) = 0;
virtual Path downloadPath() const = 0;
virtual void setDownloadPath(const Path &downloadPath) = 0;
virtual Path actualStorageLocation() const = 0;
virtual Path rootPath() const = 0;
virtual Path contentPath() const = 0;
virtual QString category() const = 0;
@ -212,9 +211,7 @@ namespace BitTorrent @@ -212,9 +211,7 @@ namespace BitTorrent
virtual qreal ratioLimit() const = 0;
virtual int seedingTimeLimit() const = 0;
virtual Path actualFilePath(int index) const = 0;
virtual PathList filePaths() const = 0;
virtual QVector<DownloadPriority> filePriorities() const = 0;
virtual TorrentInfo info() const = 0;
virtual bool isFinished() const = 0;
@ -232,7 +229,6 @@ namespace BitTorrent @@ -232,7 +229,6 @@ namespace BitTorrent
virtual bool isSequentialDownload() const = 0;
virtual bool hasFirstLastPiecePriority() const = 0;
virtual TorrentState state() const = 0;
virtual bool hasMetadata() const = 0;
virtual bool hasMissingFiles() const = 0;
virtual bool hasError() const = 0;
virtual int queuePosition() const = 0;
@ -244,7 +240,6 @@ namespace BitTorrent @@ -244,7 +240,6 @@ namespace BitTorrent
virtual qlonglong activeTime() const = 0;
virtual qlonglong finishedTime() const = 0;
virtual qlonglong eta() const = 0;
virtual QVector<qreal> filesProgress() const = 0;
virtual int seedsCount() const = 0;
virtual int peersCount() const = 0;
virtual int leechsCount() const = 0;
@ -277,13 +272,6 @@ namespace BitTorrent @@ -277,13 +272,6 @@ namespace BitTorrent
virtual int connectionsCount() const = 0;
virtual int connectionsLimit() const = 0;
virtual qlonglong nextAnnounce() const = 0;
/**
* @brief fraction of file pieces that are available at least from one peer
*
* This is not the same as torrrent availability, it is just a fraction of pieces
* that can be downloaded right now. It varies between 0 to 1.
*/
virtual QVector<qreal> availableFileFractions() const = 0;
virtual void setName(const QString &name) = 0;
virtual void setSequentialDownload(bool enable) = 0;
@ -301,7 +289,6 @@ namespace BitTorrent @@ -301,7 +289,6 @@ namespace BitTorrent
virtual void setDHTDisabled(bool disable) = 0;
virtual void setPEXDisabled(bool disable) = 0;
virtual void setLSDDisabled(bool disable) = 0;
virtual void flushCache() const = 0;
virtual void addTrackers(QVector<TrackerEntry> trackers) = 0;
virtual void removeTrackers(const QStringList &trackers) = 0;
virtual void replaceTrackers(QVector<TrackerEntry> trackers) = 0;

2
src/base/bittorrent/torrentcreatorthread.h

@ -74,7 +74,7 @@ namespace BitTorrent @@ -74,7 +74,7 @@ namespace BitTorrent
void create(const TorrentCreatorParams &params);
#ifdef QBT_USES_LIBTORRENT2
static int calculateTotalPieces(const Path &inputPath, const int pieceSize, const TorrentFormat torrentFormat);
static int calculateTotalPieces(const Path &inputPath, int pieceSize, TorrentFormat torrentFormat);
#else
static int calculateTotalPieces(const Path &inputPath
, const int pieceSize, const bool isAlignmentOptimized, int paddedFileSizeLimit);

6
src/base/bittorrent/torrentimpl.cpp

@ -98,7 +98,7 @@ namespace @@ -98,7 +98,7 @@ namespace
QString firstTrackerMessage;
QString firstErrorMessage;
#ifdef QBT_USES_LIBTORRENT2
const auto numEndpoints = static_cast<qsizetype>(nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1));
const auto numEndpoints = static_cast<qsizetype>(nativeEntry.endpoints.size()) * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1);
for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints)
{
for (const auto protocolVersion : {lt::protocol_version::V1, lt::protocol_version::V2})
@ -338,7 +338,7 @@ TorrentImpl::TorrentImpl(SessionImpl *session, lt::session *nativeSession @@ -338,7 +338,7 @@ TorrentImpl::TorrentImpl(SessionImpl *session, lt::session *nativeSession
// == END UPGRADE CODE ==
}
TorrentImpl::~TorrentImpl() {}
TorrentImpl::~TorrentImpl() = default;
bool TorrentImpl::isValid() const
{
@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi @@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
{
const auto nativeIndex = nativeIndexes.at(i);
const Path actualFilePath = fileNames.at(i);
const Path &actualFilePath = fileNames.at(i);
p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString();
const Path filePath = actualFilePath.removedExtension(QB_EXT);

6
src/base/bittorrent/torrentinfo.cpp

@ -66,12 +66,6 @@ TorrentInfo::TorrentInfo(const lt::torrent_info &nativeInfo) @@ -66,12 +66,6 @@ TorrentInfo::TorrentInfo(const lt::torrent_info &nativeInfo)
}
}
TorrentInfo::TorrentInfo(const TorrentInfo &other)
: m_nativeInfo {other.m_nativeInfo}
, m_nativeIndexes {other.m_nativeIndexes}
{
}
TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other)
{
if (this != &other)

2
src/base/bittorrent/torrentinfo.h

@ -54,7 +54,7 @@ namespace BitTorrent @@ -54,7 +54,7 @@ namespace BitTorrent
public:
TorrentInfo() = default;
TorrentInfo(const TorrentInfo &other);
TorrentInfo(const TorrentInfo &other) = default;
explicit TorrentInfo(const lt::torrent_info &nativeInfo);

4
src/base/digest32.h

@ -45,7 +45,7 @@ public: @@ -45,7 +45,7 @@ public:
Digest32() = default;
Digest32(const Digest32 &other) = default;
Digest32(Digest32 &&other) = default;
Digest32(Digest32 &&other) noexcept = default;
Digest32(const UnderlyingType &nativeDigest)
: m_dataPtr {new Data(nativeDigest)}
@ -63,7 +63,7 @@ public: @@ -63,7 +63,7 @@ public:
}
Digest32 &operator=(const Digest32 &other) = default;
Digest32 &operator=(Digest32 &&other) = default;
Digest32 &operator=(Digest32 &&other) noexcept = default;
operator UnderlyingType() const
{

2
src/base/global.h

@ -42,7 +42,7 @@ constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; } @@ -42,7 +42,7 @@ constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; }
// Forward rvalue as const
template <typename T>
constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::move(t); }
constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::forward<T>(t); }
// Prevent const rvalue arguments
template <typename T>

2
src/base/http/irequesthandler.h

@ -37,7 +37,7 @@ namespace Http @@ -37,7 +37,7 @@ namespace Http
class IRequestHandler
{
public:
virtual ~IRequestHandler() {}
virtual ~IRequestHandler() = default;
virtual Response processRequest(const Request &request, const Environment &env) = 0;
};
}

4
src/base/http/requestparser.cpp

@ -75,10 +75,6 @@ namespace @@ -75,10 +75,6 @@ namespace
}
}
RequestParser::RequestParser()
{
}
RequestParser::ParseResult RequestParser::parse(const QByteArray &data)
{
// Warning! Header names are converted to lowercase

2
src/base/http/requestparser.h

@ -57,7 +57,7 @@ namespace Http @@ -57,7 +57,7 @@ namespace Http
static const long MAX_CONTENT_SIZE = 64 * 1024 * 1024; // 64 MB
private:
RequestParser();
RequestParser() = default;
ParseResult doParse(const QByteArray &data);
bool parseStartLines(QStringView data);

2
src/base/iconprovider.cpp

@ -36,8 +36,6 @@ IconProvider::IconProvider(QObject *parent) @@ -36,8 +36,6 @@ IconProvider::IconProvider(QObject *parent)
{
}
IconProvider::~IconProvider() {}
void IconProvider::initInstance()
{
if (!m_instance)

2
src/base/iconprovider.h

@ -48,7 +48,7 @@ public: @@ -48,7 +48,7 @@ public:
protected:
explicit IconProvider(QObject *parent = nullptr);
~IconProvider();
~IconProvider() = default;
static IconProvider *m_instance;
};

2
src/base/net/downloadhandlerimpl.cpp

@ -208,7 +208,7 @@ void Net::DownloadHandlerImpl::handleRedirection(const QUrl &newUrl) @@ -208,7 +208,7 @@ void Net::DownloadHandlerImpl::handleRedirection(const QUrl &newUrl)
return;
}
auto redirected = static_cast<DownloadHandlerImpl *>(
auto *redirected = static_cast<DownloadHandlerImpl *>(
m_manager->download(DownloadRequest(m_downloadRequest).url(newUrlString), useProxy()));
redirected->m_redirectionCount = m_redirectionCount + 1;
connect(redirected, &DownloadHandlerImpl::finished, this, [this](const DownloadResult &result)

4
src/base/net/downloadmanager.cpp

@ -163,7 +163,7 @@ Net::DownloadHandler *Net::DownloadManager::download(const DownloadRequest &down @@ -163,7 +163,7 @@ Net::DownloadHandler *Net::DownloadManager::download(const DownloadRequest &down
const ServiceID id = ServiceID::fromURL(downloadRequest.url());
const bool isSequentialService = m_sequentialServices.contains(id);
auto downloadHandler = new DownloadHandlerImpl(this, downloadRequest, useProxy);
auto *downloadHandler = new DownloadHandlerImpl(this, downloadRequest, useProxy);
connect(downloadHandler, &DownloadHandler::finished, downloadHandler, &QObject::deleteLater);
connect(downloadHandler, &QObject::destroyed, this, [this, id, downloadHandler]()
{
@ -274,7 +274,7 @@ void Net::DownloadManager::handleDownloadFinished(DownloadHandlerImpl *finishedH @@ -274,7 +274,7 @@ void Net::DownloadManager::handleDownloadFinished(DownloadHandlerImpl *finishedH
return;
}
auto handler = waitingJobsIter.value().dequeue();
auto *handler = waitingJobsIter.value().dequeue();
qDebug("Downloading %s...", qUtf8Printable(handler->url()));
processRequest(handler);
handler->disconnect(this);

2
src/base/net/smtp.cpp

@ -162,7 +162,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje @@ -162,7 +162,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
// Connect to SMTP server
const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':');
const QString serverAddress = serverEndpoint[0];
const QString &serverAddress = serverEndpoint[0];
const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1));
#ifndef QT_NO_OPENSSL

2
src/base/preferences.h

@ -253,7 +253,7 @@ public: @@ -253,7 +253,7 @@ public:
void setUILocked(bool locked);
bool isAutoRunOnTorrentAddedEnabled() const;
void setAutoRunOnTorrentAddedEnabled(const bool enabled);
void setAutoRunOnTorrentAddedEnabled(bool enabled);
QString getAutoRunOnTorrentAddedProgram() const;
void setAutoRunOnTorrentAddedProgram(const QString &program);
bool isAutoRunOnTorrentFinishedEnabled() const;

4
src/base/profile_p.cpp

@ -116,9 +116,9 @@ Path Private::DefaultProfile::downloadLocation() const @@ -116,9 +116,9 @@ Path Private::DefaultProfile::downloadLocation() const
std::unique_ptr<QSettings> Private::DefaultProfile::applicationSettings(const QString &name) const
{
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
return std::unique_ptr<QSettings>(new QSettings(QSettings::IniFormat, QSettings::UserScope, profileName(), name));
return std::make_unique<QSettings>(QSettings::IniFormat, QSettings::UserScope, profileName(), name);
#else
return std::unique_ptr<QSettings>(new QSettings(profileName(), name));
return std::make_unique<QSettings>(profileName(), name);
#endif
}

4
src/base/rss/rss_autodownloader.cpp

@ -382,13 +382,13 @@ void AutoDownloader::handleFeedURLChanged(Feed *feed, const QString &oldURL) @@ -382,13 +382,13 @@ void AutoDownloader::handleFeedURLChanged(Feed *feed, const QString &oldURL)
}
}
for (QSharedPointer<ProcessingJob> job : asConst(m_processingQueue))
for (const QSharedPointer<ProcessingJob> &job : asConst(m_processingQueue))
{
if (job->feedURL == oldURL)
job->feedURL = feed->url();
}
for (QSharedPointer<ProcessingJob> job : asConst(m_waitingJobs))
for (const QSharedPointer<ProcessingJob> &job : asConst(m_waitingJobs))
{
if (job->feedURL == oldURL)
job->feedURL = feed->url();

7
src/base/rss/rss_autodownloadrule.cpp

@ -208,12 +208,9 @@ AutoDownloadRule::AutoDownloadRule(const QString &name) @@ -208,12 +208,9 @@ AutoDownloadRule::AutoDownloadRule(const QString &name)
setName(name);
}
AutoDownloadRule::AutoDownloadRule(const AutoDownloadRule &other)
: m_dataPtr(other.m_dataPtr)
{
}
AutoDownloadRule::AutoDownloadRule(const AutoDownloadRule &other) = default;
AutoDownloadRule::~AutoDownloadRule() {}
AutoDownloadRule::~AutoDownloadRule() = default;
QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, const bool isRegex) const
{

4
src/base/rss/rss_autodownloadrule.h

@ -49,7 +49,7 @@ namespace RSS @@ -49,7 +49,7 @@ namespace RSS
class AutoDownloadRule
{
public:
explicit AutoDownloadRule(const QString &name = u""_qs);
explicit AutoDownloadRule(const QString &name = {});
AutoDownloadRule(const AutoDownloadRule &other);
~AutoDownloadRule();
@ -96,7 +96,7 @@ namespace RSS @@ -96,7 +96,7 @@ namespace RSS
friend bool operator==(const AutoDownloadRule &left, const AutoDownloadRule &right);
QJsonObject toJsonObject() const;
static AutoDownloadRule fromJsonObject(const QJsonObject &jsonObj, const QString &name = u""_qs);
static AutoDownloadRule fromJsonObject(const QJsonObject &jsonObj, const QString &name = {});
QVariantHash toLegacyDict() const;
static AutoDownloadRule fromLegacyDict(const QVariantHash &dict);

2
src/base/rss/rss_feed.cpp

@ -345,7 +345,7 @@ bool Feed::addArticle(const QVariantHash &articleData) @@ -345,7 +345,7 @@ bool Feed::addArticle(const QVariantHash &articleData)
void Feed::removeOldestArticle()
{
auto oldestArticle = m_articlesByDate.last();
auto *oldestArticle = m_articlesByDate.last();
emit articleAboutToBeRemoved(oldestArticle);
m_articles.remove(oldestArticle->guid());

6
src/base/rss/rss_folder.cpp

@ -49,7 +49,7 @@ Folder::~Folder() @@ -49,7 +49,7 @@ Folder::~Folder()
{
emit aboutToBeDestroyed(this);
for (auto item : asConst(items()))
for (auto *item : asConst(items()))
delete item;
}
@ -127,7 +127,7 @@ void Folder::addItem(Item *item) @@ -127,7 +127,7 @@ void Folder::addItem(Item *item)
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
for (auto article : asConst(item->articles()))
for (auto *article : asConst(item->articles()))
emit newArticle(article);
if (item->unreadCount() > 0)
@ -138,7 +138,7 @@ void Folder::removeItem(Item *item) @@ -138,7 +138,7 @@ void Folder::removeItem(Item *item)
{
Q_ASSERT(m_items.contains(item));
for (auto article : asConst(item->articles()))
for (auto *article : asConst(item->articles()))
emit articleAboutToBeRemoved(article);
item->disconnect(this);

2
src/base/rss/rss_folder.h

@ -46,7 +46,7 @@ namespace RSS @@ -46,7 +46,7 @@ namespace RSS
friend class Session;
explicit Folder(const QString &path = u""_qs);
explicit Folder(const QString &path = {});
~Folder() override;
public:

2
src/base/rss/rss_item.cpp

@ -45,8 +45,6 @@ Item::Item(const QString &path) @@ -45,8 +45,6 @@ Item::Item(const QString &path)
{
}
Item::~Item() {}
void Item::setPath(const QString &path)
{
if (path != m_path)

2
src/base/rss/rss_item.h

@ -76,7 +76,7 @@ namespace RSS @@ -76,7 +76,7 @@ namespace RSS
protected:
explicit Item(const QString &path);
~Item() override;
~Item() override = default;
virtual void cleanup() = 0;

2
src/base/rss/rss_parser.cpp

@ -541,7 +541,7 @@ namespace @@ -541,7 +541,7 @@ namespace
const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>();
RSS::Private::Parser::Parser(const QString lastBuildDate)
RSS::Private::Parser::Parser(const QString &lastBuildDate)
{
m_result.lastBuildDate = lastBuildDate;
}

2
src/base/rss/rss_parser.h

@ -53,7 +53,7 @@ namespace RSS::Private @@ -53,7 +53,7 @@ namespace RSS::Private
Q_DISABLE_COPY_MOVE(Parser)
public:
explicit Parser(QString lastBuildDate);
explicit Parser(const QString &lastBuildDate);
void parse(const QByteArray &feedData);
signals:

24
src/base/rss/rss_session.cpp

@ -100,7 +100,7 @@ Session::Session() @@ -100,7 +100,7 @@ Session::Session()
// Remove legacy/corrupted settings
// (at least on Windows, QSettings is case-insensitive and it can get
// confused when asked about settings that differ only in their case)
auto settingsStorage = SettingsStorage::instance();
auto *settingsStorage = SettingsStorage::instance();
settingsStorage->removeValue(u"Rss/streamList"_qs);
settingsStorage->removeValue(u"Rss/streamAlias"_qs);
settingsStorage->removeValue(u"Rss/open_folders"_qs);
@ -140,7 +140,7 @@ nonstd::expected<void, QString> Session::addFolder(const QString &path) @@ -140,7 +140,7 @@ nonstd::expected<void, QString> Session::addFolder(const QString &path)
if (!result)
return result.get_unexpected();
const auto destFolder = result.value();
auto *destFolder = result.value();
addItem(new Folder(path), destFolder);
store();
return {};
@ -155,7 +155,7 @@ nonstd::expected<void, QString> Session::addFeed(const QString &url, const QStri @@ -155,7 +155,7 @@ nonstd::expected<void, QString> Session::addFeed(const QString &url, const QStri
if (!result)
return result.get_unexpected();
const auto destFolder = result.value();
auto *destFolder = result.value();
auto *feed = new Feed(generateUID(), url, path, this);
addItem(feed, destFolder);
store();
@ -198,7 +198,7 @@ nonstd::expected<void, QString> Session::moveItem(const QString &itemPath, const @@ -198,7 +198,7 @@ nonstd::expected<void, QString> Session::moveItem(const QString &itemPath, const
if (itemPath.isEmpty())
return nonstd::make_unexpected(tr("Cannot move root folder."));
auto item = m_itemsByPath.value(itemPath);
auto *item = m_itemsByPath.value(itemPath);
if (!item)
return nonstd::make_unexpected(tr("Item doesn't exist: %1.").arg(itemPath));
@ -214,11 +214,11 @@ nonstd::expected<void, QString> Session::moveItem(Item *item, const QString &des @@ -214,11 +214,11 @@ nonstd::expected<void, QString> Session::moveItem(Item *item, const QString &des
if (!result)
return result.get_unexpected();
const auto destFolder = result.value();
auto *destFolder = result.value();
if (static_cast<Item *>(destFolder) == item)
return nonstd::make_unexpected(tr("Couldn't move folder into itself."));
auto srcFolder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
auto *srcFolder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
if (srcFolder != destFolder)
{
srcFolder->removeItem(item);
@ -242,7 +242,7 @@ nonstd::expected<void, QString> Session::removeItem(const QString &itemPath) @@ -242,7 +242,7 @@ nonstd::expected<void, QString> Session::removeItem(const QString &itemPath)
emit itemAboutToBeRemoved(item);
item->cleanup();
auto folder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
auto *folder = static_cast<Folder *>(m_itemsByPath.value(Item::parentPath(item->path())));
folder->removeItem(item);
delete item;
store();
@ -410,7 +410,7 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path @@ -410,7 +410,7 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path
return nonstd::make_unexpected(tr("RSS item with given path already exists: %1.").arg(path));
const QString destFolderPath = Item::parentPath(path);
const auto destFolder = qobject_cast<Folder *>(m_itemsByPath.value(destFolderPath));
auto *destFolder = qobject_cast<Folder *>(m_itemsByPath.value(destFolderPath));
if (!destFolder)
return nonstd::make_unexpected(tr("Parent folder doesn't exist: %1.").arg(destFolderPath));
@ -419,21 +419,21 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path @@ -419,21 +419,21 @@ nonstd::expected<Folder *, QString> Session::prepareItemDest(const QString &path
Folder *Session::addSubfolder(const QString &name, Folder *parentFolder)
{
auto folder = new Folder(Item::joinPath(parentFolder->path(), name));
auto *folder = new Folder(Item::joinPath(parentFolder->path(), name));
addItem(folder, parentFolder);
return folder;
}
Feed *Session::addFeedToFolder(const QUuid &uid, const QString &url, const QString &name, Folder *parentFolder)
{
auto feed = new Feed(uid, url, Item::joinPath(parentFolder->path(), name), this);
auto *feed = new Feed(uid, url, Item::joinPath(parentFolder->path(), name), this);
addItem(feed, parentFolder);
return feed;
}
void Session::addItem(Item *item, Folder *destFolder)
{
if (auto feed = qobject_cast<Feed *>(item))
if (auto *feed = qobject_cast<Feed *>(item))
{
connect(feed, &Feed::titleChanged, this, &Session::handleFeedTitleChanged);
connect(feed, &Feed::iconLoaded, this, &Session::feedIconLoaded);
@ -530,7 +530,7 @@ QThread *Session::workingThread() const @@ -530,7 +530,7 @@ QThread *Session::workingThread() const
void Session::handleItemAboutToBeDestroyed(Item *item)
{
m_itemsByPath.remove(item->path());
auto feed = qobject_cast<Feed *>(item);
auto *feed = qobject_cast<Feed *>(item);
if (feed)
{
m_feedsByUID.remove(feed->uid());

2
src/base/search/searchdownloadhandler.cpp

@ -46,7 +46,7 @@ SearchDownloadHandler::SearchDownloadHandler(const QString &siteUrl, const QStri @@ -46,7 +46,7 @@ SearchDownloadHandler::SearchDownloadHandler(const QString &siteUrl, const QStri
, this, &SearchDownloadHandler::downloadProcessFinished);
const QStringList params
{
(m_manager->engineLocation() / Path(u"nova2dl.py"_qs)).toString(),
(SearchPluginManager::engineLocation() / Path(u"nova2dl.py"_qs)).toString(),
siteUrl,
url
};

2
src/base/search/searchhandler.cpp

@ -73,7 +73,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co @@ -73,7 +73,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
const QStringList params
{
(m_manager->engineLocation() / Path(u"nova2.py"_qs)).toString(),
(SearchPluginManager::engineLocation() / Path(u"nova2.py"_qs)).toString(),
m_usedPlugins.join(u','),
m_category
};

2
src/base/search/searchpluginmanager.cpp

@ -609,7 +609,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info) @@ -609,7 +609,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
}
}
bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion newVersion) const
bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const
{
const PluginInfo *plugin = pluginInfo(pluginName);
if (!plugin) return true;

4
src/base/search/searchpluginmanager.h

@ -80,7 +80,7 @@ public: @@ -80,7 +80,7 @@ public:
void updatePlugin(const QString &name);
void installPlugin(const QString &source);
bool uninstallPlugin(const QString &name);
static void updateIconPath(PluginInfo *const plugin);
static void updateIconPath(PluginInfo *plugin);
void checkForUpdates();
SearchHandler *startSearch(const QString &pattern, const QString &category, const QStringList &usedPlugins);
@ -109,7 +109,7 @@ private: @@ -109,7 +109,7 @@ private:
void updateNova();
void parseVersionInfo(const QByteArray &info);
void installPlugin_impl(const QString &name, const Path &path);
bool isUpdateNeeded(const QString &pluginName, PluginVersion newVersion) const;
bool isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const;
void versionInfoDownloadFinished(const Net::DownloadResult &result);
void pluginDownloadFinished(const Net::DownloadResult &result);

1
src/base/torrentfileguard.cpp

@ -59,7 +59,6 @@ FileGuard::~FileGuard() @@ -59,7 +59,6 @@ FileGuard::~FileGuard()
TorrentFileGuard::TorrentFileGuard(const Path &path, const TorrentFileGuard::AutoDeleteMode mode)
: FileGuard {mode != Never ? path : Path()}
, m_mode {mode}
, m_wasAdded {false}
{
}

3
src/base/torrentfilter.cpp

@ -62,8 +62,7 @@ TorrentFilter::TorrentFilter(const Type type, const std::optional<TorrentIDSet> @@ -62,8 +62,7 @@ TorrentFilter::TorrentFilter(const Type type, const std::optional<TorrentIDSet>
TorrentFilter::TorrentFilter(const QString &filter, const std::optional<TorrentIDSet> &idSet
, const std::optional<QString> &category, const std::optional<QString> &tag)
: m_type(All)
, m_category(category)
: m_category(category)
, m_tag(tag)
, m_idSet(idSet)
{

2
src/base/utils/bytearray.h

@ -36,7 +36,7 @@ class QByteArray; @@ -36,7 +36,7 @@ class QByteArray;
namespace Utils::ByteArray
{
// Mimic QStringView(in).split(sep, behavior)
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const Qt::SplitBehavior behavior = Qt::KeepEmptyParts);
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts);
// Mimic QByteArray::mid(pos, len) but instead of returning a full-copy,
// we only return a partial view

2
src/base/utils/io.h

@ -53,7 +53,7 @@ namespace Utils::IO @@ -53,7 +53,7 @@ namespace Utils::IO
using pointer = void;
using reference = void;
explicit FileDeviceOutputIterator(QFileDevice &device, const int bufferSize = (4 * 1024));
explicit FileDeviceOutputIterator(QFileDevice &device, int bufferSize = (4 * 1024));
FileDeviceOutputIterator(const FileDeviceOutputIterator &other) = default;
~FileDeviceOutputIterator();

2
src/gui/advancedsettings.cpp

@ -831,7 +831,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -831,7 +831,7 @@ void AdvancedSettings::loadAdvancedSettings()
template <typename T>
void AdvancedSettings::addRow(const int row, const QString &text, T *widget)
{
auto label = new QLabel(text);
auto *label = new QLabel(text);
label->setOpenExternalLinks(true);
setCellWidget(row, PROPERTY, label);

3
src/gui/desktopintegration.cpp

@ -100,8 +100,7 @@ DesktopIntegration::DesktopIntegration(QObject *parent) @@ -100,8 +100,7 @@ DesktopIntegration::DesktopIntegration(QObject *parent)
DesktopIntegration::~DesktopIntegration()
{
if (m_menu)
delete m_menu;
delete m_menu;
}
bool DesktopIntegration::isActive() const

2
src/gui/desktopintegration.h

@ -63,7 +63,7 @@ public: @@ -63,7 +63,7 @@ public:
int notificationTimeout() const;
#ifdef QBT_USES_DBUS
void setNotificationTimeout(const int value);
void setNotificationTimeout(int value);
#endif
void showNotification(const QString &title, const QString &msg) const;

2
src/gui/fspathedit_p.cpp

@ -152,8 +152,6 @@ Private::FileLineEdit::FileLineEdit(QWidget *parent) @@ -152,8 +152,6 @@ Private::FileLineEdit::FileLineEdit(QWidget *parent)
: QLineEdit {parent}
, m_completerModel {new QFileSystemModel(this)}
, m_completer {new QCompleter(this)}
, m_browseAction {nullptr}
, m_warningAction {nullptr}
{
m_iconProvider.setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);

2
src/gui/mainwindow.cpp

@ -942,7 +942,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const BitTorrent::Torre @@ -942,7 +942,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const BitTorrent::Torre
void MainWindow::on_actionSetGlobalSpeedLimits_triggered()
{
auto dialog = new SpeedLimitDialog {this};
auto *dialog = new SpeedLimitDialog {this};
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
}

18
src/gui/optionsdialog.cpp

@ -334,7 +334,7 @@ void OptionsDialog::loadBehaviorTabOptions() @@ -334,7 +334,7 @@ void OptionsDialog::loadBehaviorTabOptions()
});
connect(m_ui->buttonCustomizeUITheme, &QPushButton::clicked, this, [this]
{
auto dialog = new UIThemeDialog(this);
auto *dialog = new UIThemeDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
});
@ -698,7 +698,7 @@ void OptionsDialog::saveDownloadsTabOptions() const @@ -698,7 +698,7 @@ void OptionsDialog::saveDownloadsTabOptions() const
session->setTorrentExportDirectory(getTorrentExportDir());
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
watchedFoldersModel->apply();
session->setExcludedFileNamesEnabled(m_ui->groupExcludedFileNames->isChecked());
@ -882,7 +882,7 @@ void OptionsDialog::saveConnectionTabOptions() const @@ -882,7 +882,7 @@ void OptionsDialog::saveConnectionTabOptions() const
session->setI2PPort(m_ui->spinI2PPort->value());
session->setI2PMixedMode(m_ui->checkI2PMixed->isChecked());
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
auto *proxyConfigManager = Net::ProxyConfigurationManager::instance();
Net::ProxyConfiguration proxyConf;
proxyConf.type = getProxyType();
proxyConf.ip = getProxyIp();
@ -1668,13 +1668,13 @@ void OptionsDialog::on_addWatchedFolderButton_clicked() @@ -1668,13 +1668,13 @@ void OptionsDialog::on_addWatchedFolderButton_clicked()
if (dir.isEmpty())
return;
auto dialog = new WatchedFolderOptionsDialog({}, this);
auto *dialog = new WatchedFolderOptionsDialog({}, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
{
try
{
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
watchedFoldersModel->addFolder(dir, dialog->watchedFolderOptions());
pref->setScanDirsLastPath(dir);
@ -1722,8 +1722,8 @@ void OptionsDialog::editWatchedFolderOptions(const QModelIndex &index) @@ -1722,8 +1722,8 @@ void OptionsDialog::editWatchedFolderOptions(const QModelIndex &index)
if (!index.isValid())
return;
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
auto dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
auto *dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
{
@ -1880,7 +1880,7 @@ bool OptionsDialog::schedTimesOk() @@ -1880,7 +1880,7 @@ bool OptionsDialog::schedTimesOk()
void OptionsDialog::on_banListButton_clicked()
{
auto dialog = new BanListOptionsDialog(this);
auto *dialog = new BanListOptionsDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
dialog->open();
@ -1888,7 +1888,7 @@ void OptionsDialog::on_banListButton_clicked() @@ -1888,7 +1888,7 @@ void OptionsDialog::on_banListButton_clicked()
void OptionsDialog::on_IPSubnetWhitelistButton_clicked()
{
auto dialog = new IPSubnetWhitelistOptionsDialog(this);
auto *dialog = new IPSubnetWhitelistOptionsDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
dialog->open();

4
src/gui/powermanagement/powermanagement.cpp

@ -50,10 +50,6 @@ PowerManagement::PowerManagement(QObject *parent) @@ -50,10 +50,6 @@ PowerManagement::PowerManagement(QObject *parent)
#endif
}
PowerManagement::~PowerManagement()
{
}
void PowerManagement::setActivityState(const bool busy)
{
if (busy)

2
src/gui/powermanagement/powermanagement.h

@ -47,7 +47,7 @@ class PowerManagement : public QObject @@ -47,7 +47,7 @@ class PowerManagement : public QObject
public:
PowerManagement(QObject *parent = nullptr);
virtual ~PowerManagement();
virtual ~PowerManagement() = default;
void setActivityState(bool busy);

4
src/gui/powermanagement/powermanagement_x11.cpp

@ -51,10 +51,6 @@ PowerManagementInhibitor::PowerManagementInhibitor(QObject *parent) @@ -51,10 +51,6 @@ PowerManagementInhibitor::PowerManagementInhibitor(QObject *parent)
m_useGSM = false;
}
PowerManagementInhibitor::~PowerManagementInhibitor()
{
}
void PowerManagementInhibitor::requestIdle()
{
m_intendedState = Idle;

2
src/gui/powermanagement/powermanagement_x11.h

@ -39,7 +39,7 @@ class PowerManagementInhibitor : public QObject @@ -39,7 +39,7 @@ class PowerManagementInhibitor : public QObject
public:
PowerManagementInhibitor(QObject *parent = nullptr);
virtual ~PowerManagementInhibitor();
virtual ~PowerManagementInhibitor() = default;
void requestIdle();
void requestBusy();

2
src/gui/previewselectdialog.cpp

@ -145,7 +145,7 @@ void PreviewSelectDialog::previewButtonClicked() @@ -145,7 +145,7 @@ void PreviewSelectDialog::previewButtonClicked()
void PreviewSelectDialog::displayColumnHeaderMenu()
{
auto menu = new QMenu(this);
auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setToolTipsVisible(true);

2
src/gui/properties/downloadedpiecesbar.h

@ -52,7 +52,7 @@ public: @@ -52,7 +52,7 @@ public:
private:
// scale bitfield vector to float vector
QVector<float> bitfieldToFloatVector(const QBitArray &vecin, int reqSize);
virtual bool updateImage(QImage &image) override;
bool updateImage(QImage &image) override;
QString simpleToolTipText() const override;
// incomplete piece color

2
src/gui/properties/piecesbar.h

@ -55,7 +55,7 @@ public: @@ -55,7 +55,7 @@ public:
virtual void clear();
// QObject interface
virtual bool event(QEvent *e) override;
bool event(QEvent *e) override;
protected:
// QWidget interface

8
src/gui/properties/propertieswidget.h

@ -76,16 +76,16 @@ public: @@ -76,16 +76,16 @@ public:
public slots:
void setVisibility(bool visible);
void loadTorrentInfos(BitTorrent::Torrent *const torrent);
void loadTorrentInfos(BitTorrent::Torrent *torrent);
void loadDynamicData();
void clear();
void readSettings();
void saveSettings();
void reloadPreferences();
void loadTrackers(BitTorrent::Torrent *const torrent);
void loadTrackers(BitTorrent::Torrent *torrent);
protected slots:
void updateTorrentInfos(BitTorrent::Torrent *const torrent);
void updateTorrentInfos(BitTorrent::Torrent *torrent);
void loadUrlSeeds();
void askWebSeed();
void deleteSelectedUrlSeeds();
@ -97,7 +97,7 @@ protected slots: @@ -97,7 +97,7 @@ protected slots:
private slots:
void configure();
void updateSavePath(BitTorrent::Torrent *const torrent);
void updateSavePath(BitTorrent::Torrent *torrent);
private:
QPushButton *getButtonFromIndex(int index);

5
src/gui/properties/trackerlistwidget.cpp

@ -58,8 +58,7 @@ @@ -58,8 +58,7 @@
#define NB_STICKY_ITEM 3
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
: QTreeWidget()
, m_properties(properties)
: m_properties(properties)
{
// Set header
// Must be set before calling loadSettings() otherwise the header is reset on restart
@ -438,7 +437,7 @@ void TrackerListWidget::openAddTrackersDialog() @@ -438,7 +437,7 @@ void TrackerListWidget::openAddTrackersDialog()
if (!torrent)
return;
const auto dialog = new TrackersAdditionDialog(this, torrent);
auto *dialog = new TrackersAdditionDialog(this, torrent);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
}

2
src/gui/properties/trackersadditiondialog.h

@ -54,7 +54,7 @@ class TrackersAdditionDialog : public QDialog @@ -54,7 +54,7 @@ class TrackersAdditionDialog : public QDialog
Q_DISABLE_COPY_MOVE(TrackersAdditionDialog)
public:
TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *const torrent);
TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *torrent);
~TrackersAdditionDialog();
private slots:

8
src/gui/rss/articlelistwidget.cpp

@ -71,11 +71,11 @@ void ArticleListWidget::setRSSItem(RSS::Item *rssItem, bool unreadOnly) @@ -71,11 +71,11 @@ void ArticleListWidget::setRSSItem(RSS::Item *rssItem, bool unreadOnly)
connect(m_rssItem, &RSS::Item::articleRead, this, &ArticleListWidget::handleArticleRead);
connect(m_rssItem, &RSS::Item::articleAboutToBeRemoved, this, &ArticleListWidget::handleArticleAboutToBeRemoved);
for (const auto article : asConst(rssItem->articles()))
for (auto *article : asConst(rssItem->articles()))
{
if (!(m_unreadOnly && article->isRead()))
{
auto item = createItem(article);
auto *item = createItem(article);
addItem(item);
m_rssArticleToListItemMapping.insert(article, item);
}
@ -89,7 +89,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle) @@ -89,7 +89,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
{
if (!(m_unreadOnly && rssArticle->isRead()))
{
auto item = createItem(rssArticle);
auto *item = createItem(rssArticle);
insertItem(0, item);
m_rssArticleToListItemMapping.insert(rssArticle, item);
}
@ -99,7 +99,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle) @@ -99,7 +99,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
{
auto item = mapRSSArticle(rssArticle);
auto *item = mapRSSArticle(rssArticle);
if (!item) return;
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)};

11
src/gui/rss/automatedrssdownloader.cpp

@ -64,7 +64,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -64,7 +64,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
, m_formatFilterJSON(u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON))
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY))
, m_ui(new Ui::AutomatedRssDownloader)
, m_currentRuleItem(nullptr)
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs}
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeHSplitterSize {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs}
@ -193,7 +192,7 @@ void AutomatedRssDownloader::loadFeedList() @@ -193,7 +192,7 @@ void AutomatedRssDownloader::loadFeedList()
{
const QSignalBlocker feedListSignalBlocker(m_ui->listFeeds);
for (const auto feed : asConst(RSS::Session::instance()->feeds()))
for (const auto *feed : asConst(RSS::Session::instance()->feeds()))
{
QListWidgetItem *item = new QListWidgetItem(feed->name(), m_ui->listFeeds);
item->setData(Qt::UserRole, feed->url());
@ -637,11 +636,11 @@ void AutomatedRssDownloader::updateMatchingArticles() @@ -637,11 +636,11 @@ void AutomatedRssDownloader::updateMatchingArticles()
: RSS::AutoDownloader::instance()->ruleByName(ruleItem->text()));
for (const QString &feedURL : asConst(rule.feedURLs()))
{
auto feed = RSS::Session::instance()->feedByURL(feedURL);
auto *feed = RSS::Session::instance()->feedByURL(feedURL);
if (!feed) continue; // feed doesn't exist
QStringList matchingArticles;
for (const auto article : asConst(feed->articles()))
for (const auto *article : asConst(feed->articles()))
if (rule.matches(article->data()))
matchingArticles << article->title();
if (!matchingArticles.isEmpty())
@ -854,7 +853,7 @@ void AutomatedRssDownloader::handleRuleAdded(const QString &ruleName) @@ -854,7 +853,7 @@ void AutomatedRssDownloader::handleRuleAdded(const QString &ruleName)
void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QString &oldRuleName)
{
auto item = m_itemsByRuleName.take(oldRuleName);
auto *item = m_itemsByRuleName.take(oldRuleName);
m_itemsByRuleName.insert(ruleName, item);
if (m_currentRule.name() == oldRuleName)
m_currentRule.setName(ruleName);
@ -863,7 +862,7 @@ void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QS @@ -863,7 +862,7 @@ void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QS
void AutomatedRssDownloader::handleRuleChanged(const QString &ruleName)
{
auto item = m_itemsByRuleName.value(ruleName);
auto *item = m_itemsByRuleName.value(ruleName);
if (item && (item != m_currentRuleItem))
item->setCheckState(RSS::AutoDownloader::instance()->ruleByName(ruleName).isEnabled() ? Qt::Checked : Qt::Unchecked);
}

10
src/gui/rss/feedlistwidget.cpp

@ -123,7 +123,7 @@ FeedListWidget::FeedListWidget(QWidget *parent) @@ -123,7 +123,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
void FeedListWidget::handleItemAdded(RSS::Item *rssItem)
{
auto parentItem = m_rssToTreeItemMapping.value(
auto *parentItem = m_rssToTreeItemMapping.value(
RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path())));
createItem(rssItem, parentItem);
}
@ -264,7 +264,7 @@ void FeedListWidget::dropEvent(QDropEvent *event) @@ -264,7 +264,7 @@ void FeedListWidget::dropEvent(QDropEvent *event)
// move as much items as possible
for (QTreeWidgetItem *srcItem : asConst(selectedItems()))
{
auto rssItem = getRSSItem(srcItem);
auto *rssItem = getRSSItem(srcItem);
RSS::Session::instance()->moveItem(rssItem, RSS::Item::joinPath(destFolder->path(), rssItem->name()));
}
@ -281,7 +281,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem @@ -281,7 +281,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
m_rssToTreeItemMapping[rssItem] = item;
QIcon icon;
if (auto feed = qobject_cast<RSS::Feed *>(rssItem))
if (auto *feed = qobject_cast<RSS::Feed *>(rssItem))
icon = rssFeedIcon(feed);
else
icon = UIThemeManager::instance()->getIcon(u"directory"_qs);
@ -299,11 +299,11 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem @@ -299,11 +299,11 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
void FeedListWidget::fill(QTreeWidgetItem *parent, RSS::Folder *rssParent)
{
for (const auto rssItem : asConst(rssParent->items()))
for (auto *rssItem : asConst(rssParent->items()))
{
QTreeWidgetItem *item = createItem(rssItem, parent);
// Recursive call if this is a folder.
if (auto folder = qobject_cast<RSS::Folder *>(rssItem))
if (auto *folder = qobject_cast<RSS::Folder *>(rssItem))
fill(item, folder);
}
}

4
src/gui/rss/htmlbrowser.cpp

@ -54,10 +54,6 @@ HtmlBrowser::HtmlBrowser(QWidget *parent) @@ -54,10 +54,6 @@ HtmlBrowser::HtmlBrowser(QWidget *parent)
connect(m_netManager, &QNetworkAccessManager::finished, this, &HtmlBrowser::resourceLoaded);
}
HtmlBrowser::~HtmlBrowser()
{
}
QVariant HtmlBrowser::loadResource(int type, const QUrl &name)
{
if (type == QTextDocument::ImageResource)

2
src/gui/rss/htmlbrowser.h

@ -42,7 +42,7 @@ class HtmlBrowser final : public QTextBrowser @@ -42,7 +42,7 @@ class HtmlBrowser final : public QTextBrowser
public:
explicit HtmlBrowser(QWidget* parent = nullptr);
~HtmlBrowser();
~HtmlBrowser() = default;
QVariant loadResource(int type, const QUrl &name) override;

12
src/gui/rss/rsswidget.cpp

@ -203,7 +203,7 @@ void RSSWidget::displayItemsListMenu() @@ -203,7 +203,7 @@ void RSSWidget::displayItemsListMenu()
bool hasLink = false;
for (const QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
{
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
Q_ASSERT(article);
if (!article->torrentUrl().isEmpty())
@ -364,7 +364,7 @@ void RSSWidget::downloadSelectedTorrents() @@ -364,7 +364,7 @@ void RSSWidget::downloadSelectedTorrents()
{
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
{
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
Q_ASSERT(article);
// Mark as read
@ -385,7 +385,7 @@ void RSSWidget::openSelectedArticlesUrls() @@ -385,7 +385,7 @@ void RSSWidget::openSelectedArticlesUrls()
{
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
{
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
auto *article = item->data(Qt::UserRole).value<RSS::Article *>();
Q_ASSERT(article);
// Mark as read
@ -467,7 +467,7 @@ void RSSWidget::copySelectedFeedsURL() @@ -467,7 +467,7 @@ void RSSWidget::copySelectedFeedsURL()
QStringList URLs;
for (QTreeWidgetItem *item : asConst(m_feedListWidget->selectedItems()))
{
if (auto feed = qobject_cast<RSS::Feed *>(m_feedListWidget->getRSSItem(item)))
if (auto *feed = qobject_cast<RSS::Feed *>(m_feedListWidget->getRSSItem(item)))
URLs << feed->url();
}
qApp->clipboard()->setText(URLs.join(u'\n'));
@ -496,14 +496,14 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL @@ -496,14 +496,14 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
if (previousItem)
{
auto article = m_articleListWidget->getRSSArticle(previousItem);
auto *article = m_articleListWidget->getRSSArticle(previousItem);
Q_ASSERT(article);
article->markAsRead();
}
if (!currentItem) return;
auto article = m_articleListWidget->getRSSArticle(currentItem);
auto *article = m_articleListWidget->getRSSArticle(currentItem);
Q_ASSERT(article);
const QString highlightedBaseColor = m_ui->textBrowser->palette().color(QPalette::Highlight).name();

2
src/gui/search/searchjobwidget.cpp

@ -459,7 +459,7 @@ int SearchJobWidget::visibleColumnsCount() const @@ -459,7 +459,7 @@ int SearchJobWidget::visibleColumnsCount() const
void SearchJobWidget::displayColumnHeaderMenu()
{
auto menu = new QMenu(this);
auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setTitle(tr("Column visibility"));
menu->setToolTipsVisible(true);

4
src/gui/search/searchwidget.cpp

@ -144,7 +144,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow) @@ -144,7 +144,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchWidget::fillCatCombobox);
const auto focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
const auto *focusSearchHotkey = new QShortcut(QKeySequence::Find, this);
connect(focusSearchHotkey, &QShortcut::activated, this, &SearchWidget::toggleFocusBetweenLineEdits);
}
@ -156,7 +156,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event) @@ -156,7 +156,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
if (event->type() != QEvent::MouseButtonRelease)
return false;
const auto mouseEvent = static_cast<QMouseEvent *>(event);
const auto *mouseEvent = static_cast<QMouseEvent *>(event);
const int tabIndex = m_ui->tabWidget->tabBar()->tabAt(mouseEvent->pos());
if ((mouseEvent->button() == Qt::MiddleButton) && (tabIndex >= 0))
{

2
src/gui/statusbar.cpp

@ -255,7 +255,7 @@ void StatusBar::updateAltSpeedsBtn(bool alternative) @@ -255,7 +255,7 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
void StatusBar::capSpeed()
{
auto dialog = new SpeedLimitDialog {parentWidget()};
auto *dialog = new SpeedLimitDialog {parentWidget()};
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
}

2
src/gui/torrentcategorydialog.cpp

@ -108,7 +108,7 @@ void TorrentCategoryDialog::editCategory(QWidget *parent, const QString &categor @@ -108,7 +108,7 @@ void TorrentCategoryDialog::editCategory(QWidget *parent, const QString &categor
Q_ASSERT(Session::instance()->categories().contains(categoryName));
auto dialog = new TorrentCategoryDialog(parent);
auto *dialog = new TorrentCategoryDialog(parent);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setCategoryNameEditable(false);
dialog->setCategoryName(categoryName);

6
src/gui/torrentcontentwidget.cpp

@ -75,7 +75,7 @@ TorrentContentWidget::TorrentContentWidget(QWidget *parent) @@ -75,7 +75,7 @@ TorrentContentWidget::TorrentContentWidget(QWidget *parent)
m_filterModel->setSourceModel(m_model);
QTreeView::setModel(m_filterModel);
auto itemDelegate = new TorrentContentItemDelegate(this);
auto *itemDelegate = new TorrentContentItemDelegate(this);
setItemDelegate(itemDelegate);
connect(this, &QAbstractItemView::clicked, this, qOverload<const QModelIndex &>(&QAbstractItemView::edit));
@ -436,7 +436,7 @@ void TorrentContentWidget::openParentFolder(const QModelIndex &index) const @@ -436,7 +436,7 @@ void TorrentContentWidget::openParentFolder(const QModelIndex &index) const
Path TorrentContentWidget::getFullPath(const QModelIndex &index) const
{
const auto contentHandler = m_model->contentHandler();
const auto *contentHandler = m_model->contentHandler();
if (const int fileIdx = getFileIndex(index); fileIdx >= 0)
{
const Path fullPath = contentHandler->actualStorageLocation() / contentHandler->actualFilePath(fileIdx);
@ -450,7 +450,7 @@ Path TorrentContentWidget::getFullPath(const QModelIndex &index) const @@ -450,7 +450,7 @@ Path TorrentContentWidget::getFullPath(const QModelIndex &index) const
void TorrentContentWidget::onItemDoubleClicked(const QModelIndex &index)
{
const auto contentHandler = m_model->contentHandler();
const auto *contentHandler = m_model->contentHandler();
Q_ASSERT(contentHandler && contentHandler->hasMetadata());
if (Q_UNLIKELY(!contentHandler || !contentHandler->hasMetadata()))

2
src/gui/transferlistfilters/basefilterwidget.h

@ -56,7 +56,7 @@ private slots: @@ -56,7 +56,7 @@ private slots:
virtual void showMenu() = 0;
virtual void applyFilter(int row) = 0;
virtual void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) = 0;
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *const) = 0;
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *) = 0;
private:
TransferListWidget *m_transferList = nullptr;

25
src/gui/transferlistfilters/categoryfiltermodel.cpp

@ -38,13 +38,10 @@ @@ -38,13 +38,10 @@
class CategoryModelItem
{
public:
CategoryModelItem()
{
}
CategoryModelItem() = default;
CategoryModelItem(CategoryModelItem *parent, QString categoryName, int torrentsCount = 0)
: m_parent(nullptr)
, m_name(categoryName)
: m_name(categoryName)
, m_torrentsCount(torrentsCount)
{
if (parent)
@ -207,7 +204,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const @@ -207,7 +204,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) return {};
auto item = static_cast<const CategoryModelItem *>(index.internalPointer());
const auto *item = static_cast<const CategoryModelItem *>(index.internalPointer());
if ((index.column() == 0) && (role == Qt::DecorationRole))
{
@ -251,7 +248,7 @@ QModelIndex CategoryFilterModel::index(int row, int column, const QModelIndex &p @@ -251,7 +248,7 @@ QModelIndex CategoryFilterModel::index(int row, int column, const QModelIndex &p
if (parent.isValid() && (parent.column() != 0))
return {};
auto parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
auto *parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
: m_rootItem;
if (row < parentItem->childCount())
return createIndex(row, column, parentItem->childAt(row));
@ -264,7 +261,7 @@ QModelIndex CategoryFilterModel::parent(const QModelIndex &index) const @@ -264,7 +261,7 @@ QModelIndex CategoryFilterModel::parent(const QModelIndex &index) const
if (!index.isValid())
return {};
auto item = static_cast<CategoryModelItem *>(index.internalPointer());
auto *item = static_cast<CategoryModelItem *>(index.internalPointer());
if (!item) return {};
return this->index(item->parent());
@ -278,7 +275,7 @@ int CategoryFilterModel::rowCount(const QModelIndex &parent) const @@ -278,7 +275,7 @@ int CategoryFilterModel::rowCount(const QModelIndex &parent) const
if (!parent.isValid())
return m_rootItem->childCount();
auto item = static_cast<CategoryModelItem *>(parent.internalPointer());
auto *item = static_cast<CategoryModelItem *>(parent.internalPointer());
if (!item) return 0;
return item->childCount();
@ -308,7 +305,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName) @@ -308,7 +305,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
if (m_isSubcategoriesEnabled)
{
QStringList expanded = BitTorrent::Session::instance()->expandCategory(categoryName);
QStringList expanded = BitTorrent::Session::expandCategory(categoryName);
if (expanded.count() > 1)
parent = findItem(expanded[expanded.count() - 2]);
}
@ -322,7 +319,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName) @@ -322,7 +319,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
void CategoryFilterModel::categoryRemoved(const QString &categoryName)
{
auto item = findItem(categoryName);
auto *item = findItem(categoryName);
if (item)
{
QModelIndex i = index(item);
@ -357,7 +354,7 @@ void CategoryFilterModel::torrentCategoryChanged(BitTorrent::Torrent *const torr @@ -357,7 +354,7 @@ void CategoryFilterModel::torrentCategoryChanged(BitTorrent::Torrent *const torr
{
QModelIndex i;
auto item = findItem(oldCategory);
auto *item = findItem(oldCategory);
Q_ASSERT(item);
item->decreaseTorrentsCount();
@ -413,7 +410,7 @@ void CategoryFilterModel::populate() @@ -413,7 +410,7 @@ void CategoryFilterModel::populate()
for (const QString &categoryName : asConst(session->categories()))
{
CategoryModelItem *parent = m_rootItem;
for (const QString &subcat : asConst(session->expandCategory(categoryName)))
for (const QString &subcat : asConst(BitTorrent::Session::expandCategory(categoryName)))
{
const QString subcatName = shortName(subcat);
if (!parent->hasChild(subcatName))
@ -446,7 +443,7 @@ CategoryModelItem *CategoryFilterModel::findItem(const QString &fullName) const @@ -446,7 +443,7 @@ CategoryModelItem *CategoryFilterModel::findItem(const QString &fullName) const
return m_rootItem->child(fullName);
CategoryModelItem *item = m_rootItem;
for (const QString &subcat : asConst(BitTorrent::Session::instance()->expandCategory(fullName)))
for (const QString &subcat : asConst(BitTorrent::Session::expandCategory(fullName)))
{
const QString subcatName = shortName(subcat);
if (!item->hasChild(subcatName)) return nullptr;

4
src/gui/transferlistfilters/categoryfiltermodel.h

@ -63,8 +63,8 @@ private slots: @@ -63,8 +63,8 @@ private slots:
void categoryAdded(const QString &categoryName);
void categoryRemoved(const QString &categoryName);
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
void torrentCategoryChanged(BitTorrent::Torrent *const torrent, const QString &oldCategory);
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
void torrentCategoryChanged(BitTorrent::Torrent *torrent, const QString &oldCategory);
void subcategoriesSupportChanged();
private:

2
src/gui/transferlistfilters/categoryfilterwidget.cpp

@ -214,7 +214,7 @@ void CategoryFilterWidget::removeCategory() @@ -214,7 +214,7 @@ void CategoryFilterWidget::removeCategory()
void CategoryFilterWidget::removeUnusedCategories()
{
auto session = BitTorrent::Session::instance();
auto *session = BitTorrent::Session::instance();
for (const QString &category : asConst(session->categories()))
{
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)

2
src/gui/transferlistfilters/statusfilterwidget.cpp

@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems() @@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
}
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> torrents)
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> &torrents)
{
for (const BitTorrent::Torrent *torrent : torrents)
updateTorrentStatus(torrent);

4
src/gui/transferlistfilters/statusfilterwidget.h

@ -54,11 +54,11 @@ private: @@ -54,11 +54,11 @@ private:
void showMenu() override;
void applyFilter(int row) override;
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
void torrentAboutToBeDeleted(BitTorrent::Torrent *const) override;
void torrentAboutToBeDeleted(BitTorrent::Torrent *) override;
void configure();
void update(const QVector<BitTorrent::Torrent *> torrents);
void update(const QVector<BitTorrent::Torrent *> &torrents);
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
void updateTexts();
void hideZeroItems();

6
src/gui/transferlistfilters/tagfiltermodel.h

@ -61,10 +61,10 @@ public: @@ -61,10 +61,10 @@ public:
private slots:
void tagAdded(const QString &tag);
void tagRemoved(const QString &tag);
void torrentTagAdded(BitTorrent::Torrent *const torrent, const QString &tag);
void torrentTagRemoved(BitTorrent::Torrent *const, const QString &tag);
void torrentTagAdded(BitTorrent::Torrent *torrent, const QString &tag);
void torrentTagRemoved(BitTorrent::Torrent *, const QString &tag);
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
private:
static QString tagDisplayName(const QString &tag);

2
src/gui/transferlistfilters/tagfilterwidget.cpp

@ -208,7 +208,7 @@ void TagFilterWidget::removeTag() @@ -208,7 +208,7 @@ void TagFilterWidget::removeTag()
void TagFilterWidget::removeUnusedTags()
{
auto session = BitTorrent::Session::instance();
auto *session = BitTorrent::Session::instance();
for (const QString &tag : asConst(session->tags()))
if (model()->data(static_cast<TagFilterProxyModel *>(model())->index(tag), Qt::UserRole) == 0)
session->removeTag(tag);

2
src/gui/transferlistfilters/trackersfilterwidget.h

@ -69,7 +69,7 @@ private: @@ -69,7 +69,7 @@ private:
void showMenu() override;
void applyFilter(int row) override;
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
void torrentAboutToBeDeleted(BitTorrent::Torrent *const torrent) override;
void torrentAboutToBeDeleted(BitTorrent::Torrent *torrent) override;
void addItems(const QString &trackerURL, const QVector<BitTorrent::TorrentID> &torrents);
void removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id);

6
src/gui/transferlistmodel.h

@ -107,15 +107,15 @@ public: @@ -107,15 +107,15 @@ public:
private slots:
void addTorrents(const QVector<BitTorrent::Torrent *> &torrents);
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
void handleTorrentStatusUpdated(BitTorrent::Torrent *const torrent);
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
void handleTorrentStatusUpdated(BitTorrent::Torrent *torrent);
void handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
private:
void configure();
QString displayValue(const BitTorrent::Torrent *torrent, int column) const;
QVariant internalValue(const BitTorrent::Torrent *torrent, int column, bool alt) const;
QIcon getIconByState(const BitTorrent::TorrentState state) const;
QIcon getIconByState(BitTorrent::TorrentState state) const;
QList<BitTorrent::Torrent *> m_torrentList; // maps row number to torrent handle
QHash<BitTorrent::Torrent *, int> m_torrentMap; // maps torrent handle to row number

10
src/gui/transferlistwidget.cpp

@ -335,7 +335,7 @@ void TransferListWidget::setSelectedTorrentsLocation() @@ -335,7 +335,7 @@ void TransferListWidget::setSelectedTorrentsLocation()
const Path oldLocation = torrents[0]->savePath();
auto fileDialog = new QFileDialog(this, tr("Choose save path"), oldLocation.data());
auto *fileDialog = new QFileDialog(this, tr("Choose save path"), oldLocation.data());
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
fileDialog->setFileMode(QFileDialog::Directory);
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
@ -616,7 +616,7 @@ void TransferListWidget::setTorrentOptions() @@ -616,7 +616,7 @@ void TransferListWidget::setTorrentOptions()
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
if (selectedTorrents.empty()) return;
auto dialog = new TorrentOptionsDialog {this, selectedTorrents};
auto *dialog = new TorrentOptionsDialog {this, selectedTorrents};
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->open();
}
@ -654,7 +654,7 @@ int TransferListWidget::visibleColumnsCount() const @@ -654,7 +654,7 @@ int TransferListWidget::visibleColumnsCount() const
// hide/show columns menu
void TransferListWidget::displayColumnHeaderMenu()
{
auto menu = new QMenu(this);
auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setTitle(tr("Column visibility"));
menu->setToolTipsVisible(true);
@ -767,7 +767,7 @@ void TransferListWidget::editTorrentTrackers() @@ -767,7 +767,7 @@ void TransferListWidget::editTorrentTrackers()
}
}
auto trackerDialog = new TrackerEntriesDialog(this);
auto *trackerDialog = new TrackerEntriesDialog(this);
trackerDialog->setAttribute(Qt::WA_DeleteOnClose);
trackerDialog->setTrackers(commonTrackers);
@ -785,7 +785,7 @@ void TransferListWidget::exportTorrent() @@ -785,7 +785,7 @@ void TransferListWidget::exportTorrent()
if (getSelectedTorrents().isEmpty())
return;
auto fileDialog = new QFileDialog(this, tr("Choose folder to save exported .torrent files"));
auto *fileDialog = new QFileDialog(this, tr("Choose folder to save exported .torrent files"));
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
fileDialog->setFileMode(QFileDialog::Directory);
fileDialog->setOptions(QFileDialog::ShowDirsOnly);

2
src/gui/transferlistwidget.h

@ -102,7 +102,7 @@ public slots: @@ -102,7 +102,7 @@ public slots:
void renameSelectedTorrent();
signals:
void currentTorrentChanged(BitTorrent::Torrent *const torrent);
void currentTorrentChanged(BitTorrent::Torrent *torrent);
private slots:
void torrentDoubleClicked();

2
src/gui/uithemedialog.cpp

@ -124,7 +124,7 @@ private: @@ -124,7 +124,7 @@ private:
void showColorDialog()
{
auto dialog = new QColorDialog(m_currentColor, this);
auto *dialog = new QColorDialog(m_currentColor, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, this, [this, dialog]
{

12
src/gui/uithemesource.h

@ -54,8 +54,8 @@ class UIThemeSource @@ -54,8 +54,8 @@ class UIThemeSource
public:
virtual ~UIThemeSource() = default;
virtual QColor getColor(const QString &colorId, const ColorMode colorMode) const = 0;
virtual Path getIconPath(const QString &iconId, const ColorMode colorMode) const = 0;
virtual QColor getColor(const QString &colorId, ColorMode colorMode) const = 0;
virtual Path getIconPath(const QString &iconId, ColorMode colorMode) const = 0;
virtual QByteArray readStyleSheet() = 0;
};
@ -65,8 +65,8 @@ public: @@ -65,8 +65,8 @@ public:
DefaultThemeSource();
QByteArray readStyleSheet() override;
QColor getColor(const QString &colorId, const ColorMode colorMode) const override;
Path getIconPath(const QString &iconId, const ColorMode colorMode) const override;
QColor getColor(const QString &colorId, ColorMode colorMode) const override;
Path getIconPath(const QString &iconId, ColorMode colorMode) const override;
private:
void loadColors();
@ -79,8 +79,8 @@ private: @@ -79,8 +79,8 @@ private:
class CustomThemeSource : public UIThemeSource
{
public:
QColor getColor(const QString &colorId, const ColorMode colorMode) const override;
Path getIconPath(const QString &iconId, const ColorMode colorMode) const override;
QColor getColor(const QString &colorId, ColorMode colorMode) const override;
Path getIconPath(const QString &iconId, ColorMode colorMode) const override;
QByteArray readStyleSheet() override;
protected:

4
src/webui/api/appcontroller.cpp

@ -149,7 +149,7 @@ void AppController::preferencesAction() @@ -149,7 +149,7 @@ void AppController::preferencesAction()
QJsonObject nativeDirs;
for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i)
{
const Path watchedFolder = i.key();
const Path &watchedFolder = i.key();
const BitTorrent::AddTorrentParams params = i.value().addTorrentParams;
if (params.savePath.isEmpty())
nativeDirs.insert(watchedFolder.toString(), 1);
@ -616,7 +616,7 @@ void AppController::setPreferencesAction() @@ -616,7 +616,7 @@ void AppController::setPreferencesAction()
session->setMaxUploadsPerTorrent(it.value().toInt());
// Proxy Server
auto proxyManager = Net::ProxyConfigurationManager::instance();
auto *proxyManager = Net::ProxyConfigurationManager::instance();
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
if (hasKey(u"proxy_type"_qs))
proxyConf.type = Utils::String::toEnum(it.value().toString(), Net::ProxyType::HTTP);

2
src/webui/api/torrentscontroller.cpp

@ -1279,7 +1279,7 @@ void TorrentsController::removeCategoriesAction() @@ -1279,7 +1279,7 @@ void TorrentsController::removeCategoriesAction()
void TorrentsController::categoriesAction()
{
const auto session = BitTorrent::Session::instance();
const auto *session = BitTorrent::Session::instance();
QJsonObject categories;
const QStringList categoriesList = session->categories();

Loading…
Cancel
Save