Browse Source

Merge pull request #18936 from Chocobo1/tidy

Code clean up
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
32a55551fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/app/application.cpp
  2. 2
      src/app/application.h
  3. 6
      src/app/cmdoptions.cpp
  4. 1
      src/base/bittorrent/bandwidthscheduler.cpp
  5. 2
      src/base/bittorrent/bandwidthscheduler.h
  6. 3
      src/base/bittorrent/filterparserthread.cpp
  7. 2
      src/base/bittorrent/filterparserthread.h
  8. 2
      src/base/bittorrent/loadtorrentparams.h
  9. 3
      src/base/bittorrent/magneturi.cpp
  10. 2
      src/base/bittorrent/magneturi.h
  11. 6
      src/base/bittorrent/sessionimpl.h
  12. 6
      src/base/bittorrent/torrentcreatorthread.h
  13. 2
      src/base/bittorrent/torrentimpl.h
  14. 4
      src/base/http/requestparser.h
  15. 4
      src/base/http/types.h
  16. 12
      src/base/logger.h
  17. 2
      src/base/net/dnsupdater.cpp
  18. 4
      src/base/net/dnsupdater.h
  19. 2
      src/base/net/downloadmanager.h
  20. 2
      src/base/profile_p.cpp
  21. 5
      src/base/rss/rss_parser.cpp
  22. 6
      src/base/search/searchhandler.h
  23. 2
      src/base/search/searchpluginmanager.cpp
  24. 4
      src/base/search/searchpluginmanager.h
  25. 49
      src/gui/powermanagement/powermanagement_x11.cpp
  26. 2
      src/gui/properties/speedplotview.h
  27. 13
      src/gui/rss/feedlistwidget.cpp
  28. 7
      src/gui/search/searchsortmodel.cpp
  29. 8
      src/gui/search/searchsortmodel.h
  30. 11
      src/gui/search/searchwidget.cpp
  31. 2
      src/gui/torrenttagsdialog.h
  32. 2
      src/gui/transferlistfilters/categoryfiltermodel.cpp
  33. 2
      src/gui/transferlistfilters/categoryfiltermodel.h
  34. 2
      src/gui/tristatewidget.cpp
  35. 4
      src/gui/tristatewidget.h
  36. 2
      src/gui/uithemedialog.h
  37. 6
      src/webui/api/synccontroller.cpp
  38. 4
      src/webui/webapplication.cpp
  39. 16
      src/webui/webapplication.h

1
src/app/application.cpp

@ -224,7 +224,6 @@ namespace
Application::Application(int &argc, char **argv) Application::Application(int &argc, char **argv)
: BaseApplication(argc, argv) : BaseApplication(argc, argv)
, m_shutdownAct(ShutdownDialogAction::Exit)
, m_commandLineArgs(parseCommandLine(Application::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))

2
src/app/application.h

@ -173,7 +173,7 @@ private:
ApplicationInstanceManager *m_instanceManager = nullptr; ApplicationInstanceManager *m_instanceManager = nullptr;
QAtomicInt m_isCleanupRun; QAtomicInt m_isCleanupRun;
bool m_isProcessingParamsAllowed = false; bool m_isProcessingParamsAllowed = false;
ShutdownDialogAction m_shutdownAct; ShutdownDialogAction m_shutdownAct = ShutdownDialogAction::Exit;
QBtCommandLineParameters m_commandLineArgs; QBtCommandLineParameters m_commandLineArgs;
// FileLog // FileLog

6
src/app/cmdoptions.cpp

@ -198,13 +198,15 @@ namespace
int value(const QString &arg) const int value(const QString &arg) const
{ {
QString val = StringOption::value(arg); const QString val = StringOption::value(arg);
bool ok = false; bool ok = false;
int res = val.toInt(&ok); const int res = val.toInt(&ok);
if (!ok) if (!ok)
{
throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'",
"e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'") "e.g. Parameter '--webui-port' must follow syntax '--webui-port=<value>'")
.arg(fullParameter(), u"<integer value>"_qs)); .arg(fullParameter(), u"<integer value>"_qs));
}
return res; return res;
} }

1
src/base/bittorrent/bandwidthscheduler.cpp

