X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fsrc%2Fmastervolume.cpp;h=43beaefeba60cf46a3d1d2e0ae657c74038998a7;hb=3a7d88cf2cc33cfba6a0759692e88700103bc4d9;hp=98b884d5172424d8e32e0e61311da848dbe872d3;hpb=f386507d3c6996e39fcd459d032b9e0cf6f0f563;p=apps%2Fhomescreen.git diff --git a/homescreen/src/mastervolume.cpp b/homescreen/src/mastervolume.cpp index 98b884d..43beaef 100644 --- a/homescreen/src/mastervolume.cpp +++ b/homescreen/src/mastervolume.cpp @@ -19,6 +19,8 @@ #include #include +#define MASTER_CONTROL "Master Playback" + MasterVolume::MasterVolume(QObject* parent) : QObject(parent) , m_volume{50} @@ -46,7 +48,7 @@ void MasterVolume::setVolume(qint32 volume) { m_volume = volume; QJsonObject arg; - arg.insert("control", "Master"); + arg.insert("control", MASTER_CONTROL); double v = (double) volume / 100.0; arg.insert("value", v); m_client.call("audiomixer", "volume", arg); @@ -56,7 +58,7 @@ void MasterVolume::setVolume(qint32 volume) void MasterVolume::onClientConnected() { QJsonObject arg; - arg.insert("control", "Master"); + arg.insert("control", MASTER_CONTROL); m_client.call("audiomixer", "volume", arg, [this](bool r, const QJsonValue& v) { if (r && v.isObject()) { int volume = v.toObject()["response"].toObject()["volume"].toDouble() * 100; @@ -92,7 +94,7 @@ void MasterVolume::onClientEventReceived(QString name, const QJsonValue& data) { QString ctlName = data.toObject()["control"].toString(); - if (ctlName != "Master") + if (ctlName != MASTER_CONTROL) return; int volume = data.toObject()["value"].toDouble() * 100;