Fix layout issues
[apps/mediaplayer.git] / app / MediaPlayer.qml
index 95bc22b..fd4db58 100644 (file)
@@ -96,21 +96,21 @@ ApplicationWindow {
         }
 
         onAuthorized: {
-           VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.Media.Action")
+           VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.Next")
+           VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.Previous")
+           VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.Mode")
        }
 
         onSignalNotification: {
-            if (path === "Vehicle.Cabin.Infotainment.Media.Action") {
-                if (value == "SkipForward") {
-                    mediaplayer.next()
-                } else if (value == "SkipBackward") {
-                    mediaplayer.previous()
-                } else if (value == "NextSource") {
-                    if (player.av_connected)
-                        mediaplayer.connect()
-                    else
-                        mediaplayer.disconnect()
-                }
+            if (path === "Vehicle.Cabin.SteeringWheel.Switches.Next" && value === "true") {
+                mediaplayer.next()
+            } else if (path === "Vehicle.Cabin.SteeringWheel.Switches.Previous" && value === "true") {
+                mediaplayer.previous()
+            } else if (path === "Vehicle.Cabin.SteeringWheel.Switches.Mode" && value === "true") {
+                if (player.av_connected)
+                    mediaplayer.connect()
+                else
+                    mediaplayer.disconnect()
             }
         }
     }
@@ -140,17 +140,19 @@ ApplicationWindow {
             Layout.fillHeight: true
             Layout.preferredHeight: 1080
             clip: true
+
             Image {
+                anchors.top: parent.top
                 anchors.left: parent.left
                 anchors.right: parent.right
-                anchors.bottom: parent.bottom
-                height: sourceSize.height * width / sourceSize.width
-                fillMode: Image.PreserveAspectCrop
+                anchors.bottom: controls.top
+                fillMode: Image.PreserveAspectFit
                 source: AlbumArt
                 visible: player.av_connected === false
             }
 
             Item {
+                id: controls
                 anchors.left: parent.left
                 anchors.right: parent.right
                 anchors.bottom: parent.bottom
@@ -292,7 +294,7 @@ ApplicationWindow {
         Item {
             Layout.fillWidth: true
             Layout.fillHeight: true
-            Layout.preferredHeight: 407
+            Layout.preferredHeight: 480
 
             ListView {
                 anchors.fill: parent