summaryrefslogtreecommitdiffstats
path: root/common/configstore.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 22:23:49 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-07 22:23:49 +0200
commitda2b049e248c1ad7efeb53685158a205335e4e36 (patch)
tree1e7e5e940e9b760b2108081b1d2f3879cebdb0ff /common/configstore.cpp
parent9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (diff)
downloadsink-da2b049e248c1ad7efeb53685158a205335e4e36.tar.gz
sink-da2b049e248c1ad7efeb53685158a205335e4e36.zip
A new debug system.
Instead of a single #define as debug area the new system allows for an identifier for each debug message with the structure component.area. The component is a dot separated identifier of the runtime component, such as the process or the plugin. The area is the code component, and can be as such defined at compiletime. The idea of this system is that it becomes possible to i.e. look at the output of all messages in the query subsystem of a specific resource (something that happens in the client process, but in the resource-specific subcomponent). The new macros are supposed to be less likely to clash with other names, hence the new names.
Diffstat (limited to 'common/configstore.cpp')
-rw-r--r--common/configstore.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/configstore.cpp b/common/configstore.cpp
index a8469ba..c8809ea 100644
--- a/common/configstore.cpp
+++ b/common/configstore.cpp
@@ -24,6 +24,8 @@
24#include <QFile> 24#include <QFile>
25#include <log.h> 25#include <log.h>
26 26
27SINK_DEBUG_AREA("configstore")
28
27static QSharedPointer<QSettings> getConfig(const QByteArray &identifier) 29static QSharedPointer<QSettings> getConfig(const QByteArray &identifier)
28{ 30{
29 return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/" + identifier + ".ini", QSettings::IniFormat); 31 return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/sink/" + identifier + ".ini", QSettings::IniFormat);
@@ -50,7 +52,7 @@ QMap<QByteArray, QByteArray> ConfigStore::getEntries()
50 52
51void ConfigStore::add(const QByteArray &identifier, const QByteArray &type) 53void ConfigStore::add(const QByteArray &identifier, const QByteArray &type)
52{ 54{
53 Trace() << "Adding " << identifier; 55 SinkTrace() << "Adding " << identifier;
54 mConfig->beginGroup(QString::fromLatin1(identifier)); 56 mConfig->beginGroup(QString::fromLatin1(identifier));
55 mConfig->setValue("type", type); 57 mConfig->setValue("type", type);
56 mConfig->endGroup(); 58 mConfig->endGroup();
@@ -59,7 +61,7 @@ void ConfigStore::add(const QByteArray &identifier, const QByteArray &type)
59 61
60void ConfigStore::remove(const QByteArray &identifier) 62void ConfigStore::remove(const QByteArray &identifier)
61{ 63{
62 Trace() << "Removing " << identifier; 64 SinkTrace() << "Removing " << identifier;
63 mConfig->beginGroup(QString::fromLatin1(identifier)); 65 mConfig->beginGroup(QString::fromLatin1(identifier));
64 mConfig->remove(""); 66 mConfig->remove("");
65 mConfig->endGroup(); 67 mConfig->endGroup();
@@ -75,7 +77,7 @@ void ConfigStore::clear()
75 77
76void ConfigStore::modify(const QByteArray &identifier, const QMap<QByteArray, QVariant> &configuration) 78void ConfigStore::modify(const QByteArray &identifier, const QMap<QByteArray, QVariant> &configuration)
77{ 79{
78 Trace() << "Modifying " << identifier; 80 SinkTrace() << "Modifying " << identifier;
79 auto config = getConfig(identifier); 81 auto config = getConfig(identifier);
80 config->clear(); 82 config->clear();
81 for (const auto &key : configuration.keys()) { 83 for (const auto &key : configuration.keys()) {