@ -41,7 +41,6 @@ using namespace std::chrono_literals;
BandwidthScheduler::BandwidthScheduler(QObject *parent) BandwidthScheduler::BandwidthScheduler(QObject *parent)
: QObject(parent) : QObject(parent)
, m_lastAlternative(false)
{ {
connect(&m_timer, &QTimer::timeout, this, &BandwidthScheduler::onTimeout); connect(&m_timer, &QTimer::timeout, this, &BandwidthScheduler::onTimeout);
} }

2
src/base/bittorrent/bandwidthscheduler.h

@ -49,5 +49,5 @@ private:
void onTimeout(); void onTimeout();
QTimer m_timer; QTimer m_timer;
bool m_lastAlternative; bool m_lastAlternative = false;
}; };

3
src/base/bittorrent/filterparserthread.cpp

@ -89,7 +89,7 @@ namespace
} }
private: private:
lt::address_v4::bytes_type m_buf; lt::address_v4::bytes_type m_buf {};
}; };
bool parseIPAddress(const char *data, lt::address &address) bool parseIPAddress(const char *data, lt::address &address)
@ -111,7 +111,6 @@ namespace
FilterParserThread::FilterParserThread(QObject *parent) FilterParserThread::FilterParserThread(QObject *parent)
: QThread(parent) : QThread(parent)
, m_abort(false)
{ {
} }

2
src/base/bittorrent/filterparserthread.h

@ -62,7 +62,7 @@ private:
int getlineInStream(QDataStream &stream, std::string &name, char delim); int getlineInStream(QDataStream &stream, std::string &name, char delim);
int parseP2BFilterFile(); int parseP2BFilterFile();
bool m_abort; bool m_abort = false;
Path m_filePath; Path m_filePath;
lt::ip_filter m_filter; lt::ip_filter m_filter;
}; };

2
src/base/bittorrent/loadtorrentparams.h

@ -54,7 +54,7 @@ namespace BitTorrent
bool firstLastPiecePriority = false; bool firstLastPiecePriority = false;
bool hasFinishedStatus = false; bool hasFinishedStatus = false;
bool stopped = false; bool stopped = false;
Torrent::StopCondition stopCondition; Torrent::StopCondition stopCondition = Torrent::StopCondition::None;
bool addToQueueTop = false; // only for new torrents bool addToQueueTop = false; // only for new torrents

3
src/base/bittorrent/magneturi.cpp

