123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- import QtQuick 2.5
- import Qt.labs.controls 1.0
- import QtQuick.Layouts 1.1
- import "qrc:/Globals"
- Rectangle {
- property int roleFontSize: 20
- property int roleRectHeight: 40
- id: root
- width: parent.width
- height: parent.height
- color: "white"
- Flickable {
- id: flickable
- anchors.fill: parent
- contentWidth: content.width
- contentHeight: content.height
- interactive: contentHeight > height
- flickableDirection: Flickable.VerticalFlick
- Item {
- id: content
- x: 0
- y: 0
- width: flickable.width
- //============================================================================
- Rectangle {
- id: rectangle
- x: 0
- y: 0
- width: root.width
- height: root.height
- color: "white"
- // Rectangle {
- // property string userRole: "oper"
- // id: userRoleOperRECT
- // x: (parent.width / 17) * 2
- // y: (parent.height / 3) / 2
- // width: (parent.width / 17) * 3
- // height: roleRectHeight
- // color: Globals.actUserRole == userRole?Globals.customer_color_base:"lightgray"
- // border.color: Globals.actUserRole != userRole?Globals.customer_color_base:"lightgray"
- // border.width: 3
- // Label {
- // anchors.centerIn: parent
- // font.pixelSize: roleFontSize
- // text: Globals.getActUserRoleText(parent.userRole)
- // }
- // MouseArea {
- // anchors.fill : parent
- // onClicked: {
- // sysinfo.beep();
- // Globals.actUserRole = parent.userRole;
- // stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- // }
- // }
- // }
- // Rectangle {
- // property string userRole: "eng"
- // id: userRoleEngRECT
- // x: (parent.width / 17) * 7
- // y: (parent.height / 3) / 2
- // width: (parent.width / 17) * 3
- // height: roleRectHeight
- // color: Globals.actUserRole == userRole?Globals.customer_color_base:"lightgray"
- // border.color: Globals.actUserRole != userRole?Globals.customer_color_base:"lightgray"
- // border.width: 3
- // Label {
- // anchors.centerIn: parent
- // font.pixelSize: roleFontSize
- // text: Globals.getActUserRoleText(parent.userRole)
- // }
- // MouseArea {
- // anchors.fill : parent
- // onClicked: {
- // sysinfo.beep();
- // Globals.actUserRole = parent.userRole;
- // if (settings.value("UserRoleEng/Password", "*") === "*") {
- // pwdINPUT.focus = false;
- // Qt.inputMethod.hide();
- // stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- // } else {
- // pwdINPUT.focus = false;
- // pwdINPUT.focus = true;
- // }
- // }
- // }
- // }
- Rectangle {
- property string userRole: "admin"
- id: userRoleAdminRECT
- x: (parent.width / 17) * 7 //12
- y: (parent.height / 3) / 2
- width: (parent.width / 17) * 3
- height: roleRectHeight
- color: Globals.actUserRole == userRole?Globals.customer_color_base:"lightgray"
- border.color: Globals.actUserRole != userRole?Globals.customer_color_base:"lightgray"
- border.width: 3
- Label {
- anchors.centerIn: parent
- font.pixelSize: roleFontSize
- text: Globals.getActUserRoleText(parent.userRole)
- }
- MouseArea {
- anchors.fill : parent
- onClicked: {
- sysinfo.beep();
- Globals.actUserRole = parent.userRole;
- if (settings.value("UserRoleAdmin/Password", "*") === "*") {
- pwdINPUT.focus = false;
- Qt.inputMethod.hide();
- stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- } else {
- pwdINPUT.focus = false;
- pwdINPUT.focus = true;
- }
- }
- }
- }
- Rectangle {
- id : pwdRECT
- x: (parent.width / 17) * 7
- y: (parent.height / 6) * 3
- width: (parent.width / 17) * 3
- height: 40
- radius: 4
- color: "silver"
- TextInput {
- id: pwdINPUT
- x: (parent.height - font.pixelSize) / 2
- y: x
- width: parent.width - (parent.height - font.pixelSize)
- clip: true
- color: "black"
- font.pixelSize: 25
- echoMode: TextInput.Password
- passwordMaskDelay: 250
- text: ""
- onAccepted: {
- console.debug(" TXT " + text + " " + Qt.md5(text));
- if(((settings.value("UserRoleEng/Password", "*") === Qt.md5(text)) && (Globals.actUserRole === "eng")) ||
- ((settings.value("UserRoleEng/Password", "*") === "*") && (Globals.actUserRole === "eng")) ) {
- focus = false;
- Qt.inputMethod.hide();
- stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- }
- if(((settings.value("UserRoleAdmin/Password", "*") === Qt.md5(text)) && (Globals.actUserRole === "admin")) ||
- ((settings.value("UserRoleAdmin/Password", "*") === "*") && (Globals.actUserRole === "admin")) ) {
- focus = false;
- Qt.inputMethod.hide();
- stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- }
- text = "";
- }
- }
- }
- Timer {
- interval: 1
- running: Globals.startTO.length > 0 ? true:false
- onTriggered: {
- if (Globals.startTO.length > 0) {
- stackView.push(Qt.resolvedUrl("HMI_MainMenu.qml"));
- }
- }
- }
- }
- //============================================================================
- }
- }
- }
|