QJsonObject arg;
arg.insert("action", "volume");
arg.insert("value", QJsonValue(value));
- m_client.call("ahl-4a", name, arg, [this, name](bool r, const QJsonValue& v) {
+ m_client.call("ahl-4a", name, arg, [name](bool r, const QJsonValue& v) {
if (r && v.isObject())
{
// TODO: Success, update the slider
if (r && v.isObject())
{
// TODO: Success, update the slider
+ qDebug() << "Volume changed: " << v;
+ int newVolume = v.toObject()["response"].toObject()["response"].toObject()["volnew"].toInt();
+ auto currentVolume = volumes_.find(name);
+ if (currentVolume != volumes_.end() && *currentVolume == newVolume)
+ return;
+
+ volumes_[name] = newVolume;
+ emit volumeChanged(name, newVolume);
}
else
{