@ -75,8 +75,7 @@ using namespace BitTorrent;
const int magnetUriId = qRegisterMetaType<MagnetUri>(); const int magnetUriId = qRegisterMetaType<MagnetUri>();
MagnetUri::MagnetUri(const QString &source) MagnetUri::MagnetUri(const QString &source)
: m_valid(false) : m_url(source)
, m_url(source)
{ {
if (source.isEmpty()) return; if (source.isEmpty()) return;

2
src/base/bittorrent/magneturi.h

@ -54,7 +54,7 @@ namespace BitTorrent
lt::add_torrent_params addTorrentParams() const; lt::add_torrent_params addTorrentParams() const;
private: private:
bool m_valid; bool m_valid = false;
QString m_url; QString m_url;
InfoHash m_infoHash; InfoHash m_infoHash;
QString m_name; QString m_name;

6
src/base/bittorrent/sessionimpl.h

@ -485,15 +485,15 @@ namespace BitTorrent
{ {
lt::torrent_handle torrentHandle; lt::torrent_handle torrentHandle;
Path path; Path path;
MoveStorageMode mode; MoveStorageMode mode {};
MoveStorageContext context; MoveStorageContext context {};
}; };
struct RemovingTorrentData struct RemovingTorrentData
{ {
QString name; QString name;
Path pathToRemove; Path pathToRemove;
DeleteOption deleteOption; DeleteOption deleteOption {};
}; };
explicit SessionImpl(QObject *parent = nullptr); explicit SessionImpl(QObject *parent = nullptr);

6
src/base/bittorrent/torrentcreatorthread.h

@ -46,14 +46,14 @@ namespace BitTorrent
struct TorrentCreatorParams struct TorrentCreatorParams
{ {
bool isPrivate; bool isPrivate = false;
#ifdef QBT_USES_LIBTORRENT2 #ifdef QBT_USES_LIBTORRENT2
TorrentFormat torrentFormat; TorrentFormat torrentFormat = TorrentFormat::Hybrid;
#else #else
bool isAlignmentOptimized; bool isAlignmentOptimized;
int paddedFileSizeLimit; int paddedFileSizeLimit;
#endif #endif
int pieceSize; int pieceSize = 0;
Path inputPath; Path inputPath;
Path savePath; Path savePath;
QString comment; QString comment;

2
src/base/bittorrent/torrentimpl.h

@ -84,7 +84,7 @@ namespace BitTorrent
struct FileErrorInfo struct FileErrorInfo
{ {
lt::error_code error; lt::error_code error;
lt::operation_t operation; lt::operation_t operation = lt::operation_t::unknown;
}; };
class TorrentImpl final : public Torrent class TorrentImpl final : public Torrent

4
src/base/http/requestparser.h

@ -47,9 +47,9 @@ namespace Http
struct ParseResult struct ParseResult
{ {
// when `status != ParseStatus::OK`, `request` & `frameSize` are undefined // when `status != ParseStatus::OK`, `request` & `frameSize` are undefined
ParseStatus status; ParseStatus status = ParseStatus::BadRequest;
Request request; Request request;
long frameSize; // http request frame size (bytes) long frameSize = 0; // http request frame size (bytes)
}; };
static ParseResult parse(const QByteArray &data); static ParseResult parse(const QByteArray &data);

4
src/base/http/types.h

@ -79,10 +79,10 @@ namespace Http
struct Environment struct Environment
{ {
QHostAddress localAddress; QHostAddress localAddress;
quint16 localPort; quint16 localPort = 0;
QHostAddress clientAddress; QHostAddress clientAddress;
quint16 clientPort; quint16 clientPort = 0;
}; };
struct UploadedFile struct UploadedFile

12
src/base/logger.h

@ -51,17 +51,17 @@ namespace Log
struct Msg struct Msg
{ {
int id; int id = -1;
MsgType type; MsgType type = ALL;
qint64 timestamp; qint64 timestamp = -1;
QString message; QString message;
}; };
struct Peer struct Peer
{ {
int id; int id = -1;
bool blocked; bool blocked = false;
qint64 timestamp; qint64 timestamp = -1;
QString ip; QString ip;
QString reason; QString reason;
}; };

2
src/base/net/dnsupdater.cpp

@ -44,8 +44,6 @@ const std::chrono::seconds IP_CHECK_INTERVAL = 30min;
DNSUpdater::DNSUpdater(QObject *parent) DNSUpdater::DNSUpdater(QObject *parent)
: QObject(parent) : QObject(parent)
, m_state(OK)
, m_service(DNS::Service::None)
{ {
updateCredentials(); updateCredentials();

4
src/base/net/dnsupdater.h

@ -74,9 +74,9 @@ namespace Net
QHostAddress m_lastIP; QHostAddress m_lastIP;
QDateTime m_lastIPCheckTime; QDateTime m_lastIPCheckTime;
QTimer m_ipCheckTimer; QTimer m_ipCheckTimer;
int m_state; int m_state = OK;
// Service creds // Service creds
DNS::Service m_service; DNS::Service m_service = DNS::Service::None;
QString m_domain; QString m_domain;
QString m_username; QString m_username;
QString m_password; QString m_password;

2
src/base/net/downloadmanager.h

@ -103,7 +103,7 @@ namespace Net
struct DownloadResult struct DownloadResult
{ {
QString url; QString url;
DownloadStatus status; DownloadStatus status = DownloadStatus::Failed;
QString errorString; QString errorString;
QByteArray data; QByteArray data;
Path filePath; Path filePath;

2
src/base/profile_p.cpp

@ -177,7 +177,7 @@ std::unique_ptr<QSettings> Private::CustomProfile::applicationSettings(const QSt
const auto CONF_FILE_EXTENSION = u".conf"_qs; const auto CONF_FILE_EXTENSION = u".conf"_qs;
#endif #endif
const Path settingsFilePath = configLocation() / Path(name + CONF_FILE_EXTENSION); const Path settingsFilePath = configLocation() / Path(name + CONF_FILE_EXTENSION);
return std::unique_ptr<QSettings>(new QSettings(settingsFilePath.data(), QSettings::IniFormat)); return std::make_unique<QSettings>(settingsFilePath.data(), QSettings::IniFormat);
} }
Path Private::NoConvertConverter::fromPortablePath(const Path &portablePath) const Path Private::NoConvertConverter::fromPortablePath(const Path &portablePath) const

5
src/base/rss/rss_parser.cpp

@ -723,13 +723,16 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml)
: xml.attributes().value(u"href"_qs).toString()); : xml.attributes().value(u"href"_qs).toString());
if (link.startsWith(u"magnet:", Qt::CaseInsensitive)) if (link.startsWith(u"magnet:", Qt::CaseInsensitive))
{
article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL
}
else else
{
// Atom feeds can have relative links, work around this and // Atom feeds can have relative links, work around this and
// take the stress of figuring article full URI from UI // take the stress of figuring article full URI from UI
// Assemble full URI // Assemble full URI
article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link); article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link);
}
} }
else if ((name == u"summary") || (name == u"content")) else if ((name == u"summary") || (name == u"content"))
{ {

6
src/base/search/searchhandler.h

@ -42,9 +42,9 @@ struct SearchResult
{ {
QString fileName; QString fileName;
QString fileUrl; QString fileUrl;
qlonglong fileSize; qlonglong fileSize = 0;
qlonglong nbSeeders; qlonglong nbSeeders = 0;
qlonglong nbLeechers; qlonglong nbLeechers = 0;
QString siteUrl; QString siteUrl;
QString descrLink; QString descrLink;
}; };

2
src/base/search/searchpluginmanager.cpp

@ -366,7 +366,7 @@ QString SearchPluginManager::categoryFullName(const QString &categoryName)
return categoryTable.value(categoryName); return categoryTable.value(categoryName);
} }
QString SearchPluginManager::pluginFullName(const QString &pluginName) QString SearchPluginManager::pluginFullName(const QString &pluginName) const
{ {
return pluginInfo(pluginName) ? pluginInfo(pluginName)->fullName : QString(); return pluginInfo(pluginName) ? pluginInfo(pluginName)->fullName : QString();
} }

