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

HMIWindow{

    id:app_RouteMain
    //windowImgSource: imagePath + "M8X_full-screen_bk.png"
    title : qsTr("路线") + applinkControl.qsEmptyString
    //imagePath: "/var/navi/App/bin/qml_navi/images/"  /* For PC test*/

    property bool bRouteMap:true//false
    property int isRouteGuiding:0

    property bool bIsUnArrivedDest:true//false

    property int iMsgType:0
    property int iLabelCount:1

    property int iFalseCount: 0
    onSignal_returnClick: {
        ScreenManager.backward(Layout.APPLINK)
    }

    onVisibleChanged: {
        if(visible){
            iFalseCount = 0
            bRouteMap = applinkControl.QML_NIF_Gid_GetRouteInfoStatus()
            applinkControl.QML_NIF_Cus_GetDestAndViaInfo()
        }else{
            iMsgType = 0
            msg_PopUp.visible = false
            if(1 === applinkControl.QML_GetCusStatus()){ //calculating status
                applinkControl.QML_NIF_Cus_CancelRoute()
            }
        }
    }


    HMIButton{
        id:list1
        anchors.left:parent.left
        anchors.leftMargin: 58
        anchors.top: parent.top
        anchors.topMargin: 81
        btnImgOnPressed:imagePath +"Common/M8X_list_78_p.png"
        btnImg:imagePath +"Common/M8X_list_78.png"        

        HMILabel{
            id:list1text
            x:84
            y:24
            width:570
            height:38
            font.pixelSize:30
            horizontalAlignment: Text.AlignLeft
            verticalAlignment: Text.AlignTop
            text:qsTr("路线行程图") + applinkControl.qsEmptyString
        }


        Image{
            id:iconChoose
            anchors.left:parent.left
            anchors.leftMargin: 758
            anchors.top: parent.top
            anchors.topMargin: 9
            source: list1.pressed?bRouteMap?imagePath +"Common/M8X_choice_box_check_Pushed.png":imagePath +"Common/M8X_choice_box_Pushed.png":(bRouteMap?imagePath +"Common/M8X_choice_box_check.png":imagePath +"Common/M8X_choice_box.png")
        }

        onClicked:{
            bRouteMap = !bRouteMap
            applinkControl.QML_NIF_Gid_SetRouteInfoStatus(bRouteMap)
        }
    }
    HMIButton{
        id:list2
        anchors.left:parent.left
        anchors.leftMargin: 58
        anchors.top: parent.top
        anchors.topMargin: 81+80
        btnImgOnPressed:imagePath +"Common/M8X_list_78_p.png"
        btnImg:imagePath +"Common/M8X_list_78.png"

        HMILabel{
            id:list2text
            x:84
            y:24
            width:570
            height:38
            font.pixelSize:30
            horizontalAlignment: Text.AlignLeft
            verticalAlignment: Text.AlignTop
            text:(bIsUnArrivedDest != 0 )?((isRouteGuiding == 0)?qsTr("引导状态(非引导)") + applinkControl.qsEmptyString:qsTr("引导状态(引导)") + applinkControl.qsEmptyString):qsTr("引导状态(未设定目的地)") + applinkControl.qsEmptyString
        }

        HMILabel{
            id:list2textTail
            x:683-120
            y:24
            width:120+120
            height:38
            font.pixelSize:30
            horizontalAlignment: Text.AlignRight
            verticalAlignment: Text.AlignTop
            text:(isRouteGuiding == 0)?qsTr("引导") + applinkControl.qsEmptyString:qsTr("停止") + applinkControl.qsEmptyString
            visible:bIsUnArrivedDest
        }

        onClicked: {
            if(bIsUnArrivedDest == true){
                if(isRouteGuiding == 1){
                    iMsgType = 6
                    msg_PopUp.visible = true
                    msg_timer.start()
                    applinkControl.QML_NIF_Gid_StopGuide()
                }else if(isRouteGuiding == 0){
                    if(applinkControl.QML_NIF_Cus_StartCalc() != -1){
                        iMsgType = 1
                        msg_PopUp.visible = true
                    }else{
                        iMsgType = 7
                        msg_PopUp.visible = true
                        msg_timer.start()
                    }
                }

            }else{
                iMsgType = 10
                msg_PopUp.visible = true
                iLabelCount = 2
                msg_timer.start()
            }
        }
    }
    HMIButton{
        id:list3
        anchors.left:parent.left
        anchors.leftMargin: 58
        anchors.top: parent.top
        anchors.topMargin: 81+80+80
        btnImgOnPressed:imagePath +"Common/M8X_list_78_p.png"
        btnImg:imagePath +"Common/M8X_list_78.png"

        HMILabel{
            id:list3text
            x:84
            y:24
            width:570
            height:38
            font.pixelSize:30
            horizontalAlignment: Text.AlignLeft
            verticalAlignment: Text.AlignTop
            text:qsTr("引导地点") + applinkControl.qsEmptyString
        }

        onClicked: {
            ScreenManager.forward(Layout.APPLINK,WindowsList.APP_ROUTE_GUIDE)
        }
    }
    HMIButton{
        id:list4
        anchors.left:parent.left
        anchors.leftMargin: 58
        anchors.top: parent.top
        anchors.topMargin: 81+80+80+80
        btnImgOnPressed:imagePath +"Common/M8X_list_78_p.png"
        btnImg:imagePath +"Common/M8X_list_78.png"


        HMILabel{
            id:list4text
            x:84
            y:24
            width:570
            height:38
            font.pixelSize:30
            horizontalAlignment: Text.AlignLeft
            verticalAlignment: Text.AlignTop
            text: qsTr("算路方式变更") + applinkControl.qsEmptyString
        }

        onClicked: {
            if(bIsUnArrivedDest){
                if(applinkControl.QML_NIF_Cus_StartCalc() != -1){
                    iMsgType = 1
                    msg_PopUp.visible = true
                }else{
                    iMsgType = 7
                    msg_PopUp.visible = true
                    msg_timer.start()
                }
            }else{
                iMsgType = 8
                msg_PopUp.visible = true
                iLabelCount = 2
                msg_timer.start()
            }
        }
    }

    //底部动能栏
    Row{
        id: functionArea
        y:1041-160
        HMIButton{
            id: quitBtn
            btnImgOnPressed:  imagePath +"Common/M8X_Function_close_Button_p.png"
            btnImg:  imagePath+"Common/M8X_Function_close_Button.png"
            btnIcon: imagePath+"Common/M8X_icon_close.png"
            onClicked:{
                applinkControl.QML_CloseAppLink()
                //ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.APP_ROUTE_MAIN)
            }
        }
        HMIButton{
            id: nosw
            enabled: false
            btnImgOnPressed:  imagePath +"M8X_Function_1_Button_NoSwitch_p.png"
            btnImg:  imagePath+"M8X_Function_1_Button_NoSwitch.png"
        }
    }

    App_Com_Newspopup{
        id:msg_PopUp
        labelCount:iLabelCount
        newspopText1: qsTr(applinkControl.QML_getMessageString(iMsgType)) + applinkControl.qsEmptyString
        newspopText2: qsTr(applinkControl.QML_getMessageString(iMsgType+1)) + applinkControl.qsEmptyString
        bIsTouchClear:applinkControl.QML_getMessageTouchClearFlag(iMsgType)
        onClicked:{
            if(bIsTouchClear){
                //newspopup.visible = false
                iLabelCount = 1
                iMsgType = 0
                msg_PopUp.visible = false
                msg_timer.stop()
                isRouteGuiding = applinkControl.QML_NIF_Gid_iGetNaviStatus()
            }
        }
    }
    Timer{
        id:msg_timer
        interval: applinkControl.QML_getMessageTime(iMsgType)
        onTriggered: {
            iLabelCount = 1
            iMsgType = 0
            msg_PopUp.visible = false
            msg_timer.stop()
            isRouteGuiding = applinkControl.QML_NIF_Gid_iGetNaviStatus()
        }
    }

    Connections{
        target:applinkControl
        onSignal_CalcRouteFinish:{
            if(app_RouteMain.visible){
                if(bIsFinish == true){
                    applinkControl.QML_SetCurrentType(iFalseCount)
                    iFalseCount = 0
                    iMsgType = 0
                    msg_PopUp.visible = false
                    ScreenManager.forward(Layout.APPLINK,WindowsList.APP_NAVI_VIEWROUTE)
                    applinkControl.QML_NIF_Cus_GetCusStatus();
                }else{
                    if(++iFalseCount === 4 ){
                        iFalseCount = 0
                        iMsgType = 7
                        msg_PopUp.visible = true
                        msg_timer.restart()
                    }
                }
            }
        }

        onSignal_NIF_Cus_GetDestAndViaInforCB:{
            if(app_RouteMain.visible){
                if(bIsDestValid && bIsDestArrived == false){
                    bIsUnArrivedDest = true
                }else{
                    bIsUnArrivedDest = false
                }
                isRouteGuiding = applinkControl.QML_NIF_Gid_iGetNaviStatus()
            }
        }
    }
}