[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeconnect-kde] /: Fixup the sfos mpris control
From:       Adam Pigg <null () kde ! org>
Date:       2018-08-26 20:10:17
Message-ID: E1fu1MX-0005q5-F8 () code ! kde ! org
[Download RAW message or body]

Git commit 064b07c0ce8ade5073c7943cd6c1a61970ee6ad5 by Adam Pigg.
Committed on 26/08/2018 at 20:10.
Pushed by piggz into branch 'master'.

Fixup the sfos mpris control

Summary:
-Fix type in pause icon
-Remove unnescessary label
-Size volumne slider correctly
-Centre buttons
-Make volume control work

Reviewers: #kde_connect, nicolasfella, kossebau, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, apol, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D14568

M  +4    -1    plugins/CMakeLists.txt
M  +74   -18   sfos/qml/pages/mpris.qml
M  +1    -0    sfos/rpm/kdeconnect-sfos.spec

https://commits.kde.org/kdeconnect-kde/064b07c0ce8ade5073c7943cd6c1a61970ee6ad5

diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index b65c3978..4f771c7d 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -7,6 +7,10 @@ add_subdirectory(battery)
 add_subdirectory(sendnotifications)
 add_subdirectory(clipboard)
 
+if (NOT WIN32)
+    add_subdirectory(mpriscontrol)
+endif()
+
 if(NOT SAILFISHOS)
     add_subdirectory(contacts)
     add_subdirectory(share)
@@ -18,7 +22,6 @@ if(NOT SAILFISHOS)
     if(NOT WIN32)
         add_subdirectory(runcommand)
         add_subdirectory(pausemusic)
-        add_subdirectory(mpriscontrol)
         add_subdirectory(screensaver-inhibit)
         add_subdirectory(sftp)
     endif()
diff --git a/sfos/qml/pages/mpris.qml b/sfos/qml/pages/mpris.qml
index 1b0c7268..4fb0b5c5 100644
--- a/sfos/qml/pages/mpris.qml
+++ b/sfos/qml/pages/mpris.qml
@@ -20,6 +20,7 @@
 
 import QtQuick 2.0
 import Sailfish.Silica 1.0
+import QtQuick.Layouts 1.0
 import org.kde.kdeconnect 1.0
 
 Page
@@ -27,19 +28,22 @@ Page
     id: root
     property QtObject pluginInterface
 
-    Column
+    Label {
+        id: noPlayersText
+        text: "No players available"
+        anchors.centerIn: parent
+        visible: pluginInterface.playerList.length == 0
+    }
+    ColumnLayout
     {
         anchors.fill: parent
+        anchors.margins: Theme.paddingMedium
         PageHeader { title: "Multimedia Controls" }
+        visible: !noPlayersText.visible
 
-        Component.onCompleted: {
-            pluginInterface.requestPlayerList();
-        }
-
-        Item { height: parent.height }
         ComboBox {
             label: "Player"
-            width: parent.width
+            Layout.fillWidth: true
             onCurrentIndexChanged: root.pluginInterface.player = value
 
             menu: ContextMenu {
@@ -49,34 +53,86 @@ Page
                 }
             }
         }
+
         Label {
-            width: parent.width
+            id: nowPlaying
+            Layout.fillWidth: true
             text: root.pluginInterface.nowPlaying
+            visible: root.pluginInterface.title.length == 0
+            wrapMode: Text.Wrap
+        }
+        Label {
+            Layout.fillWidth: true
+            text: root.pluginInterface.title
+            visible: !nowPlaying.visible
+            wrapMode: Text.Wrap
+        }
+        Label {
+            Layout.fillWidth: true
+            text: root.pluginInterface.artist
+            visible: !nowPlaying.visible && !artistAlbum.visible && \
root.pluginInterface.artist.length > 0 +            wrapMode: Text.Wrap
+        }
+        Label {
+            Layout.fillWidth: true
+            text: root.pluginInterface.album
+            visible: !nowPlaying.visible && !artistAlbum.visible && \
root.pluginInterface.album.length > 0 +            wrapMode: Text.Wrap
         }
-        Row {
-            width: parent.width
+        Label {
+            id: artistAlbum
+            Layout.fillWidth: true
+            text: "%1 - %2", root.pluginInterface.artist, root.pluginInterface.album
+            visible: !nowPlaying.visible && root.pluginInterface.album.length > 0 && \
root.pluginInterface.artist.length > 0 +            wrapMode: Text.Wrap
+        }
+
+        RowLayout {
+            Layout.fillWidth: true
+            height: childrenRect.height
             IconButton {
+                id: btnPrev
+                Layout.fillWidth: true
                 icon.source: "image://theme/icon-m-previous"
                 onClicked: root.pluginInterface.sendAction("Previous")
             }
             IconButton {
-                icon.source: root.pluginInterface.isPlaying ? \
"icon-m-image://theme/pause" : "image://theme/icon-m-play" +                id: \
btnPlay +                Layout.fillWidth: true
+                icon.source: root.pluginInterface.isPlaying ? \
"image://theme/icon-m-pause" : "image://theme/icon-m-play"  onClicked: \
root.pluginInterface.sendAction("PlayPause");  }
             IconButton {
+                id: btnNext
+                Layout.fillWidth: true
                 icon.source: "image://theme/icon-m-next"
                 onClicked: root.pluginInterface.sendAction("Next")
             }
         }
-        Row {
-            width: parent.width
-            Label { text: ("Volume:") }
-            Slider {
-                value: root.pluginInterface.volume
-                maximumValue: 100
-                width: parent.width
+
+        Slider {
+            id: sldVolume
+            label: "Volume"
+            maximumValue: 100
+            Layout.fillWidth: true
+            //value: root.pluginInterface.volume
+            onValueChanged: {
+                root.pluginInterface.volume = value;
             }
         }
+
         Item { height: parent.height }
     }
+
+
+    Connections {
+        target: root.pluginInterface
+        onPropertiesChanged: {
+            sldVolume.value = root.pluginInterface.volume;
+        }
+    }
+
+    Component.onCompleted: {
+        pluginInterface.requestPlayerList();
+    }
 }
diff --git a/sfos/rpm/kdeconnect-sfos.spec b/sfos/rpm/kdeconnect-sfos.spec
index e8a880c0..72ca2582 100644
--- a/sfos/rpm/kdeconnect-sfos.spec
+++ b/sfos/rpm/kdeconnect-sfos.spec
@@ -17,6 +17,7 @@ URL:        http://example.org/
 Source0:    %{name}-%{version}.tar.bz2
 Source100:  kdeconnect-sfos.yaml
 Requires:   sailfishsilica-qt5 >= 0.10.9
+Requires:   qt5-qtquickcontrols-layouts
 BuildRequires:  pkgconfig(sailfishapp) >= 1.0.2
 BuildRequires:  pkgconfig(Qt5Core)
 BuildRequires:  pkgconfig(Qt5Qml)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic