import QtQuick 2.0 import "../com/neusoft/auto/widgets" import "../eventsList.js" as EventsList import "../layoutList.js" as Layout import "../windowsList.js" as WindowsList import Label 2.0 HMIWindow{ id:main_window property bool isLongPress : false property bool needReflesh : false property bool speechIndex : false property int pyeventx: 15 Component.onCompleted: { windowID = WindowsList.CARLINK_DIALOGBOX } onVisibleChanged: { bMainWindow = false bFullWindow = true if(main_window.visible ===true){ console.log("---------dialogbox----visible--------") user_input.focus = false; user_input.text=""; //keyBoard.opacity = 0; } else if(main_window.visible ===false) { if(speechIndex===true) { console.log("visible is false ,speech_stop ---------------->") speechIndex=false carlinkCtrl.stopSpeech() car_vrTimer.stop() speech_tanchu.visible=false } } } HMILabel { id : text_title x : 51 -pyeventx y : 148-131 height : 28 width : 250 font.pixelSize:26 horizontalAlignment: Label.AlignLeft text : carlinkCtrl.currentDialogName } HMIButton{ id:back x:689-pyeventx y:151-131 width:31 height:21 btnImg:back.pressed?"qrc:MATERIAL/MATERIAL_M8X_ICON_BACK_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle onClicked: { //ScreenManager.changeForm(Layout.FM_CLOSE,windowID) carlinkCtrl.setCurrentDialogId("ChatInteraction"); carlinkCtrl.cleanMsgListOfUserId(); ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CHATINTERACTION) console.log("dialog back setCurrentUseId ChatInteraction---------->>>"); } } Item{ id:input_frame x:34-pyeventx y:197-131 width: 524 height: 48 Image { id: input_bk x: 0 y: 0 source:user_input.focus ? "qrc:MATERIAL/MATERIAL_M8X_INPUT-BOX_524_C"+bgImageStyle : "qrc:MATERIAL/MATERIAL_M8X_INPUT-BOX_524"+bgImageStyle HMILabel { id: input_title x:35 y:13 width: 250 height: 23 color:"gray" text:qsTr("Please input info")+systemCtrl.emptyString font.pixelSize: 23 visible:user_input.focus||user_input.text.length>0?false:true } HMIInputText { id: user_input x:5 y:10 height: 48 width: 500 focus: false horizontalAlignment: Label.AlignLeft color: "white" text:"" font.pixelSize: 24 clip:true //autoScroll: false cursorVisible:user_input.focus?true:false onCursorPositionChanged: { if(user_input.text.length>0) { keyBoard.deleteEnable=true } else { keyBoard.deleteEnable=false } } onContentWidthChanged: { if (user_input.text.length > 200) { user_input.text = user_input.text.substring(0, user_input.text.length - 1); } } MouseArea { anchors.fill: parent onClicked: { user_input.focus = true if(keyBoard.opacity ===1){ keyBoard.opacity = 0 } else{ keyBoard.opacity = 1 } if(keyBoard.enabled ===false){ keyBoard.enabled = true; } else{ keyBoard.enabled = false; } if(user_input.text.length > 0) { keyBoard.deleteEnable=true } else { keyBoard.deleteEnable=false } systemCtrl.setTextInputHandle(user_input) } } } } } Component{ id:model_delegate Item{ id : everyone height: (model.modelData.Msg_Type==="1")?msg_background.height+25+45: (model.modelData.Msg_Type==="2")?msg_background.height+25+45: (model.modelData.Msg_Type==="3")?msg_background.height+25+45: "" //height: 150 width:700 HMILabel{ id : msg_time x:269-34 y:19 height: 25 width :230 font.pixelSize:25 horizontalAlignment: Label.AlignHCenter text:model.modelData.Msg_Date visible:model.modelData.Displaytime==="1"?true:false } Image{ id : send_status x:264-34-34 y:318-253 source: model.modelData.SendStatus ==="1"?"qrc:MATERIAL/MATERIAL_M8X_ICON_SENDING"+bgImageStyle :(model.modelData.SendStatus ==="2"?"qrc:MATERIAL/MATERIAL_M8X_ICON_SMS-FALLURE"+bgImageStyle:"") visible:model.modelData.SendStatus ==="0"?false:true //source: "qrc:MATERIAL/MATERIAL_M8X_ICON_SMS-FALLURE"+bgImageStyle } Image{ id : msg_background x:model.modelData.SndOrRcv==="1"?0: (model.modelData.Msg_Type==="3")?400:((model.modelData.Msg_Type==="2")?264-34:264-34) y:318-253 //width: 470 width: (model.modelData.Msg_Type==="1")?470: ((model.modelData.Msg_Type==="3")?300:470)//((model.modelData.Msg_Type==="2")?380:470) height: (model.modelData.Msg_Type==="1")?msg_content.height: ((model.modelData.Msg_Type==="3")?145:msg_content.height) source: model.modelData.SndOrRcv==="1"?"qrc:MATERIAL/MATERIAL_M8X_DIALOG-BOX_W470_H62"+bgImageStyle : "qrc:MATERIAL/MATERIAL_M8X_DIALOG-BOX_W470_H62_P"+bgImageStyle Image{ id:touxiang x:model.modelData.SndOrRcv==="1"?9:((model.modelData.Msg_Type==="3")?245:415)//((model.modelData.Msg_Type==="2")?245:415) y:8 sourceSize.height:46 sourceSize.width:46 source: model.modelData.SndOrRcv==="1"?model.modelData.Icon_Path:"qrc:MATERIAL/MATERIAL_M8X_DEFAULT_AVATAR"+bgImageStyle } Text{ id : msg_content x:model.modelData.SndOrRcv==="1"?(99-34):(316-264) y:340-318-8 width :348 font.pixelSize:20 horizontalAlignment: Label.AlignLeft verticalAlignment :Label.AlignTop wrapMode: Label.Wrap text:model.modelData.Msg_Content visible: model.modelData.Msg_Type==="1"? true : false color:"white" font.family: "方正兰亭黑简体" height:msg_content.lineCount*20+42 } Image{ id : msg_speech x:model.modelData.SndOrRcv==="1"?60:model.modelData.Msg_Content<=5?(415-40): model.modelData.Msg_Content<=10?(380-40): model.modelData.Msg_Content<=15?(345-40): model.modelData.Msg_Content<=20?(310-40): model.modelData.Msg_Content<=25?(275-40): model.modelData.Msg_Content<=30?(240-40): model.modelData.Msg_Content<=35?(205-40): model.modelData.Msg_Content<=40?(170-40): model.modelData.Msg_Content<=45?(135-40): model.modelData.Msg_Content<=50?(100-40): model.modelData.Msg_Content<=55?(65-40): (model.modelData.Msg_Content<60?(45-40):(30-40)) /* (5>") if ("1" === carlinkCtrl.currentDialogType){ carlinkCtrl.loadMoreMsgforId(); } else if ("3" === carlinkCtrl.currentDialogType){ carlinkCtrl.loadMoreMsgforGroup(); } else{ } } } } HMIButton{ id: send x:574-pyeventx y:193-131 labelText: qsTr("Send")+systemCtrl.emptyString enabled:user_input.text.length>0?true:false labelColor: (user_input.text.length >0)?"#FFFFFF" : "#656565" btnImg:send.pressed? "qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON_PUSHED"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON"+bgImageStyle onClicked: { console.log("send button is clicked---------------->") carlinkCtrl.appSendMsgText_Request(user_input.text); } } HMIButton{ id:speech x:70-pyeventx+2 y:bMaxWindow?828-131-3:444-131-3 labelPixelSize:14 labelText:speechIndex? qsTr("End_Record"):qsTr("Speech_Record") btnImg:speech.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle onClicked: { if(speechIndex===false) { console.log("speech button is clicked---------------->") console.log("start onClicked systemCtrl.getCurrentSource()-->" + systemCtrl.getCurrentSource()) carlinkCtrl.getTimeForSpeechStart(); if (Layout.HMI_SRC_PHONE == systemCtrl.getCurrentSource()) { console.log("current source is phone") } else { systemCtrl.reqSource(Layout.HMI_SRC_AUDIO_TTS,Layout.HMI_SRC_START,Layout.HMI_SRC_Front) } speechIndex=true carlinkCtrl.startSpeech() car_vrTimer.start() speech_tanchu.visible=true } else { console.log("speech_stop button is clicked---------------->") carlinkCtrl.getTimeForSpeechStop(); speechIndex=false carlinkCtrl.stopSpeech() car_vrTimer.stop() speech_tanchu.visible=false } } } HMIButton{ id:addpictrue x:192-pyeventx+2 y:bMaxWindow?828-131-3:444-131-3 btnImg:addpictrue.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle //enabled: carlinkCtrl.isUsbConnected?true:false Image{ x:47 y:18 source: "qrc:MATERIAL/MATERIAL_M8X_ICON_+"+bgImageStyle } onClicked: { carlinkCtrl.get_rootFolder(); ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_IMGBROWSER) } } HMIButton{ id:locationshare x:314-pyeventx+2 y:bMaxWindow?828-131-3:444-131-3 labelPixelSize:23 labelText: qsTr("Location") btnImg:locationshare.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle } HMIButton{ id:searchrequest x:436-pyeventx+2 y:bMaxWindow?828-131-3:444-131-3 labelPixelSize:23 labelText: qsTr("Track") btnImg:searchrequest.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle } HMIKeyBoard{ id: keyBoard x: 0 y: bMaxWindow ?440:257-131-70 opacity: 0 enabled: false iType:1 isPinyin:true iSerach:false iConfirm:true onClickspell: { if(!keyBoard.isPinyin) { systemCtrl.setKeyPress(spell) } } } DiagLogPopup{ x:-1 y:1 id:pop isMaxWindow: bMaxWindow popvisible: false } ShowImage{ id:showImage popvisible: false } Connections { target: carlinkCtrl onSigAutoGrpMsgListForIdChanged : { msg_list.model = carlinkCtrl.getAutoGroupListforId(); //user_input.focus = false; user_input.text=""; msg_list.currentIndex= carlinkCtrl.getAutoGroupListCount()-1 keyBoard.opacity = 0; keyBoard.enabled = false; } onSigImageFileDownLoadSuccess :{ var id = carlinkCtrl.getCurrentUseId(); if ("1" === carlinkCtrl.currentDialogType) { console.log("--------dialogbox-----user------") carlinkCtrl.selAutoGroupListforId(id); } else if ("3" === carlinkCtrl.currentDialogType ){ carlinkCtrl.selAutoGroupListforGroup(id); } else{ //do nothing } } } Rectangle{ id:speech_tanchu anchors.verticalCenter:parent.verticalCenter anchors.horizontalCenter:parent.horizontalCenter width: 300;height: 150; color:"lightgreen" radius: 10 Text { id: text3 text: "录制中......" anchors.verticalCenter:parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter font.pointSize: 30 font.bold: true } visible:false opacity: 0.7 } /* Pop up result Timer */ Timer { id:car_vrTimer interval: 60000 running: false repeat: false onTriggered: { //text3.text=20//main_window.counter //main_window.counter-=1; //if(main_window.counter<0) //{ speechIndex=false carlinkCtrl.getTimeForSpeechStop(); carlinkCtrl.stopSpeech(); speech_tanchu.visible=false //text3.visible=false diagCtrl.stopVR() car_vrTimer.stop() // } } } }