summaryrefstree
path: root/usr/bin/qml_link/AppLink/Com/HMIKeyBrd1.qml
blob: f2ddb72ad845d90b0df8561de5c67ab54b08872c (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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
import QtQuick 2.0
import "../../eventsList.js" as EventsList
import "../../layoutList.js" as Layout
import "../../windowsList.js" as WindowsList
import "../../com"
import Label 2.0
Item{
    id: root
    y:561
    width:960
    height:399

    property string str             : ""
    property int maximumLength
    property bool isSmall           : false
    property bool isPinyin           : true
    property bool isZifu           : false
    property int iQiehuan           : 1

    property int ishowStatus           : 1

    property string searchInfo: ""
    property bool bFlage           : false

    property bool searchEnable: false
    property bool deleteEnable: false

    property alias numberText: number.labelText
    property alias shiftText: shift.labelText
    property alias shiftIcon: shift.btnIcon

    property int iType           : 1

    property int hanziindex      : 1
    property string hanziinfo   : ""

    property QtObject listtmp

    property bool maximumState :false

    signal clickspell(string spell,bool isPinyin)
    signal clickspace()
    signal searchStart()
    signal handwriteborad()
    signal searchStarth()
    signal keyborad(int itype)
    signal deleteLongPress()
    signal clickinputtext()
    signal  clickSwtich()               //键盘收起开关信号

    onVisibleChanged:{
        //listView.model = ""  *-*
    }

    Connections{
        target: systemCtrlLink
        onPinyinAltListChanged:{

            listView.model = systemCtrlLink.pinyinAlternateList
            listView.contentX = 0
            listView.currentIndex = 0
        }
        onPinyinPredListChanged:{

            listView.model = systemCtrlLink.pinyinPredictList
            listView.contentX = 0
            listView.currentIndex = 0
        }

        onInputInfoToClear:{
            clearstring()
        }
    }


    onSearchInfoChanged:{
        //listView.contentX = 0
        if(searchInfo!=""){
            if(isPinyin)
            {
                listView.model = listtmp
                systemCtrlLink.setHanZiListModel(searchInfo)
            }
            else
            {
                searchInfo=""
            }
        }
    }

    function clearstring()
    {
        listView.model = ""
        searchInfo=""
    }



    Image {
        x:1
        id: image_list_bg
        //opacity: (listView.count>0&&isPinyin&&ishowStatus)?1:0
        //enabled: (listView.count>0&&isPinyin&&ishowStatus)?1:0
        source: imagePath+"Common/keyboard/M8X_Candidate-Key_bg.png"

        /*HMIButton{
            id:keyList_l
//            x: 23
//            y: 13
            width: 94
            height: 78
            enabled: (listView.count==1||listView.currentIndex==0)?false:true
            btnIcon: keyList_l.enabled?(keyList_l.pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_ left.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_ left.png"):imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_ left_d.png"
            btnIconOnPressed: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_p.png"
            onClicked: {
                listView.currentIndex--
            }
            onPressAndHold: {
                keyList_l_t.restart()
            }
            onCanceled: {
                keyList_l_t.stop()
            }
            onReleased: {
                keyList_l_t.stop()
            }
            Timer{
                id: keyList_l_t
                interval:150
                repeat:true
                onTriggered: {
                    if (listView.currentIndex > 0){
                        listView.currentIndex--
                    }
                }
            }
        }
        HMIButton{
            id:keyList_r
            x: 770
            //y: 13
            width: 94
            height: 78
            enabled: (listView.count==1||listView.currentIndex==listView.count-1)?false:true
            btnIcon: keyList_r.enabled?(keyList_r.pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_right.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_right.png"):imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_Arrow_right_d.png"
            btnIconOnPressed: imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_p.png"
            onClicked: {
                listView.currentIndex++//listView.contentX+=61
            }
            onPressAndHold: {
                keyList_r_t.restart()
            }
            onCanceled: {
                keyList_r_t.stop()
            }
            onReleased: {
                keyList_r_t.stop()
            }
            Timer{
                id: keyList_r_t
                interval:150
                repeat:true
                onTriggered: {
                    if (listView.currentIndex < listView.count-1){
                        listView.currentIndex++
                    }
                }
            }
        }*/
    }
    HMIButton{
        id:keybrddown
        x: 865
        width: 94
        height: 78
        enabled: true
        //btnIcon: imagePath+"Common/keyboard/M8X_Arrow_retract.png"
        btnImgOnPressed:  imagePath + "Common/keyboard/M8X_keyboard_Button_p.png"
        Image{
            x: 890-865
            y: 749-721
            source:imagePath+"Common/keyboard/M8X_Arrow_retract.png"
        }
        onClicked: {
            clickSwtich()
        }
    }
    Component{
        id: recipeDelegate
        Item{
            id: delegateImgMain
            width: _testLabelbg.width
            height: _testLabelbg.height

            Row{
                id: _testLabelbg
                Item{
                    width:_testLabel.contentWidth+32*2
                    height: 78
                    Image {
                        width: _testLabel.contentWidth+32*2
                        source: m_area.pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_p.png":""
                    }
                }
            }

            HMILabel{
                id: _testLabel
                width: _testLabelbg.width
                height: _testLabelbg.height
                text: col0
                color:"white"
                HMIMouseArea{
                    id: m_area
                    anchors.fill: parent
                    onClicked: {
                        var temp = searchInfo
                        searchInfo = ""
                        hanziindex = index
                        hanziinfo = col0
                        selecthanzi_timer.restart()
                    }
                }
            }
        }
    }

    Timer{
        id: selecthanzi_timer
        interval: 1
        onTriggered: {
            listView.model = listtmp
            systemCtrlLink.setSelectedHanZiIndex(hanziindex, hanziinfo)
            clickinputtext()
        }
    }


    ListView{
        id:listView
        x: 0
        y: 0
        width: 864
        height: 78
        opacity: (listView.count>0&&isPinyin&&ishowStatus)?1:0
        enabled: (listView.count>0&&isPinyin&&ishowStatus)?1:0
        flickableDirection:Flickable.HorizontalFlick
        clip: true
        snapMode:ListView.SnapToItem
        orientation:ListView.Horizontal
        //model:systemCtrlLink.pinyinAlternateList
        highlightFollowsCurrentItem:true
        highlightRangeMode: ListView.StrictlyEnforceRange
        cacheBuffer: listView.width*4
        delegate: recipeDelegate
        spacing:2
        onMovementStarted: {
            refreshList.restart()
        }

        onMovementEnded: {
            refreshList.stop()
        }
        onFlickEnded:{
            refreshList.stop()
        }
        onFlickStarted:{
            refreshList.restart()
        }
        Timer{
            id:refreshList
            interval: 800
            repeat: true
            running: false
            onTriggered:
            {
                if(listview.visible)
                {
                    listview.visible = false
                    listview.visible = true
                }
            }
         }
    }

    Row {
        id:firRow
        x: 1
        y: 801-721
        spacing: 2
        Repeater{
            model:
            {
                switch(iType)
                {
                    case 1:
                        ["Q","W","E","R","T","Y","U","I","O","P"]
                        break;
                    case 2:
                        ["q","w","e","r","t","y","u","i","o","p"]
                        break;
                    case 3:
                        ["1","2","3","4","5","6","7","8","9","0"]
                        break;
                    case 4:
                         ["[","]","{","}","#","%","^","*","+","="]
                        break;
                }
            }
            HMIKeyBrdButton{
                id:firstRowKey
                labelText:modelData
                onPressed: {
                    if(!isPinyin)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                    else if(!maximumState)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                }
            }
        }
    }
    Row {
        id: secRow
        spacing: 2
        anchors{top:firRow.bottom;topMargin: 2;left: firRow.left;leftMargin: 48}
        Repeater{
            model:
            {
                switch(iType)
                {
                case 1:
                    ["A","S","D","F","G","H","J","K","L"]
                    break;
                case 2:
                    ["a","s","d","f","g","h","j","k","l"]
                    break;
                case 3:
                    ["-","/",":",";","(",")","!","《","》"]
                    break;
                case 4:
                    ["——","\\","`","~","<",">","$","@","&"]
                    break;
                }
            }
            HMIKeyBrdButton{
                id:secondRowKey;
                labelText: modelData
                onPressed: {
                    if(!isPinyin)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                    else if(!maximumState)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                }
            }
        }
    }
    Row{
        id: thirdRow
        anchors{top:secRow.bottom;topMargin: 2;left: secRow.left;leftMargin: -48}//{top:parent.top;topMargin:0;horizontalCenter: parent.horizontalCenter}
        spacing: 2
        HMIButton{
            id:shift
            btnImg: pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142.png"
            btnIcon:iType==3?"":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Shift.png"
             labelText: iType==3?"#+=":""
             labelSize:30
             labelPixelSize:30
             onClicked: {
                 if(isZifu)
                 {
                     if(isSmall)
                     {
                         iType=4
                         isSmall=false
                         shift.labelText=("123")
                         shift.btnIcon=""
                       }
                       else
                     {
                         iType=3
                         isSmall=true
                         shift.labelText=("#+=")
                         shift.btnIcon=""
                     }
                 }
                 else
                 {
                     if(isSmall)
                     {
                         iType=1
                         isSmall=false
                     }
                     else
                     {
                         iType=2
                         isSmall=true
                     }
                 }
             }
        }
        Repeater{
            model:
            {
                switch(iType)
                {
                case 1:
                    ["Z","X","C","V","B","N","M"]
                    break;
                case 2:
                    ["z","x","c","v","b","n","m"]
                    break;
                case 3:
                    ["、","_","。","?",",","\“","\”"]
                    break;
                case 4:
                    [".","·","‘","’","|","¥","…"]
                    break;
                }
            }
            HMIKeyBrdButton{
                id:thirdRowKey;
                labelText: modelData
                onPressed: {
                    if(!isPinyin)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                    else if(!maximumState)
                    {
                        str = modelData;
                        clickspell(str,isPinyin);
                        searchInfo = searchInfo + modelData
                        ishowStatus=1
                    }
                }
            }
        }
        HMIButton{
            id:deleteKey
            btnImg: pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142.png"
            //btnIcon:deleteKey.enabled?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_delete.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_delete_d.png"
            //btnIcon:imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_delete.png"
            Image{
                x:867-817
                y:987-961
                source:imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_delete.png"
            }
            enabled:true
            onClicked:{
                if(deleteEnable){
                    if(isPinyin)
                    {
                        if (searchInfo.length > 1){
                            searchInfo = searchInfo.substring(0,searchInfo.length-1)
                        }
                        else {
                            systemCtrlLink.setKeyPress("delete")
                            searchInfo = ""
                            ishowStatus=0
                        }
                    }
                    else{
                        systemCtrlLink.setKeyPress("delete")
                        searchInfo = ""
                        ishowStatus=0
                    }
                }
                
            }
            onPressAndHold: {
                if(deleteKey.enabled){
                    listView.model = ""
                    searchInfo = ""
                    deleteLongPress()
                }     
            }
        }
    }
    Row{
        id: fourRow
        anchors{top:thirdRow.bottom;topMargin: 2;left: thirdRow.left;}//{top:parent.top;topMargin:0;horizontalCenter: parent.horizontalCenter}
        spacing: 2
        HMIButton{
            id:number
            btnImg: pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142.png"
            labelText:"123"
            labelSize:30
            labelPixelSize:30
            onClicked: {
                switch(iQiehuan)
                {
                case 1:
                    if(!isZifu)
                    {
                        number.labelText=("ABC")
                        isZifu=true
                        iType=3
                        isPinyin=false
                        shift.labelText=("#+=")
                        shift.btnIcon=""
                        isSmall = true
                    }
                    else
                    {
                        number.labelText=("123")
                        isZifu=false
                        iType=1
                        isPinyin=true
                        shift.labelText=("")
                        shift.btnIcon=imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Shift.png"
                        isSmall = false
                    }
                    break;
                case 2:
                    if(!isZifu)
                    {
                        number.labelText=("ABC")
                        isZifu=true
                        iType=3
                        isPinyin=false
                        shift.labelText=("#+=")
                        shift.btnIcon=""
                        isSmall = true
                    }
                    else
                    {
                        number.labelText=("123")
                        isZifu=false
                        iType=2
                        isPinyin=false
                        shift.labelText=("")
                        isSmall = true
                        shift.btnIcon=imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Shift.png"
                    }
                    break;
                }
            }
        }
        HMIButton{
            id:pinyin
            btnImg: pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142.png"
            //labelText:qsTr("PY") + systemCtrlLink.emptyString
            labelText: qsTr("全拼") + applinkControl.qsEmptyString
            labelPixelSize  : 30
            onClicked: {
                if(iQiehuan==1)
                {
                    iQiehuan=2
                    isPinyin=false
                    isZifu=false
                    searchInfo = ""
                    //pinyin.labelText=qsTr("EN") + systemCtrlLink.emptyString
                    pinyin.labelText=qsTr("英文") + applinkControl.qsEmptyString
                    number.labelText=("123")
                    iType=2
                    isSmall = true
                }
                else
                {
                    iQiehuan=1
                    isPinyin=true
                    isZifu=false
                    searchInfo = ""
                    //pinyin.labelText=qsTr("PY") + systemCtrlLink.emptyString
                    pinyin.labelText=qsTr("全拼") + applinkControl.qsEmptyString
                    number.labelText=("123")
                    iType=1
                    handwriteborad()
                    searchInfo = ""
                }
                shift.labelText=("")
                shift.btnIcon=imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Shift.png"
                ishowStatus=0
            }
        }
        HMIButton{
            id:ctrlKey;
            btnImg: ctrlKey.pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Space_Button_w526_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Space_Button_w526.png";
            //btnIcon:imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Space.png"
            //btnIconOnDisabled:imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Space_d.png"
            labelBold       : false
            labelPixelSize  : 30
            onPressed:str = "";
            Image{
                x:523-289
                y:1075-1041
                source:enabled?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Space.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_icon_Space_d.png"
            }
            onClicked: {
                systemCtrlLink.setKeyPress(" ")
                searchInfo = "";
                clickspace()
            }
        }
        HMIButton{
                id:search
                //enabled: search.enabled?true:false
                btnImg: pressed?imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142_p.png":imagePath+"Navi/TypeB_Search/Search_B-09_seach_gjz_select/M8X_keyboard_Button_h142.png"
                enabled:true
                //labelText: qsTr("Srch") + systemCtrlLink.emptyString
                labelText: qsTr("确定") + applinkControl.qsEmptyString
                labelPixelSize  : 30
                //labelColor: search.enabled?"white":"#646566"
                labelColor:"white"
                onClicked: {
                    if(searchEnable){
                        searchStart()
                    }
                }
//            HMILabel{
//                id:txt
//                x:30
//                y:106/2
//                width:81
//                height: 106/2
//                color:search.enabled?"white":"#4D4D4D"
//                text:qsTr("Srch") + systemCtrlLink.emptyString
//            }
//            onClicked: {
//                if(search.enabled)
//                    searchStart()
//            }
        }
    }

}