diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-09 08:50:41 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-09 08:50:41 +0200 |
commit | bd9cdb3a501612843b2c4c67ac962b41d3d0b128 (patch) | |
tree | b08633af2e3e23a603927b6b5a49c34242691df6 /options | |
parent | 12930b7ecee218d494af38e67f355bdee3fe4fd9 (diff) |
options/bundle: lessen logspam
Diffstat (limited to 'options')
-rw-r--r-- | options/bundle.cpp | 15 | ||||
-rw-r--r-- | options/bundle.hpp | 2 |
2 files changed, 9 insertions, 8 deletions
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<QVariant>(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<QVariant>(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<typename t> t get(const QString& name) const |