aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/settings/qqmlsettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/settings/qqmlsettings.cpp')
-rw-r--r--src/imports/settings/qqmlsettings.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index ae12d54f5a..f6040e7a64 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -39,6 +39,7 @@
#include "qqmlsettings_p.h"
#include <qcoreevent.h>
+#include <qloggingcategory.h>
#include <qsettings.h>
#include <qpointer.h>
#include <qjsvalue.h>
@@ -231,7 +232,7 @@ QT_BEGIN_NAMESPACE
\sa QSettings
*/
-// #define SETTINGS_DEBUG
+Q_LOGGING_CATEGORY(lcSettings, "qt.labs.settings")
static const int settingsWriteDelay = 500;
@@ -282,9 +283,7 @@ QSettings *QQmlSettingsPrivate::instance() const
void QQmlSettingsPrivate::init()
{
if (!initialized) {
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: stored at" << instance()->fileName();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: stored at" << instance()->fileName();
load();
initialized = true;
}
@@ -312,9 +311,7 @@ void QQmlSettingsPrivate::load()
if (!currentValue.isNull() && (!previousValue.isValid()
|| (currentValue.canConvert(previousValue.type()) && previousValue != currentValue))) {
property.write(q, currentValue);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
}
// ensure that a non-existent setting gets written
@@ -335,9 +332,7 @@ void QQmlSettingsPrivate::store()
QHash<const char *, QVariant>::const_iterator it = changedProperties.constBegin();
while (it != changedProperties.constEnd()) {
instance()->setValue(it.key(), it.value());
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: store" << it.key() << ":" << it.value();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: store" << it.key() << ":" << it.value();
++it;
}
changedProperties.clear();
@@ -353,9 +348,7 @@ void QQmlSettingsPrivate::_q_propertyChanged()
const QMetaProperty &property = mo->property(i);
const QVariant value = readProperty(property);
changedProperties.insert(property.name(), value);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: cache" << property.name() << ":" << value;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: cache" << property.name() << ":" << value;
}
if (timerId != 0)
q->killTimer(timerId);