mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 09:55:55 +00:00
commit
b185153254
82
.clang-tidy
Normal file
82
.clang-tidy
Normal file
@ -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: "*"
|
@ -225,7 +225,7 @@ namespace
|
|||||||
Application::Application(int &argc, char **argv)
|
Application::Application(int &argc, char **argv)
|
||||||
: BaseApplication(argc, argv)
|
: BaseApplication(argc, argv)
|
||||||
, m_shutdownAct(ShutdownDialogAction::Exit)
|
, m_shutdownAct(ShutdownDialogAction::Exit)
|
||||||
, m_commandLineArgs(parseCommandLine(this->arguments()))
|
, m_commandLineArgs(parseCommandLine(Application::arguments()))
|
||||||
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs))
|
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs))
|
||||||
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs))
|
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs))
|
||||||
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_qs))
|
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_qs))
|
||||||
|
@ -152,10 +152,10 @@ bool QtLocalPeer::sendMessage(const QString &message, const int timeout)
|
|||||||
break;
|
break;
|
||||||
int ms = 250;
|
int ms = 250;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
Sleep(DWORD(ms));
|
::Sleep(DWORD(ms));
|
||||||
#else
|
#else
|
||||||
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
||||||
nanosleep(&ts, NULL);
|
::nanosleep(&ts, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!connOk)
|
if (!connOk)
|
||||||
|
@ -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)
|
, 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
|
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;
|
m_storageData[storage].filePriorities = priorities;
|
||||||
handler(error, priorities);
|
handler(error, priorities);
|
||||||
|
@ -484,9 +484,9 @@ int FilterParserThread::parseP2BFilterFile()
|
|||||||
char buf[7];
|
char buf[7];
|
||||||
unsigned char version;
|
unsigned char version;
|
||||||
if (!stream.readRawData(buf, sizeof(buf))
|
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)))
|
|| !stream.readRawData(reinterpret_cast<char*>(&version), sizeof(version)))
|
||||||
{
|
{
|
||||||
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL);
|
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL);
|
||||||
return ruleCount;
|
return ruleCount;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ protected:
|
|||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int findAndNullDelimiter(char *const data, char delimiter, int start, int end, bool reverse = false);
|
int findAndNullDelimiter(char *data, char delimiter, int start, int end, bool reverse = false);
|
||||||
int trim(char *const data, int start, int end);
|
int trim(char *data, int start, int end);
|
||||||
int parseDATFilterFile();
|
int parseDATFilterFile();
|
||||||
int parseP2PFilterFile();
|
int parseP2PFilterFile();
|
||||||
int getlineInStream(QDataStream &stream, std::string &name, char delim);
|
int getlineInStream(QDataStream &stream, std::string &name, char delim);
|
||||||
|
@ -93,7 +93,7 @@ BitTorrent::InfoHash::operator WrappedType() const
|
|||||||
|
|
||||||
BitTorrent::TorrentID BitTorrent::TorrentID::fromString(const QString &hashString)
|
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)
|
BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::InfoHash &infoHash)
|
||||||
@ -103,7 +103,7 @@ BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::Info
|
|||||||
|
|
||||||
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA1Hash(const SHA1Hash &hash)
|
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA1Hash(const SHA1Hash &hash)
|
||||||
{
|
{
|
||||||
return TorrentID(hash);
|
return {hash};
|
||||||
}
|
}
|
||||||
|
|
||||||
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA256Hash(const SHA256Hash &hash)
|
BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA256Hash(const SHA256Hash &hash)
|
||||||
|
@ -400,7 +400,7 @@ namespace BitTorrent
|
|||||||
virtual bool isTrackerFilteringEnabled() const = 0;
|
virtual bool isTrackerFilteringEnabled() const = 0;
|
||||||
virtual void setTrackerFilteringEnabled(bool enabled) = 0;
|
virtual void setTrackerFilteringEnabled(bool enabled) = 0;
|
||||||
virtual bool isExcludedFileNamesEnabled() const = 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 QStringList excludedFileNames() const = 0;
|
||||||
virtual void setExcludedFileNames(const QStringList &newList) = 0;
|
virtual void setExcludedFileNames(const QStringList &newList) = 0;
|
||||||
virtual bool isFilenameExcluded(const QString &fileName) const = 0;
|
virtual bool isFilenameExcluded(const QString &fileName) const = 0;
|
||||||
|
@ -72,7 +72,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QScopeGuard>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
@ -1651,7 +1650,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
|||||||
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
|
settingsPack.set_int(lt::settings_pack::proxy_type, lt::settings_pack::none);
|
||||||
if (Preferences::instance()->useProxyForBT())
|
if (Preferences::instance()->useProxyForBT())
|
||||||
{
|
{
|
||||||
const auto proxyManager = Net::ProxyConfigurationManager::instance();
|
const auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||||
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
|
||||||
|
|
||||||
switch (proxyConfig.type)
|
switch (proxyConfig.type)
|
||||||
@ -4986,7 +4985,7 @@ void SessionImpl::upgradeCategories()
|
|||||||
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
|
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
|
||||||
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
|
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
|
||||||
{
|
{
|
||||||
const QString categoryName = it.key();
|
const QString &categoryName = it.key();
|
||||||
CategoryOptions categoryOptions;
|
CategoryOptions categoryOptions;
|
||||||
categoryOptions.savePath = Path(it.value().toString());
|
categoryOptions.savePath = Path(it.value().toString());
|
||||||
m_categories[categoryName] = categoryOptions;
|
m_categories[categoryName] = categoryOptions;
|
||||||
@ -5229,7 +5228,7 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector<lt::alert *> &alerts)
|
|||||||
if (a->type() != lt::add_torrent_alert::alert_type)
|
if (a->type() != lt::add_torrent_alert::alert_type)
|
||||||
continue;
|
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)
|
if (alert->error)
|
||||||
{
|
{
|
||||||
const QString msg = QString::fromStdString(alert->message());
|
const QString msg = QString::fromStdString(alert->message());
|
||||||
|
@ -378,9 +378,9 @@ namespace BitTorrent
|
|||||||
bool isTrackerFilteringEnabled() const override;
|
bool isTrackerFilteringEnabled() const override;
|
||||||
void setTrackerFilteringEnabled(bool enabled) override;
|
void setTrackerFilteringEnabled(bool enabled) override;
|
||||||
bool isExcludedFileNamesEnabled() const override;
|
bool isExcludedFileNamesEnabled() const override;
|
||||||
void setExcludedFileNamesEnabled(const bool enabled) override;
|
void setExcludedFileNamesEnabled(bool enabled) override;
|
||||||
QStringList excludedFileNames() const override;
|
QStringList excludedFileNames() const override;
|
||||||
void setExcludedFileNames(const QStringList &newList) override;
|
void setExcludedFileNames(const QStringList &excludedFileNames) override;
|
||||||
bool isFilenameExcluded(const QString &fileName) const override;
|
bool isFilenameExcluded(const QString &fileName) const override;
|
||||||
QStringList bannedIPs() const override;
|
QStringList bannedIPs() const override;
|
||||||
void setBannedIPs(const QStringList &newList) override;
|
void setBannedIPs(const QStringList &newList) override;
|
||||||
@ -420,24 +420,24 @@ namespace BitTorrent
|
|||||||
void handleTorrentNeedSaveResumeData(const TorrentImpl *torrent);
|
void handleTorrentNeedSaveResumeData(const TorrentImpl *torrent);
|
||||||
void handleTorrentSaveResumeDataRequested(const TorrentImpl *torrent);
|
void handleTorrentSaveResumeDataRequested(const TorrentImpl *torrent);
|
||||||
void handleTorrentSaveResumeDataFailed(const TorrentImpl *torrent);
|
void handleTorrentSaveResumeDataFailed(const TorrentImpl *torrent);
|
||||||
void handleTorrentShareLimitChanged(TorrentImpl *const torrent);
|
void handleTorrentShareLimitChanged(TorrentImpl *torrent);
|
||||||
void handleTorrentNameChanged(TorrentImpl *const torrent);
|
void handleTorrentNameChanged(TorrentImpl *torrent);
|
||||||
void handleTorrentSavePathChanged(TorrentImpl *const torrent);
|
void handleTorrentSavePathChanged(TorrentImpl *torrent);
|
||||||
void handleTorrentCategoryChanged(TorrentImpl *const torrent, const QString &oldCategory);
|
void handleTorrentCategoryChanged(TorrentImpl *torrent, const QString &oldCategory);
|
||||||
void handleTorrentTagAdded(TorrentImpl *const torrent, const QString &tag);
|
void handleTorrentTagAdded(TorrentImpl *torrent, const QString &tag);
|
||||||
void handleTorrentTagRemoved(TorrentImpl *const torrent, const QString &tag);
|
void handleTorrentTagRemoved(TorrentImpl *torrent, const QString &tag);
|
||||||
void handleTorrentSavingModeChanged(TorrentImpl *const torrent);
|
void handleTorrentSavingModeChanged(TorrentImpl *torrent);
|
||||||
void handleTorrentMetadataReceived(TorrentImpl *const torrent);
|
void handleTorrentMetadataReceived(TorrentImpl *torrent);
|
||||||
void handleTorrentPaused(TorrentImpl *const torrent);
|
void handleTorrentPaused(TorrentImpl *torrent);
|
||||||
void handleTorrentResumed(TorrentImpl *const torrent);
|
void handleTorrentResumed(TorrentImpl *torrent);
|
||||||
void handleTorrentChecked(TorrentImpl *const torrent);
|
void handleTorrentChecked(TorrentImpl *torrent);
|
||||||
void handleTorrentFinished(TorrentImpl *const torrent);
|
void handleTorrentFinished(TorrentImpl *torrent);
|
||||||
void handleTorrentTrackersAdded(TorrentImpl *const torrent, const QVector<TrackerEntry> &newTrackers);
|
void handleTorrentTrackersAdded(TorrentImpl *torrent, const QVector<TrackerEntry> &newTrackers);
|
||||||
void handleTorrentTrackersRemoved(TorrentImpl *const torrent, const QStringList &deletedTrackers);
|
void handleTorrentTrackersRemoved(TorrentImpl *torrent, const QStringList &deletedTrackers);
|
||||||
void handleTorrentTrackersChanged(TorrentImpl *const torrent);
|
void handleTorrentTrackersChanged(TorrentImpl *torrent);
|
||||||
void handleTorrentUrlSeedsAdded(TorrentImpl *const torrent, const QVector<QUrl> &newUrlSeeds);
|
void handleTorrentUrlSeedsAdded(TorrentImpl *torrent, const QVector<QUrl> &newUrlSeeds);
|
||||||
void handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector<QUrl> &urlSeeds);
|
void handleTorrentUrlSeedsRemoved(TorrentImpl *torrent, const QVector<QUrl> &urlSeeds);
|
||||||
void handleTorrentResumeDataReady(TorrentImpl *const torrent, const LoadTorrentParams &data);
|
void handleTorrentResumeDataReady(TorrentImpl *torrent, const LoadTorrentParams &data);
|
||||||
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
|
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
|
||||||
|
|
||||||
bool addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, MoveStorageMode mode, MoveStorageContext context);
|
bool addMoveTorrentStorageJob(TorrentImpl *torrent, const Path &newPath, MoveStorageMode mode, MoveStorageContext context);
|
||||||
|
@ -192,7 +192,6 @@ namespace BitTorrent
|
|||||||
virtual void setSavePath(const Path &savePath) = 0;
|
virtual void setSavePath(const Path &savePath) = 0;
|
||||||
virtual Path downloadPath() const = 0;
|
virtual Path downloadPath() const = 0;
|
||||||
virtual void setDownloadPath(const Path &downloadPath) = 0;
|
virtual void setDownloadPath(const Path &downloadPath) = 0;
|
||||||
virtual Path actualStorageLocation() const = 0;
|
|
||||||
virtual Path rootPath() const = 0;
|
virtual Path rootPath() const = 0;
|
||||||
virtual Path contentPath() const = 0;
|
virtual Path contentPath() const = 0;
|
||||||
virtual QString category() const = 0;
|
virtual QString category() const = 0;
|
||||||
@ -212,9 +211,7 @@ namespace BitTorrent
|
|||||||
virtual qreal ratioLimit() const = 0;
|
virtual qreal ratioLimit() const = 0;
|
||||||
virtual int seedingTimeLimit() const = 0;
|
virtual int seedingTimeLimit() const = 0;
|
||||||
|
|
||||||
virtual Path actualFilePath(int index) const = 0;
|
|
||||||
virtual PathList filePaths() const = 0;
|
virtual PathList filePaths() const = 0;
|
||||||
virtual QVector<DownloadPriority> filePriorities() const = 0;
|
|
||||||
|
|
||||||
virtual TorrentInfo info() const = 0;
|
virtual TorrentInfo info() const = 0;
|
||||||
virtual bool isFinished() const = 0;
|
virtual bool isFinished() const = 0;
|
||||||
@ -232,7 +229,6 @@ namespace BitTorrent
|
|||||||
virtual bool isSequentialDownload() const = 0;
|
virtual bool isSequentialDownload() const = 0;
|
||||||
virtual bool hasFirstLastPiecePriority() const = 0;
|
virtual bool hasFirstLastPiecePriority() const = 0;
|
||||||
virtual TorrentState state() const = 0;
|
virtual TorrentState state() const = 0;
|
||||||
virtual bool hasMetadata() const = 0;
|
|
||||||
virtual bool hasMissingFiles() const = 0;
|
virtual bool hasMissingFiles() const = 0;
|
||||||
virtual bool hasError() const = 0;
|
virtual bool hasError() const = 0;
|
||||||
virtual int queuePosition() const = 0;
|
virtual int queuePosition() const = 0;
|
||||||
@ -244,7 +240,6 @@ namespace BitTorrent
|
|||||||
virtual qlonglong activeTime() const = 0;
|
virtual qlonglong activeTime() const = 0;
|
||||||
virtual qlonglong finishedTime() const = 0;
|
virtual qlonglong finishedTime() const = 0;
|
||||||
virtual qlonglong eta() const = 0;
|
virtual qlonglong eta() const = 0;
|
||||||
virtual QVector<qreal> filesProgress() const = 0;
|
|
||||||
virtual int seedsCount() const = 0;
|
virtual int seedsCount() const = 0;
|
||||||
virtual int peersCount() const = 0;
|
virtual int peersCount() const = 0;
|
||||||
virtual int leechsCount() const = 0;
|
virtual int leechsCount() const = 0;
|
||||||
@ -277,13 +272,6 @@ namespace BitTorrent
|
|||||||
virtual int connectionsCount() const = 0;
|
virtual int connectionsCount() const = 0;
|
||||||
virtual int connectionsLimit() const = 0;
|
virtual int connectionsLimit() const = 0;
|
||||||
virtual qlonglong nextAnnounce() 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 setName(const QString &name) = 0;
|
||||||
virtual void setSequentialDownload(bool enable) = 0;
|
virtual void setSequentialDownload(bool enable) = 0;
|
||||||
@ -301,7 +289,6 @@ namespace BitTorrent
|
|||||||
virtual void setDHTDisabled(bool disable) = 0;
|
virtual void setDHTDisabled(bool disable) = 0;
|
||||||
virtual void setPEXDisabled(bool disable) = 0;
|
virtual void setPEXDisabled(bool disable) = 0;
|
||||||
virtual void setLSDDisabled(bool disable) = 0;
|
virtual void setLSDDisabled(bool disable) = 0;
|
||||||
virtual void flushCache() const = 0;
|
|
||||||
virtual void addTrackers(QVector<TrackerEntry> trackers) = 0;
|
virtual void addTrackers(QVector<TrackerEntry> trackers) = 0;
|
||||||
virtual void removeTrackers(const QStringList &trackers) = 0;
|
virtual void removeTrackers(const QStringList &trackers) = 0;
|
||||||
virtual void replaceTrackers(QVector<TrackerEntry> trackers) = 0;
|
virtual void replaceTrackers(QVector<TrackerEntry> trackers) = 0;
|
||||||
|
@ -74,7 +74,7 @@ namespace BitTorrent
|
|||||||
void create(const TorrentCreatorParams ¶ms);
|
void create(const TorrentCreatorParams ¶ms);
|
||||||
|
|
||||||
#ifdef QBT_USES_LIBTORRENT2
|
#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
|
#else
|
||||||
static int calculateTotalPieces(const Path &inputPath
|
static int calculateTotalPieces(const Path &inputPath
|
||||||
, const int pieceSize, const bool isAlignmentOptimized, int paddedFileSizeLimit);
|
, const int pieceSize, const bool isAlignmentOptimized, int paddedFileSizeLimit);
|
||||||
|
@ -98,7 +98,7 @@ namespace
|
|||||||
QString firstTrackerMessage;
|
QString firstTrackerMessage;
|
||||||
QString firstErrorMessage;
|
QString firstErrorMessage;
|
||||||
#ifdef QBT_USES_LIBTORRENT2
|
#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 lt::announce_endpoint &endpoint : nativeEntry.endpoints)
|
||||||
{
|
{
|
||||||
for (const auto protocolVersion : {lt::protocol_version::V1, lt::protocol_version::V2})
|
for (const auto protocolVersion : {lt::protocol_version::V1, lt::protocol_version::V2})
|
||||||
@ -338,7 +338,7 @@ TorrentImpl::TorrentImpl(SessionImpl *session, lt::session *nativeSession
|
|||||||
// == END UPGRADE CODE ==
|
// == END UPGRADE CODE ==
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentImpl::~TorrentImpl() {}
|
TorrentImpl::~TorrentImpl() = default;
|
||||||
|
|
||||||
bool TorrentImpl::isValid() const
|
bool TorrentImpl::isValid() const
|
||||||
{
|
{
|
||||||
@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
|
|||||||
{
|
{
|
||||||
const auto nativeIndex = nativeIndexes.at(i);
|
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();
|
p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString();
|
||||||
|
|
||||||
const Path filePath = actualFilePath.removedExtension(QB_EXT);
|
const Path filePath = actualFilePath.removedExtension(QB_EXT);
|
||||||
|
@ -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)
|
TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other)
|
||||||
{
|
{
|
||||||
if (this != &other)
|
if (this != &other)
|
||||||
|
@ -54,7 +54,7 @@ namespace BitTorrent
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TorrentInfo() = default;
|
TorrentInfo() = default;
|
||||||
TorrentInfo(const TorrentInfo &other);
|
TorrentInfo(const TorrentInfo &other) = default;
|
||||||
|
|
||||||
explicit TorrentInfo(const lt::torrent_info &nativeInfo);
|
explicit TorrentInfo(const lt::torrent_info &nativeInfo);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
Digest32() = default;
|
Digest32() = default;
|
||||||
Digest32(const Digest32 &other) = default;
|
Digest32(const Digest32 &other) = default;
|
||||||
Digest32(Digest32 &&other) = default;
|
Digest32(Digest32 &&other) noexcept = default;
|
||||||
|
|
||||||
Digest32(const UnderlyingType &nativeDigest)
|
Digest32(const UnderlyingType &nativeDigest)
|
||||||
: m_dataPtr {new Data(nativeDigest)}
|
: m_dataPtr {new Data(nativeDigest)}
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Digest32 &operator=(const Digest32 &other) = default;
|
Digest32 &operator=(const Digest32 &other) = default;
|
||||||
Digest32 &operator=(Digest32 &&other) = default;
|
Digest32 &operator=(Digest32 &&other) noexcept = default;
|
||||||
|
|
||||||
operator UnderlyingType() const
|
operator UnderlyingType() const
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; }
|
|||||||
|
|
||||||
// Forward rvalue as const
|
// Forward rvalue as const
|
||||||
template <typename T>
|
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
|
// Prevent const rvalue arguments
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -37,7 +37,7 @@ namespace Http
|
|||||||
class IRequestHandler
|
class IRequestHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IRequestHandler() {}
|
virtual ~IRequestHandler() = default;
|
||||||
virtual Response processRequest(const Request &request, const Environment &env) = 0;
|
virtual Response processRequest(const Request &request, const Environment &env) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,6 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestParser::RequestParser()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RequestParser::ParseResult RequestParser::parse(const QByteArray &data)
|
RequestParser::ParseResult RequestParser::parse(const QByteArray &data)
|
||||||
{
|
{
|
||||||
// Warning! Header names are converted to lowercase
|
// Warning! Header names are converted to lowercase
|
||||||
|
@ -57,7 +57,7 @@ namespace Http
|
|||||||
static const long MAX_CONTENT_SIZE = 64 * 1024 * 1024; // 64 MB
|
static const long MAX_CONTENT_SIZE = 64 * 1024 * 1024; // 64 MB
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RequestParser();
|
RequestParser() = default;
|
||||||
|
|
||||||
ParseResult doParse(const QByteArray &data);
|
ParseResult doParse(const QByteArray &data);
|
||||||
bool parseStartLines(QStringView data);
|
bool parseStartLines(QStringView data);
|
||||||
|
@ -36,8 +36,6 @@ IconProvider::IconProvider(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IconProvider::~IconProvider() {}
|
|
||||||
|
|
||||||
void IconProvider::initInstance()
|
void IconProvider::initInstance()
|
||||||
{
|
{
|
||||||
if (!m_instance)
|
if (!m_instance)
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit IconProvider(QObject *parent = nullptr);
|
explicit IconProvider(QObject *parent = nullptr);
|
||||||
~IconProvider();
|
~IconProvider() = default;
|
||||||
|
|
||||||
static IconProvider *m_instance;
|
static IconProvider *m_instance;
|
||||||
};
|
};
|
||||||
|
@ -208,7 +208,7 @@ void Net::DownloadHandlerImpl::handleRedirection(const QUrl &newUrl)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto redirected = static_cast<DownloadHandlerImpl *>(
|
auto *redirected = static_cast<DownloadHandlerImpl *>(
|
||||||
m_manager->download(DownloadRequest(m_downloadRequest).url(newUrlString), useProxy()));
|
m_manager->download(DownloadRequest(m_downloadRequest).url(newUrlString), useProxy()));
|
||||||
redirected->m_redirectionCount = m_redirectionCount + 1;
|
redirected->m_redirectionCount = m_redirectionCount + 1;
|
||||||
connect(redirected, &DownloadHandlerImpl::finished, this, [this](const DownloadResult &result)
|
connect(redirected, &DownloadHandlerImpl::finished, this, [this](const DownloadResult &result)
|
||||||
|
@ -163,7 +163,7 @@ Net::DownloadHandler *Net::DownloadManager::download(const DownloadRequest &down
|
|||||||
const ServiceID id = ServiceID::fromURL(downloadRequest.url());
|
const ServiceID id = ServiceID::fromURL(downloadRequest.url());
|
||||||
const bool isSequentialService = m_sequentialServices.contains(id);
|
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, &DownloadHandler::finished, downloadHandler, &QObject::deleteLater);
|
||||||
connect(downloadHandler, &QObject::destroyed, this, [this, id, downloadHandler]()
|
connect(downloadHandler, &QObject::destroyed, this, [this, id, downloadHandler]()
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ void Net::DownloadManager::handleDownloadFinished(DownloadHandlerImpl *finishedH
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto handler = waitingJobsIter.value().dequeue();
|
auto *handler = waitingJobsIter.value().dequeue();
|
||||||
qDebug("Downloading %s...", qUtf8Printable(handler->url()));
|
qDebug("Downloading %s...", qUtf8Printable(handler->url()));
|
||||||
processRequest(handler);
|
processRequest(handler);
|
||||||
handler->disconnect(this);
|
handler->disconnect(this);
|
||||||
|
@ -162,7 +162,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
|
|||||||
|
|
||||||
// Connect to SMTP server
|
// Connect to SMTP server
|
||||||
const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':');
|
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));
|
const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1));
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
|
@ -253,7 +253,7 @@ public:
|
|||||||
void setUILocked(bool locked);
|
void setUILocked(bool locked);
|
||||||
|
|
||||||
bool isAutoRunOnTorrentAddedEnabled() const;
|
bool isAutoRunOnTorrentAddedEnabled() const;
|
||||||
void setAutoRunOnTorrentAddedEnabled(const bool enabled);
|
void setAutoRunOnTorrentAddedEnabled(bool enabled);
|
||||||
QString getAutoRunOnTorrentAddedProgram() const;
|
QString getAutoRunOnTorrentAddedProgram() const;
|
||||||
void setAutoRunOnTorrentAddedProgram(const QString &program);
|
void setAutoRunOnTorrentAddedProgram(const QString &program);
|
||||||
bool isAutoRunOnTorrentFinishedEnabled() const;
|
bool isAutoRunOnTorrentFinishedEnabled() const;
|
||||||
|
@ -116,9 +116,9 @@ Path Private::DefaultProfile::downloadLocation() const
|
|||||||
std::unique_ptr<QSettings> Private::DefaultProfile::applicationSettings(const QString &name) const
|
std::unique_ptr<QSettings> Private::DefaultProfile::applicationSettings(const QString &name) const
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#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
|
#else
|
||||||
return std::unique_ptr<QSettings>(new QSettings(profileName(), name));
|
return std::make_unique<QSettings>(profileName(), name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
if (job->feedURL == oldURL)
|
||||||
job->feedURL = feed->url();
|
job->feedURL = feed->url();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QSharedPointer<ProcessingJob> job : asConst(m_waitingJobs))
|
for (const QSharedPointer<ProcessingJob> &job : asConst(m_waitingJobs))
|
||||||
{
|
{
|
||||||
if (job->feedURL == oldURL)
|
if (job->feedURL == oldURL)
|
||||||
job->feedURL = feed->url();
|
job->feedURL = feed->url();
|
||||||
|
@ -208,12 +208,9 @@ AutoDownloadRule::AutoDownloadRule(const QString &name)
|
|||||||
setName(name);
|
setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoDownloadRule::AutoDownloadRule(const AutoDownloadRule &other)
|
AutoDownloadRule::AutoDownloadRule(const AutoDownloadRule &other) = default;
|
||||||
: m_dataPtr(other.m_dataPtr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoDownloadRule::~AutoDownloadRule() {}
|
AutoDownloadRule::~AutoDownloadRule() = default;
|
||||||
|
|
||||||
QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, const bool isRegex) const
|
QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, const bool isRegex) const
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace RSS
|
|||||||
class AutoDownloadRule
|
class AutoDownloadRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AutoDownloadRule(const QString &name = u""_qs);
|
explicit AutoDownloadRule(const QString &name = {});
|
||||||
AutoDownloadRule(const AutoDownloadRule &other);
|
AutoDownloadRule(const AutoDownloadRule &other);
|
||||||
~AutoDownloadRule();
|
~AutoDownloadRule();
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace RSS
|
|||||||
friend bool operator==(const AutoDownloadRule &left, const AutoDownloadRule &right);
|
friend bool operator==(const AutoDownloadRule &left, const AutoDownloadRule &right);
|
||||||
|
|
||||||
QJsonObject toJsonObject() const;
|
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;
|
QVariantHash toLegacyDict() const;
|
||||||
static AutoDownloadRule fromLegacyDict(const QVariantHash &dict);
|
static AutoDownloadRule fromLegacyDict(const QVariantHash &dict);
|
||||||
|
@ -345,7 +345,7 @@ bool Feed::addArticle(const QVariantHash &articleData)
|
|||||||
|
|
||||||
void Feed::removeOldestArticle()
|
void Feed::removeOldestArticle()
|
||||||
{
|
{
|
||||||
auto oldestArticle = m_articlesByDate.last();
|
auto *oldestArticle = m_articlesByDate.last();
|
||||||
emit articleAboutToBeRemoved(oldestArticle);
|
emit articleAboutToBeRemoved(oldestArticle);
|
||||||
|
|
||||||
m_articles.remove(oldestArticle->guid());
|
m_articles.remove(oldestArticle->guid());
|
||||||
|
@ -49,7 +49,7 @@ Folder::~Folder()
|
|||||||
{
|
{
|
||||||
emit aboutToBeDestroyed(this);
|
emit aboutToBeDestroyed(this);
|
||||||
|
|
||||||
for (auto item : asConst(items()))
|
for (auto *item : asConst(items()))
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void Folder::addItem(Item *item)
|
|||||||
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
|
connect(item, &Item::articleAboutToBeRemoved, this, &Item::articleAboutToBeRemoved);
|
||||||
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
|
connect(item, &Item::unreadCountChanged, this, &Folder::handleItemUnreadCountChanged);
|
||||||
|
|
||||||
for (auto article : asConst(item->articles()))
|
for (auto *article : asConst(item->articles()))
|
||||||
emit newArticle(article);
|
emit newArticle(article);
|
||||||
|
|
||||||
if (item->unreadCount() > 0)
|
if (item->unreadCount() > 0)
|
||||||
@ -138,7 +138,7 @@ void Folder::removeItem(Item *item)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(m_items.contains(item));
|
Q_ASSERT(m_items.contains(item));
|
||||||
|
|
||||||
for (auto article : asConst(item->articles()))
|
for (auto *article : asConst(item->articles()))
|
||||||
emit articleAboutToBeRemoved(article);
|
emit articleAboutToBeRemoved(article);
|
||||||
|
|
||||||
item->disconnect(this);
|
item->disconnect(this);
|
||||||
|
@ -46,7 +46,7 @@ namespace RSS
|
|||||||
|
|
||||||
friend class Session;
|
friend class Session;
|
||||||
|
|
||||||
explicit Folder(const QString &path = u""_qs);
|
explicit Folder(const QString &path = {});
|
||||||
~Folder() override;
|
~Folder() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -45,8 +45,6 @@ Item::Item(const QString &path)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Item::~Item() {}
|
|
||||||
|
|
||||||
void Item::setPath(const QString &path)
|
void Item::setPath(const QString &path)
|
||||||
{
|
{
|
||||||
if (path != m_path)
|
if (path != m_path)
|
||||||
|
@ -76,7 +76,7 @@ namespace RSS
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit Item(const QString &path);
|
explicit Item(const QString &path);
|
||||||
~Item() override;
|
~Item() override = default;
|
||||||
|
|
||||||
virtual void cleanup() = 0;
|
virtual void cleanup() = 0;
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ namespace
|
|||||||
|
|
||||||
const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>();
|
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;
|
m_result.lastBuildDate = lastBuildDate;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace RSS::Private
|
|||||||
Q_DISABLE_COPY_MOVE(Parser)
|
Q_DISABLE_COPY_MOVE(Parser)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Parser(QString lastBuildDate);
|
explicit Parser(const QString &lastBuildDate);
|
||||||
void parse(const QByteArray &feedData);
|
void parse(const QByteArray &feedData);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -100,7 +100,7 @@ Session::Session()
|
|||||||
// Remove legacy/corrupted settings
|
// Remove legacy/corrupted settings
|
||||||
// (at least on Windows, QSettings is case-insensitive and it can get
|
// (at least on Windows, QSettings is case-insensitive and it can get
|
||||||
// confused when asked about settings that differ only in their case)
|
// 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/streamList"_qs);
|
||||||
settingsStorage->removeValue(u"Rss/streamAlias"_qs);
|
settingsStorage->removeValue(u"Rss/streamAlias"_qs);
|
||||||
settingsStorage->removeValue(u"Rss/open_folders"_qs);
|
settingsStorage->removeValue(u"Rss/open_folders"_qs);
|
||||||
@ -140,7 +140,7 @@ nonstd::expected<void, QString> Session::addFolder(const QString &path)
|
|||||||
if (!result)
|
if (!result)
|
||||||
return result.get_unexpected();
|
return result.get_unexpected();
|
||||||
|
|
||||||
const auto destFolder = result.value();
|
auto *destFolder = result.value();
|
||||||
addItem(new Folder(path), destFolder);
|
addItem(new Folder(path), destFolder);
|
||||||
store();
|
store();
|
||||||
return {};
|
return {};
|
||||||
@ -155,7 +155,7 @@ nonstd::expected<void, QString> Session::addFeed(const QString &url, const QStri
|
|||||||
if (!result)
|
if (!result)
|
||||||
return result.get_unexpected();
|
return result.get_unexpected();
|
||||||
|
|
||||||
const auto destFolder = result.value();
|
auto *destFolder = result.value();
|
||||||
auto *feed = new Feed(generateUID(), url, path, this);
|
auto *feed = new Feed(generateUID(), url, path, this);
|
||||||
addItem(feed, destFolder);
|
addItem(feed, destFolder);
|
||||||
store();
|
store();
|
||||||
@ -198,7 +198,7 @@ nonstd::expected<void, QString> Session::moveItem(const QString &itemPath, const
|
|||||||
if (itemPath.isEmpty())
|
if (itemPath.isEmpty())
|
||||||
return nonstd::make_unexpected(tr("Cannot move root folder."));
|
return nonstd::make_unexpected(tr("Cannot move root folder."));
|
||||||
|
|
||||||
auto item = m_itemsByPath.value(itemPath);
|
auto *item = m_itemsByPath.value(itemPath);
|
||||||
if (!item)
|
if (!item)
|
||||||
return nonstd::make_unexpected(tr("Item doesn't exist: %1.").arg(itemPath));
|
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
|
|||||||
if (!result)
|
if (!result)
|
||||||
return result.get_unexpected();
|
return result.get_unexpected();
|
||||||
|
|
||||||
const auto destFolder = result.value();
|
auto *destFolder = result.value();
|
||||||
if (static_cast<Item *>(destFolder) == item)
|
if (static_cast<Item *>(destFolder) == item)
|
||||||
return nonstd::make_unexpected(tr("Couldn't move folder into itself."));
|
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)
|
if (srcFolder != destFolder)
|
||||||
{
|
{
|
||||||
srcFolder->removeItem(item);
|
srcFolder->removeItem(item);
|
||||||
@ -242,7 +242,7 @@ nonstd::expected<void, QString> Session::removeItem(const QString &itemPath)
|
|||||||
emit itemAboutToBeRemoved(item);
|
emit itemAboutToBeRemoved(item);
|
||||||
item->cleanup();
|
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);
|
folder->removeItem(item);
|
||||||
delete item;
|
delete item;
|
||||||
store();
|
store();
|
||||||
@ -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));
|
return nonstd::make_unexpected(tr("RSS item with given path already exists: %1.").arg(path));
|
||||||
|
|
||||||
const QString destFolderPath = Item::parentPath(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)
|
if (!destFolder)
|
||||||
return nonstd::make_unexpected(tr("Parent folder doesn't exist: %1.").arg(destFolderPath));
|
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
|
|||||||
|
|
||||||
Folder *Session::addSubfolder(const QString &name, Folder *parentFolder)
|
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);
|
addItem(folder, parentFolder);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
Feed *Session::addFeedToFolder(const QUuid &uid, const QString &url, const QString &name, Folder *parentFolder)
|
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);
|
addItem(feed, parentFolder);
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::addItem(Item *item, Folder *destFolder)
|
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::titleChanged, this, &Session::handleFeedTitleChanged);
|
||||||
connect(feed, &Feed::iconLoaded, this, &Session::feedIconLoaded);
|
connect(feed, &Feed::iconLoaded, this, &Session::feedIconLoaded);
|
||||||
@ -530,7 +530,7 @@ QThread *Session::workingThread() const
|
|||||||
void Session::handleItemAboutToBeDestroyed(Item *item)
|
void Session::handleItemAboutToBeDestroyed(Item *item)
|
||||||
{
|
{
|
||||||
m_itemsByPath.remove(item->path());
|
m_itemsByPath.remove(item->path());
|
||||||
auto feed = qobject_cast<Feed *>(item);
|
auto *feed = qobject_cast<Feed *>(item);
|
||||||
if (feed)
|
if (feed)
|
||||||
{
|
{
|
||||||
m_feedsByUID.remove(feed->uid());
|
m_feedsByUID.remove(feed->uid());
|
||||||
|
@ -46,7 +46,7 @@ SearchDownloadHandler::SearchDownloadHandler(const QString &siteUrl, const QStri
|
|||||||
, this, &SearchDownloadHandler::downloadProcessFinished);
|
, this, &SearchDownloadHandler::downloadProcessFinished);
|
||||||
const QStringList params
|
const QStringList params
|
||||||
{
|
{
|
||||||
(m_manager->engineLocation() / Path(u"nova2dl.py"_qs)).toString(),
|
(SearchPluginManager::engineLocation() / Path(u"nova2dl.py"_qs)).toString(),
|
||||||
siteUrl,
|
siteUrl,
|
||||||
url
|
url
|
||||||
};
|
};
|
||||||
|
@ -73,7 +73,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
|
|||||||
|
|
||||||
const QStringList params
|
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_usedPlugins.join(u','),
|
||||||
m_category
|
m_category
|
||||||
};
|
};
|
||||||
|
@ -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);
|
const PluginInfo *plugin = pluginInfo(pluginName);
|
||||||
if (!plugin) return true;
|
if (!plugin) return true;
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
void updatePlugin(const QString &name);
|
void updatePlugin(const QString &name);
|
||||||
void installPlugin(const QString &source);
|
void installPlugin(const QString &source);
|
||||||
bool uninstallPlugin(const QString &name);
|
bool uninstallPlugin(const QString &name);
|
||||||
static void updateIconPath(PluginInfo *const plugin);
|
static void updateIconPath(PluginInfo *plugin);
|
||||||
void checkForUpdates();
|
void checkForUpdates();
|
||||||
|
|
||||||
SearchHandler *startSearch(const QString &pattern, const QString &category, const QStringList &usedPlugins);
|
SearchHandler *startSearch(const QString &pattern, const QString &category, const QStringList &usedPlugins);
|
||||||
@ -109,7 +109,7 @@ private:
|
|||||||
void updateNova();
|
void updateNova();
|
||||||
void parseVersionInfo(const QByteArray &info);
|
void parseVersionInfo(const QByteArray &info);
|
||||||
void installPlugin_impl(const QString &name, const Path &path);
|
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 versionInfoDownloadFinished(const Net::DownloadResult &result);
|
||||||
void pluginDownloadFinished(const Net::DownloadResult &result);
|
void pluginDownloadFinished(const Net::DownloadResult &result);
|
||||||
|
@ -59,7 +59,6 @@ FileGuard::~FileGuard()
|
|||||||
TorrentFileGuard::TorrentFileGuard(const Path &path, const TorrentFileGuard::AutoDeleteMode mode)
|
TorrentFileGuard::TorrentFileGuard(const Path &path, const TorrentFileGuard::AutoDeleteMode mode)
|
||||||
: FileGuard {mode != Never ? path : Path()}
|
: FileGuard {mode != Never ? path : Path()}
|
||||||
, m_mode {mode}
|
, m_mode {mode}
|
||||||
, m_wasAdded {false}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ TorrentFilter::TorrentFilter(const Type type, const std::optional<TorrentIDSet>
|
|||||||
|
|
||||||
TorrentFilter::TorrentFilter(const QString &filter, const std::optional<TorrentIDSet> &idSet
|
TorrentFilter::TorrentFilter(const QString &filter, const std::optional<TorrentIDSet> &idSet
|
||||||
, const std::optional<QString> &category, const std::optional<QString> &tag)
|
, const std::optional<QString> &category, const std::optional<QString> &tag)
|
||||||
: m_type(All)
|
: m_category(category)
|
||||||
, m_category(category)
|
|
||||||
, m_tag(tag)
|
, m_tag(tag)
|
||||||
, m_idSet(idSet)
|
, m_idSet(idSet)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ class QByteArray;
|
|||||||
namespace Utils::ByteArray
|
namespace Utils::ByteArray
|
||||||
{
|
{
|
||||||
// Mimic QStringView(in).split(sep, behavior)
|
// 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,
|
// Mimic QByteArray::mid(pos, len) but instead of returning a full-copy,
|
||||||
// we only return a partial view
|
// we only return a partial view
|
||||||
|
@ -53,7 +53,7 @@ namespace Utils::IO
|
|||||||
using pointer = void;
|
using pointer = void;
|
||||||
using reference = 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(const FileDeviceOutputIterator &other) = default;
|
||||||
~FileDeviceOutputIterator();
|
~FileDeviceOutputIterator();
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void AdvancedSettings::addRow(const int row, const QString &text, T *widget)
|
void AdvancedSettings::addRow(const int row, const QString &text, T *widget)
|
||||||
{
|
{
|
||||||
auto label = new QLabel(text);
|
auto *label = new QLabel(text);
|
||||||
label->setOpenExternalLinks(true);
|
label->setOpenExternalLinks(true);
|
||||||
|
|
||||||
setCellWidget(row, PROPERTY, label);
|
setCellWidget(row, PROPERTY, label);
|
||||||
|
@ -100,8 +100,7 @@ DesktopIntegration::DesktopIntegration(QObject *parent)
|
|||||||
|
|
||||||
DesktopIntegration::~DesktopIntegration()
|
DesktopIntegration::~DesktopIntegration()
|
||||||
{
|
{
|
||||||
if (m_menu)
|
delete m_menu;
|
||||||
delete m_menu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopIntegration::isActive() const
|
bool DesktopIntegration::isActive() const
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
int notificationTimeout() const;
|
int notificationTimeout() const;
|
||||||
#ifdef QBT_USES_DBUS
|
#ifdef QBT_USES_DBUS
|
||||||
void setNotificationTimeout(const int value);
|
void setNotificationTimeout(int value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void showNotification(const QString &title, const QString &msg) const;
|
void showNotification(const QString &title, const QString &msg) const;
|
||||||
|
@ -152,8 +152,6 @@ Private::FileLineEdit::FileLineEdit(QWidget *parent)
|
|||||||
: QLineEdit {parent}
|
: QLineEdit {parent}
|
||||||
, m_completerModel {new QFileSystemModel(this)}
|
, m_completerModel {new QFileSystemModel(this)}
|
||||||
, m_completer {new QCompleter(this)}
|
, m_completer {new QCompleter(this)}
|
||||||
, m_browseAction {nullptr}
|
|
||||||
, m_warningAction {nullptr}
|
|
||||||
{
|
{
|
||||||
m_iconProvider.setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
|
m_iconProvider.setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
|
||||||
|
|
||||||
|
@ -942,7 +942,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(const BitTorrent::Torre
|
|||||||
|
|
||||||
void MainWindow::on_actionSetGlobalSpeedLimits_triggered()
|
void MainWindow::on_actionSetGlobalSpeedLimits_triggered()
|
||||||
{
|
{
|
||||||
auto dialog = new SpeedLimitDialog {this};
|
auto *dialog = new SpeedLimitDialog {this};
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ void OptionsDialog::loadBehaviorTabOptions()
|
|||||||
});
|
});
|
||||||
connect(m_ui->buttonCustomizeUITheme, &QPushButton::clicked, this, [this]
|
connect(m_ui->buttonCustomizeUITheme, &QPushButton::clicked, this, [this]
|
||||||
{
|
{
|
||||||
auto dialog = new UIThemeDialog(this);
|
auto *dialog = new UIThemeDialog(this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
});
|
});
|
||||||
@ -698,7 +698,7 @@ void OptionsDialog::saveDownloadsTabOptions() const
|
|||||||
session->setTorrentExportDirectory(getTorrentExportDir());
|
session->setTorrentExportDirectory(getTorrentExportDir());
|
||||||
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
session->setFinishedTorrentExportDirectory(getFinishedTorrentExportDir());
|
||||||
|
|
||||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||||
watchedFoldersModel->apply();
|
watchedFoldersModel->apply();
|
||||||
|
|
||||||
session->setExcludedFileNamesEnabled(m_ui->groupExcludedFileNames->isChecked());
|
session->setExcludedFileNamesEnabled(m_ui->groupExcludedFileNames->isChecked());
|
||||||
@ -882,7 +882,7 @@ void OptionsDialog::saveConnectionTabOptions() const
|
|||||||
session->setI2PPort(m_ui->spinI2PPort->value());
|
session->setI2PPort(m_ui->spinI2PPort->value());
|
||||||
session->setI2PMixedMode(m_ui->checkI2PMixed->isChecked());
|
session->setI2PMixedMode(m_ui->checkI2PMixed->isChecked());
|
||||||
|
|
||||||
auto proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
auto *proxyConfigManager = Net::ProxyConfigurationManager::instance();
|
||||||
Net::ProxyConfiguration proxyConf;
|
Net::ProxyConfiguration proxyConf;
|
||||||
proxyConf.type = getProxyType();
|
proxyConf.type = getProxyType();
|
||||||
proxyConf.ip = getProxyIp();
|
proxyConf.ip = getProxyIp();
|
||||||
@ -1668,13 +1668,13 @@ void OptionsDialog::on_addWatchedFolderButton_clicked()
|
|||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto dialog = new WatchedFolderOptionsDialog({}, this);
|
auto *dialog = new WatchedFolderOptionsDialog({}, this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
|
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||||
watchedFoldersModel->addFolder(dir, dialog->watchedFolderOptions());
|
watchedFoldersModel->addFolder(dir, dialog->watchedFolderOptions());
|
||||||
|
|
||||||
pref->setScanDirsLastPath(dir);
|
pref->setScanDirsLastPath(dir);
|
||||||
@ -1722,8 +1722,8 @@ void OptionsDialog::editWatchedFolderOptions(const QModelIndex &index)
|
|||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
auto *watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||||
auto dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
auto *dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
|
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
|
||||||
{
|
{
|
||||||
@ -1880,7 +1880,7 @@ bool OptionsDialog::schedTimesOk()
|
|||||||
|
|
||||||
void OptionsDialog::on_banListButton_clicked()
|
void OptionsDialog::on_banListButton_clicked()
|
||||||
{
|
{
|
||||||
auto dialog = new BanListOptionsDialog(this);
|
auto *dialog = new BanListOptionsDialog(this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
@ -1888,7 +1888,7 @@ void OptionsDialog::on_banListButton_clicked()
|
|||||||
|
|
||||||
void OptionsDialog::on_IPSubnetWhitelistButton_clicked()
|
void OptionsDialog::on_IPSubnetWhitelistButton_clicked()
|
||||||
{
|
{
|
||||||
auto dialog = new IPSubnetWhitelistOptionsDialog(this);
|
auto *dialog = new IPSubnetWhitelistOptionsDialog(this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
connect(dialog, &QDialog::accepted, this, &OptionsDialog::enableApplyButton);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
|
@ -50,10 +50,6 @@ PowerManagement::PowerManagement(QObject *parent)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerManagement::~PowerManagement()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PowerManagement::setActivityState(const bool busy)
|
void PowerManagement::setActivityState(const bool busy)
|
||||||
{
|
{
|
||||||
if (busy)
|
if (busy)
|
||||||
|
@ -47,7 +47,7 @@ class PowerManagement : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PowerManagement(QObject *parent = nullptr);
|
PowerManagement(QObject *parent = nullptr);
|
||||||
virtual ~PowerManagement();
|
virtual ~PowerManagement() = default;
|
||||||
|
|
||||||
void setActivityState(bool busy);
|
void setActivityState(bool busy);
|
||||||
|
|
||||||
|
@ -51,10 +51,6 @@ PowerManagementInhibitor::PowerManagementInhibitor(QObject *parent)
|
|||||||
m_useGSM = false;
|
m_useGSM = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerManagementInhibitor::~PowerManagementInhibitor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PowerManagementInhibitor::requestIdle()
|
void PowerManagementInhibitor::requestIdle()
|
||||||
{
|
{
|
||||||
m_intendedState = Idle;
|
m_intendedState = Idle;
|
||||||
|
@ -39,7 +39,7 @@ class PowerManagementInhibitor : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PowerManagementInhibitor(QObject *parent = nullptr);
|
PowerManagementInhibitor(QObject *parent = nullptr);
|
||||||
virtual ~PowerManagementInhibitor();
|
virtual ~PowerManagementInhibitor() = default;
|
||||||
|
|
||||||
void requestIdle();
|
void requestIdle();
|
||||||
void requestBusy();
|
void requestBusy();
|
||||||
|
@ -145,7 +145,7 @@ void PreviewSelectDialog::previewButtonClicked()
|
|||||||
|
|
||||||
void PreviewSelectDialog::displayColumnHeaderMenu()
|
void PreviewSelectDialog::displayColumnHeaderMenu()
|
||||||
{
|
{
|
||||||
auto menu = new QMenu(this);
|
auto *menu = new QMenu(this);
|
||||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
menu->setToolTipsVisible(true);
|
menu->setToolTipsVisible(true);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// scale bitfield vector to float vector
|
// scale bitfield vector to float vector
|
||||||
QVector<float> bitfieldToFloatVector(const QBitArray &vecin, int reqSize);
|
QVector<float> bitfieldToFloatVector(const QBitArray &vecin, int reqSize);
|
||||||
virtual bool updateImage(QImage &image) override;
|
bool updateImage(QImage &image) override;
|
||||||
QString simpleToolTipText() const override;
|
QString simpleToolTipText() const override;
|
||||||
|
|
||||||
// incomplete piece color
|
// incomplete piece color
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
// QObject interface
|
// QObject interface
|
||||||
virtual bool event(QEvent *e) override;
|
bool event(QEvent *e) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
|
@ -76,16 +76,16 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setVisibility(bool visible);
|
void setVisibility(bool visible);
|
||||||
void loadTorrentInfos(BitTorrent::Torrent *const torrent);
|
void loadTorrentInfos(BitTorrent::Torrent *torrent);
|
||||||
void loadDynamicData();
|
void loadDynamicData();
|
||||||
void clear();
|
void clear();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void reloadPreferences();
|
void reloadPreferences();
|
||||||
void loadTrackers(BitTorrent::Torrent *const torrent);
|
void loadTrackers(BitTorrent::Torrent *torrent);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateTorrentInfos(BitTorrent::Torrent *const torrent);
|
void updateTorrentInfos(BitTorrent::Torrent *torrent);
|
||||||
void loadUrlSeeds();
|
void loadUrlSeeds();
|
||||||
void askWebSeed();
|
void askWebSeed();
|
||||||
void deleteSelectedUrlSeeds();
|
void deleteSelectedUrlSeeds();
|
||||||
@ -97,7 +97,7 @@ protected slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void configure();
|
void configure();
|
||||||
void updateSavePath(BitTorrent::Torrent *const torrent);
|
void updateSavePath(BitTorrent::Torrent *torrent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPushButton *getButtonFromIndex(int index);
|
QPushButton *getButtonFromIndex(int index);
|
||||||
|
@ -58,8 +58,7 @@
|
|||||||
#define NB_STICKY_ITEM 3
|
#define NB_STICKY_ITEM 3
|
||||||
|
|
||||||
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
|
||||||
: QTreeWidget()
|
: m_properties(properties)
|
||||||
, m_properties(properties)
|
|
||||||
{
|
{
|
||||||
// Set header
|
// Set header
|
||||||
// Must be set before calling loadSettings() otherwise the header is reset on restart
|
// Must be set before calling loadSettings() otherwise the header is reset on restart
|
||||||
@ -438,7 +437,7 @@ void TrackerListWidget::openAddTrackersDialog()
|
|||||||
if (!torrent)
|
if (!torrent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto dialog = new TrackersAdditionDialog(this, torrent);
|
auto *dialog = new TrackersAdditionDialog(this, torrent);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class TrackersAdditionDialog : public QDialog
|
|||||||
Q_DISABLE_COPY_MOVE(TrackersAdditionDialog)
|
Q_DISABLE_COPY_MOVE(TrackersAdditionDialog)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *const torrent);
|
TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *torrent);
|
||||||
~TrackersAdditionDialog();
|
~TrackersAdditionDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -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::articleRead, this, &ArticleListWidget::handleArticleRead);
|
||||||
connect(m_rssItem, &RSS::Item::articleAboutToBeRemoved, this, &ArticleListWidget::handleArticleAboutToBeRemoved);
|
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()))
|
if (!(m_unreadOnly && article->isRead()))
|
||||||
{
|
{
|
||||||
auto item = createItem(article);
|
auto *item = createItem(article);
|
||||||
addItem(item);
|
addItem(item);
|
||||||
m_rssArticleToListItemMapping.insert(article, item);
|
m_rssArticleToListItemMapping.insert(article, item);
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
|
|||||||
{
|
{
|
||||||
if (!(m_unreadOnly && rssArticle->isRead()))
|
if (!(m_unreadOnly && rssArticle->isRead()))
|
||||||
{
|
{
|
||||||
auto item = createItem(rssArticle);
|
auto *item = createItem(rssArticle);
|
||||||
insertItem(0, item);
|
insertItem(0, item);
|
||||||
m_rssArticleToListItemMapping.insert(rssArticle, item);
|
m_rssArticleToListItemMapping.insert(rssArticle, item);
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
|
|||||||
|
|
||||||
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
|
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
|
||||||
{
|
{
|
||||||
auto item = mapRSSArticle(rssArticle);
|
auto *item = mapRSSArticle(rssArticle);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)};
|
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs)};
|
||||||
|
@ -64,7 +64,6 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
|
|||||||
, m_formatFilterJSON(u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON))
|
, m_formatFilterJSON(u"%1 (*%2)"_qs.arg(tr("Rules"), EXT_JSON))
|
||||||
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY))
|
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY))
|
||||||
, m_ui(new Ui::AutomatedRssDownloader)
|
, m_ui(new Ui::AutomatedRssDownloader)
|
||||||
, m_currentRuleItem(nullptr)
|
|
||||||
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs}
|
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs}
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
, m_storeHSplitterSize {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs}
|
, m_storeHSplitterSize {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs}
|
||||||
@ -193,7 +192,7 @@ void AutomatedRssDownloader::loadFeedList()
|
|||||||
{
|
{
|
||||||
const QSignalBlocker feedListSignalBlocker(m_ui->listFeeds);
|
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);
|
QListWidgetItem *item = new QListWidgetItem(feed->name(), m_ui->listFeeds);
|
||||||
item->setData(Qt::UserRole, feed->url());
|
item->setData(Qt::UserRole, feed->url());
|
||||||
@ -637,11 +636,11 @@ void AutomatedRssDownloader::updateMatchingArticles()
|
|||||||
: RSS::AutoDownloader::instance()->ruleByName(ruleItem->text()));
|
: RSS::AutoDownloader::instance()->ruleByName(ruleItem->text()));
|
||||||
for (const QString &feedURL : asConst(rule.feedURLs()))
|
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
|
if (!feed) continue; // feed doesn't exist
|
||||||
|
|
||||||
QStringList matchingArticles;
|
QStringList matchingArticles;
|
||||||
for (const auto article : asConst(feed->articles()))
|
for (const auto *article : asConst(feed->articles()))
|
||||||
if (rule.matches(article->data()))
|
if (rule.matches(article->data()))
|
||||||
matchingArticles << article->title();
|
matchingArticles << article->title();
|
||||||
if (!matchingArticles.isEmpty())
|
if (!matchingArticles.isEmpty())
|
||||||
@ -854,7 +853,7 @@ void AutomatedRssDownloader::handleRuleAdded(const QString &ruleName)
|
|||||||
|
|
||||||
void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QString &oldRuleName)
|
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);
|
m_itemsByRuleName.insert(ruleName, item);
|
||||||
if (m_currentRule.name() == oldRuleName)
|
if (m_currentRule.name() == oldRuleName)
|
||||||
m_currentRule.setName(ruleName);
|
m_currentRule.setName(ruleName);
|
||||||
@ -863,7 +862,7 @@ void AutomatedRssDownloader::handleRuleRenamed(const QString &ruleName, const QS
|
|||||||
|
|
||||||
void AutomatedRssDownloader::handleRuleChanged(const QString &ruleName)
|
void AutomatedRssDownloader::handleRuleChanged(const QString &ruleName)
|
||||||
{
|
{
|
||||||
auto item = m_itemsByRuleName.value(ruleName);
|
auto *item = m_itemsByRuleName.value(ruleName);
|
||||||
if (item && (item != m_currentRuleItem))
|
if (item && (item != m_currentRuleItem))
|
||||||
item->setCheckState(RSS::AutoDownloader::instance()->ruleByName(ruleName).isEnabled() ? Qt::Checked : Qt::Unchecked);
|
item->setCheckState(RSS::AutoDownloader::instance()->ruleByName(ruleName).isEnabled() ? Qt::Checked : Qt::Unchecked);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
|
|||||||
|
|
||||||
void FeedListWidget::handleItemAdded(RSS::Item *rssItem)
|
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())));
|
RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path())));
|
||||||
createItem(rssItem, parentItem);
|
createItem(rssItem, parentItem);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ void FeedListWidget::dropEvent(QDropEvent *event)
|
|||||||
// move as much items as possible
|
// move as much items as possible
|
||||||
for (QTreeWidgetItem *srcItem : asConst(selectedItems()))
|
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()));
|
RSS::Session::instance()->moveItem(rssItem, RSS::Item::joinPath(destFolder->path(), rssItem->name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
|
|||||||
m_rssToTreeItemMapping[rssItem] = item;
|
m_rssToTreeItemMapping[rssItem] = item;
|
||||||
|
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
if (auto feed = qobject_cast<RSS::Feed *>(rssItem))
|
if (auto *feed = qobject_cast<RSS::Feed *>(rssItem))
|
||||||
icon = rssFeedIcon(feed);
|
icon = rssFeedIcon(feed);
|
||||||
else
|
else
|
||||||
icon = UIThemeManager::instance()->getIcon(u"directory"_qs);
|
icon = UIThemeManager::instance()->getIcon(u"directory"_qs);
|
||||||
@ -299,11 +299,11 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
|
|||||||
|
|
||||||
void FeedListWidget::fill(QTreeWidgetItem *parent, RSS::Folder *rssParent)
|
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);
|
QTreeWidgetItem *item = createItem(rssItem, parent);
|
||||||
// Recursive call if this is a folder.
|
// 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);
|
fill(item, folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,6 @@ HtmlBrowser::HtmlBrowser(QWidget *parent)
|
|||||||
connect(m_netManager, &QNetworkAccessManager::finished, this, &HtmlBrowser::resourceLoaded);
|
connect(m_netManager, &QNetworkAccessManager::finished, this, &HtmlBrowser::resourceLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
HtmlBrowser::~HtmlBrowser()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant HtmlBrowser::loadResource(int type, const QUrl &name)
|
QVariant HtmlBrowser::loadResource(int type, const QUrl &name)
|
||||||
{
|
{
|
||||||
if (type == QTextDocument::ImageResource)
|
if (type == QTextDocument::ImageResource)
|
||||||
|
@ -42,7 +42,7 @@ class HtmlBrowser final : public QTextBrowser
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit HtmlBrowser(QWidget* parent = nullptr);
|
explicit HtmlBrowser(QWidget* parent = nullptr);
|
||||||
~HtmlBrowser();
|
~HtmlBrowser() = default;
|
||||||
|
|
||||||
QVariant loadResource(int type, const QUrl &name) override;
|
QVariant loadResource(int type, const QUrl &name) override;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ void RSSWidget::displayItemsListMenu()
|
|||||||
bool hasLink = false;
|
bool hasLink = false;
|
||||||
for (const QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
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);
|
Q_ASSERT(article);
|
||||||
|
|
||||||
if (!article->torrentUrl().isEmpty())
|
if (!article->torrentUrl().isEmpty())
|
||||||
@ -364,7 +364,7 @@ void RSSWidget::downloadSelectedTorrents()
|
|||||||
{
|
{
|
||||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
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);
|
Q_ASSERT(article);
|
||||||
|
|
||||||
// Mark as read
|
// Mark as read
|
||||||
@ -385,7 +385,7 @@ void RSSWidget::openSelectedArticlesUrls()
|
|||||||
{
|
{
|
||||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
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);
|
Q_ASSERT(article);
|
||||||
|
|
||||||
// Mark as read
|
// Mark as read
|
||||||
@ -467,7 +467,7 @@ void RSSWidget::copySelectedFeedsURL()
|
|||||||
QStringList URLs;
|
QStringList URLs;
|
||||||
for (QTreeWidgetItem *item : asConst(m_feedListWidget->selectedItems()))
|
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();
|
URLs << feed->url();
|
||||||
}
|
}
|
||||||
qApp->clipboard()->setText(URLs.join(u'\n'));
|
qApp->clipboard()->setText(URLs.join(u'\n'));
|
||||||
@ -496,14 +496,14 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
|
|||||||
|
|
||||||
if (previousItem)
|
if (previousItem)
|
||||||
{
|
{
|
||||||
auto article = m_articleListWidget->getRSSArticle(previousItem);
|
auto *article = m_articleListWidget->getRSSArticle(previousItem);
|
||||||
Q_ASSERT(article);
|
Q_ASSERT(article);
|
||||||
article->markAsRead();
|
article->markAsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentItem) return;
|
if (!currentItem) return;
|
||||||
|
|
||||||
auto article = m_articleListWidget->getRSSArticle(currentItem);
|
auto *article = m_articleListWidget->getRSSArticle(currentItem);
|
||||||
Q_ASSERT(article);
|
Q_ASSERT(article);
|
||||||
|
|
||||||
const QString highlightedBaseColor = m_ui->textBrowser->palette().color(QPalette::Highlight).name();
|
const QString highlightedBaseColor = m_ui->textBrowser->palette().color(QPalette::Highlight).name();
|
||||||
|
@ -459,7 +459,7 @@ int SearchJobWidget::visibleColumnsCount() const
|
|||||||
|
|
||||||
void SearchJobWidget::displayColumnHeaderMenu()
|
void SearchJobWidget::displayColumnHeaderMenu()
|
||||||
{
|
{
|
||||||
auto menu = new QMenu(this);
|
auto *menu = new QMenu(this);
|
||||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
menu->setTitle(tr("Column visibility"));
|
menu->setTitle(tr("Column visibility"));
|
||||||
menu->setToolTipsVisible(true);
|
menu->setToolTipsVisible(true);
|
||||||
|
@ -144,7 +144,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
|
|||||||
connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
|
connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
|
||||||
, this, &SearchWidget::fillCatCombobox);
|
, 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);
|
connect(focusSearchHotkey, &QShortcut::activated, this, &SearchWidget::toggleFocusBetweenLineEdits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
|
|||||||
if (event->type() != QEvent::MouseButtonRelease)
|
if (event->type() != QEvent::MouseButtonRelease)
|
||||||
return false;
|
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());
|
const int tabIndex = m_ui->tabWidget->tabBar()->tabAt(mouseEvent->pos());
|
||||||
if ((mouseEvent->button() == Qt::MiddleButton) && (tabIndex >= 0))
|
if ((mouseEvent->button() == Qt::MiddleButton) && (tabIndex >= 0))
|
||||||
{
|
{
|
||||||
|
@ -255,7 +255,7 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
|
|||||||
|
|
||||||
void StatusBar::capSpeed()
|
void StatusBar::capSpeed()
|
||||||
{
|
{
|
||||||
auto dialog = new SpeedLimitDialog {parentWidget()};
|
auto *dialog = new SpeedLimitDialog {parentWidget()};
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void TorrentCategoryDialog::editCategory(QWidget *parent, const QString &categor
|
|||||||
|
|
||||||
Q_ASSERT(Session::instance()->categories().contains(categoryName));
|
Q_ASSERT(Session::instance()->categories().contains(categoryName));
|
||||||
|
|
||||||
auto dialog = new TorrentCategoryDialog(parent);
|
auto *dialog = new TorrentCategoryDialog(parent);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->setCategoryNameEditable(false);
|
dialog->setCategoryNameEditable(false);
|
||||||
dialog->setCategoryName(categoryName);
|
dialog->setCategoryName(categoryName);
|
||||||
|
@ -75,7 +75,7 @@ TorrentContentWidget::TorrentContentWidget(QWidget *parent)
|
|||||||
m_filterModel->setSourceModel(m_model);
|
m_filterModel->setSourceModel(m_model);
|
||||||
QTreeView::setModel(m_filterModel);
|
QTreeView::setModel(m_filterModel);
|
||||||
|
|
||||||
auto itemDelegate = new TorrentContentItemDelegate(this);
|
auto *itemDelegate = new TorrentContentItemDelegate(this);
|
||||||
setItemDelegate(itemDelegate);
|
setItemDelegate(itemDelegate);
|
||||||
|
|
||||||
connect(this, &QAbstractItemView::clicked, this, qOverload<const QModelIndex &>(&QAbstractItemView::edit));
|
connect(this, &QAbstractItemView::clicked, this, qOverload<const QModelIndex &>(&QAbstractItemView::edit));
|
||||||
@ -436,7 +436,7 @@ void TorrentContentWidget::openParentFolder(const QModelIndex &index) const
|
|||||||
|
|
||||||
Path TorrentContentWidget::getFullPath(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)
|
if (const int fileIdx = getFileIndex(index); fileIdx >= 0)
|
||||||
{
|
{
|
||||||
const Path fullPath = contentHandler->actualStorageLocation() / contentHandler->actualFilePath(fileIdx);
|
const Path fullPath = contentHandler->actualStorageLocation() / contentHandler->actualFilePath(fileIdx);
|
||||||
@ -450,7 +450,7 @@ Path TorrentContentWidget::getFullPath(const QModelIndex &index) const
|
|||||||
|
|
||||||
void TorrentContentWidget::onItemDoubleClicked(const QModelIndex &index)
|
void TorrentContentWidget::onItemDoubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
const auto contentHandler = m_model->contentHandler();
|
const auto *contentHandler = m_model->contentHandler();
|
||||||
Q_ASSERT(contentHandler && contentHandler->hasMetadata());
|
Q_ASSERT(contentHandler && contentHandler->hasMetadata());
|
||||||
|
|
||||||
if (Q_UNLIKELY(!contentHandler || !contentHandler->hasMetadata()))
|
if (Q_UNLIKELY(!contentHandler || !contentHandler->hasMetadata()))
|
||||||
|
@ -56,7 +56,7 @@ private slots:
|
|||||||
virtual void showMenu() = 0;
|
virtual void showMenu() = 0;
|
||||||
virtual void applyFilter(int row) = 0;
|
virtual void applyFilter(int row) = 0;
|
||||||
virtual void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) = 0;
|
virtual void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) = 0;
|
||||||
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *const) = 0;
|
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TransferListWidget *m_transferList = nullptr;
|
TransferListWidget *m_transferList = nullptr;
|
||||||
|
@ -38,13 +38,10 @@
|
|||||||
class CategoryModelItem
|
class CategoryModelItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CategoryModelItem()
|
CategoryModelItem() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CategoryModelItem(CategoryModelItem *parent, QString categoryName, int torrentsCount = 0)
|
CategoryModelItem(CategoryModelItem *parent, QString categoryName, int torrentsCount = 0)
|
||||||
: m_parent(nullptr)
|
: m_name(categoryName)
|
||||||
, m_name(categoryName)
|
|
||||||
, m_torrentsCount(torrentsCount)
|
, m_torrentsCount(torrentsCount)
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
@ -207,7 +204,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
if (!index.isValid()) return {};
|
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))
|
if ((index.column() == 0) && (role == Qt::DecorationRole))
|
||||||
{
|
{
|
||||||
@ -251,7 +248,7 @@ QModelIndex CategoryFilterModel::index(int row, int column, const QModelIndex &p
|
|||||||
if (parent.isValid() && (parent.column() != 0))
|
if (parent.isValid() && (parent.column() != 0))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
|
auto *parentItem = parent.isValid() ? static_cast<CategoryModelItem *>(parent.internalPointer())
|
||||||
: m_rootItem;
|
: m_rootItem;
|
||||||
if (row < parentItem->childCount())
|
if (row < parentItem->childCount())
|
||||||
return createIndex(row, column, parentItem->childAt(row));
|
return createIndex(row, column, parentItem->childAt(row));
|
||||||
@ -264,7 +261,7 @@ QModelIndex CategoryFilterModel::parent(const QModelIndex &index) const
|
|||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto item = static_cast<CategoryModelItem *>(index.internalPointer());
|
auto *item = static_cast<CategoryModelItem *>(index.internalPointer());
|
||||||
if (!item) return {};
|
if (!item) return {};
|
||||||
|
|
||||||
return this->index(item->parent());
|
return this->index(item->parent());
|
||||||
@ -278,7 +275,7 @@ int CategoryFilterModel::rowCount(const QModelIndex &parent) const
|
|||||||
if (!parent.isValid())
|
if (!parent.isValid())
|
||||||
return m_rootItem->childCount();
|
return m_rootItem->childCount();
|
||||||
|
|
||||||
auto item = static_cast<CategoryModelItem *>(parent.internalPointer());
|
auto *item = static_cast<CategoryModelItem *>(parent.internalPointer());
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
||||||
return item->childCount();
|
return item->childCount();
|
||||||
@ -308,7 +305,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
|
|||||||
|
|
||||||
if (m_isSubcategoriesEnabled)
|
if (m_isSubcategoriesEnabled)
|
||||||
{
|
{
|
||||||
QStringList expanded = BitTorrent::Session::instance()->expandCategory(categoryName);
|
QStringList expanded = BitTorrent::Session::expandCategory(categoryName);
|
||||||
if (expanded.count() > 1)
|
if (expanded.count() > 1)
|
||||||
parent = findItem(expanded[expanded.count() - 2]);
|
parent = findItem(expanded[expanded.count() - 2]);
|
||||||
}
|
}
|
||||||
@ -322,7 +319,7 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
|
|||||||
|
|
||||||
void CategoryFilterModel::categoryRemoved(const QString &categoryName)
|
void CategoryFilterModel::categoryRemoved(const QString &categoryName)
|
||||||
{
|
{
|
||||||
auto item = findItem(categoryName);
|
auto *item = findItem(categoryName);
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
QModelIndex i = index(item);
|
QModelIndex i = index(item);
|
||||||
@ -357,7 +354,7 @@ void CategoryFilterModel::torrentCategoryChanged(BitTorrent::Torrent *const torr
|
|||||||
{
|
{
|
||||||
QModelIndex i;
|
QModelIndex i;
|
||||||
|
|
||||||
auto item = findItem(oldCategory);
|
auto *item = findItem(oldCategory);
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
|
|
||||||
item->decreaseTorrentsCount();
|
item->decreaseTorrentsCount();
|
||||||
@ -413,7 +410,7 @@ void CategoryFilterModel::populate()
|
|||||||
for (const QString &categoryName : asConst(session->categories()))
|
for (const QString &categoryName : asConst(session->categories()))
|
||||||
{
|
{
|
||||||
CategoryModelItem *parent = m_rootItem;
|
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);
|
const QString subcatName = shortName(subcat);
|
||||||
if (!parent->hasChild(subcatName))
|
if (!parent->hasChild(subcatName))
|
||||||
@ -446,7 +443,7 @@ CategoryModelItem *CategoryFilterModel::findItem(const QString &fullName) const
|
|||||||
return m_rootItem->child(fullName);
|
return m_rootItem->child(fullName);
|
||||||
|
|
||||||
CategoryModelItem *item = m_rootItem;
|
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);
|
const QString subcatName = shortName(subcat);
|
||||||
if (!item->hasChild(subcatName)) return nullptr;
|
if (!item->hasChild(subcatName)) return nullptr;
|
||||||
|
@ -63,8 +63,8 @@ private slots:
|
|||||||
void categoryAdded(const QString &categoryName);
|
void categoryAdded(const QString &categoryName);
|
||||||
void categoryRemoved(const QString &categoryName);
|
void categoryRemoved(const QString &categoryName);
|
||||||
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||||
void torrentCategoryChanged(BitTorrent::Torrent *const torrent, const QString &oldCategory);
|
void torrentCategoryChanged(BitTorrent::Torrent *torrent, const QString &oldCategory);
|
||||||
void subcategoriesSupportChanged();
|
void subcategoriesSupportChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -214,7 +214,7 @@ void CategoryFilterWidget::removeCategory()
|
|||||||
|
|
||||||
void CategoryFilterWidget::removeUnusedCategories()
|
void CategoryFilterWidget::removeUnusedCategories()
|
||||||
{
|
{
|
||||||
auto session = BitTorrent::Session::instance();
|
auto *session = BitTorrent::Session::instance();
|
||||||
for (const QString &category : asConst(session->categories()))
|
for (const QString &category : asConst(session->categories()))
|
||||||
{
|
{
|
||||||
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)
|
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)
|
||||||
|
@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
|
|||||||
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
|
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)
|
for (const BitTorrent::Torrent *torrent : torrents)
|
||||||
updateTorrentStatus(torrent);
|
updateTorrentStatus(torrent);
|
||||||
|
@ -54,11 +54,11 @@ private:
|
|||||||
void showMenu() override;
|
void showMenu() override;
|
||||||
void applyFilter(int row) override;
|
void applyFilter(int row) override;
|
||||||
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
|
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
|
||||||
void torrentAboutToBeDeleted(BitTorrent::Torrent *const) override;
|
void torrentAboutToBeDeleted(BitTorrent::Torrent *) override;
|
||||||
|
|
||||||
void configure();
|
void configure();
|
||||||
|
|
||||||
void update(const QVector<BitTorrent::Torrent *> torrents);
|
void update(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
||||||
void updateTexts();
|
void updateTexts();
|
||||||
void hideZeroItems();
|
void hideZeroItems();
|
||||||
|
@ -61,10 +61,10 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void tagAdded(const QString &tag);
|
void tagAdded(const QString &tag);
|
||||||
void tagRemoved(const QString &tag);
|
void tagRemoved(const QString &tag);
|
||||||
void torrentTagAdded(BitTorrent::Torrent *const torrent, const QString &tag);
|
void torrentTagAdded(BitTorrent::Torrent *torrent, const QString &tag);
|
||||||
void torrentTagRemoved(BitTorrent::Torrent *const, const QString &tag);
|
void torrentTagRemoved(BitTorrent::Torrent *, const QString &tag);
|
||||||
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QString tagDisplayName(const QString &tag);
|
static QString tagDisplayName(const QString &tag);
|
||||||
|
@ -208,7 +208,7 @@ void TagFilterWidget::removeTag()
|
|||||||
|
|
||||||
void TagFilterWidget::removeUnusedTags()
|
void TagFilterWidget::removeUnusedTags()
|
||||||
{
|
{
|
||||||
auto session = BitTorrent::Session::instance();
|
auto *session = BitTorrent::Session::instance();
|
||||||
for (const QString &tag : asConst(session->tags()))
|
for (const QString &tag : asConst(session->tags()))
|
||||||
if (model()->data(static_cast<TagFilterProxyModel *>(model())->index(tag), Qt::UserRole) == 0)
|
if (model()->data(static_cast<TagFilterProxyModel *>(model())->index(tag), Qt::UserRole) == 0)
|
||||||
session->removeTag(tag);
|
session->removeTag(tag);
|
||||||
|
@ -69,7 +69,7 @@ private:
|
|||||||
void showMenu() override;
|
void showMenu() override;
|
||||||
void applyFilter(int row) override;
|
void applyFilter(int row) override;
|
||||||
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) 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 addItems(const QString &trackerURL, const QVector<BitTorrent::TorrentID> &torrents);
|
||||||
void removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id);
|
void removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id);
|
||||||
|
@ -107,15 +107,15 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addTorrents(const QVector<BitTorrent::Torrent *> &torrents);
|
void addTorrents(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||||
void handleTorrentStatusUpdated(BitTorrent::Torrent *const torrent);
|
void handleTorrentStatusUpdated(BitTorrent::Torrent *torrent);
|
||||||
void handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
|
void handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void configure();
|
void configure();
|
||||||
QString displayValue(const BitTorrent::Torrent *torrent, int column) const;
|
QString displayValue(const BitTorrent::Torrent *torrent, int column) const;
|
||||||
QVariant internalValue(const BitTorrent::Torrent *torrent, int column, bool alt) 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
|
QList<BitTorrent::Torrent *> m_torrentList; // maps row number to torrent handle
|
||||||
QHash<BitTorrent::Torrent *, int> m_torrentMap; // maps torrent handle to row number
|
QHash<BitTorrent::Torrent *, int> m_torrentMap; // maps torrent handle to row number
|
||||||
|
@ -335,7 +335,7 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
|||||||
|
|
||||||
const Path oldLocation = torrents[0]->savePath();
|
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->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
fileDialog->setFileMode(QFileDialog::Directory);
|
fileDialog->setFileMode(QFileDialog::Directory);
|
||||||
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
||||||
@ -616,7 +616,7 @@ void TransferListWidget::setTorrentOptions()
|
|||||||
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
||||||
if (selectedTorrents.empty()) return;
|
if (selectedTorrents.empty()) return;
|
||||||
|
|
||||||
auto dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
auto *dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
@ -654,7 +654,7 @@ int TransferListWidget::visibleColumnsCount() const
|
|||||||
// hide/show columns menu
|
// hide/show columns menu
|
||||||
void TransferListWidget::displayColumnHeaderMenu()
|
void TransferListWidget::displayColumnHeaderMenu()
|
||||||
{
|
{
|
||||||
auto menu = new QMenu(this);
|
auto *menu = new QMenu(this);
|
||||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
menu->setTitle(tr("Column visibility"));
|
menu->setTitle(tr("Column visibility"));
|
||||||
menu->setToolTipsVisible(true);
|
menu->setToolTipsVisible(true);
|
||||||
@ -767,7 +767,7 @@ void TransferListWidget::editTorrentTrackers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto trackerDialog = new TrackerEntriesDialog(this);
|
auto *trackerDialog = new TrackerEntriesDialog(this);
|
||||||
trackerDialog->setAttribute(Qt::WA_DeleteOnClose);
|
trackerDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
trackerDialog->setTrackers(commonTrackers);
|
trackerDialog->setTrackers(commonTrackers);
|
||||||
|
|
||||||
@ -785,7 +785,7 @@ void TransferListWidget::exportTorrent()
|
|||||||
if (getSelectedTorrents().isEmpty())
|
if (getSelectedTorrents().isEmpty())
|
||||||
return;
|
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->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
fileDialog->setFileMode(QFileDialog::Directory);
|
fileDialog->setFileMode(QFileDialog::Directory);
|
||||||
fileDialog->setOptions(QFileDialog::ShowDirsOnly);
|
fileDialog->setOptions(QFileDialog::ShowDirsOnly);
|
||||||
|
@ -102,7 +102,7 @@ public slots:
|
|||||||
void renameSelectedTorrent();
|
void renameSelectedTorrent();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentTorrentChanged(BitTorrent::Torrent *const torrent);
|
void currentTorrentChanged(BitTorrent::Torrent *torrent);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void torrentDoubleClicked();
|
void torrentDoubleClicked();
|
||||||
|
@ -124,7 +124,7 @@ private:
|
|||||||
|
|
||||||
void showColorDialog()
|
void showColorDialog()
|
||||||
{
|
{
|
||||||
auto dialog = new QColorDialog(m_currentColor, this);
|
auto *dialog = new QColorDialog(m_currentColor, this);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, [this, dialog]
|
connect(dialog, &QDialog::accepted, this, [this, dialog]
|
||||||
{
|
{
|
||||||
|
@ -54,8 +54,8 @@ class UIThemeSource
|
|||||||
public:
|
public:
|
||||||
virtual ~UIThemeSource() = default;
|
virtual ~UIThemeSource() = default;
|
||||||
|
|
||||||
virtual QColor getColor(const QString &colorId, const ColorMode colorMode) const = 0;
|
virtual QColor getColor(const QString &colorId, ColorMode colorMode) const = 0;
|
||||||
virtual Path getIconPath(const QString &iconId, const ColorMode colorMode) const = 0;
|
virtual Path getIconPath(const QString &iconId, ColorMode colorMode) const = 0;
|
||||||
virtual QByteArray readStyleSheet() = 0;
|
virtual QByteArray readStyleSheet() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,8 +65,8 @@ public:
|
|||||||
DefaultThemeSource();
|
DefaultThemeSource();
|
||||||
|
|
||||||
QByteArray readStyleSheet() override;
|
QByteArray readStyleSheet() override;
|
||||||
QColor getColor(const QString &colorId, const ColorMode colorMode) const override;
|
QColor getColor(const QString &colorId, ColorMode colorMode) const override;
|
||||||
Path getIconPath(const QString &iconId, const ColorMode colorMode) const override;
|
Path getIconPath(const QString &iconId, ColorMode colorMode) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadColors();
|
void loadColors();
|
||||||
@ -79,8 +79,8 @@ private:
|
|||||||
class CustomThemeSource : public UIThemeSource
|
class CustomThemeSource : public UIThemeSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QColor getColor(const QString &colorId, const ColorMode colorMode) const override;
|
QColor getColor(const QString &colorId, ColorMode colorMode) const override;
|
||||||
Path getIconPath(const QString &iconId, const ColorMode colorMode) const override;
|
Path getIconPath(const QString &iconId, ColorMode colorMode) const override;
|
||||||
QByteArray readStyleSheet() override;
|
QByteArray readStyleSheet() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -149,7 +149,7 @@ void AppController::preferencesAction()
|
|||||||
QJsonObject nativeDirs;
|
QJsonObject nativeDirs;
|
||||||
for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i)
|
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;
|
const BitTorrent::AddTorrentParams params = i.value().addTorrentParams;
|
||||||
if (params.savePath.isEmpty())
|
if (params.savePath.isEmpty())
|
||||||
nativeDirs.insert(watchedFolder.toString(), 1);
|
nativeDirs.insert(watchedFolder.toString(), 1);
|
||||||
@ -616,7 +616,7 @@ void AppController::setPreferencesAction()
|
|||||||
session->setMaxUploadsPerTorrent(it.value().toInt());
|
session->setMaxUploadsPerTorrent(it.value().toInt());
|
||||||
|
|
||||||
// Proxy Server
|
// Proxy Server
|
||||||
auto proxyManager = Net::ProxyConfigurationManager::instance();
|
auto *proxyManager = Net::ProxyConfigurationManager::instance();
|
||||||
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
|
Net::ProxyConfiguration proxyConf = proxyManager->proxyConfiguration();
|
||||||
if (hasKey(u"proxy_type"_qs))
|
if (hasKey(u"proxy_type"_qs))
|
||||||
proxyConf.type = Utils::String::toEnum(it.value().toString(), Net::ProxyType::HTTP);
|
proxyConf.type = Utils::String::toEnum(it.value().toString(), Net::ProxyType::HTTP);
|
||||||
|
@ -1279,7 +1279,7 @@ void TorrentsController::removeCategoriesAction()
|
|||||||
|
|
||||||
void TorrentsController::categoriesAction()
|
void TorrentsController::categoriesAction()
|
||||||
{
|
{
|
||||||
const auto session = BitTorrent::Session::instance();
|
const auto *session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
QJsonObject categories;
|
QJsonObject categories;
|
||||||
const QStringList categoriesList = session->categories();
|
const QStringList categoriesList = session->categories();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user