summaryrefstree
path: root/usr/bin/qml_link/AppLink/App_Navi_Demo.qml
blob: 1f2837982b1cf73dacdfbec798d5b0595682749d (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
import QtQuick 2.0
import "../AppLink/Com"
import "../windowsList.js" as WindowsList
import "../layoutList.js" as Layout
import "../eventsList.js" as EventsList
Rectangle{

    id:app_Demo
    width: 960
    height: 960
    x: 0; y: 0
    color:"#00000000"

    property int istatus:1
    property int iScaleLevel:0
    property int iAzimuth:0
    property int iBarHeight:0
    property bool bShowCross: false
    property bool bShowGuide: false
    property bool bHideCrossView: false
    property bool bVisibleGuide: false
    property bool bVisibleCross: false
    property bool bIsFirstInStack: false
    property bool bIsDemoVisible: false
    property string imagePath_navi: "/usr/bin/qml_link/images/AppLink/"
    property int  iMsgType:0

    Component.onCompleted:{   
        bIsFirstInStack = true
        iScaleLevel = applinkControl.QML_NIF_Map_GetCurScale(true)
        location_com.iScale = iScaleLevel
        iAzimuth = applinkControl.QML_NIF_Map_GetAzimuth(true);
        location_com.iDirType = iAzimuth
        applinkControl.QML_NIF_Gid_StartDemo()
    }

    onVisibleChanged: {
        if(visible){
            bIsDemoVisible = true
            bVisibleGuide = applinkControl.QML_NIF_Gid_GetRouteInfoStatus()
            bVisibleCross = applinkControl.QML_NIF_Gid_GetMagViewStatus();
            if(applinkControl.QML_NIF_Map_SetScale(iScaleLevel, false)==0){
                location_com.iScale = iScaleLevel;
            }
            applinkControl.QML_NIF_Map_SetAzimuth(iAzimuth,false);
            location_com.iDirType = iAzimuth
            applinkControl.QML_NIF_Map_FollowCarWithScale(location_com.iScale,false);
            if(bVisibleGuide){
                bShowGuide = true
            }else{
            }
        }
        else{
            if(bIsFirstInStack==false)
            {
                iScaleLevel = applinkControl.QML_NIF_Map_GetCurScale(false);
                iAzimuth = applinkControl.QML_NIF_Map_GetAzimuth(false);
            }else{
                bIsFirstInStack = false
            }
            if(bIsDemoVisible === true){
                applinkControl.QML_NIF_Gid_StopDemo()
                applinkControl.QML_NIF_Gid_StopGuide()
                applinkControl.QML_setGuideOffsetvalue(0);
                bIsDemoVisible = false
            }
        }
    }

    Connections{
        target:applinkControl
        onSignal_UpdateGuideData:{
            if(2 === applinkControl.QML_NIF_Gid_iGetNaviStatus()){
                residualInfo.restDistance      = qRestDist+qRestType
                directionManuver.distanceText  = qDistFromCar+qDistType
                directionManuver.directMarkImg = applinkControl.strGetNaviDir(iPointKind)
                if(iRestTime_h==0){
                    residualInfo.restTime = iRestTime_m+"m"
                }else if(iRestTime_m==0){
                     residualInfo.restTime = iRestTime_h+"h"
                }else{
                     residualInfo.restTime = iRestTime_h+"h" + iRestTime_m+"m"
                }
            }
        }
        onSignal_UpdateCurrPosName:{
            if(2 === applinkControl.QML_NIF_Gid_iGetNaviStatus()){
                location_com.sDestName = qCurrPosName
            }
        }
        onSignal_HideCrossView:{
            if(2 === applinkControl.QML_NIF_Gid_iGetNaviStatus()){
                bShowCross = false
                bHideCrossView = false
                if(bVisibleGuide){
                    bShowGuide = true
                }
            }
        }
        onSignal_ShowCrossView:{
            if((2 === applinkControl.QML_NIF_Gid_iGetNaviStatus()) && bVisibleCross && (bHideCrossView==false) ){
                bShowGuide = false
                bShowCross = true
            }
        }
        onSignal_NaviStart:{
            if(visible){
                msg_PopUp.visible = true
                iMsgType = 25
                msg_timer.restart()
            }
        }
    }

    //===========================location_com===========================//
    App_LocationComponent{
        id:location_com
        bVisible_dir : true
    }

    //===========================guideInfo===========================//
    App_HMIGuideInfo{
        id:guideInfo
        anchors.right: parent.right
        anchors.rightMargin:-1
        y:99
        visible: bVisibleGuide&&bShowGuide
    }

    //===========================App_HMICrossInfo===========================//
    App_HMICrossInfo{
        id:crossInfo
        anchors.right: parent.right
        y:99
        visible: bVisibleCross&&bShowCross
    }

    //===========================residualInfo===========================//
    App_HMIResidualInfo{
        id: residualInfo
        visible: true
        x:102
        y:5
    }
    //===========================directionManuver===========================//
    App_HMIDirectionManuver{
        id: directionManuver
//        x:residualInfo.x+15
//        y:residualInfo.y+1
        //visible: location_com.bLongPress?false:(bIsCusStatus?true:false)
    }

    Image{
        id:menuBackground
        y:881
        visible: location_com.bLongPress?false:true
        source: imagePath_navi+"M8X_Function_Button_bg.png"
    }
    //===========================redBtn===========================//
    HMIButton{
        id: redBtn
        x:90
        y:881
        enabled: (applinkControl.QML_NIF_Gid_DemoGetSpeed()==0)?false:true
        btnImg:imagePath_navi+"M8X_NAVI_Button_w218.png"
        btnImgOnPressed: imagePath_navi+"M8X_NAVI_Button_w218_p.png"
        onClicked:{
            applinkControl.QML_NIF_Gid_DemoSpeedDown()
            rdBtn_text.text = applinkControl.QML_convertDemoSpeedToString()
            fucChangeSpeedEnabled()
        }
    }
    Image{
        x:176
        y:1060-160
        source:imagePath_navi+"M8X_Location_icon_Fast-backward.png"
    }

    //===========================rdBtn===========================//
    HMIButton{
        id: rdBtn
        x:308
        y:881
        enabled: (applinkControl.QML_NIF_Gid_DemoGetSpeed()==0)?false:true
        btnImg:imagePath_navi+"M8X_NAVI_Button_w218.png"
        btnImgOnPressed: imagePath_navi+"M8X_NAVI_Button_w218_p.png"
    }
    HMILabel{
        id: rdBtn_text
        x:360
        y:1061-160
        text:applinkControl.QML_convertDemoSpeedToString()
        font.pixelSize:38
        width:114
        height:38
    }

    //===========================accelerateBtn===========================//
    HMIButton{
        id: accelerateBtn
        x:526
        y:881
        enabled: (applinkControl.QML_NIF_Gid_DemoGetSpeed()==2)?false:true
        btnImg:imagePath_navi+"M8X_NAVI_Button_w218.png"
        btnImgOnPressed: imagePath_navi+"M8X_NAVI_Button_w218_p.png"
        onClicked:{
            applinkControl.QML_NIF_Gid_DemoSpeedUp()
            rdBtn_text.text = applinkControl.QML_convertDemoSpeedToString()
            fucChangeSpeedEnabled()
        }
    }
    Image{
        x:610
        y:1060-160
        source:imagePath_navi+"M8X_Location_icon_Fast-forward.png"
    }
    //===========================roadCamera===========================//
    App_HMICamera{
        id: roadCamera
        x:5//8
        y:692//705
    }

    //===========================stopDemo===========================//
    App_HMIReturnBtn{
        id: stopDemo
        x:0//862
        y:5//4
        visible: location_com.bLongPress?false:true
        iChange: true
        onClicked:{
            applinkControl.QML_NIF_Gid_StopDemo()
            applinkControl.QML_NIF_Gid_StopGuide()
            applinkControl.QML_setGuideOffsetvalue(0);
            ScreenManager.backward(Layout.APPLINK,WindowsList.APP_LOCATION)
        }
    }

    //===========================soundBtn===========================//
    HMIButton{
        id: soundBtn
        visible:true
        x:862//0
        y:5//108
        width: 98
        height: 80
        btnImg: soundBtn.pressed?imagePath_navi+"M8X_Location_Button_p.png":imagePath_navi+"M8X_Location_Button.png"
        btnIcon:imagePath_navi+"M8X_Voice_icon.png"

        onClicked: {
            applinkControl.QML_NIF_Gid_TouchGuide()
        }
    }
    //===========================pausBtn===========================//
    HMIButton{
        id: pausBtn
        x:744
        y:881
        btnImg:imagePath_navi+"M8X_NAVI_Button_w218.png"
        btnImgOnPressed: imagePath_navi+"M8X_NAVI_Button_w218_p.png"
        onClicked:
        {
            if(istatus)
            {
                applinkControl.QML_NIF_Gid_DemoPause()
                istatus=0
            }
            else
            {
                applinkControl.QML_NIF_Gid_DemoContinue()
                istatus=1
            }
        }
    }
    Image{
        x:istatus?838:839
        y:istatus?1061-160:1066-160
        source:istatus?imagePath_navi+"M8X_Location_icon_Pause.png":imagePath_navi+"M8X_Location_icon_play.png"
    }

    //===========================back_home===========================//
    HMIButton{
        id: back_home
        y:881
        visible: location_com.bLongPress?false:true
        btnImgOnPressed:  imagePath_navi +"M8X_Function_close_Button_p.png"
        btnImg:  imagePath_navi+"M8X_Function_close_Button.png"
        btnIcon: imagePath_navi+"M8X_icon_close.png"
        onClicked:{
            applinkControl.QML_NIF_Gid_StopDemo()
            applinkControl.QML_NIF_Gid_StopGuide()
            applinkControl.QML_setGuideOffsetvalue(0);
            applinkControl.QML_CloseAppLink();
        }
    }

    //===========================hideBtn===========================//
        HMIButton{
            id: hideBtn
            x:862
            y:269-160//108
            visible: (bShowCross||bShowGuide)
            btnImg: hideBtn.pressed?imagePath_navi+"M8X_Location_Button_p.png":imagePath_navi+"M8X_Location_Button.png"
            Image{
                x:901-parent.x
                y:289-160-parent.y
                source:imagePath_navi+"M8X_Location_Arrow_R.png"
            }

            onClicked:{
                if(bShowCross){
                    bShowCross = false
                    bHideCrossView = true
                }
                if(bShowGuide){
                    bShowGuide = false
                }
            }
        }
        //===========================viewBtn===========================//
        HMIButton{
            id: viewBtn
            x:862
            y:269-160//108
            visible: bHideCrossView||(bVisibleGuide&&(!bShowGuide)&&(!bShowCross))
            btnImg: viewBtn.pressed?imagePath_navi+"M8X_Location_Button_p.png":imagePath_navi+"M8X_Location_Button.png"
            Image{
                x:895-parent.x
                y:289-160-parent.y
                source:imagePath_navi+"M8X_Location_Arrow_L.png"
            }

            onClicked:{
                if(bHideCrossView){
                    bShowCross = true
                    bHideCrossView = false
                }
                if( bVisibleGuide && (bShowGuide==false) ){
                    bShowGuide = true
                }
            }
        }

    function fucChangeSpeedEnabled()
    {
        if(applinkControl.QML_NIF_Gid_DemoGetSpeed()==2){
            accelerateBtn.enabled=false;
        }else{
            accelerateBtn.enabled=true;
        }
        if(applinkControl.QML_NIF_Gid_DemoGetSpeed()==0){
            redBtn.enabled=false;
        }else{
            redBtn.enabled=true;
        }
    }
    App_Com_Newspopup{
           id:msg_PopUp
           labelCount:1
           newspopText1: qsTr(applinkControl.QML_getMessageString(iMsgType)) + applinkControl.qsEmptyString
           visible:(iMsgType > 0)?true:false
           bIsTouchClear:applinkControl.QML_getMessageTouchClearFlag(iMsgType)
     }
    Timer{
        id:msg_timer
        interval: applinkControl.QML_getMessageTime(iMsgType)
        onTriggered: {
            msg_PopUp.visible = false
            iMsgType = 0
        }
    }
    App_Com_LaneALL{
        id:lane
        bCrossOrGuideOut:bShowCross||bShowGuide

        Connections{
            target:applinkControl
            onSignal_UpdateLaneInfo:
            {
                if(visible){
                    lane.bLane = bHasLane                    
                    if(lane.bLane == true){
                        lane.iLaneNum = iLaneCnt
                        lane.iLane1 = iLaneInfo1
                        lane.iLane2 = iLaneInfo2
                        lane.iLane3 = iLaneInfo3
                        lane.iLane4 = iLaneInfo4
                        lane.iLane5 = iLaneInfo5
                        lane.iLane6 = iLaneInfo6
                        lane.iLane7 = iLaneInfo7
                        lane.iLane8 = iLaneInfo8
                        lane.iLane9 = iLaneInfo9
                        lane.iLane10 = iLaneInfo10
                        lane.iLane11 = iLaneInfo11
                        lane.iLane12 = iLaneInfo12
                        lane.iLane13 = iLaneInfo13
                        lane.iLane14 = iLaneInfo14
                        lane.iLane15 = iLaneInfo15
                        lane.iLane16 = iLaneInfo16
                        lane.iLaneRecmd = iLaneRecmdInfo
                        lane.lane1_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(1)
                        lane.lane2_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(2)
                        lane.lane3_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(3)
                        lane.lane4_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(4)
                        lane.lane5_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(5)
                        lane.lane6_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(6)
                        lane.lane7_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(7)
                        lane.lane8_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(8)
                        lane.lane9_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(9)
                        lane.lane10_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(10)
                        lane.lane11_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(11)
                        lane.lane12_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(12)
                        lane.lane13_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(13)
                        lane.lane14_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(14)
                        lane.lane15_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(15)
                        lane.lane16_bLaneOneSimple = applinkControl.QML_getLaneSimpleIndex(16)
                        lane.lane1_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(1)
                        lane.lane2_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(2)
                        lane.lane3_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(3)
                        lane.lane4_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(4)
                        lane.lane5_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(5)
                        lane.lane6_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(6)
                        lane.lane7_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(7)
                        lane.lane8_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(8)
                        lane.lane9_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(9)
                        lane.lane10_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(10)
                        lane.lane11_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(11)
                        lane.lane12_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(12)
                        lane.lane13_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(13)
                        lane.lane14_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(14)
                        lane.lane15_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(15)
                        lane.lane16_bLaneMoreRecmdIndex = applinkControl.QML_getLaneMoreRecmdIndex(16)
                    }
                }
            }
        }
    }
    HMIWindowLine{

    }
    App_Com_TmcBar{
        id:tmcBar
        visible: applinkControl.QML_NIF_Tmc_GetShowSwitch()
        Connections{
            target:applinkControl
            onSignal_TMC_SegmentUpdateDataCB:{
                if(visible){
                    applinkControl.QML_NIF_Tmc_Get()
                }
            }
            onSignal_TMC_GetInfo:{
                if(visible){
                    tmcBar.iCarRunDist = isCarRunDist
                    tmcBar.iCusDist = isCusDist
                }
            }
            onSignal_TMC_GetData:{
                if(visible){
                    tmcBar.segModel=applinkControl.tmcBarListModel
                }
            }
        }
    }
}