4
src/base/search/searchpluginmanager.h

@ -52,7 +52,7 @@ struct PluginInfo
QString url; QString url;
QStringList supportedCategories; QStringList supportedCategories;
Path iconPath; Path iconPath;
bool enabled; bool enabled = false;
}; };
class SearchDownloadHandler; class SearchDownloadHandler;
@ -88,7 +88,7 @@ public:
static PluginVersion getPluginVersion(const Path &filePath); static PluginVersion getPluginVersion(const Path &filePath);
static QString categoryFullName(const QString &categoryName); static QString categoryFullName(const QString &categoryName);
QString pluginFullName(const QString &pluginName); QString pluginFullName(const QString &pluginName) const;
static Path pluginsLocation(); static Path pluginsLocation();
static Path engineLocation(); static Path engineLocation();

49
src/gui/powermanagement/powermanagement_x11.cpp

@ -57,27 +57,21 @@ void PowerManagementInhibitor::requestIdle()
if ((m_state == Error) || (m_state == Idle) || (m_state == RequestIdle) || (m_state == RequestBusy)) if ((m_state == Error) || (m_state == Idle) || (m_state == RequestIdle) || (m_state == RequestBusy))
return; return;
m_state = RequestIdle;
qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); qDebug("D-Bus: PowerManagementInhibitor: Requesting idle");
QDBusMessage call; QDBusMessage call = m_useGSM
if (!m_useGSM) ? QDBusMessage::createMethodCall(
call = QDBusMessage::createMethodCall( u"org.gnome.SessionManager"_qs,
u"/org/gnome/SessionManager"_qs,
u"org.gnome.SessionManager"_qs,
u"Uninhibit"_qs)
: QDBusMessage::createMethodCall(
u"org.freedesktop.PowerManagement"_qs, u"org.freedesktop.PowerManagement"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs, u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs, u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"UnInhibit"_qs); u"UnInhibit"_qs);
else call.setArguments({m_cookie});
call = QDBusMessage::createMethodCall(
u"org.gnome.SessionManager"_qs,
u"/org/gnome/SessionManager"_qs,
u"org.gnome.SessionManager"_qs,
u"Uninhibit"_qs);
m_state = RequestIdle;
QList<QVariant> args;
args << m_cookie;
call.setArguments(args);
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000);
auto *watcher = new QDBusPendingCallWatcher(pcall, this); auto *watcher = new QDBusPendingCallWatcher(pcall, this);
@ -91,28 +85,27 @@ void PowerManagementInhibitor::requestBusy()
if ((m_state == Error) || (m_state == Busy) || (m_state == RequestBusy) || (m_state == RequestIdle)) if ((m_state == Error) || (m_state == Busy) || (m_state == RequestBusy) || (m_state == RequestIdle))
return; return;
m_state = RequestBusy;
qDebug("D-Bus: PowerManagementInhibitor: Requesting busy"); qDebug("D-Bus: PowerManagementInhibitor: Requesting busy");
QDBusMessage call; QDBusMessage call = m_useGSM
if (!m_useGSM) ? QDBusMessage::createMethodCall(
call = QDBusMessage::createMethodCall(
u"org.freedesktop.PowerManagement"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"Inhibit"_qs);
else
call = QDBusMessage::createMethodCall(
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_qs,
u"/org/gnome/SessionManager"_qs, u"/org/gnome/SessionManager"_qs,
u"org.gnome.SessionManager"_qs, u"org.gnome.SessionManager"_qs,
u"Inhibit"_qs)
: QDBusMessage::createMethodCall(
u"org.freedesktop.PowerManagement"_qs,
u"/org/freedesktop/PowerManagement/Inhibit"_qs,
u"org.freedesktop.PowerManagement.Inhibit"_qs,
u"Inhibit"_qs); u"Inhibit"_qs);
m_state = RequestBusy;
QList<QVariant> args = {u"qBittorrent"_qs}; QList<QVariant> args = {u"qBittorrent"_qs};
if (m_useGSM) args << 0u; if (m_useGSM)
args << 0u;
args << u"Active torrents are presented"_qs; args << u"Active torrents are presented"_qs;
if (m_useGSM) args << 8u; if (m_useGSM)
args << 8u;
call.setArguments(args); call.setArguments(args);
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000);

