changes to setting changed signal
This commit is contained in:
parent
ad3f8318c7
commit
152887b1e3
5 changed files with 9 additions and 10 deletions
|
@ -34,7 +34,7 @@ public slots:
|
||||||
void setValue(QVariant value);
|
void setValue(QVariant value);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleSettingChange(int key, int keyLevel);
|
void handleSettingChange(int key, int keyLevel, QVariant value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void scStwSettingsChanged();
|
void scStwSettingsChanged();
|
||||||
|
|
|
@ -66,7 +66,7 @@ private slots:
|
||||||
bool writeSettingsToFile();
|
bool writeSettingsToFile();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void settingChanged(int key, int keyLevel);
|
void settingChanged(int key, int keyLevel, QVariant value);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,13 @@ void ScStwRemoteSettings::setDefaultSetting(QString key, QVariant defaultVariant
|
||||||
|
|
||||||
void ScStwRemoteSettings::handleClientStateChange() {
|
void ScStwRemoteSettings::handleClientStateChange() {
|
||||||
if(this->scStwClient->getState() == ScStwClient::DISCONNECTED)
|
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) {
|
void ScStwRemoteSettings::handleBaseStationSignal(ScStw::SignalKey key, QVariant data) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case ScStw::SettingChanged:
|
case ScStw::SettingChanged:
|
||||||
emit this->settingChanged(data.toMap()["key"].toInt(), 0);
|
emit this->settingChanged(data.toMap()["key"].toInt(), 0, data.toMap()["value"]);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
ScStwSetting::ScStwSetting(QObject *parent) : QObject(parent)
|
ScStwSetting::ScStwSetting(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScStwSettings* ScStwSetting::getScStwSettings(){
|
ScStwSettings* ScStwSetting::getScStwSettings(){
|
||||||
|
@ -22,7 +21,7 @@ int ScStwSetting::getKey() {
|
||||||
void ScStwSetting::setKey(int key) {
|
void ScStwSetting::setKey(int key) {
|
||||||
if(this->key != key) {
|
if(this->key != key) {
|
||||||
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();
|
emit this->keyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +32,7 @@ int ScStwSetting::getKeyLevel() {
|
||||||
void ScStwSetting::setKeyLevel(int keyLevel) {
|
void ScStwSetting::setKeyLevel(int keyLevel) {
|
||||||
if(this->keyLevel != keyLevel) {
|
if(this->keyLevel != keyLevel) {
|
||||||
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();
|
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) {
|
if(keyLevel == this->keyLevel && key == this->key) {
|
||||||
this->valueCache = this->scStwSettings->readSetting(key, keyLevel);
|
this->valueCache = value;
|
||||||
emit this->valueChanged();
|
emit this->valueChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool ScStwSettings::writeSetting(QString key, QVariant value, int keyInt, int ke
|
||||||
else
|
else
|
||||||
this->settingsCache[key] = value;
|
this->settingsCache[key] = value;
|
||||||
|
|
||||||
emit this->settingChanged(keyInt, keyLevel);
|
emit this->settingChanged(keyInt, keyLevel, value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue