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/>.
18import Ubuntu.Components 0.1
20import "../../Components"
26 property alias ready: nfo.ready
27 property bool playable: fileUri != ""
28 readonly property url fileUri: item ? item.fileUri : ""
29 property url url: item ? item.nfoUri.replace(/\.nfo$/, "-fanart.jpg") : ""
33 source: item ? item.nfoUri : ""
36 title: nfo.ready ? nfo.video.title : ""
37 previewWidthRatio: 0.6
39 onPreviewImageClicked: {
41 shell.activateApplication('/usr/share/applications/mediaplayer-app.desktop', root.fileUri);
45 // TODO: replace this UbuntuShape with the Video component once that lands
49 anchors.left: parent.left
50 anchors.right: parent.right
51 height: width * previewImage.sourceSize.height / previewImage.sourceSize.width
57 fillMode: Image.PreserveAspectCrop
61 objectName: "playButton"
62 anchors.centerIn: parent
63 visible: root.playable
64 readonly property bool bigButton: parent.width > units.gu(40)
65 width: bigButton ? units.gu(8) : units.gu(4.5)
67 source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
71 id: previewImageMouseArea
73 onClicked: root.previewImageClicked()
80 property int buttonWidth: Math.min(units.gu(22), (width - spacing) / 2)
82 width: parent.buttonWidth
83 color: Theme.palette.selected.foreground
84 text: nfo.ready && nfo.video.buyPrice != "" ? "Buy for " + nfo.video.buyPrice : ""
86 iconSource: "graphics/icon_button_amazon.png"
90 width: parent.buttonWidth
91 color: Theme.palette.selected.foreground
92 text: nfo.ready && nfo.video.buyPrice != "" ? "Rent for " + nfo.video.rentPrice : ""
94 iconSource: "graphics/icon_button_u1.png"
102 maximumRating: 10 // FIXME: this should happen on the backend side
103 rating: nfo.ready ? nfo.video.rating: 0
107 text: nfo.ready ? nfo.video.plot : ""
108 color: Theme.palette.selected.backgroundText
112 wrapMode: Text.WordWrap
121 property int firstColWidth: units.gu(9)
122 property int secondColWidth: width - firstColWidth - spacing
124 visible: directedLabel.visible
128 horizontalAlignment: Text.AlignRight
129 width: parent.firstColWidth
130 text: i18n.tr("Directed by:")
140 width: parent.secondColWidth
141 text: nfo.ready ? nfo.video.director : ""
144 wrapMode: Text.WordWrap
147 visible: starringLabel.visible
150 horizontalAlignment: Text.AlignRight
152 width: parent.firstColWidth
153 text: i18n.tr("Starring:")
163 width: parent.secondColWidth
164 text: nfo.ready ? nfo.getActors().join(", ") : ""
165 wrapMode: Text.WordWrap
170 visible: authorLabel.visible
173 horizontalAlignment: Text.AlignRight
175 width: parent.firstColWidth
176 text: i18n.tr("Author:")
186 width: parent.secondColWidth
187 text: nfo.ready ? nfo.video.author : ""
188 wrapMode: Text.WordWrap
201 if (nfo.video.year) parts.push(nfo.video.year)
202 if (nfo.video.runtime) parts.push("%1 minutes".arg(nfo.video.runtime))
204 return parts.join(", ");
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list