2
src/gui/properties/speedplotview.h

@ -139,5 +139,5 @@ private:
Averager *m_currentAverager {&m_averager5Min}; Averager *m_currentAverager {&m_averager5Min};
QMap<GraphID, GraphProperties> m_properties; QMap<GraphID, GraphProperties> m_properties;
milliseconds m_currentMaxDuration; milliseconds m_currentMaxDuration {0};
}; };

13
src/gui/rss/feedlistwidget.cpp

@ -243,15 +243,12 @@ void FeedListWidget::dragMoveEvent(QDragMoveEvent *event)
QTreeWidget::dragMoveEvent(event); QTreeWidget::dragMoveEvent(event);
QTreeWidgetItem *item = itemAt(event->pos()); QTreeWidgetItem *item = itemAt(event->pos());
// Prohibit dropping onto global unread counter if ((item == m_unreadStickyItem) // Prohibit dropping onto global unread counter
if (item == m_unreadStickyItem) || selectedItems().contains(m_unreadStickyItem) // Prohibit dragging of global unread counter
event->ignore(); || (item && isFeed(item))) // Prohibit dropping onto feeds
// Prohibit dragging of global unread counter {
else if (selectedItems().contains(m_unreadStickyItem))
event->ignore();
// Prohibit dropping onto feeds
else if (item && isFeed(item))
event->ignore(); event->ignore();
}
} }
void FeedListWidget::dropEvent(QDropEvent *event) void FeedListWidget::dropEvent(QDropEvent *event)

7
src/gui/search/searchsortmodel.cpp

