import QtQuick 2.0 //import "../eventsList.js" as EventsList import "../layoutList.js" as Layout import "../windowsList.js" as WindowsList import "search.js" as Search import "../AppLink/Com" import Label 2.0 HMIWindow { id:app_SrchKeyCrossMain //windowImgSource:imagePath + "Common/M8X_Background.png" property alias bIsAllBtnVisible: app_Srch_BottomCom.allBtnVisible property string sTextTitle: "" property int geoindex:0xffff //property int geoindex:0 //xxx property int iMsgType:0 property int iCurpos:0 property bool bkeybrd: false property bool bFlage: false signal qieHuanKeybrd(int iType,int iQiehuan,bool isZifu,bool isPinyin,string str) property bool bHandWrite:true property bool bIsHideKeyboard:true onSignal_returnClick: { ScreenManager.backward(Layout.APPLINK) } Component.onCompleted:{ console.log("-----[applink]---[SrchKeyCrossMain]----onCompleted--") } Component.onDestruction: { console.log("-----[applink]---[SrchKeyCrossMain]----onDestruction--") applinkControl.QML_cleanHistroyMemoryListModel() } onVisibleChanged: { if(visible == true) { systemCtrlLink.setTextInputHandle(text_input); applinkControl.sspLinkTextChanged() geoindex=applinkControl.QML_SSPLink_iGetSearchMode(); applinkControl.QML_SSPLink_iSetSrchArdflag(0,false) iMsgType = 0 switch(geoindex){ case 0: applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_KEWORD,false) break; case 1: applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_COMMONFACICATEGORY,false) break; case 2: applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_RODAKEYWORD,false) break; default: break; } }else{ text_input.text = "" } } onGeoindexChanged: { switch(geoindex){ case 0: bIsAllBtnVisible = false //sTextTitle=qsTr("Keywords") + systemCtrlLink.emptyString //app_SrchKeyCrossMain.title=qsTr("Keywords") + systemCtrlLink.emptyString applinkControl.QML_SSPLink_vSetSearchMode(geoindex); applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_KEWORD,false) sTextTitle = qsTr("关键字") + applinkControl.qsEmptyString app_SrchKeyCrossMain.title=qsTr("关键字") + applinkControl.qsEmptyString break; case 1: bIsAllBtnVisible = true //app_SrchKeyCrossMain.title=qsTr("Institution") + systemCtrlLink.emptyString applinkControl.QML_NIF_Poi_GetQuickKind() applinkControl.QML_SSPLink_vSetSearchMode(geoindex); applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_COMMONFACICATEGORY,false) app_SrchKeyCrossMain.title=qsTr("设施") + applinkControl.qsEmptyString break; case 2: bIsAllBtnVisible = false //sTextTitle=qsTr("Junction") + systemCtrlLink.emptyString //app_SrchKeyCrossMain.title=qsTr("Junction") + systemCtrlLink.emptyString applinkControl.QML_SSPLink_vSetSearchMode(geoindex); applinkControl.QML_SSPLink_iSetSearchKind(Search.SRCH_RODAKEYWORD,false) sTextTitle = qsTr("交叉口") + applinkControl.qsEmptyString app_SrchKeyCrossMain.title=qsTr("交叉口") + applinkControl.qsEmptyString break; default: break; } } onSTextTitleChanged: { text_input.text = "" } HMIButtonWithCheck{ id:srchKey x: 0 y: bIsAllBtnVisible||bIsHideKeyboard?965-160:(bHandWrite?805 - 160:565-160) //labelText: qsTr("关键字") + applinkControl.qsEmptyString //labelPixelSize: 30 btnImg: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319.png" btnImgOnPressed: imagePath+"/Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319_p.png" btnImgOnCheck: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319_c.png" bCheck: 0 == geoindex ? true : false HMILabel{ x:25 y:20 width:270 height:30+4 text:qsTr("关键字") + applinkControl.qsEmptyString verticalAlignment: Text.AlignTop font.pixelSize:30 } onClicked: { geoindex=0 if(!bkeybrd) { loader_board.item.clearstring() } else { loader_board.item.clearstring() } } } HMIButtonWithCheck{ id:srchFaci x: 321 y: bIsAllBtnVisible||bIsHideKeyboard?965-160:(bHandWrite?805 - 160:565-160) //labelText: qsTr("设施") + applinkControl.qsEmptyString //labelPixelSize: 30 btnImg: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319.png" btnImgOnPressed: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319_p.png" btnImgOnCheck: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w319_c.png" bCheck: 1 == geoindex ? true : false HMILabel{ x:25 y:20 width:270 height:30+4 text:qsTr("设施") + applinkControl.qsEmptyString verticalAlignment: Text.AlignTop font.pixelSize:30 } onClicked:{ geoindex=1 } } HMIButtonWithCheck{ id:srchCross x: 641 y: bIsAllBtnVisible||bIsHideKeyboard?965-160:(bHandWrite?805 - 160:565-160) //labelText: qsTr("交叉口") + applinkControl.qsEmptyString //labelPixelSize: 30 btnImg: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w318.png" btnImgOnPressed: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w318_p.png" btnImgOnCheck: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Tag_Button_w318_c.png" bCheck: 2 == geoindex ? true : false HMILabel{ x:25 y:20 width:270 height:30+4 text:qsTr("交叉口") + applinkControl.qsEmptyString verticalAlignment: Text.AlignTop font.pixelSize:30 } onClicked:{ geoindex = 2 if(!bkeybrd) { loader_board.item.clearstring() } else { loader_board.item.clearstring() } } } HMILabel { id: text_title x: applinkControl.getLanguageType()?58:0 y: 265-160 width: applinkControl.getLanguageType()?90+24:172 height: 30+4 visible: geoindex!=1?true:false//!bIsAllBtnVisible text: sTextTitle font.pixelSize: 30 horizontalAlignment: applinkControl.getLanguageType()?Label.AlignLeft:Label.AlignHCenter verticalAlignment: Text.AlignTop } Image { id: disp_image x: 172 y: 241-160 visible: geoindex!=1?true:false//!bIsAllBtnVisible source:imagePath+"Common/M8X_input_w728.png" HMILabel{ id:inputInitial x:32 y:24 text: qsTr("请输入关键字") + applinkControl.qsEmptyString color: "grey" width:600 height:30+4 horizontalAlignment: Text.AlignLeft visible:text_input.text.length==0?true:false verticalAlignment: Text.AlignTop } TextInput { id: text_input anchors.left: parent.left anchors.leftMargin: 32 anchors.top: parent.top anchors.topMargin: 24 width: 600 height: parent.height //cursorVisible: true focus: true clip: true cursorVisible: true color: "white" selectionColor:"#434343" text:"" //font.family: "微软雅黑" font.pixelSize: 30 autoScroll: true maximumLength : 16 onContentWidthChanged: { if(bkeybrd) { if(text_input.text.length == 16) { loader_board.item.maximumState=true } else if(text_input.text.length <16) { loader_board.item.maximumState=false } } if(text_input.text.length>0) { if(!bkeybrd) { loader_board.item.isDel=true loader_board.item.isSearch=true } else { loader_board.item.searchEnable = true loader_board.item.deleteEnable = true } //keyBoard.deleteEnable=true //handboard.isDel=true } else { if(!bkeybrd) { loader_board.item.isDel=false loader_board.item.isSearch=false } else { loader_board.item.searchEnable = false loader_board.item.deleteEnable = false } } if (bFlage) { if(text_input.contentWidth > 30*16) { text_input.text = text_input.text.substring(0, text_input.text.length - 1) } else { bFlage = false if ( iCurpos < text_input.text.length) { text_input.cursorPosition = iCurpos } else { text_input.cursorPosition = text_input.text.length } } } // else // { // if(bkeybrd) // { // console.log("----------lvchangxin-----------------loader_board.item.bStopInput = false-------------------------------") // loader_board.item.bStopInput = false // } // } } MouseArea{ anchors.fill: parent enabled: { if(bkeybrd) { if(loader_board.item.isPinyin && loader_board.item.searchInfo != "") { return true } else { return false } } else { if(loader_board.item.isInput) { return true } else { return false } } } } } } HMIMouseArea{ id:inputBg_Trigger x: 172 y: 241-160 anchors.fill:disp_image //enabled:bLoading?false:true onClicked: { if(bIsHideKeyboard){ //inputInitial.text="" bIsHideKeyboard = false // text_input.cursorVisible = true // inputBg_Trigger.visible =false } } } HMIButton{ id:showMemory x: 811 y: 254-160 //z: 2 visible: listView.count>0&&geoindex!=1?true:false//!bIsAllBtnVisible btnImg: mask_memory.opacity?imagePath+"Common/M8X_Arrow_up.png":imagePath+"Common/M8X_Arrow_down.png" btnImgOnPressed: mask_memory.opacity ? imagePath+"Common/M8X_Arrow_up_p.png":imagePath + "Common/M8X_Arrow_down_p.png" onClicked: { //memoryMouseArea = true; if(0 == mask_memory.opacity) { listView.model = applinkControl.memoryListModel mask_memory.opacity = 1 mask_memory.enabled = true listView.enabled = true } else { mask_memory.opacity = 0 mask_memory.enabled = false listView.enabled = false } } } HMIMouseArea { id: mask_memory x: 0 y: 0 z:1 width: 960 height: 960 opacity: 0 enabled: false onClicked:{ mask_memory.opacity = 0 mask_memory.enabled = false listView.enabled = false } Image { id: memoryListbkg x: 172 y: 321-160 source:{ switch(listView.count) { case 1: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button1_bg.png" break; case 2: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button2_bg.png" break; case 3: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button3_bg.png" break; case 4: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button4_bg.png" break; case 5: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button5_bg.png" break; default: imagePath + "Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button5_bg.png" break; } } } HMIListView{ id:listView x:180 y:329-160 width: 712 height: 64*5 model:applinkControl.memoryListModel snapMode:ListView.SnapToItem enabled: false interactive:false currentIndex:0 delegate:Item{ id:item_select width: 712 height: 64 HMIButton{ id: membtn width: 712 height: 62 btnImgOnPressed: imagePath+"Navi/Type_B_Search/Search_B-13_seach_jycd/M8X_popup-menu_Button_p.png" //labelText: col0 //labelSize: 30 //elideMode: Text.ElideRight HMILabel{ id: membtnText x:22 y:16 text:col0 elide: Text.ElideRight font.pixelSize:30 width:660 height:30 horizontalAlignment: Text.AlignLeft } onClicked: { text_input.text = membtnText.text text_input.cursorPosition = text_input.text.length mask_memory.opacity = 0 mask_memory.enabled = false listView.enabled = false if(bkeybrd) { loader_board.item.searchInfo = "" } bIsHideKeyboard = false } } } } } App_Srch_BottomCom{ id: app_Srch_BottomCom allBtnVisible: bIsAllBtnVisible bHandWrite:bHandWrite bHideKeyboard:bIsHideKeyboard } App_Srch_FaciComListView{ id: app_Srch_FaciComListView visible: bIsAllBtnVisible&&(geoindex==1) model : applinkControl.comPoiListModel onClickList: { iMsgType = 5; msg_PopUp.visible = true msg_PopUp.opacity = 1 applinkControl.QML_SSPLink_vsetiSrchTolnum() applinkControl.QML_NIF_Poi_SrchByKindCode(index) } } Loader{ id: loader_board source: "../AppLink/Com/HMIHandwriteBrd.qml" //x: 5 //y: 721-160 visible: bIsHideKeyboard?false:(bIsAllBtnVisible?false:true) Connections{ target: loader_board.item onClickspell: { if(!isPinyin){ systemCtrlLink.setKeyPress(spell) if (text_input.contentWidth > 30*16 ) { iCurpos = text_input.cursorPosition if("——" == spell) { text_input.text = text_input.text.substring(0, text_input.text.length - 1) if (text_input.contentWidth > 30*16 ) { text_input.text = text_input.text.substring(0, text_input.text.length - 1) } } else { text_input.text = text_input.text.substring(0, text_input.text.length - 1) } if ( iCurpos < text_input.text.length) { text_input.cursorPosition = iCurpos } else { text_input.cursorPosition = text_input.text.length } } } } onClickspace: { if (text_input.contentWidth > 30*16 ) { iCurpos = text_input.cursorPosition text_input.text = text_input.text.substring(0, text_input.text.length - 1) if ( iCurpos < text_input.text.length) { text_input.cursorPosition = iCurpos } else { text_input.cursorPosition = text_input.text.length } } } onClickinputtext: { if (text_input.contentWidth > 30*16 ) { bFlage = true iCurpos = text_input.cursorPosition text_input.text = text_input.text.substring(0, text_input.text.length - 1) //bFlage = true } } onHandwriteborad:{ bHandWrite=true app_Srch_BottomCom.bHandWrite=bHandWrite bkeybrd = false loader_board.source = "../AppLink/Com/HMIHandwriteBrd.qml" if(text_input.text.length>0){ loader_board.item.isDel=true loader_board.item.isSearch=true }else{ loader_board.item.searchEnable = false loader_board.item.deleteEnable = false } } onDeleteLongPress: { text_input.text = "" } onKeyborad: { bHandWrite=false app_Srch_BottomCom.bHandWrite=bHandWrite bkeybrd = true loader_board.source = "../AppLink/Com/HMIKeyBrd.qml" if(text_input.text.length>0){ loader_board.item.searchEnable = true loader_board.item.deleteEnable = true }else{ loader_board.item.searchEnable = false loader_board.item.deleteEnable = false } if(itype==3) { //searchkeyInfo=1 loader_board.item.numberText="CH" loader_board.item.iType=3 loader_board.item.isPinyin=false loader_board.item.iQiehuan=1 loader_board.item.isZifu=true loader_board.item.isSmall= true //qieHuanKeybrd(3,1,true,false,"") } else { //searchkeyInfo=1 loader_board.item.iQiehuan=1 loader_board.item.isPinyin=true loader_board.item.isZifu=false loader_board.item.searchInfo = "" loader_board.item.iType=1 //qieHuanKeybrd(1,1,false,true,"") } } onSearchStart: { if (text_input.text.trim() != "") { applinkControl.QML_NIF_Poi_SetHistorySearch(text_input.text) applinkControl.QML_SSPLink_vsetiSrchTolnum() iMsgType = 5; msg_PopUp.visible = true msg_PopUp.opacity = 1 if(geoindex==0){ applinkControl.QML_NIF_Poi_SrchByKeyword(text_input.text) }else if(geoindex==2){ applinkControl.QML_NIF_Poi_SrchRoadByKeyword(text_input.text) } } } onClickSwtich: { bIsHideKeyboard = true //loader_board.visible=false } } } App_Com_Newspopup{ id:msg_PopUp z: 3 labelCount: 1 newspopText1: qsTr(applinkControl.QML_getMessageString(iMsgType)) + applinkControl.qsEmptyString visible:(iMsgType > 0)?true:false opacity: 0 //enabled: false bIsTouchClear:applinkControl.QML_getMessageTouchClearFlag(iMsgType) onClicked: { if(bIsTouchClear){ msg_timer.stop() iMsgType = 0 msg_PopUp.opacity = 0 msg_PopUp.visible = false } } } Timer{ id:msg_timer interval: applinkControl.QML_getMessageTime(iMsgType) onTriggered: { iMsgType = 0 msg_PopUp.opacity = 0 msg_PopUp.visible = false } } Connections{ target:applinkControl onSspLinkTextChanged:{ if(visible == true){ app_Srch_BottomCom.currentArea=applinkControl.QML_SSPLink_strGetAreaName() } } onSearchEnd:{ if(visible == true){ iMsgType = 0 msg_PopUp.opacity = 0 msg_PopUp.visible = false switch(geoindex){ case 0: text_input.text = "" applinkControl.QML_SSPLink_ToSrchRslt(Search.FromKeyCrossMain_2) applinkControl.QML_SSPLink_SetSrchRsltMove(0); ScreenManager.forward(Layout.APPLINK,WindowsList.APP_NAVI_SRCHRSLT) break; case 1: applinkControl.QML_SSPLink_ToSrchRslt(Search.FromKeyCrossMain_2) applinkControl.QML_SSPLink_SetSrchRsltMove(0); ScreenManager.forward(Layout.APPLINK,WindowsList.APP_NAVI_SRCHRSLT) break; case 2: text_input.text = "" applinkControl.QML_SSPLink_SetSrchRDRsltMove(0) ScreenManager.forward(Layout.APPLINK,WindowsList.APP_NAVI_SRCHCROSSRSLT) break; default: break; } listView.model = applinkControl.memoryListModel } } onSearchEndNoResult:{ if(visible == true){ iMsgType = 4 msg_PopUp.opacity = 1 msg_PopUp.visible = true msg_timer.restart() listView.model = applinkControl.memoryListModel } } onComPoiEnd:{ if(visible == true){ app_Srch_FaciComListView.model = applinkControl.comPoiListModel } } onSignal_SrchInPutNoValid:{ if(visible == true){ iMsgType = 21 msg_PopUp.opacity = 1 msg_PopUp.visible = true msg_timer.restart() } } } }