#include "scstwsetting.h" #include ScStwSetting::ScStwSetting(QObject *parent) : QObject(parent) { } QVariant ScStwSetting::getValue() { if(this->hasToReload) { this->valueCache = this->readSetting(this->key, this->keyLevel); this->hasToReload = false; } return this->valueCache; } void ScStwSetting::setValue(QVariant value) { if(value != this->valueCache) { this->writeSetting(this->key, this->keyLevel, value); } } void ScStwSetting::handleSettingChange(int key, int keyLevel, QVariant value) { if(keyLevel == this->keyLevel && key == this->key) { this->valueCache = value; qDebug() << "value changed!!! key: " << key << " new value " << value; emit this->valueChanged(); } else if(key == -1 && this->key != -1 && this->keyLevel != -1 && this->keyLevel == keyLevel) { this->hasToReload = true; emit this->valueChanged(); } }