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 QString;
|
||||||
|
|
||||||
class IconProvider : public QObject
|
class IconProvider final : public QObject
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY_MOVE(IconProvider)
|
Q_DISABLE_COPY_MOVE(IconProvider)
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ namespace Log
|
|||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Log::MsgTypes)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Log::MsgTypes)
|
||||||
|
|
||||||
class Logger : public QObject
|
class Logger final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(Logger)
|
Q_DISABLE_COPY_MOVE(Logger)
|
||||||
|
@ -126,7 +126,7 @@ namespace Net
|
|||||||
|
|
||||||
class DownloadHandlerImpl;
|
class DownloadHandlerImpl;
|
||||||
|
|
||||||
class DownloadManager : public QObject
|
class DownloadManager final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(DownloadManager)
|
Q_DISABLE_COPY_MOVE(DownloadManager)
|
||||||
|
@ -40,7 +40,7 @@ namespace Net
|
|||||||
{
|
{
|
||||||
struct DownloadResult;
|
struct DownloadResult;
|
||||||
|
|
||||||
class GeoIPManager : public QObject
|
class GeoIPManager final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(GeoIPManager)
|
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)
|
Q_ENUM_NS(Style)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Preferences : public QObject
|
class Preferences final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(Preferences)
|
Q_DISABLE_COPY_MOVE(Preferences)
|
||||||
@ -142,7 +142,7 @@ public:
|
|||||||
QString getMailNotificationEmail() const;
|
QString getMailNotificationEmail() const;
|
||||||
void setMailNotificationEmail(const QString &mail);
|
void setMailNotificationEmail(const QString &mail);
|
||||||
QString getMailNotificationSMTP() const;
|
QString getMailNotificationSMTP() const;
|
||||||
void setMailNotificationSMTP(const QString &smtp_server);
|
void setMailNotificationSMTP(const QString &smtpServer);
|
||||||
bool getMailNotificationSMTPSSL() const;
|
bool getMailNotificationSMTPSSL() const;
|
||||||
void setMailNotificationSMTPSSL(bool use);
|
void setMailNotificationSMTPSSL(bool use);
|
||||||
bool getMailNotificationSMTPAuth() const;
|
bool getMailNotificationSMTPAuth() const;
|
||||||
@ -291,14 +291,14 @@ public:
|
|||||||
bool neverCheckFileAssoc() const;
|
bool neverCheckFileAssoc() const;
|
||||||
void setNeverCheckFileAssoc(bool check = true);
|
void setNeverCheckFileAssoc(bool check = true);
|
||||||
static bool isTorrentFileAssocSet();
|
static bool isTorrentFileAssocSet();
|
||||||
static bool isMagnetLinkAssocSet();
|
|
||||||
static void setTorrentFileAssoc(bool set);
|
static void setTorrentFileAssoc(bool set);
|
||||||
|
static bool isMagnetLinkAssocSet();
|
||||||
static void setMagnetLinkAssoc(bool set);
|
static void setMagnetLinkAssoc(bool set);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
static bool isTorrentFileAssocSet();
|
static bool isTorrentFileAssocSet();
|
||||||
static bool isMagnetLinkAssocSet();
|
|
||||||
static void setTorrentFileAssoc();
|
static void setTorrentFileAssoc();
|
||||||
|
static bool isMagnetLinkAssocSet();
|
||||||
static void setMagnetLinkAssoc();
|
static void setMagnetLinkAssoc();
|
||||||
#endif
|
#endif
|
||||||
int getTrackerPort() const;
|
int getTrackerPort() const;
|
||||||
|
@ -88,7 +88,7 @@ namespace RSS
|
|||||||
class Folder;
|
class Folder;
|
||||||
class Item;
|
class Item;
|
||||||
|
|
||||||
class Session : public QObject
|
class Session final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(Session)
|
Q_DISABLE_COPY_MOVE(Session)
|
||||||
|
@ -58,7 +58,7 @@ struct PluginInfo
|
|||||||
class SearchDownloadHandler;
|
class SearchDownloadHandler;
|
||||||
class SearchHandler;
|
class SearchHandler;
|
||||||
|
|
||||||
class SearchPluginManager : public QObject
|
class SearchPluginManager final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(SearchPluginManager)
|
Q_DISABLE_COPY_MOVE(SearchPluginManager)
|
||||||
|
@ -79,8 +79,10 @@ SettingsStorage *SettingsStorage::instance()
|
|||||||
|
|
||||||
bool SettingsStorage::save()
|
bool SettingsStorage::save()
|
||||||
{
|
{
|
||||||
|
// return `true` only when settings is different AND is saved successfully
|
||||||
|
|
||||||
const QWriteLocker locker(&m_lock); // guard for `m_dirty` too
|
const QWriteLocker locker(&m_lock); // guard for `m_dirty` too
|
||||||
if (!m_dirty) return true;
|
if (!m_dirty) return false;
|
||||||
|
|
||||||
if (!writeNativeSettings())
|
if (!writeNativeSettings())
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,9 @@ void WebUI::configure()
|
|||||||
|
|
||||||
// http server
|
// http server
|
||||||
const QString serverAddressString = pref->getWebUiAddress();
|
const QString serverAddressString = pref->getWebUiAddress();
|
||||||
|
const auto serverAddress = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
||||||
|
? QHostAddress::Any : QHostAddress(serverAddressString);
|
||||||
|
|
||||||
if (!m_httpServer)
|
if (!m_httpServer)
|
||||||
{
|
{
|
||||||
m_webapp = new WebApplication(app(), this);
|
m_webapp = new WebApplication(app(), this);
|
||||||
@ -75,8 +78,7 @@ void WebUI::configure()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((m_httpServer->serverAddress().toString() != serverAddressString)
|
if ((m_httpServer->serverAddress() != serverAddress) || (m_httpServer->serverPort() != port))
|
||||||
|| (m_httpServer->serverPort() != port))
|
|
||||||
m_httpServer->close();
|
m_httpServer->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,9 +105,7 @@ void WebUI::configure()
|
|||||||
|
|
||||||
if (!m_httpServer->isListening())
|
if (!m_httpServer->isListening())
|
||||||
{
|
{
|
||||||
const auto address = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
const bool success = m_httpServer->listen(serverAddress, port);
|
||||||
? QHostAddress::Any : QHostAddress(serverAddressString);
|
|
||||||
bool success = m_httpServer->listen(address, port);
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));
|
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));
|
||||||
|
Loading…
Reference in New Issue
Block a user