2 * Copyright (C) 2013,2014 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 1.1
24 // This is the header displayed, like "Right edge"
25 property alias title: titleLabel.text
27 // This is the block of text displayed below the header
28 property alias text: textLabel.text
30 // This is the block of text displayed during an error
31 property alias errorText: errorLabel.text
33 // Whether animations are paused
36 // Whether to give the text the full width that the title has
37 property bool fullTextWidth
39 // Whether whole page (background + foreground) or just the foreground fades in
40 property bool backgroundFadesIn: false
42 // Whether whole page (background + foreground) or just the foreground fades out
43 property bool backgroundFadesOut: false
45 // The foreground Item, add children to it that you want to fade in
46 property alias foreground: foregroundExtra
48 // The text label bottom, so you can position elements relative to it
49 property real textBottom: textLabel.y + textLabel.height
51 // The MouseArea that eats events (so you can adjust size as you will)
52 property alias mouseArea: mouseArea
54 // X/Y offsets for text
55 property real textXOffset: 0
56 property real textYOffset: 0
58 // Foreground text opacity
59 property real textOpacity: 1
63 function showError() {
72 property real _foregroundHideOpacity
74 showAnimation: StandardAnimation {
75 property: root.backgroundFadesIn ? "opacity" : "_foregroundHideOpacity"
78 duration: root.backgroundFadesIn ? UbuntuAnimation.SleepyDuration : UbuntuAnimation.BriskDuration
79 onStarted: root.visible = true
82 hideAnimation: StandardAnimation {
83 property: root.backgroundFadesOut ? "opacity" : "_foregroundHideOpacity"
85 duration: UbuntuAnimation.BriskDuration
95 readonly property real sideMargin: units.gu(5.5)
96 readonly property real verticalOffset: -units.gu(9)
97 readonly property real textXOffset: Math.max(0, root.textXOffset - sideMargin + units.gu(2))
99 property real fadeInOffset: {
100 if (showAnimation.running) {
101 var opacity = root[root.showAnimation.property]
102 return (1 - opacity) * units.gu(3);
114 MouseArea { // eat any errant presses
128 opacity: root._foregroundHideOpacity
132 opacity: root.textOpacity
137 top: parent.verticalCenter
138 topMargin: d.verticalOffset + root.textYOffset
140 leftMargin: d.sideMargin + d.textXOffset
142 width: parent.width - d.sideMargin * 2
143 horizontalAlignment: Text.AlignLeft
145 font.weight: Font.Light
146 font.pixelSize: units.gu(3.5)
152 top: titleLabel.bottom
153 topMargin: units.gu(2)
155 leftMargin: d.sideMargin + d.textXOffset
157 width: (parent.width - d.sideMargin * 2) * (fullTextWidth ? 1 : 0.66)
158 horizontalAlignment: Text.AlignLeft
160 font.weight: Font.Light
161 font.pixelSize: units.gu(2.5)
166 objectName: "errorLabel"
168 top: parent.verticalCenter
169 topMargin: d.verticalOffset + root.textYOffset
171 leftMargin: d.sideMargin + d.textXOffset
173 width: parent.width - d.sideMargin * 2
174 horizontalAlignment: Text.AlignLeft
176 font.weight: Font.Light
177 font.pixelSize: units.gu(3.5)
182 // A place for subclasses to add extra widgets
191 when: errorTimer.running
192 PropertyChanges { target: titleLabel; opacity: 0 }
193 PropertyChanges { target: textLabel; opacity: 0 }
194 PropertyChanges { target: errorLabel; opacity: 1 }
197 transitions: Transition {
200 SequentialAnimation {
201 id: showErrorAnimation
206 duration: UbuntuAnimation.BriskDuration
211 duration: UbuntuAnimation.BriskDuration
217 duration: UbuntuAnimation.BriskDuration
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