import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import Qt.labs.controls 1.0 import QtQuick.Layouts 1.1 import QtQml 2.2 import ApplicationLauncher 1.0 import "qrc:/Globals" Rectangle { id: root width: parent.width height: parent.height color: "white" property int ipsettingsXpos: 200 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 //============================================================================ Component.onCompleted: { setEth0.doGetInterface(); hmiIP.ipFocus = 0; } // Rectangle{ // x: 100 // y: 50 // width:200 // height: 50 // color: "lightgray" // Switch { // id:dhcpSWITCH // checked: false // text: (checked)?"DHCP":"STATIC" // font.pixelSize: 20 // onCheckedChanged: { // hmiIP.ipvisible = !checked; // hmiNETMASK.ipvisible = !checked; // hmiGATEWAY.ipvisible = !checked; // hmiDNS.ipvisible = !checked; // } // } // } Label { id: lab1 x: hmiIP.posX - lab1.implicitWidth y: hmiIP.posY // visible: !dhcpSWITCH.checked font.pixelSize: 20 //: ID:_sys_ipaddress Ip Address settings text: qsTrId("_sys_ipaddress") + " : " + transLoad.emptyString //qsTr("IP-Adresse : ") + transLoad.emptyString } IpAddressInput { id: hmiIP posX: ipsettingsXpos posY: 100 ipwidth: 200 ipcolor: "black" ipFontSize: 20 onIpAddressChanged: { setEth0.address = ipAddress; } onKeyDownPressed: { var foc = ipFocus; ipFocus = 0; hmiNETMASK.ipFocus = foc; } onKeyUpPressed: { var foc = ipFocus; ipFocus = 0; hmiDNS.ipFocus = foc; } } Label { id: lab2 x: hmiNETMASK.posX - lab2.implicitWidth y: hmiNETMASK.posY // visible: !dhcpSWITCH.checked font.pixelSize: 20 //: ID:_sys_netmask Ip Address settings Netmask text: qsTrId("_sys_netmask") + " : " + transLoad.emptyString //qsTr("Netmask : ") + transLoad.emptyString } IpAddressInput { id: hmiNETMASK posX: ipsettingsXpos posY: 150 ipwidth: 200 ipcolor: "black" ipFontSize: 20 onIpAddressChanged: { setEth0.netmask = ipAddress; } onKeyDownPressed: { var foc = ipFocus; ipFocus = 0; hmiGATEWAY.ipFocus = foc; } onKeyUpPressed: { var foc = ipFocus; ipFocus = 0; hmiIP.ipFocus = foc; } } Label { id: lab3 x: hmiGATEWAY.posX - lab3.implicitWidth y: hmiGATEWAY.posY // visible: !dhcpSWITCH.checked font.pixelSize: 20 //: ID:_sys_defaultrouter Ip Address settings Defaultrouter text: qsTrId("_sys_defaultrouter") + " : " + transLoad.emptyString //qsTr("Def. Router : ") + transLoad.emptyString } IpAddressInput { id: hmiGATEWAY posX: ipsettingsXpos posY: 200 ipwidth: 200 ipcolor: "black" ipFontSize: 20 onIpAddressChanged: { setEth0.gateway = ipAddress; } onKeyDownPressed: { var foc = ipFocus; ipFocus = 0; hmiDNS.ipFocus = foc; } onKeyUpPressed: { var foc = ipFocus; ipFocus = 0; hmiNETMASK.ipFocus = foc; } } Label { id: lab4 x: hmiDNS.posX - lab4.implicitWidth y: hmiDNS.posY // visible: !dhcpSWITCH.checked font.pixelSize: 20 //: ID:_sys_dns1 Ip Address settings DNS Server 1 text: qsTrId("_sys_dns1") + " : " + transLoad.emptyString //qsTr("DNS Server : ") + transLoad.emptyString } IpAddressInput { id: hmiDNS posX: ipsettingsXpos posY: 250 ipwidth: 200 ipcolor: "black" ipFontSize: 20 onIpAddressChanged: { setEth0.nameserver = ipAddress; } onKeyDownPressed: { var foc = ipFocus; ipFocus = 0; hmiIP.ipFocus = foc; } onKeyUpPressed: { var foc = ipFocus; ipFocus = 0; hmiGATEWAY.ipFocus = foc; } } ButtHMI { buttX: 50 buttY: 290 buttWidth:35 buttHeight: buttWidth text: "\uf0c7" //floppy-sign color: Globals.customer_color_base onButtPressed: { hmiIP.makeIpAddress(); hmiNETMASK.makeIpAddress(); hmiGATEWAY.makeIpAddress(); hmiDNS.makeIpAddress(); setEth0.doSetInterface(); } } ButtHMI { buttX: 150 buttY: 290 buttWidth: 35 buttHeight: buttWidth color: Globals.customer_color_base text: "\uf046" //check-sqare onButtPressed: { hmiIP.makeIpAddress(); hmiNETMASK.makeIpAddress(); hmiGATEWAY.makeIpAddress(); hmiDNS.makeIpAddress(); setEth0.doRestartNetwork(); } } ButtHMI { id: buttUPDATE buttX: 250 buttY: 290 buttWidth: 35 buttHeight: buttWidth visible: false color: Globals.customer_color_base text: "\uf0c5" //files -- für Update onButtPressed: { console.debug("Update Button Pressed"); updateHMI.popupVISIBLE = true; } } HMI_UpdatePopup { id: updateHMI popupVISIBLE: false //: ID:_sys_update_hmi Headline HMI Updatewindow popupTEXT: qsTrId("_sys_update_hmi") + transLoad.emptyString } SetNetworkInterface { id: setEth0 mode: "static" ifacename: "eth0" address: "192.168.0.125" netmask: "255.255.0.0" nameserver: "192.168.0.1" gateway: "192.168.0.1" infile: (sysinfo.currentCpuArchitecture == "x86_64") ?"/home/ru/IFACE/interfaces":"/etc/network/interfaces" outfile: (sysinfo.currentCpuArchitecture == "x86_64") ?"/home/ru/IFACE/interfaces":"/etc/network/interfaces" onAddressChanged: { hmiIP.ipAddress = address; } onNetmaskChanged: { hmiNETMASK.ipAddress = netmask; } onGatewayChanged: { hmiGATEWAY.ipAddress = gateway; } onNameserverChanged: { hmiDNS.ipAddress = nameserver; } onCmdDone: { hmiIP.ipAddress = setEth0.address; hmiNETMASK.ipAddress = setEth0.netmask; hmiGATEWAY.ipAddress = setEth0.gateway; hmiDNS.ipAddress = setEth0.nameserver; } } //============================================================================ //Language settings Rectangle { id: langSelect width: (height / 5) * 1.5 height: root.height x: root.width / 2 y:0 color: "lightgray" function dispLang(){ // setze aktive Sprache idACTLANGIMG.source = "qrc:/Languages/FLAG-" + transLoad.getActiveLanguage() + ".svg"; var languages = transLoad.getLanguages(); langData.clear(); languages.forEach(function(entry) { if (entry.length > 0) { console.debug(JSON.stringify(entry)); langData.append( {flag: "qrc:/Languages/FLAG-" + entry + ".svg", name: entry } ); } }); } Image { x: 0 y: 0 id: idACTLANGIMG fillMode: Image.PreserveAspectFit sourceSize.height: parent.height / 5 sourceSize.width: parent.height / 5 } ListModel { id: langData } Item { id: langListArea width: parent.width height: parent.height - idACTLANGIMG.sourceSize.height y: idACTLANGIMG.sourceSize.height Component { id: langDataDelegate Item { x:langListArea.width * 0.1 width: height * 1.5 height: langListArea.height / 5 Rectangle { anchors.fill: parent radius: 4 gradient: Gradient { GradientStop { position:0 ; color: (transLoad.getActiveLanguage() === name) ? Globals.customer_color_base : "darkgray" } GradientStop { position:1 ; color: (transLoad.getActiveLanguage() === name) ? Globals.customer_color_base : "black" } } } Image { id:langFLAGIMG anchors.centerIn: parent fillMode: Image.PreserveAspectFit sourceSize.height: parent.height - parent.height * 0.25 sourceSize.width: parent.width source: flag smooth: true } MouseArea { anchors.fill: parent onClicked: { settings.setValue("HMI/Language", name); // unbedingt vor dispLang() transLoad.selectLanguage(name); langSelect.dispLang(); dateTimeSettings.datetimeSet(); // aktuelle Zeit Setzen } } } } ListView { id: langLISTVIEW anchors.fill: parent model: langData delegate: langDataDelegate clip: true focus: true } } Component.onCompleted: { dispLang(); var count = langData.rowCount(); // set active item for Joblist, scroll to active job for (var i = 0, len = langData.count; i < len; i++) { var actlang = langData.get(i).name; if ( actlang === transLoad.getActiveLanguage() ) langLISTVIEW.currentIndex = i; } } } //Languagesettings end //Test Month/Day Rectangle { width: root.width / 2 - langSelect.width //(root.height / 5) * 1.5 height: root.height x: root.width / 2 + langSelect.width y: 0 //color: Globals.customer_color_base //"blue" HMI_DateTimeSettings { id: dateTimeSettings anchors.fill: parent } } //Test Month/Day end // Update tarFiles von USB Item { id: updateItem ApplicationLaunch { id: appUPDATE appName: "sudo " + Globals.baseDir + "/Scripts/FindUpdate.sh " arguments: "" onAppFinished: { var lines = stdOUT.split(/[\r\n]+/g); var idx = 0; var files = []; lines.forEach(function(entry) { if (entry.length > 0) { if(!updateHMI.popupVISIBLE) { // Datenstruktur nur wenn nicht sichtbar aufbauen files.push(entry); } ++idx; } }); updateTIMER.interval = 5000; updateTIMER.restart(); buttUPDATE.visible = (idx > 0)?true:false; if ((updateHMI.popupVISIBLE) && (idx == 0)) updateHMI.popupVISIBLE = false; if (!updateHMI.popupVISIBLE) updateHMI.listData = files; } } Timer { id: updateTIMER interval: 500 running: true repeat: false onTriggered: { appUPDATE.launchScript(); } } } // Update tarFiles von USB } } }