on xenial help sign in
Properly fade in new prompts; don't show double prompts when using mocks
commit7d7cfae82bec5927f222b529fc0e9b91b26966cb authorMichael Terry <mike@mterry.name> dateFri 13 Jan 2017, 12:31 (10 years ago) parent74a104f
6 files changed+22−11
plugins/LightDM/PromptsModel.cpp+1−1 plugins/LightDM/PromptsModel.h+1−1 qml/Greeter/Circle.qml+1−1 qml/Greeter/LoginList.qml−1 qml/Greeter/PromptList.qml+7−4 tests/mocks/liblightdm/MockGreeter.cpp+12−3
plugins/LightDM/PromptsModel.cpp+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2016 Canonical, Ltd.
2+ * Copyright (C) 2017 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
plugins/LightDM/PromptsModel.h+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2016 Canonical, Ltd.
2+ * Copyright (C) 2017 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
qml/Greeter/Circle.qml+1−1
@@ -27,7 +27,7 @@ Canvas {
2727 onCenterCircleChanged: requestPaint()
2828
2929 onPaint: {
30− if (circleScale <= 0) {
30+ if (circleScale <= 0 || width <= 0 || height <= 0) {
3131 return;
3232 }
3333
qml/Greeter/LoginList.qml−1
@@ -266,7 +266,6 @@ StyledItem {
266266 margins: units.gu(2)
267267 }
268268 width: highlightItem.width - anchors.margins * 2
269− opacity: userList.movingInternally ? 0 : 1
270269
271270 onClicked: {
272271 interactive = false;
qml/Greeter/PromptList.qml+7−4
@@ -30,10 +30,6 @@ FocusScope {
3030 signal clicked()
3131 signal canceled()
3232
33− Behavior on opacity {
34− NumberAnimation { duration: 100 }
35− }
36−
3733 function showFakePassword() {
3834 for (var i = 0; i < repeater.count; i++) {
3935 var item = repeater.itemAt(i).item;
@@ -81,6 +77,7 @@ FocusScope {
8177 break;
8278 }
8379 }
80+ loader.item.opacity = 1;
8481 }
8582
8683 Binding {
@@ -107,6 +104,9 @@ FocusScope {
107104 fontSize: "small"
108105 textFormat: Text.PlainText
109106 text: model.text
107+
108+ Behavior on opacity { UbuntuNumberAnimation {} }
109+ opacity: 0
110110 }
111111 }
112112
@@ -140,6 +140,9 @@ FocusScope {
140140 d.sendResponse();
141141 }
142142 onCanceled: root.canceled()
143+
144+ Behavior on opacity { UbuntuNumberAnimation {} }
145+ opacity: 0
143146 }
144147 }
145148}
tests/mocks/liblightdm/MockGreeter.cpp+12−3
@@ -29,12 +29,18 @@ public:
2929 bool authenticated = false;
3030 QString authenticationUser;
3131 bool twoFactorDone = false;
32+ QTimer authCallbackTimer;
3233};
3334
3435Greeter::Greeter(QObject *parent)
3536 : QObject(parent)
3637 , d_ptr(new GreeterPrivate)
3738{
39+ Q_D(Greeter);
40+
41+ d->authCallbackTimer.setSingleShot(true);
42+ connect(&d->authCallbackTimer, &QTimer::timeout,
43+ this, &QLightDM::Greeter::handleAuthenticate);
3844}
3945
4046Greeter::~Greeter()
@@ -134,7 +140,7 @@ void Greeter::authenticate(const QString &username)
134140 d->authenticated = false;
135141 d->authenticationUser = username;
136142 d->twoFactorDone = false;
137− QTimer::singleShot(0, this, &Greeter::handleAuthenticate);
143+ d->authCallbackTimer.start();
138144}
139145
140146void Greeter::handleAuthenticate()
@@ -190,7 +196,7 @@ void Greeter::authenticateAsGuest()
190196 d->authenticated = true;
191197 d->authenticationUser = QString(); // this is what the real liblightdm does
192198 d->twoFactorDone = false;
193− QTimer::singleShot(0, this, &Greeter::authenticationComplete);
199+ d->authCallbackTimer.start();
194200}
195201
196202void Greeter::authenticateAutologin()
@@ -203,7 +209,10 @@ void Greeter::authenticateRemote(const QString &session, const QString &username
203209}
204210
205211void Greeter::cancelAuthentication()
206−{}
212+{
213+ Q_D(Greeter);
214+ d->authCallbackTimer.stop();
215+}
207216
208217void Greeter::setLanguage (const QString &language)
209218{