@ -32,13 +32,6 @@
SearchSortModel::SearchSortModel(QObject *parent) SearchSortModel::SearchSortModel(QObject *parent)
: base(parent) : base(parent)
, m_isNameFilterEnabled(false)
, m_minSeeds(0)
, m_maxSeeds(-1)
, m_minLeeches(0)
, m_maxLeeches(-1)
, m_minSize(0)
, m_maxSize(-1)
{ {
setSortRole(UnderlyingDataRole); setSortRole(UnderlyingDataRole);
setFilterRole(UnderlyingDataRole); setFilterRole(UnderlyingDataRole);

8
src/gui/search/searchsortmodel.h

@ -90,12 +90,12 @@ protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
private: private:
bool m_isNameFilterEnabled; bool m_isNameFilterEnabled = false;
QString m_searchTerm; QString m_searchTerm;
QStringList m_searchTermWords; QStringList m_searchTermWords;
int m_minSeeds, m_maxSeeds; int m_minSeeds = 0, m_maxSeeds = -1;
int m_minLeeches, m_maxLeeches; int m_minLeeches = 0, m_maxLeeches = -1;
qint64 m_minSize, m_maxSize; qint64 m_minSize = 0, m_maxSize = -1;
Utils::Compare::NaturalLessThan<Qt::CaseInsensitive> m_naturalLessThan; Utils::Compare::NaturalLessThan<Qt::CaseInsensitive> m_naturalLessThan;
}; };

11
src/gui/search/searchwidget.cpp

@ -75,7 +75,6 @@ namespace
case SearchJobWidget::Status::Aborted: case SearchJobWidget::Status::Aborted:
return u"task-reject"_qs; return u"task-reject"_qs;
case SearchJobWidget::Status::Error: case SearchJobWidget::Status::Error:
return u"dialog-warning"_qs;
case SearchJobWidget::Status::NoResults: case SearchJobWidget::Status::NoResults:
return u"dialog-warning"_qs; return u"dialog-warning"_qs;
default: default:
@ -330,15 +329,15 @@ void SearchWidget::on_searchButton_clicked()
return; return;
} }
const QString plugin = selectedPlugin();
QStringList plugins; QStringList plugins;
if (selectedPlugin() == u"all") if (plugin == u"all")
plugins = SearchPluginManager::instance()->allPlugins(); plugins = SearchPluginManager::instance()->allPlugins();
else if (selectedPlugin() == u"enabled") else if ((plugin == u"enabled") || (plugin == u"multi"))
plugins = SearchPluginManager::instance()->enabledPlugins();
else if (selectedPlugin() == u"multi")
plugins = SearchPluginManager::instance()->enabledPlugins(); plugins = SearchPluginManager::instance()->enabledPlugins();
else else
plugins << selectedPlugin(); plugins << plugin;
qDebug("Search with category: %s", qUtf8Printable(selectedCategory())); qDebug("Search with category: %s", qUtf8Printable(selectedCategory()));

2
src/gui/torrenttagsdialog.h

@ -52,6 +52,6 @@ public:
private: private:
void addNewTag(); void addNewTag();
Ui::TorrentTagsDialog *m_ui; Ui::TorrentTagsDialog *m_ui = nullptr;
SettingValue<QSize> m_storeDialogSize; SettingValue<QSize> m_storeDialogSize;
}; };

2
src/gui/transferlistfilters/categoryfiltermodel.cpp

@ -40,7 +40,7 @@ class CategoryModelItem
public: public:
CategoryModelItem() = default; CategoryModelItem() = default;
CategoryModelItem(CategoryModelItem *parent, QString categoryName, int torrentsCount = 0) CategoryModelItem(CategoryModelItem *parent, const QString &categoryName, const int torrentsCount = 0)
: m_name(categoryName) : m_name(categoryName)
, m_torrentsCount(torrentsCount) , m_torrentsCount(torrentsCount)
{ {

2
src/gui/transferlistfilters/categoryfiltermodel.h

@ -72,6 +72,6 @@ private:
QModelIndex index(CategoryModelItem *item) const; QModelIndex index(CategoryModelItem *item) const;
CategoryModelItem *findItem(const QString &fullName) const; CategoryModelItem *findItem(const QString &fullName) const;
bool m_isSubcategoriesEnabled; bool m_isSubcategoriesEnabled = false;
CategoryModelItem *m_rootItem = nullptr; CategoryModelItem *m_rootItem = nullptr;
}; };

2
src/gui/tristatewidget.cpp

@ -38,8 +38,6 @@
TriStateWidget::TriStateWidget(const QString &text, QWidget *parent) TriStateWidget::TriStateWidget(const QString &text, QWidget *parent)
: QWidget {parent} : QWidget {parent}
, m_closeOnInteraction {true}
, m_checkState {Qt::Unchecked}
, m_text {text} , m_text {text}
{ {
setMouseTracking(true); // for visual effects via mouse navigation setMouseTracking(true); // for visual effects via mouse navigation

4
src/gui/tristatewidget.h

@ -55,7 +55,7 @@ private:
void toggleCheckState(); void toggleCheckState();
bool m_closeOnInteraction; bool m_closeOnInteraction = true;
Qt::CheckState m_checkState; Qt::CheckState m_checkState = Qt::Unchecked;
const QString m_text; const QString m_text;
}; };

