2 * Copyright (C) 2013 Canonical, Ltd.
5 * Michał Sawicz <michal.sawicz@canonical.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21import Ubuntu.Components 0.1
27 // TODO convert into enums when available in QML
28 property string scaleTo
30 property real initialWidth: units.gu(10)
31 property real initialHeight: units.gu(10)
33 property alias sourceSize: image.sourceSize
34 property alias fillMode: image.fillMode
35 property alias asynchronous: image.asynchronous
36 property alias cache: image.cache
37 property alias horizontalAlignment: image.horizontalAlignment
38 property alias verticalAlignment: image.verticalAlignment
43 if (state === "ready") {
45 image.nextSource = source;
47 image.source = source;
53 objectName: "placeholder"
60 anchors.centerIn: parent
69 objectName: "errorImage"
70 anchors.centerIn: parent
74 source: "graphics/close.png"
75 sourceSize { width: units.gu(3); height: units.gu(3) }
90 property url nextSource
92 width: root.scaleTo == "height" ? implicitWidth * root.height / implicitHeight : implicitWidth
93 height: root.scaleTo == "width" ? implicitHeight * root.width / implicitWidth : implicitHeight
94 fillMode: Image.PreserveAspectCrop
97 horizontalAlignment: Image.AlignHCenter
98 verticalAlignment: Image.AlignVCenter
99 sourceSize.width: root.scaleTo == "width" ? root.width : 0
100 sourceSize.height: root.scaleTo == "height" ? root.height : 0
107 when: image.source == ""
108 PropertyChanges { target: root; implicitWidth: root.initialWidth; implicitHeight: root.initialHeight }
109 PropertyChanges { target: errorImage; opacity: 0 }
114 when: image.status === Image.Loading
115 PropertyChanges { target: activity; opacity: 1 }
119 when: image.status === Image.Ready && image.source != ""
120 PropertyChanges { target: root; implicitWidth: image.width; implicitHeight: image.height }
121 PropertyChanges { target: shape; opacity: 1 }
122 PropertyChanges { target: placeholder; opacity: 0 }
127 when: image.status === Image.Error
128 PropertyChanges { target: errorImage; opacity: 1.0 }
135 objectName: "readyTransition"
136 SequentialAnimation {
137 PropertyAction { target: shape; property: "visible" }
139 NumberAnimation { target: shape; property: "opacity"; easing.type: Easing.Linear }
140 UbuntuNumberAnimation { target: root; properties: "implicitWidth,implicitHeight" }
142 targets: [placeholder, activity, errorImage]; property: "opacity";
143 easing.type: Easing.Linear; duration: UbuntuAnimation.SnapDuration
151 objectName: "genericTransition"
152 SequentialAnimation {
154 NumberAnimation { target: shape; property: "opacity"; easing.type: Easing.Linear }
156 targets: [placeholder, activity, errorImage]; property: "opacity";
157 easing.type: Easing.Linear; duration: UbuntuAnimation.SnapDuration
159 UbuntuNumberAnimation { target: root; properties: "implicitWidth,implicitHeight" }
161 PropertyAction { target: shape; property: "visible" }
165 if (!running && state === "default" && image.nextSource !== "") {
166 image.source = image.nextSource;
167 image.nextSource = "";
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