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 { // y:128 property int curMsgIndex: 0 Component.onCompleted: { windowID = WindowsList.CARLINK_CONTACTS_NEW_MSG systemCtrl.setTextInputHandle(newMsgInput) } onVisibleChanged: { bFullWindow = true if(visible && newMsgInput.cursorVisible == true) { systemCtrl.setTextInputHandle(newMsgInput) } } HMILabel { x:20 y:150-128 width:610 height:62 text:"Interact" color: "white" font.pixelSize: 26 horizontalAlignment: Text.horizontalAlignment verticalAlignment: Text.verticalAlignment } HMIButton { id:icon_return x:650 y:10 width: 90 height: 21 btnImg:icon_return.pressed?("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK_P"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle) onClicked: { ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_ALL_LIST) } } HMILabel { x: 24 y: 200-128 width: 600//380 height: 43 horizontalAlignment: Label.AlignLeft text:("SMS to:")+carlinkCtrl.currentPhoneNum+(" ")+carlinkCtrl.currentPhoneName//carlinkCtrl.getCurrentPhoneNum+carlinkCtrl.getCurrentPhoneName } HMIListView{ id:msgContactList x:24+110 y:200-128 width: 500 height: 43 model: carlinkCtrl.carlinkMsgContactListModel orientation: ListView.Horizontal delegate: del onCountChanged: { if(count == 0) { listviewCover.visible = true } else{ listviewCover.visible = false } } HMIMouseArea { anchors.fill: parent visible: handInputNum.visible onPressed: { handInputNum.visible=false newMsgInput.cursorVisible = false } } } HMIMouseArea { id:listviewCover x:24+110 y:200-128 width: 500 height: 43 visible: true onClicked: { systemCtrl.setTextInputHandle(handInputNum) handInputNum.visible=true newMsgInput.cursorVisible = false } } /*TextInput { id: handInputNum visible: false x:msgContactList.count > 0?24+110+100:24+110 y:200-128 width: 500 height: 43 font.pixelSize: 26 readOnly: false enabled: true horizontalAlignment: Text.AlignLeft clip: true color:"white" cursorVisible:true onVisibleChanged: { text = "" if(visible) { msgContactList.width=msgContactList.count > 0?100:500 msgContactList.positionViewAtEnd() } else{ msgContactList.width=500 } } }*/ Component{ id:del Item{ width: contactText.width height: 43 HMILabel{ anchors.fill: parent text:col0 + " " + col1 + ";" HMIMouseArea{ anchors.fill: parent onClicked: { newMsgInput.cursorVisible = false systemCtrl.setTextInputHandle(handInputNum) } } } Text{ font.pixelSize: 30 visible: false id:contactText text:col0 + " " + col1 + ";" } Item{ width:40 height: 43 x:contactText.width - 40 Image{ anchors.right: parent.right width: 10 height: 10 source: close_img.pressed?"qrc:MATERIAL/MATERIAL_M8X_ICON_AIR-CONDITION_CLOSE_P"+bgImageStyle :"qrc:MATERIAL/MATERIAL_M8X_ICON_AIR-CONDITION_CLOSE"+bgImageStyle } HMIMouseArea{ id:close_img anchors.fill: parent onClicked: { console.debug("delBtMsgContact"+index) carlinkCtrl.delCarlinkMsgContact(index,col0) newMsgInput.cursorVisible = false systemCtrl.setTextInputHandle(handInputNum) } } } } } HMIButton { id:search_Cont x:650 y:75 width: 90 height: 21 labelText: "..." btnImg: search_Cont.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_56_P"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_56"+bgImageStyle) onClicked: { //carlinkCtrl.sLPphoneBookListModelClear(); ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_SELECT_CONT) } } Item { id:input_bar x:24 y:60+60 width: 700 height: 310 HMIButton { x:0 y:0 btnImg: "qrc:MATERIAL/MATERIAL_M8X_SMS_BK_310"+bgImageStyle } Flickable { id: flick x:5 y:0 width: 698 height: 310 flickableDirection:Flickable.VerticalFlick contentWidth: newMsgInput.paintedWidth contentHeight: newMsgInput.paintedHeight clip: true 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 width: 698 height: newMsgInput.contentHeight focus: true color:"white" cursorVisible:true font.pixelSize: 24 wrapMode: TextEdit.Wrap onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) onLengthChanged: { if(length > 80) { console.debug("lengthlengthlengthlengthlengthlengthlengthlength") remove(80, 82) } } onCursorPositionChanged: { if(newMsgInput.text.length == 80) { console.debug("lengthlengthlengthlengthlengthlengthlengthlength") keyBoard.maximumState=true } else if(newMsgInput.text.length <80) { keyBoard.maximumState=false } } } HMIMouseArea { id: text_cursor visible: !newMsgInput.cursorVisible anchors.fill: parent onClicked:{ handInputNum.visible = false newMsgInput.cursorVisible = true systemCtrl.setTextInputHandle(newMsgInput) } } } } /*---------------------------------------------Key Board Start----------------------------------------*/ Rectangle { id:newmsg_area x:0 y:380+60 width: 750 height: 320-62 color:"#202020" HMIKeyBoard { id:keyBoard iSerach: false x:0 y:0 onClickspell: { if(!keyBoard.isPinyin) { systemCtrl.setKeyPress(spell) if(false == newMsgInput.cursorVisible && false == handInputNum.visible) { systemCtrl.setTextInputHandle(handInputNum) handInputNum.visible=true } } } } } /*---------------------------------------------Key Board Over----------------------------------------*/ HMIButton { id:icon_Send x:60 y:822-128 width: 100 height: 66 labelText: "Send" btnImg:icon_Send.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_3_P"+bgImageStyle) :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_3"+bgImageStyle) onClicked: { if(carlinkCtrl.currentPhoneNum !="") { carlinkCtrl.carLinkContactsMsgSend(newMsgInput.text) newMsgInput.text = "" ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_ALL_LIST) } } } }