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
22 property string title: ""
24 property real previewWidthRatio: 0.5
25 property bool playable: false
26 property bool forceSquare: false
27 property Component buttons
28 property Component caption
29 property Component description
31 readonly property bool narrowMode: width <= height
32 readonly property int contentSpacing: units.gu(3)
35 signal previewImageClicked()
37 color: Qt.rgba(0, 0, 0, .3)
41 target: shell.applicationManager
42 onMainStageFocusedApplicationChanged: {
45 onSideStageFocusedApplicationChanged: {
61 margins: root.contentSpacing
67 leftMargin: -root.contentSpacing
68 rightMargin: -root.contentSpacing
69 topMargin: -root.contentSpacing
72 onClicked: root.close();
79 rightMargin: closePreviewImage.width + spacing
82 property int spacing: units.gu(2)
86 objectName: "titleLabel"
92 elide: Text.ElideRight
94 font.weight: Font.Light
102 id: closePreviewImage
103 source: "graphics/tablet/icon_close_preview.png"
105 height: units.gu(1.5)
108 bottomMargin: units.dp(7)
110 leftMargin: title.paintedWidth + labelItem.spacing
121 top: headerRow.bottom
122 bottom: parent.bottom
123 margins: root.contentSpacing
130 anchors.top: parent.top
131 anchors.bottom: parent.bottom
132 width: root.narrowMode ? contentRow.width : contentRow.width * root.previewWidthRatio
133 contentHeight: leftColumn.height
138 objectName: "leftColumn"
143 height: childrenRect.height
144 spacing: root.contentSpacing
146 // TODO: replace this UbuntuShape with the Video component once that lands
150 anchors.left: parent.left
151 anchors.right: parent.right
152 height: root.forceSquare ? width : width * previewImage.sourceSize.height / previewImage.sourceSize.width
158 fillMode: Image.PreserveAspectCrop
162 objectName: "playButton"
163 anchors.centerIn: parent
164 visible: root.playable
165 readonly property bool bigButton: parent.width > units.gu(40)
166 width: bigButton ? units.gu(8) : units.gu(4.5)
168 source: "graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "")
172 id: previewImageMouseArea
174 onClicked: root.previewImageClicked()
179 anchors.left: parent.left
180 anchors.right: parent.right
181 sourceComponent: root.buttons
185 anchors.left: parent.left
186 anchors.right: parent.right
187 sourceComponent: root.caption
194 anchors.top: parent.top
195 anchors.bottom: parent.bottom
196 width: narrowMode ? 0 : (contentRow.width - leftColumn.width - contentRow.spacing)
197 contentHeight: rightColumn.height
202 objectName: "rightColumn"
203 height: childrenRect.height
213 parent: root.narrowMode ? leftColumn : rightColumn
214 anchors.left: parent.left
215 anchors.right: parent.right
216 sourceComponent: root.description
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