@@ -27,30 +27,21 @@ Showable {
2727 // This is the block of text displayed below the header
2828 property alias text: textLabel.text
2929
30− // This is the text for the skip button
31− property string skipText: i18n.tr("Skip tutorial")
32−
3330 // Whether animations are paused
3431 property bool paused
3532
36− // Which page number this page represents, 1-indexed
37− property int pageNumber
38−
39− // How many pages there are total
40− property int pageTotal
41−
4233 // Whether whole page (background + foreground) or just the foreground fades in
4334 property bool backgroundFadesIn: false
4435
4536 // Whether whole page (background + foreground) or just the foreground fades out
4637 property bool backgroundFadesOut: false
4738
48− // An integrated glowing Bar class, for convenience
49− property alias bar: bar
50−
5139 // The foreground Item, add children to it that you want to fade in
5240 property alias foreground: foregroundExtra
5341
42+ // The text label bottom, so you can position elements relative to it
43+ property real textBottom: textLabel.y + textLabel.height
44+
5445 // The MouseArea that eats events (so you can adjust size as you will)
5546 property alias mouseArea: mouseArea
5647
@@ -58,6 +49,9 @@ Showable {
5849 property real textXOffset: 0
5950 property real textYOffset: 0
6051
52+ // Foreground opacity
53+ property real foregroundOpacity: 1
54+
6155 signal finished()
6256
6357 ////
@@ -65,17 +59,17 @@ Showable {
6559 shown: false
6660 Component.onCompleted: show()
6761
68− property alias _foregroundOpacity: foreground.opacity
62+ property real _foregroundHideOpacity
6963
7064 showAnimation: StandardAnimation {
71− property: root.backgroundFadesIn ? "opacity" : "_foregroundOpacity"
65+ property: root.backgroundFadesIn ? "opacity" : "_foregroundHideOpacity"
7266 from: 0
7367 to: 1
7468 duration: root.backgroundFadesIn ? UbuntuAnimation.SleepyDuration : UbuntuAnimation.BriskDuration
7569 }
7670
7771 hideAnimation: StandardAnimation {
78− property: root.backgroundFadesOut ? "opacity" : "_foregroundOpacity"
72+ property: root.backgroundFadesOut ? "opacity" : "_foregroundHideOpacity"
7973 to: 0
8074 duration: UbuntuAnimation.BriskDuration
8175 onRunningChanged: {
@@ -88,10 +82,9 @@ Showable {
8882 QtObject {
8983 id: d
9084
91− property real sideMargin: units.gu(6)
92− property real verticalOffset: -units.gu(3)
93− property real buttonMargin: units.gu(2)
94− property real paginationOffset: units.gu(12)
85+ readonly property real sideMargin: units.gu(5.5)
86+ readonly property real verticalOffset: -units.gu(9)
87+ readonly property real textXOffset: Math.max(0, root.textXOffset - sideMargin + units.gu(2))
9588
9689 property real fadeInOffset: {
9790 if (showAnimation.running) {
@@ -101,25 +94,6 @@ Showable {
10194 return 0;
10295 }
10396 }
104−
105− property real xLabelOffset: {
106− if (bar.direction === "right") {
107− return bar.offset - fadeInOffset + root.textXOffset;
108− } else if (bar.direction === "left") {
109− return -bar.offset + fadeInOffset + root.textXOffset;
110− } else {
111− return root.textXOffset;
112− }
113− }
114− property real yLabelOffset: {
115− if (bar.direction === "down") {
116− return bar.offset - fadeInOffset + root.textYOffset;
117− } else if (bar.direction === "up") {
118− return -bar.offset + fadeInOffset + root.textYOffset;
119− } else {
120− return root.textYOffset;
121− }
122− }
12397 }
12498
12599 MouseArea { // eat any errant presses
@@ -130,95 +104,46 @@ Showable {
130104 Rectangle {
131105 anchors.fill: parent
132106 color: "black"
133− opacity: 0.8
107+ opacity: 0.82
134108 }
135109
136110 Item {
137111 id: foreground
138112 anchors.fill: parent
113+ opacity: root.foregroundOpacity < 1 ? root.foregroundOpacity : root._foregroundHideOpacity
139114
140115 Label {
141116 id: titleLabel
142117 anchors {
143− bottom: textLabel.top
144− bottomMargin: units.gu(2)
145− horizontalCenter: parent.horizontalCenter
146− horizontalCenterOffset: d.xLabelOffset - root.textXOffset / 2
118+ top: parent.verticalCenter
119+ topMargin: d.verticalOffset + root.textYOffset
120+ left: parent.left
121+ leftMargin: d.sideMargin + d.textXOffset
147122 }
148− width: parent.width - d.sideMargin * 2 - root.textXOffset
149− horizontalAlignment: Text.AlignHCenter
123+ width: parent.width - d.sideMargin * 2
124+ horizontalAlignment: Text.AlignLeft
150125 wrapMode: Text.Wrap
151− font.pixelSize: units.gu(4)
126+ font.weight: Font.Light
127+ font.pixelSize: units.gu(3.5)
152128 text: root.title
153129 }
154130
155131 Label {
156132 id: textLabel
157133 anchors {
158− top: parent.verticalCenter
159− topMargin: d.verticalOffset + d.yLabelOffset
160− horizontalCenter: parent.horizontalCenter
161− horizontalCenterOffset: d.xLabelOffset - root.textXOffset / 2
134+ top: titleLabel.bottom
135+ topMargin: units.gu(2)
136+ left: parent.left
137+ leftMargin: d.sideMargin + d.textXOffset
162138 }
163− width: parent.width - d.sideMargin * 2 - root.textXOffset
164− horizontalAlignment: Text.AlignHCenter
139+ width: (parent.width - d.sideMargin * 2) * 0.66
140+ horizontalAlignment: Text.AlignLeft
165141 wrapMode: Text.Wrap
166− fontSize: "large"
142+ font.weight: Font.Light
143+ font.pixelSize: units.gu(2.5)
167144 text: root.text
168145 }
169146
170− Row {
171− visible: root.pageNumber > 0
172− spacing: units.gu(0.5)
173− anchors {
174− bottom: parent.bottom
175− bottomMargin: d.paginationOffset
176− horizontalCenter: parent.horizontalCenter
177− }
178− Repeater {
179− model: root.pageTotal
180− Image {
181− height: units.gu(1)
182− width: height
183− source: (index === root.pageNumber - 1) ?
184− "../Dash/graphics/pagination_dot_on.png" :
185− "../Dash/graphics/pagination_dot_off.png"
186− }
187− }
188− }
189−
190− MouseArea {
191− visible: root.pageNumber > 0
192− enabled: visible
193− anchors {
194− bottom: parent.bottom
195− right: parent.right
196− }
197− implicitHeight: skipLabel.height + d.buttonMargin * 2
198− implicitWidth: skipLabel.width + d.buttonMargin * 2
199−
200− Label {
201− id: skipLabel
202− objectName: "skipLabel"
203− anchors.centerIn: parent
204− // Translators: This is the arrow for "Skip tutorial" buttons
205− text: i18n.tr("%1 〉").arg(root.skipText)
206− }
207−
208− onClicked: root.hide()
209− }
210−
211− Bar {
212− id: bar
213− animating: !root.paused
214− anchors {
215− top: direction === "up" ? undefined : parent.top
216− bottom: direction === "down" ? undefined : parent.bottom
217− left: direction === "left" ? undefined : parent.left
218− right: direction === "right" ? undefined : parent.right
219− }
220− }
221−
222147 // A place for subclasses to add extra widgets
223148 Item {
224149 id: foregroundExtra