Message info
 
To:kde-commits@kde.org From:Shantanu Tushar Subject:[plasma-mediacenter/plain-containment-shantanu] components: Add components Date:Sun, 18 Mar 2012 16:47:52 +0100 (CET)
 

Git commit 18ccb7b9e97cfe6762e406ba3104e4bf995fabb4 by Shantanu Tushar.
Committed on 11/03/2012 at 08:05.
Pushed by shantanu into branch 'plain-containment-shantanu'.

Add components

A +105 -0 components/mediabrowser/MediaItemDelegate.qml [License: UNKNOWN] *
A +7 -0 components/mediabrowser/MediaItemHighlight.qml [License: UNKNOWN] *
A +5 -0 components/runtimedata/RuntimeData.qml [License: UNKNOWN] *

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/plasma-mediacenter/18ccb7b9e97cfe6762e406ba3104e4bf995fabb4

diff --git a/components/mediabrowser/MediaItemDelegate.qml b/components/mediabrowser/MediaItemDelegate.qml
new file mode 100644
index 0000000..b5ff76e
--- /dev/null
+++ b/components/mediabrowser/MediaItemDelegate.qml
@@ -0,0 +1,105 @@
+import QtQuick 1.1
+import org.kde.qtextracomponents 0.1 as QtExtraComponents
+import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.plasma.core 0.1 as PlasmaCore
+
+Item {
+ id: mediaItemDelegateItem
+ width: GridView.view.cellWidth; height: GridView.view.cellHeight
+
+ property QtObject backend
+ signal playRequested(string url)
+
+ PlasmaCore.Theme {
+ id:theme
+ }
+
+ Column {
+ anchors. fill: parent
+
+ Loader {
+ id: iconImageLoader
+ width: parent.width * 0.95; height: parent.height - itemText.height;
+
+ function checkAndLoad()
+ {
+ console.log("checking for " + typeof(decoration))
+ if (typeof(decoration) == "string") {
+ console.log("string")
+ if (decoration.search('[a-z]+://') == 0) {
+ sourceComponent = delegateItemImageComponent;
+ if (item) {
+ item.source = decoration;
+ }
+ } else {
+ sourceComponent = delegateItemIconComponent;
+ item.icon = QIcon(decoration);
+ }
+ } else if (typeof(decoration) == "object") {
+ console.log(decoration)
+ sourceComponent = delegateItemIconComponent;
+ if (item) {
+ item.icon = QIcon(decoration);
+ }
+ }
+ }
+ Component.onCompleted: checkAndLoad()
+ }
+
+ Component {
+ id: delegateItemImageComponent
+ Image {
+ id: delegateItemImage
+ width: parent.width
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ fillMode: Image.PreserveAspectFit
+ sourceSize.width: 128
+ sourceSize.height: 0
+ asynchronous: true
+ }
+ }
+
+ Component {
+ id: delegateItemIconComponent
+ QtExtraComponents.QIconItem {
+ id: delegateItemIcon
+ width: parent.width
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Text {
+ id: itemText
+ text: display
+ font.pointSize: 20
+ color: theme.textColor
+ elide: Text.ElideRight
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+ }
+
+ MouseArea {
+ hoverEnabled: true
+ anchors.fill: parent
+ onEntered: mediaItemDelegateItem.GridView.view.currentIndex = index
+
+ onClicked: {
+ if (isExpandable) {
+ backend.expand(index);
+ } else {
+ mediaItemDelegateItem.playRequested(mediaUrl)
+ }
+ }
+ }
+
+ Text {
+ id: workaroundForDecorationUpdate
+ text: decoration.toString()
+ visible: false
+
+ onTextChanged: iconImageLoader.checkAndLoad()
+ }
+}
\ No newline at end of file
diff --git a/components/mediabrowser/MediaItemHighlight.qml b/components/mediabrowser/MediaItemHighlight.qml
new file mode 100644
index 0000000..067d32b
--- /dev/null
+++ b/components/mediabrowser/MediaItemHighlight.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.1
+import org.kde.plasma.core 0.1 as PlasmaCore
+
+PlasmaCore.FrameSvgItem {
+ imagePath: "widgets/viewitem"
+ prefix: "selected+hover"
+}
diff --git a/components/runtimedata/RuntimeData.qml b/components/runtimedata/RuntimeData.qml
new file mode 100644
index 0000000..708c4b9
--- /dev/null
+++ b/components/runtimedata/RuntimeData.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.1
+
+Item {
+ property QtObject currentBrowsingBackend
+}
\ No newline at end of file