aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Lelong <lelong.ph@meltemus.com>2016-12-20 10:19:29 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-12-20 13:28:35 +0100
commit3b90fc6e1d569d568d4158aae700b077e2ad824b (patch)
tree388aa7dea0e4e73011877304832af2f09d8160ee
parent4c0c9989d249ef1af027f7fda85a4f2922635044 (diff)
Add logout button in home screen
Signed-off-by: Philippe Lelong <lelong.ph@meltemus.com>
-rw-r--r--HomeScreen/qml/Home.qml38
-rwxr-xr-xHomeScreen/qml/images/Home/Logout-01.pngbin0 -> 8868 bytes
-rw-r--r--HomeScreen/qml/images/Home/home.qrc1
-rw-r--r--HomeScreen/src2/usermanagement.cpp19
-rw-r--r--HomeScreen/src2/usermanagement.h1
5 files changed, 56 insertions, 3 deletions
diff --git a/HomeScreen/qml/Home.qml b/HomeScreen/qml/Home.qml
index 756efb9..ed0d949 100644
--- a/HomeScreen/qml/Home.qml
+++ b/HomeScreen/qml/Home.qml
@@ -24,6 +24,7 @@ Item {
id: root
property int pid: -1
signal languageChanged
+ signal disconnect
Image {
anchors.fill: parent
@@ -82,14 +83,15 @@ Item {
Text {
id: helloText
anchors.centerIn: parent
- color: "white"
- text: "No Authenticated User"
+ color: 'white'
+ text: 'No Authenticated User'
font.pixelSize: 40
- font.family: "Roboto"
+ font.family: 'Roboto'
SequentialAnimation on font.letterSpacing {
id: animation1
loops: 1;
NumberAnimation { from: 0; to: 50; easing.type: Easing.InQuad; duration: 3000 }
+ running: false
onRunningChanged: {
if(running) {
hello.visible = true
@@ -103,6 +105,7 @@ Item {
SequentialAnimation on opacity {
id: animation2
loops: 1;
+ running: false
NumberAnimation { from: 1; to: 0; duration: 2600 }
PauseAnimation { duration: 400 }
}
@@ -176,4 +179,33 @@ Item {
}
}
}
+ Image {
+ id: logout
+ width: sourceSize.width
+ height: sourceSize.height
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.bottomMargin: 10
+ anchors.rightMargin: 20
+ source: './images/Logout-01.png'
+ visible: true
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ rotateLogout.start()
+ disconnect()
+ helloText.text= 'No Authenticated User'
+
+ }
+ }
+ RotationAnimator {
+ id: rotateLogout
+ target: logout;
+ from: 0;
+ to: 360;
+ loops: 1
+ duration: 500
+ running: false
+ }
+ }
}
diff --git a/HomeScreen/qml/images/Home/Logout-01.png b/HomeScreen/qml/images/Home/Logout-01.png
new file mode 100755
index 0000000..0183565
--- /dev/null
+++ b/HomeScreen/qml/images/Home/Logout-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/home.qrc b/HomeScreen/qml/images/Home/home.qrc
index 8bef69d..a9d1dc3 100644
--- a/HomeScreen/qml/images/Home/home.qrc
+++ b/HomeScreen/qml/images/Home/home.qrc
@@ -23,5 +23,6 @@
<file>visa.png</file>
<file>french_flag.png</file>
<file>us_flag.png</file>
+ <file>Logout-01.png</file>
</qresource>
</RCC>
diff --git a/HomeScreen/src2/usermanagement.cpp b/HomeScreen/src2/usermanagement.cpp
index 23550e4..5daa1f5 100644
--- a/HomeScreen/src2/usermanagement.cpp
+++ b/HomeScreen/src2/usermanagement.cpp
@@ -5,6 +5,8 @@
UserManagement::UserManagement(QObject *root) : QObject()
{
home = root->findChild<QObject *>("Home");
+ QObject::connect(home, SIGNAL(disconnect()),
+ this, SLOT(slot_disconnect()));
logo = root->findChild<QObject *>("Logo_colour");
shortcutArea = root->findChild<QObject *>("ShortcutArea");
statusArea = root->findChild<QObject *>("StatusArea");
@@ -24,6 +26,19 @@ UserManagement::UserManagement(QObject *root) : QObject()
launchServer();
#endif
}
+void UserManagement::slot_disconnect()
+{
+ appModel->changeOrder(-1);
+ timerRed.stop();
+ slot_turnOffRed();
+ QMetaObject::invokeMethod(home, "languageChanged");
+ QMetaObject::invokeMethod(shortcutArea, "languageChanged", Q_ARG(QVariant, "en"));
+ QMetaObject::invokeMethod(statusArea, "languageChanged", Q_ARG(QVariant, "en"));
+ QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, false));
+ QMetaObject::invokeMethod(home, "showVisa", Q_ARG(QVariant, false), Q_ARG(QVariant, ""));
+ QMetaObject::invokeMethod(home, "changeFlag", Q_ARG(QVariant, "./images/us_flag.png"));
+}
+
void UserManagement::setUser(const User &user)
{
int hash = qHash(user.name + user.first_name);
@@ -293,6 +308,10 @@ void UserManagement::slot_timerTest()
{
if(!pSocket)
return;
+ if(sequence > 3) {
+ timerTest.stop();
+ return;
+ }
pSocket->sendTextMessage("[5,\"agl-identity-agent/event\",{\"event\":\"agl-identity-agent\/event\",\"data\":{\"eventName\":\"incoming\",\"accountid\":\"D2:D4:71:0D:B5:F1\",\"nickname\":\"D2:D4:71:0D:B5:F1\"},\"jtype\":\"afb-event\"}]");
pSocket->sendTextMessage("[5,\"agl-identity-agent/event\",{\"event\":\"agl-identity-agent\/event\",\"data\":{\"eventName\":\"login\",\"accountid\":\"null\"},\"jtype\":\"afb-event\"}]");
}
diff --git a/HomeScreen/src2/usermanagement.h b/HomeScreen/src2/usermanagement.h
index 085549d..b374719 100644
--- a/HomeScreen/src2/usermanagement.h
+++ b/HomeScreen/src2/usermanagement.h
@@ -62,6 +62,7 @@ public slots:
void slot_timerTest();
#endif
void slot_turnOffRed();
+ void slot_disconnect();
private:
QObject *home;
QObject *shortcutArea;