@@ -0,0 +1,165 @@
2+ * Copyright (C) 2013 Canonical, Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import Ubuntu.Components 0.1
20+import "../../Components"
25+ property bool ready: previewData ? true : false
26+ property bool playable: previewData.imageSourceUri != null
27+ property url url: ready ? previewData.image : ""
29+ title: root.ready ? previewData.title : ""
30+ previewWidthRatio: 0.6
32+ onPreviewImageClicked: {
34+ shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', previewData.imageSourceUri);
38+ header: UbuntuShape {
40+ anchors.left: parent.left
41+ anchors.right: parent.right
47+ fillMode: Image.PreserveAspectCrop
51+ objectName: "playButton"
52+ anchors.centerIn: parent
53+ visible: root.playable
54+ readonly property bool bigButton: parent.width > units.gu(40)
55+ width: bigButton ? units.gu(8) : units.gu(4.5)
57+ source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
61+ id: previewImageMouseArea
63+ onClicked: root.previewImageClicked()
69+ objectName: "gridButtons"
70+ model: root.previewData.actions
73+ anchors.left: parent.left
74+ anchors.right: parent.right
76+ property int numOfRows: (count + numOfColumns - 1) / numOfColumns
77+ property int numOfColumns: Math.max(1, Math.floor(width / (buttonWidth + spacing)))
78+ property int spacing: units.gu(1)
79+ height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
81+ cellWidth: width / buttons.numOfColumns
82+ cellHeight: buttonHeight + buttons.spacing
83+ property int buttonWidth: units.gu(17) - spacing
84+ property int buttonHeight: units.gu(4)
87+ width: Math.max(units.gu(4), buttons.buttonWidth)
88+ height: buttons.buttonHeight
90+ text: modelData.displayName
91+ iconSource: modelData.iconHint
92+ iconPosition: "right"
95+ root.previewData.execute(modelData.id, { })
102+ spacing: units.gu(2)
104+ visible: previewData.rating >= 0.0
105+ rating: previewData.rating >= 0.0 ? previewData.rating * 5 : 0
109+ text: ready ? previewData.description : ""
110+ color: Theme.palette.selected.backgroundText
114+ wrapMode: Text.WordWrap
121+ spacing: units.gu(1)
123+ property int firstColWidth: units.gu(9)
124+ property int secondColWidth: width - firstColWidth - spacing
126+ visible: directedLabel.visible
130+ horizontalAlignment: Text.AlignRight
131+ width: parent.firstColWidth
132+ text: i18n.tr("Date:")
142+ width: parent.secondColWidth
143+ text: ready ? previewData.subtitle : ""
146+ wrapMode: Text.WordWrap
157+ if (previewData.year) parts.push(previewData.year)
159+ return parts.join(", ");