diff --git a/src/app/application.cpp b/src/app/application.cpp index c50c82a4b..47c0431c3 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -224,7 +224,6 @@ namespace Application::Application(int &argc, char **argv) : BaseApplication(argc, argv) - , m_shutdownAct(ShutdownDialogAction::Exit) , m_commandLineArgs(parseCommandLine(Application::arguments())) , m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs)) , m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs)) diff --git a/src/app/application.h b/src/app/application.h index e7f1b1d14..ee69f5afc 100644 --- a/src/app/application.h +++ b/src/app/application.h @@ -173,7 +173,7 @@ private: ApplicationInstanceManager *m_instanceManager = nullptr; QAtomicInt m_isCleanupRun; bool m_isProcessingParamsAllowed = false; - ShutdownDialogAction m_shutdownAct; + ShutdownDialogAction m_shutdownAct = ShutdownDialogAction::Exit; QBtCommandLineParameters m_commandLineArgs; // FileLog diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index cebfcbbf7..fa80a57dc 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -198,13 +198,15 @@ namespace int value(const QString &arg) const { - QString val = StringOption::value(arg); + const QString val = StringOption::value(arg); bool ok = false; - int res = val.toInt(&ok); + const int res = val.toInt(&ok); if (!ok) + { throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--webui-port' must follow syntax '--webui-port='") .arg(fullParameter(), u""_qs)); + } return res; } diff --git a/src/base/bittorrent/bandwidthscheduler.cpp b/src/base/bittorrent/bandwidthscheduler.cpp index ca4c5d5a3..bb8d1d0a8 100644 --- a/src/base/bittorrent/bandwidthscheduler.cpp +++ b/src/base/bittorrent/bandwidthscheduler.cpp @@ -41,7 +41,6 @@ using namespace std::chrono_literals; BandwidthScheduler::BandwidthScheduler(QObject *parent) : QObject(parent) - , m_lastAlternative(false) { connect(&m_timer, &QTimer::timeout, this, &BandwidthScheduler::onTimeout); } diff --git a/src/base/bittorrent/bandwidthscheduler.h b/src/base/bittorrent/bandwidthscheduler.h index ecbb43d8d..00eebe7ad 100644 --- a/src/base/bittorrent/bandwidthscheduler.h +++ b/src/base/bittorrent/bandwidthscheduler.h @@ -49,5 +49,5 @@ private: void onTimeout(); QTimer m_timer; - bool m_lastAlternative; + bool m_lastAlternative = false; }; diff --git a/src/base/bittorrent/filterparserthread.cpp b/src/base/bittorrent/filterparserthread.cpp index cdd8f88b1..3b92396f2 100644 --- a/src/base/bittorrent/filterparserthread.cpp +++ b/src/base/bittorrent/filterparserthread.cpp @@ -89,7 +89,7 @@ namespace } private: - lt::address_v4::bytes_type m_buf; + lt::address_v4::bytes_type m_buf {}; }; bool parseIPAddress(const char *data, lt::address &address) @@ -111,7 +111,6 @@ namespace FilterParserThread::FilterParserThread(QObject *parent) : QThread(parent) - , m_abort(false) { } diff --git a/src/base/bittorrent/filterparserthread.h b/src/base/bittorrent/filterparserthread.h index b118d706e..2b734a555 100644 --- a/src/base/bittorrent/filterparserthread.h +++ b/src/base/bittorrent/filterparserthread.h @@ -62,7 +62,7 @@ private: int getlineInStream(QDataStream &stream, std::string &name, char delim); int parseP2BFilterFile(); - bool m_abort; + bool m_abort = false; Path m_filePath; lt::ip_filter m_filter; }; diff --git a/src/base/bittorrent/loadtorrentparams.h b/src/base/bittorrent/loadtorrentparams.h index 1ebbcfe47..68932c609 100644 --- a/src/base/bittorrent/loadtorrentparams.h +++ b/src/base/bittorrent/loadtorrentparams.h @@ -54,7 +54,7 @@ namespace BitTorrent bool firstLastPiecePriority = false; bool hasFinishedStatus = false; bool stopped = false; - Torrent::StopCondition stopCondition; + Torrent::StopCondition stopCondition = Torrent::StopCondition::None; bool addToQueueTop = false; // only for new torrents diff --git a/src/base/bittorrent/magneturi.cpp b/src/base/bittorrent/magneturi.cpp index dba8bb392..2c0154bce 100644 --- a/src/base/bittorrent/magneturi.cpp +++ b/src/base/bittorrent/magneturi.cpp @@ -75,8 +75,7 @@ using namespace BitTorrent; const int magnetUriId = qRegisterMetaType(); MagnetUri::MagnetUri(const QString &source) - : m_valid(false) - , m_url(source) + : m_url(source) { if (source.isEmpty()) return; diff --git a/src/base/bittorrent/magneturi.h b/src/base/bittorrent/magneturi.h index 861ce53b2..f0becd129 100644 --- a/src/base/bittorrent/magneturi.h +++ b/src/base/bittorrent/magneturi.h @@ -54,7 +54,7 @@ namespace BitTorrent lt::add_torrent_params addTorrentParams() const; private: - bool m_valid; + bool m_valid = false; QString m_url; InfoHash m_infoHash; QString m_name; diff --git a/src/base/bittorrent/sessionimpl.h b/src/base/bittorrent/sessionimpl.h index b2b93cb8d..257437aa0 100644 --- a/src/base/bittorrent/sessionimpl.h +++ b/src/base/bittorrent/sessionimpl.h @@ -485,15 +485,15 @@ namespace BitTorrent { lt::torrent_handle torrentHandle; Path path; - MoveStorageMode mode; - MoveStorageContext context; + MoveStorageMode mode {}; + MoveStorageContext context {}; }; struct RemovingTorrentData { QString name; Path pathToRemove; - DeleteOption deleteOption; + DeleteOption deleteOption {}; }; explicit SessionImpl(QObject *parent = nullptr); diff --git a/src/base/bittorrent/torrentcreatorthread.h b/src/base/bittorrent/torrentcreatorthread.h index 02b33f79b..31afeeb0c 100644 --- a/src/base/bittorrent/torrentcreatorthread.h +++ b/src/base/bittorrent/torrentcreatorthread.h @@ -46,14 +46,14 @@ namespace BitTorrent struct TorrentCreatorParams { - bool isPrivate; + bool isPrivate = false; #ifdef QBT_USES_LIBTORRENT2 - TorrentFormat torrentFormat; + TorrentFormat torrentFormat = TorrentFormat::Hybrid; #else bool isAlignmentOptimized; int paddedFileSizeLimit; #endif - int pieceSize; + int pieceSize = 0; Path inputPath; Path savePath; QString comment; diff --git a/src/base/bittorrent/torrentimpl.h b/src/base/bittorrent/torrentimpl.h index c0657ccf7..685944293 100644 --- a/src/base/bittorrent/torrentimpl.h +++ b/src/base/bittorrent/torrentimpl.h @@ -84,7 +84,7 @@ namespace BitTorrent struct FileErrorInfo { lt::error_code error; - lt::operation_t operation; + lt::operation_t operation = lt::operation_t::unknown; }; class TorrentImpl final : public Torrent diff --git a/src/base/http/requestparser.h b/src/base/http/requestparser.h index 56ecc51e8..0cab0db0e 100644 --- a/src/base/http/requestparser.h +++ b/src/base/http/requestparser.h @@ -47,9 +47,9 @@ namespace Http struct ParseResult { // when `status != ParseStatus::OK`, `request` & `frameSize` are undefined - ParseStatus status; + ParseStatus status = ParseStatus::BadRequest; Request request; - long frameSize; // http request frame size (bytes) + long frameSize = 0; // http request frame size (bytes) }; static ParseResult parse(const QByteArray &data); diff --git a/src/base/http/types.h b/src/base/http/types.h index 41b2b8bf5..fca20dc6c 100644 --- a/src/base/http/types.h +++ b/src/base/http/types.h @@ -79,10 +79,10 @@ namespace Http struct Environment { QHostAddress localAddress; - quint16 localPort; + quint16 localPort = 0; QHostAddress clientAddress; - quint16 clientPort; + quint16 clientPort = 0; }; struct UploadedFile diff --git a/src/base/logger.h b/src/base/logger.h index 429335e36..39aa8afb1 100644 --- a/src/base/logger.h +++ b/src/base/logger.h @@ -51,17 +51,17 @@ namespace Log struct Msg { - int id; - MsgType type; - qint64 timestamp; + int id = -1; + MsgType type = ALL; + qint64 timestamp = -1; QString message; }; struct Peer { - int id; - bool blocked; - qint64 timestamp; + int id = -1; + bool blocked = false; + qint64 timestamp = -1; QString ip; QString reason; }; diff --git a/src/base/net/dnsupdater.cpp b/src/base/net/dnsupdater.cpp index 2339c6444..0d201adc3 100644 --- a/src/base/net/dnsupdater.cpp +++ b/src/base/net/dnsupdater.cpp @@ -44,8 +44,6 @@ const std::chrono::seconds IP_CHECK_INTERVAL = 30min; DNSUpdater::DNSUpdater(QObject *parent) : QObject(parent) - , m_state(OK) - , m_service(DNS::Service::None) { updateCredentials(); diff --git a/src/base/net/dnsupdater.h b/src/base/net/dnsupdater.h index e7141b82f..b89ec0e61 100644 --- a/src/base/net/dnsupdater.h +++ b/src/base/net/dnsupdater.h @@ -74,9 +74,9 @@ namespace Net QHostAddress m_lastIP; QDateTime m_lastIPCheckTime; QTimer m_ipCheckTimer; - int m_state; + int m_state = OK; // Service creds - DNS::Service m_service; + DNS::Service m_service = DNS::Service::None; QString m_domain; QString m_username; QString m_password; diff --git a/src/base/net/downloadmanager.h b/src/base/net/downloadmanager.h index 19c2ce085..aeb2b4887 100644 --- a/src/base/net/downloadmanager.h +++ b/src/base/net/downloadmanager.h @@ -103,7 +103,7 @@ namespace Net struct DownloadResult { QString url; - DownloadStatus status; + DownloadStatus status = DownloadStatus::Failed; QString errorString; QByteArray data; Path filePath; diff --git a/src/base/profile_p.cpp b/src/base/profile_p.cpp index e27a232a4..e90c96139 100644 --- a/src/base/profile_p.cpp +++ b/src/base/profile_p.cpp @@ -177,7 +177,7 @@ std::unique_ptr Private::CustomProfile::applicationSettings(const QSt const auto CONF_FILE_EXTENSION = u".conf"_qs; #endif const Path settingsFilePath = configLocation() / Path(name + CONF_FILE_EXTENSION); - return std::unique_ptr(new QSettings(settingsFilePath.data(), QSettings::IniFormat)); + return std::make_unique(settingsFilePath.data(), QSettings::IniFormat); } Path Private::NoConvertConverter::fromPortablePath(const Path &portablePath) const diff --git a/src/base/rss/rss_parser.cpp b/src/base/rss/rss_parser.cpp index e07e7811d..ec940825a 100644 --- a/src/base/rss/rss_parser.cpp +++ b/src/base/rss/rss_parser.cpp @@ -723,13 +723,16 @@ void RSS::Private::Parser::parseAtomArticle(QXmlStreamReader &xml) : xml.attributes().value(u"href"_qs).toString()); if (link.startsWith(u"magnet:", Qt::CaseInsensitive)) + { article[Article::KeyTorrentURL] = link; // magnet link instead of a news URL + } else + { // Atom feeds can have relative links, work around this and // take the stress of figuring article full URI from UI // Assemble full URI article[Article::KeyLink] = (m_baseUrl.isEmpty() ? link : m_baseUrl + link); - + } } else if ((name == u"summary") || (name == u"content")) { diff --git a/src/base/search/searchhandler.h b/src/base/search/searchhandler.h index bda41fe89..b11a24de7 100644 --- a/src/base/search/searchhandler.h +++ b/src/base/search/searchhandler.h @@ -42,9 +42,9 @@ struct SearchResult { QString fileName; QString fileUrl; - qlonglong fileSize; - qlonglong nbSeeders; - qlonglong nbLeechers; + qlonglong fileSize = 0; + qlonglong nbSeeders = 0; + qlonglong nbLeechers = 0; QString siteUrl; QString descrLink; }; diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index b697ef05b..0624256cd 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -366,7 +366,7 @@ QString SearchPluginManager::categoryFullName(const QString &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(); } diff --git a/src/base/search/searchpluginmanager.h b/src/base/search/searchpluginmanager.h index 0425f9439..35ec0cf18 100644 --- a/src/base/search/searchpluginmanager.h +++ b/src/base/search/searchpluginmanager.h @@ -52,7 +52,7 @@ struct PluginInfo QString url; QStringList supportedCategories; Path iconPath; - bool enabled; + bool enabled = false; }; class SearchDownloadHandler; @@ -88,7 +88,7 @@ public: static PluginVersion getPluginVersion(const Path &filePath); static QString categoryFullName(const QString &categoryName); - QString pluginFullName(const QString &pluginName); + QString pluginFullName(const QString &pluginName) const; static Path pluginsLocation(); static Path engineLocation(); diff --git a/src/gui/powermanagement/powermanagement_x11.cpp b/src/gui/powermanagement/powermanagement_x11.cpp index 18f244ea5..d6e197bab 100644 --- a/src/gui/powermanagement/powermanagement_x11.cpp +++ b/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)) return; + m_state = RequestIdle; qDebug("D-Bus: PowerManagementInhibitor: Requesting idle"); - QDBusMessage call; - if (!m_useGSM) - call = QDBusMessage::createMethodCall( - u"org.freedesktop.PowerManagement"_qs, - u"/org/freedesktop/PowerManagement/Inhibit"_qs, - u"org.freedesktop.PowerManagement.Inhibit"_qs, - u"UnInhibit"_qs); - else - 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 args; - args << m_cookie; - call.setArguments(args); + QDBusMessage call = m_useGSM + ? 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/Inhibit"_qs, + u"org.freedesktop.PowerManagement.Inhibit"_qs, + u"UnInhibit"_qs); + call.setArguments({m_cookie}); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); 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)) return; + m_state = RequestBusy; qDebug("D-Bus: PowerManagementInhibitor: Requesting busy"); - QDBusMessage call; - if (!m_useGSM) - call = QDBusMessage::createMethodCall( + QDBusMessage call = m_useGSM + ? QDBusMessage::createMethodCall( + 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); - else - call = QDBusMessage::createMethodCall( - u"org.gnome.SessionManager"_qs, - u"/org/gnome/SessionManager"_qs, - u"org.gnome.SessionManager"_qs, - u"Inhibit"_qs); - - m_state = RequestBusy; QList args = {u"qBittorrent"_qs}; - if (m_useGSM) args << 0u; + if (m_useGSM) + args << 0u; args << u"Active torrents are presented"_qs; - if (m_useGSM) args << 8u; + if (m_useGSM) + args << 8u; call.setArguments(args); QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(call, 1000); diff --git a/src/gui/properties/speedplotview.h b/src/gui/properties/speedplotview.h index 7ef62f043..04b6dc28a 100644 --- a/src/gui/properties/speedplotview.h +++ b/src/gui/properties/speedplotview.h @@ -139,5 +139,5 @@ private: Averager *m_currentAverager {&m_averager5Min}; QMap m_properties; - milliseconds m_currentMaxDuration; + milliseconds m_currentMaxDuration {0}; }; diff --git a/src/gui/rss/feedlistwidget.cpp b/src/gui/rss/feedlistwidget.cpp index dba3a7b25..000e32bfe 100644 --- a/src/gui/rss/feedlistwidget.cpp +++ b/src/gui/rss/feedlistwidget.cpp @@ -243,15 +243,12 @@ void FeedListWidget::dragMoveEvent(QDragMoveEvent *event) QTreeWidget::dragMoveEvent(event); QTreeWidgetItem *item = itemAt(event->pos()); - // Prohibit dropping onto global unread counter - if (item == m_unreadStickyItem) - event->ignore(); - // Prohibit dragging of global unread counter - else if (selectedItems().contains(m_unreadStickyItem)) - event->ignore(); - // Prohibit dropping onto feeds - else if (item && isFeed(item)) + if ((item == m_unreadStickyItem) // Prohibit dropping onto global unread counter + || selectedItems().contains(m_unreadStickyItem) // Prohibit dragging of global unread counter + || (item && isFeed(item))) // Prohibit dropping onto feeds + { event->ignore(); + } } void FeedListWidget::dropEvent(QDropEvent *event) diff --git a/src/gui/search/searchsortmodel.cpp b/src/gui/search/searchsortmodel.cpp index 671b594eb..becf1ea72 100644 --- a/src/gui/search/searchsortmodel.cpp +++ b/src/gui/search/searchsortmodel.cpp @@ -32,13 +32,6 @@ SearchSortModel::SearchSortModel(QObject *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); setFilterRole(UnderlyingDataRole); diff --git a/src/gui/search/searchsortmodel.h b/src/gui/search/searchsortmodel.h index c5cf785bd..32f239d34 100644 --- a/src/gui/search/searchsortmodel.h +++ b/src/gui/search/searchsortmodel.h @@ -90,12 +90,12 @@ protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; private: - bool m_isNameFilterEnabled; + bool m_isNameFilterEnabled = false; QString m_searchTerm; QStringList m_searchTermWords; - int m_minSeeds, m_maxSeeds; - int m_minLeeches, m_maxLeeches; - qint64 m_minSize, m_maxSize; + int m_minSeeds = 0, m_maxSeeds = -1; + int m_minLeeches = 0, m_maxLeeches = -1; + qint64 m_minSize = 0, m_maxSize = -1; Utils::Compare::NaturalLessThan m_naturalLessThan; }; diff --git a/src/gui/search/searchwidget.cpp b/src/gui/search/searchwidget.cpp index a1ea7c15f..3ea964ad7 100644 --- a/src/gui/search/searchwidget.cpp +++ b/src/gui/search/searchwidget.cpp @@ -75,7 +75,6 @@ namespace case SearchJobWidget::Status::Aborted: return u"task-reject"_qs; case SearchJobWidget::Status::Error: - return u"dialog-warning"_qs; case SearchJobWidget::Status::NoResults: return u"dialog-warning"_qs; default: @@ -330,15 +329,15 @@ void SearchWidget::on_searchButton_clicked() return; } + const QString plugin = selectedPlugin(); + QStringList plugins; - if (selectedPlugin() == u"all") + if (plugin == u"all") plugins = SearchPluginManager::instance()->allPlugins(); - else if (selectedPlugin() == u"enabled") - plugins = SearchPluginManager::instance()->enabledPlugins(); - else if (selectedPlugin() == u"multi") + else if ((plugin == u"enabled") || (plugin == u"multi")) plugins = SearchPluginManager::instance()->enabledPlugins(); else - plugins << selectedPlugin(); + plugins << plugin; qDebug("Search with category: %s", qUtf8Printable(selectedCategory())); diff --git a/src/gui/torrenttagsdialog.h b/src/gui/torrenttagsdialog.h index b8cf9edde..c95e26337 100644 --- a/src/gui/torrenttagsdialog.h +++ b/src/gui/torrenttagsdialog.h @@ -52,6 +52,6 @@ public: private: void addNewTag(); - Ui::TorrentTagsDialog *m_ui; + Ui::TorrentTagsDialog *m_ui = nullptr; SettingValue m_storeDialogSize; }; diff --git a/src/gui/transferlistfilters/categoryfiltermodel.cpp b/src/gui/transferlistfilters/categoryfiltermodel.cpp index 99abeef62..cdb880500 100644 --- a/src/gui/transferlistfilters/categoryfiltermodel.cpp +++ b/src/gui/transferlistfilters/categoryfiltermodel.cpp @@ -40,7 +40,7 @@ class CategoryModelItem public: CategoryModelItem() = default; - CategoryModelItem(CategoryModelItem *parent, QString categoryName, int torrentsCount = 0) + CategoryModelItem(CategoryModelItem *parent, const QString &categoryName, const int torrentsCount = 0) : m_name(categoryName) , m_torrentsCount(torrentsCount) { diff --git a/src/gui/transferlistfilters/categoryfiltermodel.h b/src/gui/transferlistfilters/categoryfiltermodel.h index 1ba799f09..9576f094a 100644 --- a/src/gui/transferlistfilters/categoryfiltermodel.h +++ b/src/gui/transferlistfilters/categoryfiltermodel.h @@ -72,6 +72,6 @@ private: QModelIndex index(CategoryModelItem *item) const; CategoryModelItem *findItem(const QString &fullName) const; - bool m_isSubcategoriesEnabled; + bool m_isSubcategoriesEnabled = false; CategoryModelItem *m_rootItem = nullptr; }; diff --git a/src/gui/tristatewidget.cpp b/src/gui/tristatewidget.cpp index bc4cb0db9..2219dcb84 100644 --- a/src/gui/tristatewidget.cpp +++ b/src/gui/tristatewidget.cpp @@ -38,8 +38,6 @@ TriStateWidget::TriStateWidget(const QString &text, QWidget *parent) : QWidget {parent} - , m_closeOnInteraction {true} - , m_checkState {Qt::Unchecked} , m_text {text} { setMouseTracking(true); // for visual effects via mouse navigation diff --git a/src/gui/tristatewidget.h b/src/gui/tristatewidget.h index b65a3b541..4b5eba75b 100644 --- a/src/gui/tristatewidget.h +++ b/src/gui/tristatewidget.h @@ -55,7 +55,7 @@ private: void toggleCheckState(); - bool m_closeOnInteraction; - Qt::CheckState m_checkState; + bool m_closeOnInteraction = true; + Qt::CheckState m_checkState = Qt::Unchecked; const QString m_text; }; diff --git a/src/gui/uithemedialog.h b/src/gui/uithemedialog.h index 3d137c864..ffea740d1 100644 --- a/src/gui/uithemedialog.h +++ b/src/gui/uithemedialog.h @@ -60,7 +60,7 @@ private: bool storeColors(); bool storeIcons(); - Ui::UIThemeDialog *m_ui; + Ui::UIThemeDialog *m_ui = nullptr; SettingValue m_storeDialogSize; DefaultThemeSource m_defaultThemeSource; diff --git a/src/webui/api/synccontroller.cpp b/src/webui/api/synccontroller.cpp index 6e77396ce..e63d8bd0a 100644 --- a/src/webui/api/synccontroller.cpp +++ b/src/webui/api/synccontroller.cpp @@ -331,17 +331,23 @@ namespace for (const QVariant &item : data) { if (!prevData.contains(item)) + { // new list item found - append it to syncData syncData.append(item); + } else + { // unchanged list item found - remove it from prevData prevData.removeOne(item); + } } if (!prevData.isEmpty()) + { // prevData contains only items that are missing now - // put them in removedItems removedItems = prevData; + } } } diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 93d73e0f8..0ef09b4ff 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -730,9 +730,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const { const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue); if (isInvalid) + { LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'") .arg(m_env.clientAddress.toString(), originValue, targetOrigin) , Log::WARNING); + } return isInvalid; } @@ -740,9 +742,11 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const { const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue); if (isInvalid) + { LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'") .arg(m_env.clientAddress.toString(), refererValue, targetOrigin) , Log::WARNING); + } return isInvalid; } diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 51443a2ad..150aa3e84 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -222,21 +222,21 @@ private: bool m_translationFileLoaded = false; AuthController *m_authController = nullptr; - bool m_isLocalAuthEnabled; - bool m_isAuthSubnetWhitelistEnabled; + bool m_isLocalAuthEnabled = false; + bool m_isAuthSubnetWhitelistEnabled = false; QVector m_authSubnetWhitelist; - int m_sessionTimeout; + int m_sessionTimeout = 0; QString m_sessionCookieName; // security related QStringList m_domainList; - bool m_isCSRFProtectionEnabled; - bool m_isSecureCookieEnabled; - bool m_isHostHeaderValidationEnabled; - bool m_isHttpsEnabled; + bool m_isCSRFProtectionEnabled = true; + bool m_isSecureCookieEnabled = true; + bool m_isHostHeaderValidationEnabled = true; + bool m_isHttpsEnabled = false; // Reverse proxy - bool m_isReverseProxySupportEnabled; + bool m_isReverseProxySupportEnabled = false; QVector m_trustedReverseProxyList; QHostAddress m_clientAddress;