import QtQuick 2.0 import "../../eventsList.js" as EventsList import "../../com/neusoft/auto/widgets" import "../../layoutList.js" as Layout import "../../windowsList.js" as WindowsList import Label 2.0 HMIWindow { id:edit_new_msg //y:128 property int curMsgIndex: 0 property bool numInputMode:false property bool clickicon_contactstatus:false property bool outgoingcallstatus:false property bool incommingcallstatus:false property bool gesturesignals_leftstatus:false property bool gesturesignals_rightstatus:false //ADD #F0042 2016/10/14 wangshuang begin property int shengyuzishu:70 property int duanxingeshu:1 //ADD #F0042 2016/10/14 wangshuang end Component.onCompleted: { windowID = WindowsList.BTM_NEW_MSG systemCtrl.setTextInputHandle(newMsgInput) } onVisibleChanged: { //ADD #105313 2016/12/07 liduo begin if(newmsg_area.visible==false){ bKeyboardVisiable = true newmsg_area.visible=true } if(handWrite.visible==true) bhandwritebar=true if(keyBoard.visible==true) bhandwritebar=false if(handWrite.changecanvas==false){ handWrite.changecanvas=true } //ADD #105313 2016/12/07 liduo end bFullWindow = true bKeyboardVisiable = true //DEL #105313 2016/12/07 liduo begin //keyboardCallOut() //DEL #105313 2016/12/07 liduo end if(visible && newMsgInput.cursorVisible == true) { systemCtrl.setTextInputHandle(newMsgInput) } if(numInputMode == true){ //Fod #F0007 2016/10/10 wangshuang begin //changeIntoInputMode() //systemCtrl.handwriteshuzi(); numInputMode=false //Fod #F0007 2016/10/10 wangshuang end } } onCloseWindow: { if (closeType == Layout.CLOSE_BY_CLOSE) { // console.log("#######btm_new_msg.qml : onCloseWindow:CLOSE_BY_CLOSE") btCtrl.btpMsgWriteSavedState ="" newMsgInput.text = "" newMsgInput.cursorVisible = false btCtrl.setBtMsgContactSelectClear() btCtrl.btMsgContactAllSelectstate = true btCtrl.clearBtNewMsgInputListInfo() } else if (closeType == Layout.CLOSE_BY_OPEN) { if(clickicon_contactstatus==false&&outgoingcallstatus==false&&incommingcallstatus==false&&gesturesignals_leftstatus==false&&gesturesignals_rightstatus==false) { newMsgInput.text = "" btCtrl.setBtMsgContactSelectClear() btCtrl.clearBtNewMsgInputListInfo() } clickicon_contactstatus=false outgoingcallstatus=false incommingcallstatus=false gesturesignals_leftstatus=false gesturesignals_rightstatus=false } } HMILabel { //Fod #F0002 2016/10/10 wangshuang begin x:240//130 y:icon_return_label.y//0 width:480//700 height:38//57 text:qsTr("New message")+ systemCtrl.emptyString//New SMS color: "white" font.pixelSize: 30//26 horizontalAlignment: text.horizontalAlignment verticalAlignment: text.verticalAlignment //horizontalAlignment: Label.horizontalAlignment //Fod #F0002 2016/10/10 wangshuang end } HMIButton { id:icon_return x:0//3 y:5//-4 width: 138//130 height: 70//80 btnImg:icon_return.pressed?("qrc:MATERIAL/MATERIAL_M8X_BACK_BUTTON_P"+bgImageStyle):("qrc:MATERIAL/MATERIAL_M8X_BACK_BUTTON"+bgImageStyle) Image { id:icon_return_image x:20//12 //y:20 width: 20//24 height:34//40 source: "qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle anchors.verticalCenter:parent.verticalCenter } HMILabel { id:icon_return_label x:58//36 //y:25 //Fod #F0017 2016/10/11 wangshuang begin width: 64//60//98 //Fod #F0017 2016/10/11 wangshuang end height:30//35 text: qsTr("Back")+ systemCtrl.emptyString font.pixelSize: 30 anchors.verticalCenter:parent.verticalCenter } onClicked: { ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.BTM_NEW_MSG) } } HMILabel { //Fod #F0006 2016/10/10 wangshuang begin x: 65//39 y: 90 width: 150 height: 43 font.pixelSize: 30 text:qsTr("Receiver")+(":")+ systemCtrl.emptyString //Fod #F0006 2016/10/10 wangshuang end } Image { //Fod #F0006 2016/10/13 wangshuang begin x:208//203 y:72 width: 504//507 //Fod #F0006 2016/10/13 wangshuang end height: 78 source:"qrc:MATERIAL/MATERIAL_M8X_RECEIVER_BG_W504"+bgImageStyle } HMIListView { id:msgContactList x:211 y:69 width: 501//495 //Fod #F0038 2016/10/13 wangshuang begin height: 90//60 //Fod #F0038 2016/10/13 wangshuang end model: btCtrl.btMsgContactListModel orientation: ListView.Horizontal delegate: del spacing: 3 onCountChanged: { if(count == 0) { listviewCover.visible = true } else { listviewCover.visible = false } } HMIMouseArea { anchors.fill: parent visible:numInputMode//handInputNum.visible //Fod #119868 2016/10/13 wangshuang begin onClicked://onPressed: //Fod #119868 2016/10/13 wangshuang end { handInputCfm() if(msgContactList.count > 0) msgContactList.positionViewAtIndex(msgContactList.count-2,ListView.End) } } } HMIMouseArea { id:listviewCover //Fod #F0128 2016/12/11 wangshuang begin x:208//164 y:200-128 width: 504//500 height: 78//43 //Fod #F0128 2016/12/11 wangshuang end visible: true onClicked: { changeIntoInputMode() systemCtrl.handwriteshuzi(); } } TextInput { id: handInputNum visible: numInputMode x:msgContactList.count>0?304:220 y:93 width: msgContactList.count>0?380:475 height: 60 font.pixelSize: 30 readOnly: false enabled: true horizontalAlignment: Text.AlignLeft clip: true color:"white" cursorVisible:true onVisibleChanged: { text = "" if(visible) { msgContactList.positionViewAtEnd() } else { if(msgContactList.count > 0) { // console.debug("xxxxxxxxxxxxxxxxxxxxxxxxxxx count="+msgContactList.count) msgContactList.positionViewAtIndex(msgContactList.count-2,ListView.End) } } } } Component { id:del Item { x:25 y:1//3//16 //Fod #F0044 2016/10/20 wangshuang begin //if the item is empty ,means it is the last item.click the last empyt empty into input mode width: (col0+col1) == ""?400:((contactLabel.contentWidth>418)?470:(contactLabel.contentWidth+52))//(col0+col1) == ""?400:((contactLabel.contentWidth>425)?470:(contactLabel.contentWidth+45)) // width: (col0+col1) == ""?400:470 height: 78//60 HMIMouseArea { anchors.fill: parent onClicked: { // console.debug("list view empty") changeIntoInputMode() } } Image { //Fod #F0038 2016/10/13 wangshuang begin id:receiver_img y:12//20//13 //Fod #F0038 2016/10/13 wangshuang end visible: (col0+col1) != "" width: parent.width height: 60//90 source:"qrc:MATERIAL/MATERIAL_M8X_RECEIVER_BG"+bgImageStyle } Item { anchors.fill: parent visible: (col0+col1) != "" HMILabel { x:7 y:24//1//15 id:contactLabel width:418//(contactLabel.contentWidth>425)?425:contactLabel.contentWidth//(contactLabel.contentWidth>442)?442:contactLabel.contentWidth height:35 //anchors.fill: parent text:contactText.text font.pixelSize: 30 horizontalAlignment: Label.AlignLeft elide:Text.ElideRight HMIMouseArea { anchors.fill: parent onClicked: { //Fod #F0128 2016/12/11 wangshuang begin //newMsgInput.cursorVisible = false //systemCtrl.setTextInputHandle(handInputNum) //keyboardCallOut() changeIntoInputMode() //Fod #F0128 2016/12/11 wangshuang end } } } Text { id:contactText font.pixelSize: 30 visible: false font.family: "Montserrat"//add lqy for 325291 //horizontalAlignment: Label.AlignLeft //elide:Label.ElideRight text: (col1=="")?col0:col1//col0 + " " +col1 } } Item { width:50//24//40 height: 55//43 x:(contactLabel.contentWidth>418)?(418+22):(contactLabel.contentWidth+22)//(contactLabel.contentWidth>442)?(442+15):(contactLabel.contentWidth+15) y:14//12//1 anchors.right: receiver_img.right visible: (col0+col1) != "" Image { width: 55//45//58 height: 55//58 source: close_img.pressed?"qrc:MATERIAL/MATERIAL_M8X_ICON_CLEAR_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_ICON_CLEAR"+bgImageStyle } HMIMouseArea { id:close_img anchors.fill: parent onClicked: { // console.debug("delBtMsgContact"+index) btCtrl.delBtMsgContact(index,col0) //Fod #136879,137333 2016/12/11 wangshuang begin //newMsgInput.cursorVisible = false systemCtrl.setTextInputHandle(newMsgInput) //systemCtrl.setTextInputHandle(handInputNum) //keyboardCallOut() //Fod #136879,137333 2016/12/11 wangshuang end } } } //Fod #F0044 2016/10/20 wangshuang end } } HMIButton { id:search_Cont //Fod #F0038 2016/10/13 wangshuang begin x:714//711 //Fod #F0038 2016/10/13 wangshuang end y:72 width: 186 height: 78 //labelText: "..." btnImg: search_Cont.pressed?("qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON_P"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON"+bgImageStyle) Image { id:search_Cont_image x:72 y:24 width: 32 height:32 source: "qrc:MATERIAL/MATERIAL_M8X_ICON_CONTACTS"+bgImageStyle } onClicked: { if( true == btCtrl.btConnectState ) { //add naca #119868 wudm 2016/10/11 start handInputCfm() //add naca #119868 wudm 2016/10/11 end clickicon_contactstatus=true bKeyboardVisiable = false ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.BTM_SELECT_CONT) } } } //DEL naca #119868 wudm 2016/10/11 start // HMIButton // { // id:confim_btn // x:710 // y:72 // width: 186 // height: 78 // //labelText: "OK" // visible: numInputMode//handInputNum.visible // labelPixelSize:18 // btnImg: confim_btn.pressed?("qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON_P"+bgImageStyle) // :("qrc:MATERIAL/MATERIAL_M8X_SETTINGS_BUTTON"+bgImageStyle) // onClicked: // { // console.debug("[btm_new_msg.qml] -------------------confim_btn onClicked handInputCfm ") // handInputCfm() // } // } //DEL naca #119868 wudm 2016/10/11 end function handInputCfm() { if( true == btCtrl.btConnectState ) { if(handInputNum.text!= "") { btCtrl.btmsgInputNumCFM(handInputNum.text); } } numInputMode = false //handInputNum.visible=false } Item { id:input_bar x:32 y:148 width: 900 height: (newmsg_area.visible == true)?403:725 HMIButton { x:25 y:10 btnImg: (newmsg_area.visible == true)?("qrc:MATERIAL/MATERIAL_M8X_SMS_BK_H318"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_SMS_BK_H718"+bgImageStyle) //ADD F0055 2017/1/18 mengyufeng begin Rectangle { height:(newmsg_area.visible == true)?318:718 width:842 color: "#130f0f" } //ADD F0055 2017/1/18 mengyufeng end } Flickable { id: flick x:50 y:0 width: 800//698 height: 310 flickableDirection:Flickable.VerticalFlick contentWidth: newMsgInput.paintedWidth contentHeight: newMsgInput.paintedHeight clip: true interactive:true boundsBehavior: Flickable.StopAtBounds function ensureVisible(r) { if (contentX >= r.x) contentX = r.x; else if (contentX+width <= r.x+r.width) contentX = r.x+r.width-width; if (contentY >= r.y) contentY = r.y; else if (contentY+height <= r.y+r.height) contentY = r.y+r.height-height; } TextEdit { id: newMsgInput x:0 y:30 width: 800 height: newMsgInput.contentHeight focus: true //ADD F0055 2017/1/18 mengyufeng begin color: "#130f0f" selectedTextColor:"#676767" selectionColor:"#676767" font.family:"Montserrat" //ADD F0055 2017/1/18 mengyufeng end cursorVisible:true font.pixelSize: 30 wrapMode: TextEdit.Wrap onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) //ADD F0055 2017/1/18 mengyufeng begin cursorDelegate:mCursorDelegate Component { id:mCursorDelegate Rectangle { id:mCursorRectangle color: "white" height: 30//newMsgInput.cursorRectangle.height width: 1//newMsgInput.cursorRectangle.width Timer { running: true repeat: true interval: 800 onTriggered: { mCursorRectangle.visible = ! mCursorRectangle.visible } } } } Label { id:newMsgLable x:0 y:2 height: 30*5//(newMsgInput.lineCount>1)?(newMsgInput.lineCount+1)*30:30//newMsgLable.height width:800 text:newMsgInput.text font.family:"Montserrat" color: "white" font.pixelSize: 30 wrapMode: Label.Wrap horizontalAlignment: Label.AlignLeft verticalAlignment: Label.AlignTop } //ADD F0055 2017/1/18 mengyufeng end onLengthChanged: { if(length > 80) { // console.debug("lengthlengthlengthlengthlengthlengthlengthlength") remove(80, 82) } //ADD #F0042 2016/10/14 wangshuang begin if(length <70) { shengyuzishu=70-length duanxingeshu=1 } else{ shengyuzishu=70-length%70 duanxingeshu=1+length/70 } //ADD #F0042 2016/10/14 wangshuang end } onCursorPositionChanged: { if(newMsgInput.text.length == 80) { // console.debug("lengthlengthlengthlengthlengthlengthlengthlength") keyBoard.maximumState=true } else if(newMsgInput.text.length <80) { keyBoard.maximumState=false } } onCursorVisibleChanged: { text_cursor.visible = !newMsgInput.cursorVisible if(numInputMode==true){ newMsgInput.cursorVisible=false systemCtrl.handwriteshuzi() }else{ newMsgInput.cursorVisible=true } } //ADD #105313 2016/12/07 liduo begin HMIMouseArea{ anchors.fill: parent //visible: !keyBoardItem.visible //enabled: !keyBoardItem.visible onClicked: { newMsgInput.cursorPosition = newMsgInput.positionAt(mouseX,mouseY) if(handWrite.visible==true) bhandwritebar=true if(keyBoard.visible==true) bhandwritebar=false if(handWrite.changecanvas==false){ handWrite.changecanvas=true } //ADD #145225 2017/01/18 wangs begin systemCtrl.pinyinsreachclear() //ADD #145225 2017/01/18 wangs end } } //ADD #105313 2016/12/07 liduo begin } } HMIMouseArea { id: text_cursor visible: !newMsgInput.cursorVisible anchors.fill: parent onClicked:{ //ADD #105313 2016/12/07 liduo begin newMsgInput.cursorPosition = newMsgInput.positionAt(mouseX,mouseY) //ADD #105313 2016/12/07 liduo begin handInputCfm() numInputMode = false //handInputNum.visible=false newMsgInput.cursorVisible = true systemCtrl.setTextInputHandle(newMsgInput) keyBoard.iNum=false handWrite.iNum=false keyboardCallOut() systemCtrl.handwriteshuzi() } } HMIMouseArea { id: keyboradhideCover visible: false anchors.fill: parent onClicked:{ //ADD #105313 2016/12/07 liduo begin newMsgInput.cursorPosition = newMsgInput.positionAt(mouseX,mouseY) //ADD #105313 2016/12/07 liduo begin keyboradhideCover.visible=false numInputMode = false //handInputNum.visible=false newMsgInput.cursorVisible = true systemCtrl.setTextInputHandle(newMsgInput) keyBoard.iNum=false handWrite.iNum=false keyboardCallOut() if(handWrite.visible==true){ keyBoard.visible=false } } } } /*---------------------------------------------Key Board Start----------------------------------------*/ Item { id:newmsg_area y: 562 width: 750 height: 320-62 HMIKeyBoard { id:keyBoard x:0 y:0 iConfirm: true newline:true onClickspell: { if(!keyBoard.isPinyin) { systemCtrl.setKeyPress(spell) } if(false == newMsgInput.cursorVisible && false == handInputNum.visible) { keyBoard.iNum=true if(handWrite.visible) { handWrite.iNum=true } systemCtrl.setTextInputHandle(handInputNum) numInputMode = true //handInputNum.visible=true } } onHandwriteborad: { keyBoard.visible=false handWrite.visible=true //ADD #105313 2016/12/07 liduo begin bhandwritebar=true //ADD #105313 2016/12/07 liduo end } onCloseKeyBoardSignal: { //keyBoard.visible=false newmsg_area.visible = false keyboradhideCover.visible = true bKeyboardVisiable = false //ADD #105313 2016/12/07 liduo begin bhandwritebar=false //ADD #105313 2016/12/07 liduo end if( true == btCtrl.btConnectState ) { numInputMode = false //handInputNum.visible=false } } onSearchStart: { handInputCfm() handWrite.visible=false newmsg_area.visible = false keyboradhideCover.visible = true bKeyboardVisiable = false if( true == btCtrl.btConnectState ) { numInputMode = false //handInputNum.visible=false } } onDelKeyPressed:{ // console.debug("dele key pressd -cmy--test") if(handInputNum.visible == false && newMsgInput.cursorVisible == false) { btCtrl.delContact(msgContactList.count); } else if(handInputNum.text == "" && newMsgInput.cursorVisible == false){ btCtrl.delContact(msgContactList.count); } } } HMIHandWrite{ id:handWrite y:0 iConfirm: true visible: false newline:true onKeyborad: { //console.log("#############################################") keyBoard.iType=itype keyBoard.visible=true handWrite.visible=false //ADD #105313 2016/12/07 liduo begin bhandwritebar=false //ADD #105313 2016/12/07 liduo end } onCloseKeyBoardSignal: { bKeyboardVisiable = false //keyBoard.visible=false newmsg_area.visible = false keyboradhideCover.visible = true //ADD #105313 2016/12/07 liduo begin bhandwritebar=false //ADD #105313 2016/12/07 liduo end if( true == btCtrl.btConnectState ) { numInputMode = false //handInputNum.visible=false } } onSearchStart: { handInputCfm() handWrite.visible=false newmsg_area.visible = false keyboradhideCover.visible = true bKeyboardVisiable = false if( true == btCtrl.btConnectState ) { numInputMode = false //handInputNum.visible=false } } onDelKeyPressed:{ // console.debug("dele key pressd -cmy--test") if(handInputNum.visible == false && newMsgInput.cursorVisible == false) { btCtrl.delContact(msgContactList.count); } else if(handInputNum.text == "" && newMsgInput.cursorVisible == false){ btCtrl.delContact(msgContactList.count); } } } } /*---------------------------------------------Key Board Over----------------------------------------*/ HMIButton { id:icon_Send x:100 //FOD #105313 2016/12/07 liduo begin y:newmsg_area.visible?(bhandwritebar==true?726:486):888 //FOD #105313 2016/12/07 liduo end width: 850 height: 66 //labelText: qsTr("Send")+ systemCtrl.emptyString btnImg:icon_Send.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_1_BUTTON_NOSWITCH_P"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_1_BUTTON_NOSWITCH"+bgImageStyle) Item { anchors.centerIn: parent visible:btCtrl.btConnectState Image { id:confim_btn_image x:-18 y:-25 width: 44//32 height:32 source: "qrc:MATERIAL/MATERIAL_M8X_ICON_SEND-SMS"+bgImageStyle } HMILabel { x:-77 y:10 width: 150 height: 28 font.pixelSize: 18 text:qsTr("Send")+ systemCtrl.emptyString horizontalAlignment: Label.horizontalCenter } } //ADD #F0042 2016/10/14 wangshuang begin HMILabel { id:zishu_geshu x:770 width:60 height:35 visible: btCtrl.btConnectState color:"#A0A0A0" text:shengyuzishu+"/"+duanxingeshu font.pixelSize: 26 horizontalAlignment: Label.AlignLeft anchors.verticalCenter: parent.verticalCenter } //ADD #F0042 2016/10/14 wangshuang end onClicked: { if(msgContactList.count != 0) { handInputCfm() btCtrl.bTMsgMultiSend(newMsgInput.text) newMsgInput.text = "" ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.BTM_ALL_LIST) } else{ if( true == btCtrl.btConnectState ) { if(handInputNum.text!= "") { btCtrl.btmsgInputNumCFM(handInputNum.text); } numInputMode = false //handInputNum.visible=false } } } } function keyboardCallOut() { if((keyBoard.visible == false) && (handWrite.visible == false)) { newmsg_area.visible = true //DEL #105313 2016/12/07 liduo begin //keyBoard.visible = true //DEL #105313 2016/12/07 liduo end bKeyboardVisiable = true //ADD #105313 2016/12/07 liduo begin if(handWrite.visible==true) bhandwritebar=true if(keyBoard.visible==true) bhandwritebar=false if(handWrite.changecanvas==false){ handWrite.changecanvas=true } //ADD #105313 2016/12/07 liduo end } } function changeIntoInputMode() { keyboradhideCover.visible = false keyBoard.iNum=true if(handWrite.visible) { handWrite.iNum=true } systemCtrl.setTextInputHandle(handInputNum) numInputMode = true //handInputNum.visible=true newMsgInput.cursorVisible = false msgContactList.positionViewAtEnd() keyboardCallOut() } Connections{ target:btCtrl onBtMsg_NewMsgContactChanged:{ // console.debug("onBtMsg_NewMsgContactChanged") handInputNum.text = btCtrl.getNewMsgContact() } onBtConnectStatusChanged: { if( false == btCtrl.btConnectState ) { newmsg_area.visible = false newMsgInput.text = "" handInputNum.text = "" if(edit_new_msg.visible == true) { ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.BTM_NEW_MSG) ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.BTP_HOME) } } } onBtOutGoingCallChanged: { outgoingcallstatus=true btCtrl.btpMsgWriteSavedState = newMsgInput.text newMsgInput.text = "" } onBtIncommingCallChanged: { incommingcallstatus=true btCtrl.btpMsgWriteSavedState = newMsgInput.text newMsgInput.text = "" } } Connections{ target:ScreenManager // onBtHungupPageReset:{//del by lium for screenchange begin // newMsgInput.text=btCtrl.btpMsgWriteSavedState // newMsgInput.cursorPosition = newMsgInput.text.length // }//del by lium for screenchange end } Connections { target:systemCtrl // onSingleFingerGestureSignals_Left: // { // gesturesignals_leftstatus=true // } // onSingleFingerGestureSignals_Right: // { // gesturesignals_rightstatus=true // } } }