projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
logger: Refactor the logging framework
[quassel.git]
/
src
/
common
/
settings.cpp
diff --git
a/src/common/settings.cpp
b/src/common/settings.cpp
index
f0defb8
..
6273f7c
100644
(file)
--- a/
src/common/settings.cpp
+++ b/
src/common/settings.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
6
by the Quassel Project *
+ * Copyright (C) 2005-201
8
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-121,6
+121,24
@@
void Settings::setVersionMinor(const uint versionMinor)
}
}
+bool Settings::sync() {
+ create_qsettings;
+ s.sync();
+ switch (s.status()) {
+ case QSettings::NoError:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+bool Settings::isWritable() {
+ create_qsettings;
+ return s.isWritable();
+}
+
+
QStringList Settings::allLocalKeys()
{
create_qsettings;
QStringList Settings::allLocalKeys()
{
create_qsettings;
@@
-185,12
+203,12
@@
const QVariant &Settings::localValue(const QString &key, const QVariant &def)
return cacheValue(normKey);
}
return cacheValue(normKey);
}
+
bool Settings::localKeyExists(const QString &key)
{
QString normKey = normalizedKey(group, key);
bool Settings::localKeyExists(const QString &key)
{
QString normKey = normalizedKey(group, key);
- if (isCached(normKey))
- return true;
-
+ // Do NOT check the cache as default values get cached, too. Otherwise loading a setting once
+ // will mark it as existing in settings, even when it only exists in cache (and not on disk).
create_qsettings;
return s.contains(normKey);
}
create_qsettings;
return s.contains(normKey);
}
@@
-203,6
+221,10
@@
void Settings::removeLocalKey(const QString &key)
s.remove(key);
s.endGroup();
QString normKey = normalizedKey(group, key);
s.remove(key);
s.endGroup();
QString normKey = normalizedKey(group, key);
- if (isCached(normKey))
+ if (isCached(normKey))
{
settingsCache.remove(normKey);
settingsCache.remove(normKey);
+ }
+ if (hasNotifier(normKey)) {
+ emit notifier(normKey)->valueChanged({});
+ }
}
}