summaryrefslogtreecommitdiffhomepage
path: root/options/base-value.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-10-19 03:39:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-10-19 03:57:28 +0200
commit3d771972612e2a9dbabec719db027c7abaa8a1a3 (patch)
treef77888ba9b43def7f2ebf0a58c69a2db04c84ce0 /options/base-value.cpp
parent634403a68dd710d68abcd2e063f9660e9b3e30ea (diff)
options: add trace to valueChanged()
Diffstat (limited to 'options/base-value.cpp')
-rw-r--r--options/base-value.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/options/base-value.cpp b/options/base-value.cpp
index d4ec4b6c..c7691a8f 100644
--- a/options/base-value.cpp
+++ b/options/base-value.cpp
@@ -1,7 +1,20 @@
#include "base-value.hpp"
+#include <QThread>
using namespace options;
+//#define OTR_TRACE_NOTIFY
+
+const bool value_::TRACE_NOTIFY =
+#ifdef OTR_TRACE_NOTIFY
+ true;
+#else
+ [] {
+ auto b = qgetenv("OTR_TRACE_NOTIFY");
+ return !b.isEmpty() && b != "0";
+ }();
+#endif
+
value_::value_(bundle const& b, const QString& name) noexcept :
b(b), self_name(name)
{
@@ -12,3 +25,10 @@ value_::~value_()
{
b->on_value_destructed(this);
}
+
+void value_::maybe_trace(bool x) const
+{
+ if (TRACE_NOTIFY)
+ qDebug().noquote() << "notify" << (x ? '+' : '-')
+ << QThread::currentThreadId() << b->name() << self_name;
+}