import QtQuick 2.0 import Label 2.0 import "../AppLink/Com" import "../windowsList.js" as WindowsList import "../layoutList.js" as Layout import "../AppLink/settingLib.js" as SettingsType HMIWindow { id: himalayan_Search title:qsTr("搜索") + applinkControl.qsEmptyString //windowImgSource:imagePath + "M8X_full-screen_bk.png" property bool bIsAllBtnVisible: false property string sTextTitle: "" property int iMsgType:0 property int iCurpos:0 property bool bkeybrd: false property bool bFlage: false property bool bRadioPlay: false property bool bTrackPlay: false property bool bHandWrite:true property bool bIsHideKeyboard:true signal qieHuanKeybrd(int iType,int iQiehuan,bool isZifu,bool isPinyin,string str) onSignal_returnClick: { ScreenManager.backward(Layout.APPLINK) } Component.onCompleted: { windowID = WindowsList.APP_HIMALAYAN_SEARCHMAIN } onVisibleChanged: { if(visible == true) { bShowPlayBtn = false if(0 == applinkControl.QML_GetPlayType()) { bShowPlayBtn = true bTrackPlay = true bRadioPlay = false } else if(1 == applinkControl.QML_GetPlayType()) { bShowPlayBtn = true bTrackPlay = false bRadioPlay = true } systemCtrlLink.setTextInputHandle(text_input); listView.model = applinkControl.xmSearchKeywordListModel //iMsgType = 0 }else{ text_input.text = "" systemCtrlLink.inputInfoToClear() } } onSignal_playClick: { if (bTrackPlay) { applinkControl.QML_NIF_XM_RequestCurrentTrack() if(applinkControl.QML_getSearchSoundPlay()) { ScreenManager.forward(Layout.APPLINK,WindowsList.APP_HIMALAYAN_SEARCHSOUNDBROADCASTPLAYER) } else { ScreenManager.forward(Layout.APPLINK,WindowsList.APP_HIMALAYAN_RANKBROADCASTPLAYER) } } else { applinkControl.QML_NIF_XM_RequestCurrentRadio() ScreenManager.forward(Layout.APPLINK,WindowsList.APP_HIMALAYAN_BROADCASTLIVEPLAYER) } } HMILabel { id: text_title x: 0 y: 265-160 width: 150 height: 32 visible: true text: qsTr("关键字") + applinkControl.qsEmptyString font.pixelSize: 30 horizontalAlignment: Text.AlignRight } Image { id: disp_image x: 172 y: 241-160 visible: !bIsAllBtnVisible source:imagePath+"Common/M8X_input_w728.png" HMILabel{ id:inputInitial x:32 anchors.verticalCenter: parent.verticalCenter text: qsTr("请输入关键字") + applinkControl.qsEmptyString color: "grey" width:670 height:31 horizontalAlignment: Text.AlignLeft visible:text_input.text.length==0?true:false } TextInput { id: text_input anchors.left: parent.left anchors.leftMargin: 32 anchors.top: parent.top anchors.topMargin: 24 width: 16*30 height: parent.height //cursorVisible: true focus: true clip: true cursorVisible: true //horizontalAlignment: Label.AlignLeft color: "white" selectionColor:"#434343" text:"" //font.family: "微软雅黑" font.pixelSize: 30 autoScroll: true 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?true:false//!bIsAllBtnVisible btnImg: listView.visible?imagePath+"Common/M8X_Arrow_up.png":imagePath+"Common/M8X_Arrow_down.png" btnImgOnPressed: listView.visible ? imagePath+"Common/M8X_Arrow_up_p.png":imagePath + "Common/M8X_Arrow_down_p.png" onClicked: { listView.visible = !listView.visible } } HMIListView{ id:listView x:58 y:321-160 width: SettingsType.SETTING_CONTENT_W height: bIsHideKeyboard ? 720 : 320 model:applinkControl.xmSearchKeywordListModel //model: model_test snapMode:ListView.SnapToItem visible: false currentIndex:0 boundsBehavior: Flickable.StopAtBounds delegate:Item{ id:item_select width: SettingsType.SETTING_CONTENT_W height: 80 HMIButton{ id: membtn width: 654 height: 78 btnImg: imagePath+"Navi/Type_P_BaiduMusic/P_02_BaiduMusic_Search/M8X_list_78_w654.png" btnImgOnPressed: imagePath+"Navi/Type_P_BaiduMusic/P_02_BaiduMusic_Search/M8X_list_78_w654_p.png" //labelText: col0 //labelSize: 30 elideMode: Text.ElideRight onClicked: { text_input.text = keyword.text text_input.cursorPosition = text_input.text.length listView.visible = false if(bkeybrd) { loader_board.item.searchInfo = "" } bIsHideKeyboard = false } HMILabel{ id:keyword anchors.left: parent.left anchors.leftMargin: 84 width: 570 height: 78 elide: Text.ElideRight font.pixelSize: 30 text: col0 horizontalAlignment: Text.AlignLeft color: "white" clip:true } } HMIButton{ id: delbtn anchors.top: membtn.top anchors.left: membtn.left anchors.leftMargin: 656 width: 186 height: 78 btnImg: imagePath+"Navi/Type_P_BaiduMusic/P_02_BaiduMusic_Search/M8X_Settings_Button.png" btnImgOnPressed: imagePath+"Navi/Type_P_BaiduMusic/P_02_BaiduMusic_Search/M8X_Settings_Button_p.png" labelText: qsTr("删除") + applinkControl.qsEmptyString labelSize: 30 elideMode: Text.ElideRight onClicked: { applinkControl.QML_NIF_XM_DeleteSearchKeyword(col0) listView.model = applinkControl.xmSearchKeywordListModel iMsgType = 14; msg_PopUp.visible = true msg_timer.start() } } } } HMIListViewBar{ id: listViewBar anchors.left: listView.right anchors.leftMargin: 29 anchors.top: listView.top height: listView.height listView:listView scrollBarX:x scrollBarY:y visible: (listView.visible)?(bIsHideKeyboard ? (listView.count<=9?false:true) : (listView.count<=4?false:true)):false clip:true } 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 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 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: { //applinkControl.QML_NIF_Poi_SetHistorySearch(text_input.text) //applinkControl.QML_SSPLink_vsetiSrchTolnum() iMsgType = 5; msg_PopUp.visible = true //msg_PopUp.opacity = 1 applinkControl.QML_NIF_XM_RequestSearchAlbums(text_input.text,1,20) applinkControl.QML_NIF_XM_AddSearchKeyword(text_input.text) listView.model = applinkControl.xmSearchKeywordListModel //wlc applinkControl.QML_NIF_Baidu_AddSearchKeyword(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 } } App_Com_Popup2btn{ id:popMenu newspopText: qsTr("是否清空历史记录?") + applinkControl.qsEmptyString btnTextLeft: qsTr("是") + applinkControl.qsEmptyString btnTextRight: qsTr("否") + applinkControl.qsEmptyString onSignal_btnLeftClick:{ popMenu.visible=false applinkControl.QML_NIF_XM_ClearSearchKeywordList() listView.model = applinkControl.xmSearchKeywordListModel iMsgType = 13 msg_PopUp.visible = true msg_timer.start() } } Connections{ target:applinkControl onSignal_SearchAlbumsListEnd:{ if(visible == true){ //console.log("------------lvchangxin-----------------onSignal_SearchAlbumsListEnd------------") if (msg_PopUp.visible) { iMsgType = 0 //msg_PopUp.opacity = 0 msg_PopUp.visible = false applinkControl.Set_XM_SrchSingleflag(false) ScreenManager.forward(Layout.APPLINK,WindowsList.APP_HIMALAYAN_SEARCHALBUMSLIST) applinkControl.QML_RESearchAlbumsListModel() } } } onSignal_GetSearchAlbumsListNoRes:{ if(visible == true){ //console.log("------------lvchangxin-----------------onSignal_SearchAlbumsListEnd------------") iMsgType = 4 //msg_PopUp.opacity = 1 msg_PopUp.visible = true msg_timer.restart() } } onSignal_TrackProcessPlugInEnd:{ bTrackPlay = true bRadioPlay = false bShowPlayBtn = true } onSignal_RadioProcessPlugInEnd:{ bRadioPlay = true bTrackPlay = false bShowPlayBtn = true } } //底部功能栏 Row{ id: functionArea y: bIsAllBtnVisible||bIsHideKeyboard?1041-160:(bHandWrite?881 - 160:641-160) HMIButton{ id: quitBtn btnImgOnPressed: imagePath +"M8X_Function_close_Button_p.png" btnImg: imagePath+"M8X_Function_close_Button.png" btnIcon: imagePath+"M8X_icon_close.png" onClicked:{ applinkControl.QML_CloseAppLink() //ScreenManager.changeForm(Layout.FM_CLOSE,windowID); } } HMIButtonComplex{ id: nosw enabled: true btnImgOnPressed: imagePath +"M8X_Function_1_Button_NoSwitch_p.png" btnImg: imagePath+"M8X_Function_1_Button_NoSwitch.png" btnIcon: imagePath+"Navi/Type_P_BaiduMusic/P_02_BaiduMusic_Search/M8X_icon_baidu_clean.png" labelText: qsTr("清空历史记录") + applinkControl.qsEmptyString icon_y: 12 label_y: 52 labelPixelSize:18 onClicked:{ if (applinkControl.QML_NIF_XM_GetSearchKeywordListSize()) { popMenu.visible = true } else { iMsgType = 13 msg_PopUp.visible = true msg_timer.start() } } } } }