changes to setting changed signal

This commit is contained in:
Dorian Zedler 2020-07-11 14:00:31 +02:00
parent ad3f8318c7
commit 152887b1e3
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
5 changed files with 9 additions and 10 deletions

View file

@ -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();

View file

@ -66,7 +66,7 @@ private slots:
bool writeSettingsToFile();
signals:
void settingChanged(int key, int keyLevel);
void settingChanged(int key, int keyLevel, QVariant value);
};

View file

@ -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;
}

View file

@ -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();
}
}

View file

@ -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;
}