2
src/gui/uithemedialog.h

@ -60,7 +60,7 @@ private:
bool storeColors(); bool storeColors();
bool storeIcons(); bool storeIcons();
Ui::UIThemeDialog *m_ui; Ui::UIThemeDialog *m_ui = nullptr;
SettingValue<QSize> m_storeDialogSize; SettingValue<QSize> m_storeDialogSize;
DefaultThemeSource m_defaultThemeSource; DefaultThemeSource m_defaultThemeSource;

6
src/webui/api/synccontroller.cpp

@ -331,19 +331,25 @@ namespace
for (const QVariant &item : data) for (const QVariant &item : data)
{ {
if (!prevData.contains(item)) if (!prevData.contains(item))
{
// new list item found - append it to syncData // new list item found - append it to syncData
syncData.append(item); syncData.append(item);
}
else else
{
// unchanged list item found - remove it from prevData // unchanged list item found - remove it from prevData
prevData.removeOne(item); prevData.removeOne(item);
} }
}
if (!prevData.isEmpty()) if (!prevData.isEmpty())
{
// prevData contains only items that are missing now - // prevData contains only items that are missing now -
// put them in removedItems // put them in removedItems
removedItems = prevData; removedItems = prevData;
} }
} }
}
QJsonObject generateSyncData(int acceptedResponseId, const QVariantMap &data, QVariantMap &lastAcceptedData, QVariantMap &lastData) QJsonObject generateSyncData(int acceptedResponseId, const QVariantMap &data, QVariantMap &lastAcceptedData, QVariantMap &lastData)
{ {

4
src/webui/webapplication.cpp

@ -730,9 +730,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
{ {
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue); const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue);
if (isInvalid) if (isInvalid)
{
LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'") LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString(), originValue, targetOrigin) .arg(m_env.clientAddress.toString(), originValue, targetOrigin)
, Log::WARNING); , Log::WARNING);
}
return isInvalid; return isInvalid;
} }
@ -740,9 +742,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
{ {
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue); const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue);
if (isInvalid) if (isInvalid)
{
LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'") LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString(), refererValue, targetOrigin) .arg(m_env.clientAddress.toString(), refererValue, targetOrigin)
, Log::WARNING); , Log::WARNING);
}
return isInvalid; return isInvalid;
} }

16
src/webui/webapplication.h

@ -222,21 +222,21 @@ private:
bool m_translationFileLoaded = false; bool m_translationFileLoaded = false;
AuthController *m_authController = nullptr; AuthController *m_authController = nullptr;
bool m_isLocalAuthEnabled; bool m_isLocalAuthEnabled = false;
bool m_isAuthSubnetWhitelistEnabled; bool m_isAuthSubnetWhitelistEnabled = false;
QVector<Utils::Net::Subnet> m_authSubnetWhitelist; QVector<Utils::Net::Subnet> m_authSubnetWhitelist;
int m_sessionTimeout; int m_sessionTimeout = 0;
QString m_sessionCookieName; QString m_sessionCookieName;
// security related // security related
QStringList m_domainList; QStringList m_domainList;
bool m_isCSRFProtectionEnabled; bool m_isCSRFProtectionEnabled = true;
bool m_isSecureCookieEnabled; bool m_isSecureCookieEnabled = true;
bool m_isHostHeaderValidationEnabled; bool m_isHostHeaderValidationEnabled = true;
bool m_isHttpsEnabled; bool m_isHttpsEnabled = false;
// Reverse proxy // Reverse proxy
bool m_isReverseProxySupportEnabled; bool m_isReverseProxySupportEnabled = false;
QVector<Utils::Net::Subnet> m_trustedReverseProxyList; QVector<Utils::Net::Subnet> m_trustedReverseProxyList;
QHostAddress m_clientAddress; QHostAddress m_clientAddress;

Loading…
Cancel
Save