summaryrefstree
path: root/usr/bin/qml_link/AppLink/App_Himalayan_SearchMain.qml
blob: c81224c53cf01aa9e30655ec29d954b8f1870693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
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()
                }
            }
        }
    }
}