on xenial help sign in
Merge
commit4aa36b8d98ee8e799e22aef0d2832e69fe6c771a authorAlbert Astals <albert.astals@canonical.com> dateFri 21 Feb 2014, 09:58 (13 years ago) parentbe736b2f6c6891
8 files changed+70−48
qml/Dash/PreviewListView.qml+25−29 qml/Dash/Previews/Preview.qml−13 qml/Greeter/Greeter.qml+4 qml/Greeter/GreeterContent.qml−1 qml/Shell.qml+2−4 tests/mocks/AccountsService/AccountsService.cpp+1−1 tests/qmltests/Greeter/tst_Phone.qml+19 tests/qmltests/Greeter/tst_Tablet.qml+19
qml/Dash/PreviewListView.qml+25−29
@@ -151,43 +151,39 @@ Item {
151151 }
152152 }
153153
154− delegate: Previews.Preview {
155− id: preview
156− objectName: "preview" + index
154+ delegate: Item {
157155 height: previewListView.height
158156 width: previewListView.width
159157
160− isCurrent: ListView.isCurrentItem
161−
162− onPreviewModelChanged: preview.opacity = 0;
163− onReadyChanged: if (ready) fadeIn.start()
164− previewModel: {
165− // TODO
166− // We need the isCurrent because the scope fails to
167− // deliver the preview if we ask for one after other very quickly
168− // If we remove the isCurrent, we will have to think another way of
169− // doing the fadeIn or just don't do it at all or just decide
170− // this code is good enough and remove the TODO
171− if (isCurrent) {
158+ Previews.Preview {
159+ id: preview
160+ objectName: "preview" + index
161+ anchors.fill: parent
162+
163+ isCurrent: parent.ListView.isCurrentItem
164+
165+ previewModel: {
172166 var previewStack = root.scope.preview(result);
173167 return previewStack.get(0);
174− } else {
175− ready = false;
176− return null;
177168 }
169+
170+ // onClose: {
171+ // previewListView.open = false
172+ // }
173+
178174 }
179175
180−// onClose: {
181−// previewListView.open = false
182−// }
183−
184− PropertyAnimation {
185− id: fadeIn
186− target: preview
187− property: "opacity"
188− from: 0.0
189− to: 1.0
190− duration: UbuntuAnimation.BriskDuration
176+ MouseArea {
177+ id: processingMouseArea
178+ objectName: "processingMouseArea"
179+ anchors.fill: parent
180+ enabled: !preview.previewModel.loaded || preview.previewModel.processingAction
181+
182+ ActivityIndicator {
183+ anchors.centerIn: parent
184+ visible: parent.enabled
185+ running: visible
186+ }
191187 }
192188 }
193189 }
qml/Dash/Previews/Preview.qml−13
@@ -36,9 +36,6 @@ Item {
3636 //! \brief Should be set to true if this preview is currently displayed.
3737 property bool isCurrent: false
3838
39− //! \brief Will be changed to true when the initial preview widgets are in.
40− property bool ready: false
41−
4239 clip: true
4340
4441 Connections {
@@ -52,8 +49,6 @@ Item {
5249 }
5350 }
5451
55− onPreviewModelChanged: processingMouseArea.enabled = false
56−
5752 Binding {
5853 target: previewModel
5954 property: "widgetColumnCount"
@@ -84,7 +79,6 @@ Item {
8479 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
8580
8681 model: columnModel
87− onCountChanged: if (count > 0) root.ready = true
8882 cacheBuffer: height
8983
9084 Behavior on contentY { UbuntuNumberAnimation { } }
@@ -113,11 +107,4 @@ Item {
113107 }
114108 }
115109 }
116−
117− MouseArea {
118− id: processingMouseArea
119− objectName: "processingMouseArea"
120− anchors.fill: parent
121− enabled: false
122− }
123110}
qml/Greeter/Greeter.qml+4
@@ -67,6 +67,10 @@ Showable {
6767
6868 source: required ? "GreeterContent.qml" : ""
6969
70+ onLoaded: {
71+ selected(currentIndex);
72+ }
73+
7074 Connections {
7175 target: greeterContentLoader.item
7276
qml/Greeter/GreeterContent.qml−1
@@ -96,7 +96,6 @@ MouseArea {
9696
9797 onLoaded: {
9898 item.currentIndex = greeterContentLoader.currentIndex;
99− selected(item.currentIndex);
10099 item.resetAuthentication();
101100 }
102101
qml/Shell.qml+2−4
@@ -463,7 +463,6 @@ FocusScope {
463463 Component.onCompleted: {
464464 if (LightDM.Users.count == 1) {
465465 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
466− greeter.selected(0)
467466 }
468467 }
469468 }
@@ -504,7 +503,7 @@ FocusScope {
504503 hides: [launcher, panel.indicators, hud]
505504 shown: true
506505
507− defaultBackground: shell.background
506+ defaultBackground: shell.defaultBackground
508507
509508 y: panel.panelHeight
510509 width: parent.width
@@ -541,7 +540,6 @@ FocusScope {
541540 // If there are more users, the Greeter will handle that
542541 if (LightDM.Users.count == 1) {
543542 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
544− greeter.selected(0);
545543 }
546544 greeter.forceActiveFocus();
547545 removeApplicationFocus();
@@ -720,7 +718,7 @@ FocusScope {
720718 anchors.bottom: parent.bottom
721719 width: parent.width
722720 dragAreaWidth: shell.edgeSize
723− available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
721+ available: !greeter.locked && edgeDemo.launcherEnabled
724722
725723 onShowDashHome: {
726724 if (edgeDemo.running)
tests/mocks/AccountsService/AccountsService.cpp+1−1
@@ -20,7 +20,7 @@
2020
2121AccountsService::AccountsService(QObject* parent)
2222 : QObject(parent),
23− m_backgroundFile(TOP_SRCDIR "/graphics/phone_background.jpg"),
23+ m_backgroundFile(TOP_SRCDIR "/qml/graphics/phone_background.jpg"),
2424 m_statsWelcomeScreen(true)
2525{
2626}
tests/qmltests/Greeter/tst_Phone.qml+19
@@ -44,6 +44,17 @@ Item {
4444 }
4545 }
4646
47+ Component {
48+ id: greeterComponent
49+ Greeter {
50+ SignalSpy {
51+ objectName: "selectedSpy"
52+ target: parent
53+ signalName: "selected"
54+ }
55+ }
56+ }
57+
4758 SignalSpy {
4859 id: unlockSpy
4960 target: greeter
@@ -148,5 +159,13 @@ Item {
148159 tryCompareFunction(function() { return background.source.toString().indexOf(data.expected) !== -1; }, true)
149160 tryCompare(background, "status", Image.Ready)
150161 }
162+
163+ function test_initial_selected_signal() {
164+ var greeterObj = greeterComponent.createObject(this)
165+ var spy = findChild(greeterObj, "selectedSpy")
166+ spy.wait()
167+ tryCompare(spy, "count", 1)
168+ greeterObj.destroy()
169+ }
151170 }
152171}
tests/qmltests/Greeter/tst_Tablet.qml+19
@@ -31,6 +31,17 @@ Item {
3131 anchors.fill: parent
3232 }
3333
34+ Component {
35+ id: greeterComponent
36+ Greeter {
37+ SignalSpy {
38+ objectName: "selectedSpy"
39+ target: parent
40+ signalName: "selected"
41+ }
42+ }
43+ }
44+
3445 SignalSpy {
3546 id: unlockSpy
3647 target: greeter
@@ -335,5 +346,13 @@ Item {
335346 var userlist = findChild(greeter, "userList")
336347 compare(greeter.model.data(userlist.currentIndex, LightDM.UserRoles.NameRole), "has-password")
337348 }
349+
350+ function test_initial_selected_signal() {
351+ var greeterObj = greeterComponent.createObject(this)
352+ var spy = findChild(greeterObj, "selectedSpy")
353+ spy.wait()
354+ tryCompare(spy, "count", 1)
355+ greeterObj.destroy()
356+ }
338357 }
339358}