Code Review
/
apps
/
mixer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
volumeslider: rework of slider layout
[apps/mixer.git]
/
app
/
mixer.cpp
diff --git
a/app/mixer.cpp
b/app/mixer.cpp
index
873f1be
..
082ca12
100644
(file)
--- a/
app/mixer.cpp
+++ b/
app/mixer.cpp
@@
-49,7
+49,7
@@
void Mixer::setRoleVolume(AudioRole* role)
QJsonObject arg;
arg.insert("control", role->Name().toLocal8Bit().data());
QJsonObject arg;
arg.insert("control", role->Name().toLocal8Bit().data());
- arg.insert("value", QJsonValue(role->Value()));
+ arg.insert("value", QJsonValue(role->Value()
/ 100.0
));
m_client.call("audiomixer", "volume", arg);
}
m_client.call("audiomixer", "volume", arg);
}
@@
-63,7
+63,7
@@
void Mixer::parseControls(const QJsonValue & v)
for (const QJsonValue & av : v.toArray()) {
QString name = av.toObject()["control"].toString();
for (const QJsonValue & av : v.toArray()) {
QString name = av.toObject()["control"].toString();
- int value =
av.toObject()["volume"].toDouble() * 100
;
+ int value =
static_cast<int>(av.toObject()["volume"].toDouble() * 100)
;
value = qBound(0, value, 100);
AudioRole *ar = new AudioRole(name, value);
value = qBound(0, value, 100);
AudioRole *ar = new AudioRole(name, value);
@@
-117,10
+117,11
@@
void Mixer::onClientEventReceived(QString eventName, const QJsonValue& data)
}
else if (eventName == "audiomixer/volume_changed") {
QString name = data.toObject()["control"].toString();
}
else if (eventName == "audiomixer/volume_changed") {
QString name = data.toObject()["control"].toString();
- int value =
data.toObject()["value"].toDouble() * 100
;
+ int value =
static_cast<int>(data.toObject()["value"].toDouble() * 100)
;
value = qBound(0, value, 100);
value = qBound(0, value, 100);
- for (AudioRole *ar : m_roles) {
+ for (QObject *o : m_roles) {
+ AudioRole *ar = static_cast<AudioRole*>(o);
if (ar->Name() == name) {
ar->BeginUpdate();
ar->setValue(value);
if (ar->Name() == name) {
ar->BeginUpdate();
ar->setValue(value);