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

List:       kde-commits
Subject:    [kde-workspace/mart/AppletAttached] plasma/generic/applets/mediacontroller/contents/ui: use
From:       Marco Martin <notmart () gmail ! com>
Date:       2014-01-31 20:21:39
Message-ID: E1W9Kap-0004FE-Ce () scm ! kde ! org
[Download RAW message or body]

Git commit 40cdff71412b27a18c0f3a4525cdda2a21318d1f by Marco Martin.
Committed on 31/01/2014 at 20:21.
Pushed by mart into branch 'mart/AppletAttached'.

use Plasmoid.fullRepresentation

D  +0    -51   plasma/generic/applets/mediacontroller/contents/ui/CompactRepresentation.qml
 M  +8    -0    plasma/generic/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml
 M  +1    -1    plasma/generic/applets/mediacontroller/contents/ui/MediaControl.qml
M  +4    -26   plasma/generic/applets/mediacontroller/contents/ui/main.qml

http://commits.kde.org/kde-workspace/40cdff71412b27a18c0f3a4525cdda2a21318d1f

diff --git a/plasma/generic/applets/mediacontroller/contents/ui/CompactRepresentation.qml \
b/plasma/generic/applets/mediacontroller/contents/ui/CompactRepresentation.qml \
deleted file mode 100644 index 7c841f7..0000000
--- a/plasma/generic/applets/mediacontroller/contents/ui/CompactRepresentation.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************
- *   Copyright 2013 Sebastian Kügler <sebas@kde.org>                       *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU Library General Public License as       *
- *   published by the Free Software Foundation; either version 2 of the    *
- *   License, or (at your option) any later version.                       *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU Library General Public License for more details.                  *
- *                                                                         *
- *   You should have received a copy of the GNU Library General Public     *
- *   License along with this program; if not, write to the                 *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
- ***************************************************************************/
-
-import QtQuick 2.0
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.extras 2.0 as PlasmaExtras
-
-Item {
-    id: compactRepresentation
-
-    PlasmaCore.IconItem {
-        property int s: Math.min(parent.height, parent.width)
-        anchors {
-            horizontalCenter: parent.horizontalCenter
-            //fill: parent
-        }
-        y: -height / 8 /// Urghs, but works due to the character being rather static
-        width: s
-        height: s
-
-        source: root.state == "playing" ? "media-playback-pause" : \
                "media-playback-start"
-    }
-
-    MouseArea {
-        anchors.fill: parent
-        onClicked: {
-            if (expandedLoader.source == "") {
-                expandedLoader.setSource("ExpandedRepresentation.qml", { \
                'anchors.fill': root});
-            }
-            plasmoid.expanded = !plasmoid.expanded
-        }
-       // onPressed: PlasmaExtras.PressedAnimation { targetItem: parent }
-       // onReleased: PlasmaExtras.ReleasedAnimation { targetItem: parent }
-    }
-}
\ No newline at end of file
diff --git a/plasma/generic/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml \
b/plasma/generic/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml index \
                d90bb16..23d5d7b 100644
--- a/plasma/generic/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml
+++ b/plasma/generic/applets/mediacontroller/contents/ui/ExpandedRepresentation.qml
@@ -18,6 +18,7 @@
  ***************************************************************************/
 
 import QtQuick 2.0
+import QtQuick.Layouts 1.1
 import org.kde.plasma.core 2.0 as PlasmaCore
 import org.kde.plasma.components 2.0 as PlasmaComponents
 import org.kde.plasma.extras 2.0 as PlasmaExtras
@@ -25,6 +26,13 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
 Item {
     id: expandedRepresentation
 
+    Layout.minimumWidth: Layout.minimumHeight * 1.333
+    Layout.minimumHeight: theme.mSize(theme.defaultFont).height * 8
+    Layout.preferredWidth: Layout.minimumWidth * 1.5
+    Layout.preferredHeight: Layout.minimumHeight * 1.5
+
+    property int controlSize: Math.min(height, width) / 4
+
     anchors {
         margins: units.largeSpacing
         //fill: parent
diff --git a/plasma/generic/applets/mediacontroller/contents/ui/MediaControl.qml \
b/plasma/generic/applets/mediacontroller/contents/ui/MediaControl.qml index \
                fc04bf6..1cb905e 100644
--- a/plasma/generic/applets/mediacontroller/contents/ui/MediaControl.qml
+++ b/plasma/generic/applets/mediacontroller/contents/ui/MediaControl.qml
@@ -30,7 +30,7 @@ Item {
 
     signal triggered
 
-    width: root.controlSize
+    width: expandedRepresentation.controlSize
     height: width
 
     PlasmaCore.IconItem {
diff --git a/plasma/generic/applets/mediacontroller/contents/ui/main.qml \
b/plasma/generic/applets/mediacontroller/contents/ui/main.qml index 140bf57..c06c44a \
                100644
--- a/plasma/generic/applets/mediacontroller/contents/ui/main.qml
+++ b/plasma/generic/applets/mediacontroller/contents/ui/main.qml
@@ -32,18 +32,13 @@ Item {
     property string playerIcon: ""
 
 
-    Layout.minimumWidth: minimumHeight * 1.333
-    Layout.minimumHeight: theme.mSize(theme.defaultFont).height * 8
-    property int implicitWidth: minimumWidth * 1.5
-    property int implicitHeight: minimumHeight * 1.5
-
     property int baseSize: theme.mSize(theme.defaultFont).height
-    property int controlSize: Math.min(parent.height / 3, parent.width / 5)
     property bool noPlayer: true
 
-    property alias expandedLoader: expandedLoader
-
-    Plasmoid.compactRepresentation: CompactRepresentation {}
+    Plasmoid.switchWidth: units.gridUnit * 10
+    Plasmoid.switchHeight: units.gridUnit * 8
+    Plasmoid.icon: root.state == "playing" ? "media-playback-pause" : \
"media-playback-start" +    Plasmoid.fullRepresentation: ExpandedRepresentation {}
 
     state: "off"
 
@@ -125,23 +120,6 @@ Item {
         return service.startOperationCall(operation);
     }
 
-    Loader {
-        id: expandedLoader
-        anchors.fill: parent
-    }
-
-    Timer {
-        interval: 500
-        running: true
-        onTriggered: {
-            if (plasmoid.expanded) {
-                if (expandedLoader.source == "") {
-                    expandedLoader.setSource("ExpandedRepresentation.qml", { \
                'anchors.fill': root});
-                }
-            }
-        }
-    }
-
     states: [
         State {
             name: "off"


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

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