fixed non working settings write
This commit is contained in:
parent
d982bafab1
commit
e3cea06558
1 changed files with 9 additions and 2 deletions
|
@ -74,14 +74,21 @@ bool ScStwSettings::setDefaultSetting(int key, int keyLevel, QVariant defaultVal
|
||||||
QVariant ScStwSettings::readSetting(QString key, int keyInt, int keyLevel) {
|
QVariant ScStwSettings::readSetting(QString key, int keyInt, int keyLevel) {
|
||||||
Q_UNUSED(keyInt)
|
Q_UNUSED(keyInt)
|
||||||
Q_UNUSED(keyLevel)
|
Q_UNUSED(keyLevel)
|
||||||
return this->settingsCache[key];
|
|
||||||
|
if(this->settingsCache.contains(key))
|
||||||
|
return this->settingsCache[key];
|
||||||
|
else
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScStwSettings::writeSetting(QString key, QVariant value, int keyInt, int keyLevel) {
|
bool ScStwSettings::writeSetting(QString key, QVariant value, int keyInt, int keyLevel) {
|
||||||
if(!this->keyToTypeConverters.contains(keyInt) || !value.convert(this->keyToTypeConverters[keyLevel](keyInt)) || value.type() == QVariant::Invalid) {
|
|
||||||
|
// check if the value type is valid
|
||||||
|
if(!this->keyToTypeConverters.contains(keyLevel) || !value.convert(this->keyToTypeConverters[keyLevel](keyInt)) || value.type() == QVariant::Invalid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write the setting
|
||||||
if(!this->settingsCache.contains(key))
|
if(!this->settingsCache.contains(key))
|
||||||
this->settingsCache.insert(key, value);
|
this->settingsCache.insert(key, value);
|
||||||
else if (this->settingsCache[key] == value)
|
else if (this->settingsCache[key] == value)
|
||||||
|
|
Reference in a new issue