mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #19277 from Chocobo1/ctor
Don't update settings when it hasn't changed
This commit is contained in:
commit
fff7b1dcbd
@ -35,7 +35,7 @@
|
||||
|
||||
class QString;
|
||||
|
||||
class IconProvider : public QObject
|
||||
class IconProvider final : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(IconProvider)
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace Log
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Log::MsgTypes)
|
||||
|
||||
class Logger : public QObject
|
||||
class Logger final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(Logger)
|
||||
|
@ -126,7 +126,7 @@ namespace Net
|
||||
|
||||
class DownloadHandlerImpl;
|
||||
|
||||
class DownloadManager : public QObject
|
||||
class DownloadManager final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(DownloadManager)
|
||||
|
@ -40,7 +40,7 @@ namespace Net
|
||||
{
|
||||
struct DownloadResult;
|
||||
|
||||
class GeoIPManager : public QObject
|
||||
class GeoIPManager final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(GeoIPManager)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -86,7 +86,7 @@ namespace TrayIcon
|
||||
Q_ENUM_NS(Style)
|
||||
}
|
||||
|
||||
class Preferences : public QObject
|
||||
class Preferences final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(Preferences)
|
||||
@ -142,7 +142,7 @@ public:
|
||||
QString getMailNotificationEmail() const;
|
||||
void setMailNotificationEmail(const QString &mail);
|
||||
QString getMailNotificationSMTP() const;
|
||||
void setMailNotificationSMTP(const QString &smtp_server);
|
||||
void setMailNotificationSMTP(const QString &smtpServer);
|
||||
bool getMailNotificationSMTPSSL() const;
|
||||
void setMailNotificationSMTPSSL(bool use);
|
||||
bool getMailNotificationSMTPAuth() const;
|
||||
@ -291,14 +291,14 @@ public:
|
||||
bool neverCheckFileAssoc() const;
|
||||
void setNeverCheckFileAssoc(bool check = true);
|
||||
static bool isTorrentFileAssocSet();
|
||||
static bool isMagnetLinkAssocSet();
|
||||
static void setTorrentFileAssoc(bool set);
|
||||
static bool isMagnetLinkAssocSet();
|
||||
static void setMagnetLinkAssoc(bool set);
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
static bool isTorrentFileAssocSet();
|
||||
static bool isMagnetLinkAssocSet();
|
||||
static void setTorrentFileAssoc();
|
||||
static bool isMagnetLinkAssocSet();
|
||||
static void setMagnetLinkAssoc();
|
||||
#endif
|
||||
int getTrackerPort() const;
|
||||
|
@ -88,7 +88,7 @@ namespace RSS
|
||||
class Folder;
|
||||
class Item;
|
||||
|
||||
class Session : public QObject
|
||||
class Session final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(Session)
|
||||
|
@ -58,7 +58,7 @@ struct PluginInfo
|
||||
class SearchDownloadHandler;
|
||||
class SearchHandler;
|
||||
|
||||
class SearchPluginManager : public QObject
|
||||
class SearchPluginManager final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(SearchPluginManager)
|
||||
|
@ -79,8 +79,10 @@ SettingsStorage *SettingsStorage::instance()
|
||||
|
||||
bool SettingsStorage::save()
|
||||
{
|
||||
// return `true` only when settings is different AND is saved successfully
|
||||
|
||||
const QWriteLocker locker(&m_lock); // guard for `m_dirty` too
|
||||
if (!m_dirty) return true;
|
||||
if (!m_dirty) return false;
|
||||
|
||||
if (!writeNativeSettings())
|
||||
{
|
||||
|
@ -68,6 +68,9 @@ void WebUI::configure()
|
||||
|
||||
// http server
|
||||
const QString serverAddressString = pref->getWebUiAddress();
|
||||
const auto serverAddress = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
||||
? QHostAddress::Any : QHostAddress(serverAddressString);
|
||||
|
||||
if (!m_httpServer)
|
||||
{
|
||||
m_webapp = new WebApplication(app(), this);
|
||||
@ -75,8 +78,7 @@ void WebUI::configure()
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((m_httpServer->serverAddress().toString() != serverAddressString)
|
||||
|| (m_httpServer->serverPort() != port))
|
||||
if ((m_httpServer->serverAddress() != serverAddress) || (m_httpServer->serverPort() != port))
|
||||
m_httpServer->close();
|
||||
}
|
||||
|
||||
@ -103,9 +105,7 @@ void WebUI::configure()
|
||||
|
||||
if (!m_httpServer->isListening())
|
||||
{
|
||||
const auto address = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
||||
? QHostAddress::Any : QHostAddress(serverAddressString);
|
||||
bool success = m_httpServer->listen(address, port);
|
||||
const bool success = m_httpServer->listen(serverAddress, port);
|
||||
if (success)
|
||||
{
|
||||
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));
|
||||
|
Loading…
Reference in New Issue
Block a user