summaryrefslogtreecommitdiffstats
path: root/GUIModel/main.qml
blob: 438ec373248e9c935ea0741c2df058b2973b99a2 (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
/*
 * Copyright 2020,2021 Panasonic Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick.Scene3D 2.14

import "./FPSItem"
import "./ACC"
import "./CruisingRange"
import "./Header"
import "./Map"
import "./Menu"
import "./Meter"
import "./ShiftPosition"
import "./Telltale"
import "./TurnByTurn"


Window {
    id: winl
    visible: true
    width: 1920
    height: 720
    color: "black"
    flags: Qt.FramelessWindowHint
    maximumWidth: width
    maximumHeight: height
    Item{
        id: rootItem
        width: 1920
        height: 720
        focus: true
        clip: true
        property int mode: 0 /* 0:normal 1:adas 2:map */
        property string car_state : "normal_default"
        property string arrow_state : "arrow_normal_default"
        property string set_state : "set_default"
        signal transNormalToAdas()
        signal transAdasToMap()
        signal transMapToNormal()

        signal keyPressed_Up()
        signal keyPressed_Down()
        signal keyPressed_Left()
        signal keyPressed_Right()
        signal keyPressed_Enter()
        signal keyPressed_Menu()


        Item{
            id:viewdata
            property int tbtArrow: 0
            property int tbtValue: 200

            onTbtArrowChanged: {
                turnByTurn.receivedArrowId = tbtArrow
                stage.received_id = tbtArrow
            }

            onTbtValueChanged: {
                turnByTurn.receivedTbtValue = tbtValue
            }
        }

        Item{
            id:acc3d_parts
            width:1920
            height:1080
            Item{
                id:acc3d
                Item{
                    id:ddditem
                    x:548
                    y:-23
                    width: 1920
                    height: 1080
                    scale:0.6
                    Scene3D {
                        anchors.fill: parent
                        aspects: ["input", "logic"]
                        multisample: false
                        cameraAspectRatioMode:Scene3D.UserAspectRatio
                        Stage {
                            id:stage
                            ACC_Animation{
                                property int direction_acc_line : 0
                                property int direction_acc_car : 0
                                id:accc_view
                                acc_line_pos: 1
                                acc_car_pos: 1
                            }
                        }
                    }

                }
            }

            Image{
                id: acc3d_mask
                width:1920
                height:720
                source: "qrc:/Images/ADASView/ACC/3D_parts_mask.ktx"
                visible:true

            }
            Image{ source:"qrc:/Images/ADASView/MAP/acc_cover.ktx"; width:1412; height:98; x:508; y:622 }

        }

        Map{
            id: map
        }

        TurnByTurn{
            id:turnByTurn
        }
        Menu{
            id: menu
        }
        Meter{
            id: meter
        }
        ShiftPosition{
            id:shiftPosition
            shiftId:0
        }
        CruisingRange {
            id: cruisingRange
            cruisingRangeValue : 750
        }

        Header{
            id:header
        }
        Telltale{
            id:telltale
        }

        Keys.onPressed: {

            switch(event.key){
                case(Qt.Key_C):

                    if(mode === 0){
                        transNormalToAdas();
                    }else if(mode === 1){
                        transAdasToMap();
                    }else if(mode === 2){
                        transMapToNormal()
                    }

                    mode++;
                    if(mode > 2) mode = 0;
                    break



            case(Qt.Key_1):
                if(shiftPosition.shiftId < 5) {
                    shiftPosition.shiftId++
                }else{
                    shiftPosition.shiftId = 0
                }
                break

            case(Qt.Key_2):
                if(accc_view.direction_acc_line === 0){
                    if(accc_view.acc_line_pos == 1) {
                        accc_view.acc_line_pos++
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_middle"
                        }else{
                            rootItem.arrow_state = "arrow_adas_middle"}
                        rootItem.set_state = "set_middle"
                    }else if(accc_view.acc_line_pos == 2){
                        accc_view.acc_line_pos++
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_near"
                        }else{
                            rootItem.arrow_state = "arrow_adas_near"}
                        rootItem.set_state = "set_near"
                    }else if(accc_view.acc_line_pos == 3){
                        accc_view.acc_line_pos--
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_middle"
                        }else{
                            rootItem.arrow_state = "arrow_adas_middle"}
                        rootItem.set_state = "set_middle"
                        accc_view.direction_acc_line = 1
                    }
                }else{
                    if(accc_view.acc_line_pos == 3) {
                        accc_view.acc_line_pos--
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_middle"
                        }else{
                            rootItem.arrow_state = "arrow_adas_middle"}
                        rootItem.set_state = "set_middle"
                    }else if(accc_view.acc_line_pos == 2){
                        accc_view.acc_line_pos--
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_default"
                        }else{
                            rootItem.arrow_state = "arrow_adas_default"}
                        rootItem.set_state = "set_default"
                    }else if(accc_view.acc_line_pos == 1){
                        accc_view.acc_line_pos++
                        if(mode == 0){
                            rootItem.arrow_state = "arrow_normal_middle"
                        }else{
                            rootItem.arrow_state = "arrow_adas_middle"}
                        rootItem.set_state = "set_middle"
                        accc_view.direction_acc_line = 0
                    }
                }
                break

            case(Qt.Key_3):
                if(accc_view.direction_acc_car == 0){
                    if(accc_view.acc_car_pos == 1) {
                        accc_view.acc_car_pos++
                        if(mode == 0){
                            rootItem.car_state = "nornal_middle"
                        }else{
                            rootItem.car_state = "adas_middle"}
                    }else if(accc_view.acc_car_pos == 2) {
                        accc_view.acc_car_pos++
                        if(mode == 0){
                            rootItem.car_state = "normal_near"
                        }else{
                            rootItem.car_state = "adas_near"}
                    }else if(accc_view.acc_car_pos == 3) {
                        accc_view.acc_car_pos--
                        accc_view.direction_acc_car = 1
                        if(mode == 0){
                            rootItem.car_state = "normal_middle"
                        }else{
                            rootItem.car_state = "adas_middle"}
                    }
                }else{
                    if(accc_view.acc_car_pos == 3) {
                        accc_view.acc_car_pos--
                        if(mode == 0){
                            rootItem.car_state = "normal_middle"
                        }else{
                            rootItem.car_state = "adas_middle"}
                    }else if(accc_view.acc_car_pos == 2) {
                        accc_view.acc_car_pos--
                        if(mode == 0){
                            rootItem.car_state = "normal_default"
                        }else{
                            rootItem.car_state = "adas_default"}
                    }else if(accc_view.acc_car_pos == 1){
                        accc_view.acc_car_pos++
                        accc_view.direction_acc_car = 0
                        if(mode == 0){
                            rootItem.car_state = "normal_middle"
                        }else{
                            rootItem.car_state = "adas_middle"}
                    }
                }
                break
            case(Qt.Key_4):
                telltaleSwitching();
                break

            case(Qt.Key_Up):
                keyPressed_Up()
                break

            case(Qt.Key_Down):
                keyPressed_Down()
                break

            case(Qt.Key_Left):
                keyPressed_Left()
                break

            case(Qt.Key_Right):
                keyPressed_Right()
                break

            case(Qt.Key_Space):
                keyPressed_Enter()
                break

            case(Qt.Key_M):
                keyPressed_Menu()
                break

            default:
                break


            }
       }


        Timer { //test
            property int num  : 0
            interval: 5000
            repeat: true
            running: true
            onTriggered: {
                num++;
                if(num == 5){num = 1}
                viewdata.tbtArrow = num;
            }
        }

        Timer { //test
            property int v  : 200
            interval: 5000
            repeat: true
            running: true
            onTriggered: {
                if(v - 20 >= 0){
                  v = v - 20
                }else{
                    v = 200
                }
                viewdata.tbtValue = v;
            }
        }
    }

