diff --git a/ScStwLibraries/headers/client/scstwsetting.h b/ScStwLibraries/headers/client/scstwsetting.h index 42f857c..7c95674 100644 --- a/ScStwLibraries/headers/client/scstwsetting.h +++ b/ScStwLibraries/headers/client/scstwsetting.h @@ -34,7 +34,7 @@ public slots: void setValue(QVariant value); private slots: - void handleSettingChange(int key, int keyLevel); + void handleSettingChange(int key, int keyLevel, QVariant value); signals: void scStwSettingsChanged(); diff --git a/ScStwLibraries/headers/scstwsettings.h b/ScStwLibraries/headers/scstwsettings.h index eb859e8..a91d5c5 100644 --- a/ScStwLibraries/headers/scstwsettings.h +++ b/ScStwLibraries/headers/scstwsettings.h @@ -66,7 +66,7 @@ private slots: bool writeSettingsToFile(); signals: - void settingChanged(int key, int keyLevel); + void settingChanged(int key, int keyLevel, QVariant value); }; diff --git a/ScStwLibraries/sources/client/scstwremotesettings.cpp b/ScStwLibraries/sources/client/scstwremotesettings.cpp index f653ebd..4def371 100644 --- a/ScStwLibraries/sources/client/scstwremotesettings.cpp +++ b/ScStwLibraries/sources/client/scstwremotesettings.cpp @@ -42,13 +42,13 @@ void ScStwRemoteSettings::setDefaultSetting(QString key, QVariant defaultVariant void ScStwRemoteSettings::handleClientStateChange() { if(this->scStwClient->getState() == ScStwClient::DISCONNECTED) - emit this->settingChanged(-1, 0); + emit this->settingChanged(-1, 0, QVariant()); } void ScStwRemoteSettings::handleBaseStationSignal(ScStw::SignalKey key, QVariant data) { switch (key) { case ScStw::SettingChanged: - emit this->settingChanged(data.toMap()["key"].toInt(), 0); + emit this->settingChanged(data.toMap()["key"].toInt(), 0, data.toMap()["value"]); default: break; } diff --git a/ScStwLibraries/sources/client/scstwsetting.cpp b/ScStwLibraries/sources/client/scstwsetting.cpp index df0f845..4f6e6e2 100644 --- a/ScStwLibraries/sources/client/scstwsetting.cpp +++ b/ScStwLibraries/sources/client/scstwsetting.cpp @@ -2,7 +2,6 @@ ScStwSetting::ScStwSetting(QObject *parent) : QObject(parent) { - } ScStwSettings* ScStwSetting::getScStwSettings(){ @@ -22,7 +21,7 @@ int ScStwSetting::getKey() { void ScStwSetting::setKey(int key) { if(this->key != key) { this->key = key; - this->handleSettingChange(this->key, this->keyLevel); + this->handleSettingChange(this->key, this->keyLevel, this->scStwSettings->readSetting(this->key, this->keyLevel)); emit this->keyChanged(); } } @@ -33,7 +32,7 @@ int ScStwSetting::getKeyLevel() { void ScStwSetting::setKeyLevel(int keyLevel) { if(this->keyLevel != keyLevel) { this->keyLevel = keyLevel; - this->handleSettingChange(this->key, this->keyLevel); + this->handleSettingChange(this->key, this->keyLevel, this->scStwSettings->readSetting(this->key, this->keyLevel)); emit this->keyLevelChanged(); } } @@ -47,9 +46,9 @@ void ScStwSetting::setValue(QVariant value) { } } -void ScStwSetting::handleSettingChange(int key, int keyLevel) { +void ScStwSetting::handleSettingChange(int key, int keyLevel, QVariant value) { if(keyLevel == this->keyLevel && key == this->key) { - this->valueCache = this->scStwSettings->readSetting(key, keyLevel); + this->valueCache = value; emit this->valueChanged(); } } diff --git a/ScStwLibraries/sources/scstwsettings.cpp b/ScStwLibraries/sources/scstwsettings.cpp index 7da1ac8..909ac0c 100644 --- a/ScStwLibraries/sources/scstwsettings.cpp +++ b/ScStwLibraries/sources/scstwsettings.cpp @@ -58,7 +58,7 @@ bool ScStwSettings::writeSetting(QString key, QVariant value, int keyInt, int ke else this->settingsCache[key] = value; - emit this->settingChanged(keyInt, keyLevel); + emit this->settingChanged(keyInt, keyLevel, value); return true; }