123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- 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()
- }
- }
- }
- }
- }
|