@@ -27,9 +27,6 @@ Showable {
27 // This is the block of text displayed below the header
27 // This is the block of text displayed below the header
28 property alias text: textLabel.text
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
30 // Whether animations are paused
34 property bool paused
31 property bool paused
@@ -46,7 +43,7 @@ Showable {
46 property alias foreground: foregroundExtra
43 property alias foreground: foregroundExtra
48 // The text label bottom, so you can position elements relative to it
45 // The text label bottom, so you can position elements relative to it
49− property real textBottom: textLabel.y + textLabel.height
46+ readonly property real textBottom: Math.max(textLabel.y + textLabel.height, errorTextLabel.y + errorTextLabel.height)
51 // The MouseArea that eats events (so you can adjust size as you will)
48 // The MouseArea that eats events (so you can adjust size as you will)
52 property alias mouseArea: mouseArea
49 property alias mouseArea: mouseArea
@@ -157,21 +154,41 @@ Showable {
157 font.pixelSize: units.gu(2.5)
154 font.pixelSize: units.gu(2.5)
157+ // We use two separate labels like this rather than just changing
158+ // the text of the above labels because we want to know where to place
159+ // sliders (via root.textBottom) without having that place change
160+ // as the text changes length.
161− id: errorLabel
162+ id: errorTitleLabel
162− objectName: "errorLabel"
163+ objectName: "errorTitleLabel"
163 anchors {
164 anchors {
164− top: parent.verticalCenter
165+ top: titleLabel.top
165− topMargin: d.verticalOffset + root.textYOffset
166− left: parent.left
166+ left: titleLabel.left
167− leftMargin: d.sideMargin + d.textXOffset
169− width: parent.width - d.sideMargin * 2
168+ width: titleLabel.width
170− horizontalAlignment: Text.AlignLeft
169+ horizontalAlignment: titleLabel.horizontalAlignment
171− wrapMode: Text.Wrap
170+ wrapMode: titleLabel.wrapMode
172− font.weight: Font.Light
171+ font.weight: titleLabel.font.weight
173− font.pixelSize: units.gu(3.5)
172+ font.pixelSize: titleLabel.font.pixelSize
174 opacity: 0
173 opacity: 0
174+ text: i18n.tr("You almost got it!")
179+ objectName: "errorTextLabel"
181+ top: errorTitleLabel.bottom
182+ topMargin: textLabel.anchors.topMargin
183+ left: textLabel.left
185+ width: textLabel.width
186+ horizontalAlignment: textLabel.horizontalAlignment
187+ wrapMode: textLabel.wrapMode
188+ font.weight: textLabel.font.weight
189+ font.pixelSize: textLabel.font.pixelSize
191+ text: i18n.tr("Try again.")
177 // A place for subclasses to add extra widgets
194 // A place for subclasses to add extra widgets
@@ -186,14 +203,14 @@ Showable {
186 when: errorTimer.running
203 when: errorTimer.running
187 PropertyChanges { target: titleLabel; opacity: 0 }
204 PropertyChanges { target: titleLabel; opacity: 0 }
188 PropertyChanges { target: textLabel; opacity: 0 }
205 PropertyChanges { target: textLabel; opacity: 0 }
189− PropertyChanges { target: errorLabel; opacity: 1 }
206+ PropertyChanges { target: errorTitleLabel; opacity: 1 }
207+ PropertyChanges { target: errorTextLabel; opacity: 1 }
192 transitions: Transition {
210 transitions: Transition {
193 to: "errorState"
211 to: "errorState"
194 reversible: true
212 reversible: true
195 SequentialAnimation {
213 SequentialAnimation {
196− id: showErrorAnimation
197 ParallelAnimation {
214 ParallelAnimation {
198 StandardAnimation {
215 StandardAnimation {
199 target: titleLabel
216 target: titleLabel
@@ -206,10 +223,17 @@ Showable {
206 duration: UbuntuAnimation.BriskDuration
223 duration: UbuntuAnimation.BriskDuration
209− StandardAnimation {
227+ StandardAnimation {
210− target: errorLabel
228+ target: errorTitleLabel
230+ duration: UbuntuAnimation.BriskDuration
233+ target: errorTextLabel
211− property: "opacity"
234+ property: "opacity"
212− duration: UbuntuAnimation.BriskDuration
235+ duration: UbuntuAnimation.BriskDuration