//  FpsItem{}

    function telltaleSwitching(){
        telltale.telltaleMasterWarn = !telltale.telltaleMasterWarn
        telltale.telltaleGeneralWarn = !telltale.telltaleGeneralWarn
        telltale.telltaleBrakeEnergyRecovOff = !telltale.telltaleBrakeEnergyRecovOff
        telltale.telltaleBrakeEnergyRecovLv = !telltale.telltaleBrakeEnergyRecovLv
        telltale.telltaleMotorWarn = !telltale.telltaleMotorWarn
        telltale.telltalePopupHoodWarn = !telltale.telltalePopupHoodWarn
        telltale.telltaleDecharge = !telltale.telltaleDecharge
        telltale.telltaleEvSystemWarn = !telltale.telltaleEvSystemWarn
        telltale.telltaleChargingPlugWarn = !telltale.telltaleChargingPlugWarn
        telltale.telltaleLowBatt = !telltale.telltaleLowBatt
        telltale.telltaleBattWarn = !telltale.telltaleBattWarn
        telltale.telltaleBattTempWarn = !telltale.telltaleBattTempWarn
        telltale.telltaleHighVoltBattCut = !telltale.telltaleHighVoltBattCut
        telltale.telltaleAeb = !telltale.telltaleAeb
        telltale.telltaleLdw = !telltale.telltaleLdw
        telltale.telltaleBsd = !telltale.telltaleBsd
        telltale.telltaleSrsAirbag = !telltale.telltaleSrsAirbag
        telltale.telltaleEpsOff = !telltale.telltaleEpsOff
        telltale.telltaleBrake = !telltale.telltaleBrake
        telltale.telltaleAbsWarn = !telltale.telltaleAbsWarn
        telltale.telltaleEspAct = !telltale.telltaleEspAct
        telltale.telltaleHillDescent = !telltale.telltaleHillDescent
        telltale.telltaleAutoParking = !telltale.telltaleAutoParking
        telltale.telltaleTpmsInd = !telltale.telltaleTpmsInd
        telltale.telltaleImmobi = !telltale.telltaleImmobi
        telltale.telltaleDoor = !telltale.telltaleDoor
        telltale.telltaleSeatbelt = !telltale.telltaleSeatbelt
        telltale.telltaleSeatbelt2 = !telltale.telltaleSeatbelt2
        telltale.telltaleEpbWarn = !telltale.telltaleEpbWarn
        telltale.telltaleEps= !telltale.telltaleEps
        telltale.telltaleHighbeamAssist = !telltale.telltaleHighbeamAssist
        telltale.telltaleHighbeam = !telltale.telltaleHighbeam
        telltale.telltaleRearFog = !telltale.telltaleRearFog
        telltale.telltaleLowbeam = !telltale.telltaleLowbeam
        telltale.telltalePosition = !telltale.telltalePosition
    }
}