@@ -21,63 +21,27 @@ import "../Components"
24− // This is the header displayed, like "Right edge"
25− property alias title: titleLabel.text
24+ property alias arrow: arrow
27− // This is the block of text displayed below the header
28− property alias text: textLabel.text
25+ property alias label: label
29−
26+ readonly property real margin: units.gu(2)
30− // Whether animations are paused
33− // Whether to give the text the full width that the title has
34− property bool fullTextWidth
36− // Whether whole page (background + foreground) or just the foreground fades in
37− property bool backgroundFadesIn: false
39− // Whether whole page (background + foreground) or just the foreground fades out
40− property bool backgroundFadesOut: false
42− // The foreground Item, add children to it that you want to fade in
43− property alias foreground: foregroundExtra
45− // The text label bottom, so you can position elements relative to it
46− readonly property real textBottom: Math.max(textLabel.y + textLabel.height, errorTextLabel.y + errorTextLabel.height)
48− // The MouseArea that eats events (so you can adjust size as you will)
49− property alias mouseArea: mouseArea
51− // X/Y offsets for text
52− property real textXOffset: 0
53− property real textYOffset: 0
55− // Foreground text opacity
56− property real textOpacity: 1
58 signal finished()
28 signal finished()
60− function showError() {
66 visible: false
32 visible: false
67 shown: false
33 shown: false
69− property real _foregroundHideOpacity
71 showAnimation: StandardAnimation {
35 showAnimation: StandardAnimation {
72− property: root.backgroundFadesIn ? "opacity" : "_foregroundHideOpacity"
36+ property: "opacity"
75− duration: root.backgroundFadesIn ? UbuntuAnimation.SleepyDuration : UbuntuAnimation.BriskDuration
39+ duration: UbuntuAnimation.SleepyDuration
76 onStarted: root.visible = true
40 onStarted: root.visible = true
79 hideAnimation: StandardAnimation {
43 hideAnimation: StandardAnimation {
80− property: root.backgroundFadesOut ? "opacity" : "_foregroundHideOpacity"
44+ property: "opacity"
82 duration: UbuntuAnimation.BriskDuration
46 duration: UbuntuAnimation.BriskDuration
83 onStopped: {
47 onStopped: {
@@ -86,160 +50,40 @@ Showable {
92− readonly property real sideMargin: units.gu(5.5)
93− readonly property real verticalOffset: -units.gu(9)
94− readonly property real textXOffset: Math.max(0, root.textXOffset - sideMargin + units.gu(2))
96− property real fadeInOffset: {
97− if (showAnimation.running) {
98− var opacity = root[root.showAnimation.property]
99− return (1 - opacity) * units.gu(3);
111 MouseArea { // eat any errant presses
53 MouseArea { // eat any errant presses
112 id: mouseArea
54 id: mouseArea
113 anchors.fill: parent
55 anchors.fill: parent
116− Rectangle {
58+ Image {
117− anchors.fill: parent
59+ // Use x/y/height/width instead of anchors so that we don't adjust
118− color: "black"
60+ // the image if the OSK appears.
119− opacity: 0.82
61+ x: 0
121−
63+ height: root.height
124− anchors.fill: parent
125− opacity: root._foregroundHideOpacity
128− anchors.fill: parent
129− opacity: root.textOpacity
134− top: parent.verticalCenter
135− topMargin: d.verticalOffset + root.textYOffset
137− leftMargin: d.sideMargin + d.textXOffset
139− width: parent.width - d.sideMargin * 2
140− horizontalAlignment: Text.AlignLeft
142− font.weight: Font.Light
143− font.pixelSize: units.gu(3.5)
149− top: titleLabel.bottom
150− topMargin: units.gu(2)
152− leftMargin: d.sideMargin + d.textXOffset
154− width: (parent.width - d.sideMargin * 2) * (fullTextWidth ? 1 : 0.66)
155− horizontalAlignment: Text.AlignLeft
157− font.weight: Font.Light
158− font.pixelSize: units.gu(2.5)
161− // We use two separate labels like this rather than just changing
162− // the text of the above labels because we want to know where to place
163− // sliders (via root.textBottom) without having that place change
164− // as the text changes length.
167− objectName: "errorTitleLabel"
170− left: titleLabel.left
172− width: titleLabel.width
173− horizontalAlignment: titleLabel.horizontalAlignment
174− wrapMode: titleLabel.wrapMode
175− font.weight: titleLabel.font.weight
176− font.pixelSize: titleLabel.font.pixelSize
178− text: i18n.tr("You almost got it!")
183− objectName: "errorTextLabel"
185− top: errorTitleLabel.bottom
186− topMargin: textLabel.anchors.topMargin
187− left: textLabel.left
189− width: textLabel.width
64+ width: root.width
190− horizontalAlignment: textLabel.horizontalAlignment
65+ sourceSize.height: 1080
191− wrapMode: textLabel.wrapMode
66+ sourceSize.width: 1916
192− font.weight: textLabel.font.weight
67+ source: Qt.resolvedUrl("graphics/background.png")
193− font.pixelSize: textLabel.font.pixelSize
68+ fillMode: Image.PreserveAspectCrop
195− text: i18n.tr("Try again.")
199− // A place for subclasses to add extra widgets
202− anchors.fill: parent
206− states: State {
71+ Image {
207− name: "errorState"
72+ id: arrow
208− when: errorTimer.running
73+ anchors.margins: root.margin
209− PropertyChanges { target: titleLabel; opacity: 0 }
74+ width: units.gu(1)
210− PropertyChanges { target: textLabel; opacity: 0 }
75+ sourceSize.height: 106
211− PropertyChanges { target: errorTitleLabel; opacity: 1 }
76+ sourceSize.width: 34
212− PropertyChanges { target: errorTextLabel; opacity: 1 }
77+ source: Qt.resolvedUrl("graphics/arrow.png")
78+ fillMode: Image.PreserveAspectFit
215− transitions: Transition {
81+ Label {
216− to: "errorState"
82+ id: label
217− reversible: true
83+ anchors.margins: root.margin
218− SequentialAnimation {
84+ fontSize: "large"
219− ParallelAnimation {
85+ font.weight: Font.Light
220− StandardAnimation {
86+ color: "#333333"
221− target: titleLabel
87+ wrapMode: Text.Wrap
223− duration: UbuntuAnimation.BriskDuration
228− duration: UbuntuAnimation.BriskDuration
233− target: errorTitleLabel
235− duration: UbuntuAnimation.BriskDuration
238− target: errorTextLabel
240− duration: UbuntuAnimation.BriskDuration