Comment 5 for bug 1293478

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

I noticed that the var type used by dbus changed since we moved to qt5.2 (int->double), which broke volume down:

Before:
method call sender=:1.20 -> dest=com.canonical.indicator.sound serial=178 path=/com/canonical/indicator/sound; interface=org.gtk.Actions; member=Activate
   string "volume"
   array [
      variant int32 -1
   ]
   array [
   ]

After:
method call sender=:1.51 -> dest=com.canonical.indicator.sound serial=176 path=/com/canonical/indicator/sound; interface=org.gtk.Actions; member=Activate
   string "volume"
   array [
      variant double -1
   ]
   array [
   ]

Looking at the qml file (qml/Components/VolumeControl.qml), it seems Qt is now assuming -1 is double by default, which is what is probably causing the issue.

A simple patch to force the value to be an integer fixes the volume up/down when using hw keys, but there are still some other issues with the volume indicator.

Once you manually select a volume value by touching the indicator, the hw key behavor changes (it sends the same dbus message, but the value doesn't move correctly anymore at the volume bar). If you also play a bit with the volume indicator (e.g. changing volume when using the camera app), it can easily get to a point where unity8 stops sending the dbus messages, breaking the indicator.

$ bzr diff
=== modified file 'qml/Components/VolumeControl.qml'
--- qml/Components/VolumeControl.qml 2013-10-10 03:39:40 +0000
+++ qml/Components/VolumeControl.qml 2014-03-18 20:41:22 +0000
@@ -22,6 +22,9 @@
     objectName: "volumeControl"
     visible: false

+ property int stepUp: 1
+ property int stepDown: -1
+
     QDBusActionGroup {
         id: actionGroup
         busType: 1
@@ -32,11 +35,11 @@
     }

     function volumeUp() {
- actionGroup.actionObject.activate(1);
+ actionGroup.actionObject.activate(stepUp);
     }

     function volumeDown() {
- actionGroup.actionObject.activate(-1);
+ actionGroup.actionObject.activate(stepDown);
     }

     Component.onCompleted: actionGroup.start()