on xenial help sign in
Don't animate rotation when greeter is shown or while display is off
45a59d6Daniel d'Andrada
qml/Rotation/RotationStates.qml+7
@@ -16,6 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 1.1
18import Ubuntu.Components 1.1
19+import Powerd 0.1
19
20
20// Why the state machine is done that way:
21// Why the state machine is done that way:
21// We cannot use regular PropertyChanges{} inside the State elements as steps in the
22// We cannot use regular PropertyChanges{} inside the State elements as steps in the
@@ -121,6 +122,12 @@ StateGroup {
121 // During start up, inital property values are still settling while we're still
122 // During start up, inital property values are still settling while we're still
122 // to render the very first frame
123 // to render the very first frame
123 d.animationType = d.noAnimation;
124 d.animationType = d.noAnimation;
125+ } else if (Powerd.status === Powerd.Off) {
126+ // There's no point in animating if the user can't see it (display is off).
127+ d.animationType = d.noAnimation;
128+ } else if (root.shell.showingGreeter) {
129+ // A rotating greeter looks weird.
130+ d.animationType = d.noAnimation;
124 } else {
131 } else {
125 if (!root.shell.mainApp) {
132 if (!root.shell.mainApp) {
126 // shouldn't happen but, anyway
133 // shouldn't happen but, anyway
qml/Shell.qml+2
@@ -70,6 +70,8 @@ Item {
70 && (applicationsDisplayLoader.item && applicationsDisplayLoader.item.orientationChangesEnabled)
70 && (applicationsDisplayLoader.item && applicationsDisplayLoader.item.orientationChangesEnabled)
71 && !greeter.animating
71 && !greeter.animating
72
72
73+ readonly property bool showingGreeter: greeter.shown
74+
73 property bool startingUp: true
75 property bool startingUp: true
74 Timer { id: finishStartUpTimer; interval: 500; onTriggered: startingUp = false }
76 Timer { id: finishStartUpTimer; interval: 500; onTriggered: startingUp = false }
75
77
tests/qmltests/tst_OrientedShell.qml+25−1
@@ -22,6 +22,7 @@ import Ubuntu.Components.ListItems 1.0 as ListItem
22import Unity.Application 0.1
22import Unity.Application 0.1
23import Unity.Test 0.1
23import Unity.Test 0.1
24import LightDM 0.1 as LightDM
24import LightDM 0.1 as LightDM
25+import Powerd 0.1
25
26
26import "../../qml"
27import "../../qml"
27
28
@@ -161,8 +162,16 @@ Rectangle {
161 }
162 }
162
163
163 Rectangle {
164 Rectangle {
164− id: controls
165+ width: controls.width
166+ anchors {
167+ top: parent.top
168+ bottom: parent.bottom
169+ right: parent.right
170+ }
165 color: "darkgrey"
171 color: "darkgrey"
172+ }
173+ Flickable {
174+ id: controls
166 width: units.gu(30)
175 width: units.gu(30)
167 anchors {
176 anchors {
168 top: parent.top
177 top: parent.top
@@ -170,7 +179,11 @@ Rectangle {
170 right: parent.right
179 right: parent.right
171 }
180 }
172
181
182+ boundsBehavior: Flickable.StopAtBounds
183+ contentHeight: controlsColumn.height
184+
173 Column {
185 Column {
186+ id: controlsColumn
174 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
187 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
175 spacing: units.gu(1)
188 spacing: units.gu(1)
176 Button {
189 Button {
@@ -281,6 +294,17 @@ Rectangle {
281 anchors.verticalCenter: parent.verticalCenter
294 anchors.verticalCenter: parent.verticalCenter
282 }
295 }
283 }
296 }
297+ Button {
298+ text: Powerd.status === Powerd.On ? "Display ON" : "Display OFF"
299+ activeFocusOnPress: false
300+ onClicked: {
301+ if (Powerd.status === Powerd.On) {
302+ Powerd.status = Powerd.Off;
303+ } else {
304+ Powerd.status = Powerd.On;
305+ }
306+ }
307+ }
284 }
308 }
285 }
309 }
286
310