aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Lelong <lelong.ph@meltemus.com>2016-12-20 14:40:06 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-12-20 16:02:47 +0100
commit8f71f12c3622466f813ea12b64ee34e8b4102341 (patch)
tree33243aec0f49393989b6512a2272536db72eb8d8
parent3b90fc6e1d569d568d4158aae700b077e2ad824b (diff)
Add user autorisations information
Signed-off-by: Philippe Lelong <lelong.ph@meltemus.com>
-rw-r--r--HomeScreen/qml/Home.qml63
-rwxr-xr-xHomeScreen/qml/images/Home/Install App.pngbin0 -> 6438 bytes
-rwxr-xr-xHomeScreen/qml/images/Home/Logout-01.pngbin8868 -> 6217 bytes
-rwxr-xr-xHomeScreen/qml/images/Home/Open Trunk.pngbin0 -> 5395 bytes
-rwxr-xr-xHomeScreen/qml/images/Home/Update Software.pngbin0 -> 10691 bytes
-rwxr-xr-xHomeScreen/qml/images/Home/View Online.pngbin0 -> 9082 bytes
-rw-r--r--HomeScreen/qml/images/Home/home.qrc4
-rw-r--r--HomeScreen/src2/usermanagement.cpp25
-rw-r--r--HomeScreen/src2/usermanagement.h1
9 files changed, 91 insertions, 2 deletions
diff --git a/HomeScreen/qml/Home.qml b/HomeScreen/qml/Home.qml
index ed0d949..c44919d 100644
--- a/HomeScreen/qml/Home.qml
+++ b/HomeScreen/qml/Home.qml
@@ -18,6 +18,8 @@
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.0
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
import Home 1.0
Item {
@@ -128,6 +130,19 @@ Item {
function changeFlag(flagImage) {
flagLanguage.source = flagImage
}
+ function setUser(type, auts) {
+ if(type === '') {
+ authorisations.visible = false
+ } else {
+ authorisations.visible = true
+ labelUserType.text = type
+ myModel.clear()
+ for (var i=0; i<auts.length; i++) {
+ if(auts[i] !== '')
+ myModel.append({"name": auts[i]})
+ }
+ }
+ }
GridView {
anchors.centerIn: parent
@@ -179,6 +194,54 @@ Item {
}
}
}
+ ListModel {
+ id: myModel
+ ListElement {
+ name: 'Install App'
+ }
+ ListElement {
+ name: 'Open Trunk'
+ }
+ ListElement {
+ name: 'Update Software'
+ }
+ ListElement {
+ name: 'View Online'
+ }
+ }
+ Item {
+ id: authorisations
+ anchors.fill: parent
+ visible: false
+ GridLayout {
+ id: gridAut
+ columns: 2
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.bottomMargin: 50
+ anchors.leftMargin: 20
+ Repeater {
+ model: myModel
+ Image {
+ source: './images/' + model.name + '.png'
+ width: sourceSize.width
+ height: sourceSize.height
+ visible: true
+ }
+ }
+ }
+ Label {
+ id: labelUserType
+ anchors.bottom: gridAut.top
+ anchors.bottomMargin: 10
+ anchors.left: gridAut.left
+ color: "white"
+ text: "Owner"
+ font.pixelSize: 30
+ font.family: "Roboto"
+ }
+ }
+
Image {
id: logout
width: sourceSize.width
diff --git a/HomeScreen/qml/images/Home/Install App.png b/HomeScreen/qml/images/Home/Install App.png
new file mode 100755
index 0000000..17da664
--- /dev/null
+++ b/HomeScreen/qml/images/Home/Install App.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/Logout-01.png b/HomeScreen/qml/images/Home/Logout-01.png
index 0183565..5436ebc 100755
--- a/HomeScreen/qml/images/Home/Logout-01.png
+++ b/HomeScreen/qml/images/Home/Logout-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/Open Trunk.png b/HomeScreen/qml/images/Home/Open Trunk.png
new file mode 100755
index 0000000..8fdb660
--- /dev/null
+++ b/HomeScreen/qml/images/Home/Open Trunk.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/Update Software.png b/HomeScreen/qml/images/Home/Update Software.png
new file mode 100755
index 0000000..dd107fd
--- /dev/null
+++ b/HomeScreen/qml/images/Home/Update Software.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/View Online.png b/HomeScreen/qml/images/Home/View Online.png
new file mode 100755
index 0000000..d1fa287
--- /dev/null
+++ b/HomeScreen/qml/images/Home/View Online.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/home.qrc b/HomeScreen/qml/images/Home/home.qrc
index a9d1dc3..4a02101 100644
--- a/HomeScreen/qml/images/Home/home.qrc
+++ b/HomeScreen/qml/images/Home/home.qrc
@@ -24,5 +24,9 @@
<file>french_flag.png</file>
<file>us_flag.png</file>
<file>Logout-01.png</file>
+ <file>Update Software.png</file>
+ <file>Open Trunk.png</file>
+ <file>Install App.png</file>
+ <file>View Online.png</file>
</qresource>
</RCC>
diff --git a/HomeScreen/src2/usermanagement.cpp b/HomeScreen/src2/usermanagement.cpp
index 5daa1f5..9ea968f 100644
--- a/HomeScreen/src2/usermanagement.cpp
+++ b/HomeScreen/src2/usermanagement.cpp
@@ -37,6 +37,11 @@ void UserManagement::slot_disconnect()
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"));
+ QMetaObject::invokeMethod(home, "setUser", Q_ARG(QVariant, ""), Q_ARG(QVariant, ""));
+ QVariantList list;
+ list << 2 << QString().setNum(++sequence) << "agl-identity-agent/logout" << true;
+ listToJson(list, &data);
+ slot_sendData();
}
void UserManagement::setUser(const User &user)
@@ -50,6 +55,21 @@ void UserManagement::setUser(const User &user)
QMetaObject::invokeMethod(shortcutArea, "languageChanged", Q_ARG(QVariant, user.graphPreferredLanguage));
QMetaObject::invokeMethod(statusArea, "languageChanged", Q_ARG(QVariant, user.graphPreferredLanguage));
QMetaObject::invokeMethod(home, "showSign90", Q_ARG(QVariant, !user.graphActions.contains("Exceed 100 Kph")));
+ QStringList t;
+ foreach(const QString &s, user.graphActions) {
+ if(!s.contains("Exceed"))
+ t.append(s);
+ }
+ QString type = user.policy;
+ if(user.graphPreferredLanguage == "fr") {
+ if(type == "Owner")
+ type = "Propriétaire";
+ else if(type == "Driver")
+ type = "Conducteur";
+ else if(type == "Maintainer")
+ type = "Maintenance";
+ }
+ QMetaObject::invokeMethod(home, "setUser", Q_ARG(QVariant, type), Q_ARG(QVariant, QVariant::fromValue(t)));
if(user.ccNumberMasked.isEmpty())
QMetaObject::invokeMethod(home, "showVisa", Q_ARG(QVariant, false), Q_ARG(QVariant, ""));
else
@@ -160,6 +180,7 @@ void UserManagement::onTextMessageReceived(QString message)
user.postal_code = map["postal_code"].toString();
user.first_name = map["first_name"].toString();
user.keytoken = map["keytoken"].toString();
+ user.policy = map["graphPolicies"].toString();
setUser(user);
}
}
@@ -243,14 +264,14 @@ void UserManagement::processTextMessage(QString message)
":\"19\",\"ccExpMonth\":\"01\",\"description\":\"Original description\",\"groups\":[],\"last_name\":\""
"Jensen\",\"ccNumber\":\"111-2343-1121-111\",\"house_identifier\":\"ForgeRock\",\"phone\":\""
"+1 408 555 1862\",\"name\":\"bjensen\",\"state\":\"CA\",\"common_name\":\"Barbara Jensen\",\"fax\":\""
- "+1 408 555 1862\",\"postal_code\":\"94105\",\"first_name\":\"Barbara\",\"keytoken\":\"a123456\"}";
+ "+1 408 555 1862\",\"postal_code\":\"94105\",\"first_name\":\"Barbara\",\"keytoken\":\"a123456\",\"graphPolicies\":\"Driver\"}";
QString clientDetails_2 = "{\"postal_address\":\"201 Mission Street\",\"loc\":\"37.7914374,-122.3950694\""
",\"country\":\"USA\",\"mail\":\"bjensen@example.com\",\"city\":\"San Francisco\",\"graphEmail\":"
"\"bjensen@example.com\",\"graphPreferredLanguage\":\"fr\",\"ccNumberMasked\":\"-222\",\"ccExpYear\""
":\"19\",\"ccExpMonth\":\"01\",\"description\":\"Original description\",\"groups\":[],\"last_name\":\""
"Jensen\",\"ccNumber\":\"111-2343-1121-111\",\"house_identifier\":\"ForgeRock\",\"phone\":\""
"+1 408 555 1862\",\"name\":\"bjensen\",\"state\":\"CA\",\"common_name\":\"Barbara Jensen\",\"fax\":\""
- "+1 408 555 1862\",\"postal_code\":\"94105\",\"first_name\":\"José\",\"keytoken\":\"a123456\"}";
+ "+1 408 555 1862\",\"postal_code\":\"94105\",\"first_name\":\"José\",\"keytoken\":\"a123456\",\"graphPolicies\":\"Maintainer\"}";
QString clientDetails = clientDetails_1;
if(sequence % 2 == 1)
clientDetails = clientDetails_2;
diff --git a/HomeScreen/src2/usermanagement.h b/HomeScreen/src2/usermanagement.h
index b374719..32db93f 100644
--- a/HomeScreen/src2/usermanagement.h
+++ b/HomeScreen/src2/usermanagement.h
@@ -36,6 +36,7 @@ struct User {
QString first_name;
QString keytoken;
QStringList graphActions;
+ QString policy;
};
class UserManagement : public QObject