From bd9cdb3a501612843b2c4c67ac962b41d3d0b128 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Sep 2016 08:50:41 +0200 Subject: options/bundle: lessen logspam --- options/bundle.cpp | 15 ++++++++------- options/bundle.hpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'options') diff --git a/options/bundle.cpp b/options/bundle.cpp index 53298d5d..f1b4069e 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -23,7 +23,7 @@ void bundle::reload() { QMutexLocker l(&mtx); saved = group(group_name); - const bool has_changes = is_modified(); + const bool has_changes = is_modified(false); transient = saved; if (has_changes) @@ -58,12 +58,11 @@ void bundle::save_deferred(QSettings& s) if (group_name.size() == 0) return; - bool modified_ = is_modified(); + bool modified_ = false; - if (modified_) { QMutexLocker l(&mtx); - if (is_modified()) + if (is_modified(true)) { qDebug() << "bundle" << group_name << "changed, saving"; modified_ = true; @@ -81,7 +80,7 @@ void bundle::save() save_deferred(*group::ini_file()); } -bool bundle::is_modified() const +bool bundle::is_modified(bool logspam) const { QMutexLocker l(mtx); @@ -90,7 +89,8 @@ bool bundle::is_modified() const const QVariant other = saved.get(kv.first); if (!saved.contains(kv.first) || !is_equal(kv.first, kv.second, other)) { - qDebug() << "bundle" << group_name << "modified" << "key" << kv.first << "-" << other << "<>" << kv.second; + if (logspam) + qDebug() << "bundle" << group_name << "modified" << "key" << kv.first << "-" << other << "<>" << kv.second; return true; } } @@ -100,7 +100,8 @@ bool bundle::is_modified() const const QVariant other = transient.get(kv.first); if (!transient.contains(kv.first) || !is_equal(kv.first, kv.second, other)) { - qDebug() << "bundle" << group_name << "modified" << "key" << kv.first << "-" << other << "<>" << kv.second; + if (logspam) + qDebug() << "bundle" << group_name << "modified" << "key" << kv.first << "-" << other << "<>" << kv.second; return true; } } diff --git a/options/bundle.hpp b/options/bundle.hpp index 78c40ea2..20ec9eaa 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -57,7 +57,7 @@ public: bool contains(const QString& name) const; void save(); void save_deferred(QSettings& s); - bool is_modified() const; + bool is_modified(bool logspam) const; template t get(const QString& name) const -- cgit v1.2.3