import QtQuick 2.5 //import Qt.labs.controls 1.0 import QtQuick.Controls 2.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 { font.pixelSize: roleFontSize width: parent.width - parent.border.width * 2 x: parent.border.width y: parent.border.width * 2 // (parent.heigh ) - font.pixelSize scale: paintedWidth > width ? (width / paintedWidth):1 transformOrigin: Item.Left 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")); } } } } //============================================================================ } } }