15 #define lockMutex QMutexLocker locker(backing == _globalSettings ? &settingsMutex : 0)
16 #define lockMutexStatic QMutexLocker locker(&settingsMutex)
17 #define lockMutexStatic2 QMutexLocker locker2(&settingsMutex)
18 #define lockMutexCache QMutexLocker locker(&settingsCacheMutex)
20 #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
22 #define qWarning qDebug
24 #define qCritical qDebug
33 globalThread->start();
51 QThread::yieldCurrentThread();
67 if(basePath.isEmpty()){
69 qDebug() <<
"CkbSettings created with basePath = \"\" and eraseExisting = true. This is a mistake.";
92 if(!current.isEmpty())
94 QStringList res =
backing->childGroups();
95 if(!current.isEmpty())
103 if(!current.isEmpty())
105 QStringList res =
backing->childKeys();
106 if(!current.isEmpty())
117 QStringList components = group.split(
"/");
118 if(components.length() > 1){
120 SGroup group(*
this, components[0]);
121 return containsGroup(QStringList(components.mid(1)).join(
'/'));
128 return backing->value(
pwd(key), defaultValue);
133 QString realKey =
pwd(key);
151 writer->moveToThread(globalThread);
152 QObject::staticMetaObject.invokeMethod(writer,
"run", Qt::QueuedConnection);
163 return globalCache[key] = settings->value(key, defaultValue);
void setValue(const QString &key, const QVariant &value)
static void set(const QString &key, const QVariant &value)
QStringList childKeys() const
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
QAtomicInt cacheWritesInProgress(0)
bool contains(const QString &key) const
static QThread * globalThread
static QVariant get(const QString &key, const QVariant &defaultValue=QVariant())
QMap< QString, QVariant > writeCache
bool containsGroup(const QString &group)
QMutex settingsCacheMutex(QMutex::Recursive)
void beginGroup(const QString &prefix)
QMutex settingsMutex(QMutex::Recursive)
static QSettings * globalSettings()
static QMap< QString, QVariant > globalCache
static QSettings * _globalSettings
QStringList childGroups() const
void remove(const QString &key)