import QtQuick import QtQuick.Controls 2.5 import QtQuick.Layouts 1.3 import "backend.js" as Backend Item { property string back_content: "ask content"; property string move_content: ""; property int uid: 0 property string strArea:"" property string strNo:"" width: 1920 height: 1080 visible: true FontLoader { id: alibaba source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf" } FontLoader { id: fontawesome source: "qrc:/components/font/fontawesome-webfont.ttf" } signal loginSuccess(var userName, var password) function loginUser(uname, pword) { var ret = Backend.validateUserCredentials(uname, pword) var message = "" if (ret) { message = "用户名或密码输入错误" subPopup.popMessage = message subPopup.open() return } // loginSuccess(uname, pword) appModel.userLogin(uname, pword); page_car.visible = true page_car.stack = stack stack.push(page_car) } function moveBegin(area,no) { appModel.moveBegin(area,no) back_content="\t 自动驾驶即将启动 \n\t 是否还需要保持远程监控"; trackDialog.visible=true; /* if(appModel.autoClose()) { page_detail.disconnect() appModel.leaveCar() stack.pop() stack.pop() } */ } function carManage(){ stack.pop() } function workManage(){ page_work.visible=true; page_work.stack=stack; stack.push(page_work) } objectName: "tst" function popDialog(str,area,no, vid) { strArea=String.fromCharCode(0x41+area)+"" no= no+1 strNo=(no<3?"新"+strArea+(no+1).toString()+"罐":strArea+(no-2).toString()+"罐") back_content=str+"已经到达"+strNo+"区域 \n\t 请求远程操控"; uid=vid; backDialog.visible=true; } function moveErrorDialog(desc) { strDesc="不能执行自动驾驶" if(desc===1) { back_content=strDesc+"(未能获取编码器数据)"; } else { back_content=strDesc+"(未知错误)"; } moveErrorDlg.visible=true; } function carSelect(id) { appModel.connectCar(id) } function track() { // appModel.track() } function unTrack() { console.log('1111111'); appModel.leaveCar() appModel.ready = false stack.pop() page_detail.update() stack.pop() } Popup { id: subPopup property alias popMessage: message.text background: Rectangle { id: subPopupBg implicitWidth: 1920 implicitHeight: 60 color: popupBgColorErr } y: (parent.height - 60) modal: true focus: true closePolicy: Popup.CloseOnPressOutside Text { id: message anchors.centerIn: parent font.pointSize: 12 color: popupTextColor font.family: alibaba.name } onOpened: subPopupClose.start() } Timer { id: subPopupClose interval: 3000 onTriggered: subPopup.close() } Rectangle { anchors.fill: parent Image { fillMode: Image.PreserveAspectFit source: 'qrc:/images/bg.png' } color: 'transparent' } Rectangle { width: parent.width height: 80 color: 'transparent' z: 99 Image { anchors.horizontalCenter: parent.horizontalCenter fillMode: Image.PreserveAspectFit source: 'qrc:/images/banner.png' } Text { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter text: textTitle font.family: alibaba.name font.pointSize: 24 color: mainTextColor } } StackView { id: stack initialItem: page_login anchors.fill: parent } LoginPage { id: page_login visible: false } CarPage { id: page_car visible: false } WorkPage { id: page_work visible:false } DetailPage { id: page_detail visible: false } Dialog { id: backDialog visible: false modal: true x: (parent.width - width) / 2 y: (parent.height - height) / 2 closePolicy: Popup.NoAutoClose implicitWidth: 600 implicitHeight: 300 Text { text: back_content font.pointSize: 24 font.family: alibaba.name color: '#000000' anchors.horizontalCenter: parent.horizontalCenter y: 100 } Row { height: parent.height anchors.horizontalCenter: parent.horizontalCenter y: 200 CButton { id: quitButton textHeight: 50 fontHeight: 0.4 width: 150 height: 50 color: pressed ? textClickedColor : mainAppColor text: "确定" onClicked: { appModel.controlCar(uid); backDialog.visible = false; // videoWindow.close() // rootItem.qmlSignalQuit() } } spacing: 50 CButton { id: cancelBtn textHeight: 50 fontHeight: 0.4 width: 150 height: 50 color: pressed ? textClickedColor : mainAppColor text: "取消" onClicked: { appModel.cancelControl() backDialog.visible = false } } } } Dialog { id: trackDialog visible: false modal: true x: (parent.width - width) / 2 y: (parent.height - height) / 2 closePolicy: Popup.NoAutoClose implicitWidth: 600 implicitHeight: 300 Text { text: back_content font.pointSize: 24 font.family: alibaba.name color: '#000000' anchors.horizontalCenter: parent.horizontalCenter y: 100 } Row { height: parent.height anchors.horizontalCenter: parent.horizontalCenter y: 200 CButton { id: yesBtn textHeight: 50 fontHeight: 0.4 width: 150 height: 50 color: pressed ? textClickedColor : mainAppColor text: "是" onClicked: { track(); trackDialog.visible = false; // videoWindow.close() // rootItem.qmlSignalQuit() } } spacing: 50 CButton { id: noBtn textHeight: 50 fontHeight: 0.4 width: 150 height: 50 color: pressed ? textClickedColor : mainAppColor text: "否" onClicked: { unTrack(); trackDialog.visible = false } } } } Dialog { id: moveErrorDlg visible: false modal: true x: (parent.width - width) / 2 y: (parent.height - height) / 2 closePolicy: Popup.NoAutoClose implicitWidth: 600 implicitHeight: 300 Text { text: move_content font.pointSize: 24 font.family: alibaba.name color: '#000000' anchors.horizontalCenter: parent.horizontalCenter y: 100 } Row { height: parent.height anchors.horizontalCenter: parent.horizontalCenter y: 200 CButton { id: exbutton textHeight: 50 fontHeight: 0.4 width: 150 height: 50 color: pressed ? textClickedColor : mainAppColor text: "确定" onClicked: { appModel.controlCar(uid); backDialog.visible = false; // videoWindow.close() // rootItem.qmlSignalQuit() } } } } }