summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qml
blob: 22e408c716668beb66eb1ae758957dfd0f55fd9e (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
import QtQuick 2.0
import com.ford.hmiframework 1.0
import "Models"
import "Widgets"
import "Styles"

Rectangle {
    width: 1360
    height: 768
    color: "black"

    // global events
    FEvent { id: cornerClicked }
    FEvent { id: closeNormalScreens }

    //global timers
    FTimer {id: testTimer; interval: 5000; repeat: false}

    // global datapools
    FDataPool {
        id: dataPool

        property string version: "V1.0.0"
        property string currSource: "FM"
        property string currStation: "91.9"
        property string currStatText: "WUOM"
        property string currSong: "Fresh Air"
        property string currAlbumArt: "album artRazorFish.png"
        property int layout: 2 //AM/FM:0, AMhd:1, FMhd:2, Sirius:3, USB:4, BT:5
        property int currFMpreset: 2
        property int currAMpreset: 1
        property int currSATpreset: 3
        property string curStationDT: ""
        property int statusBarChange: 0
        property int curFanSpeed: 1
        property int drvTemp: 70
        property int passTemp: 70

        property bool mainPCAmenuShown: false


        property string fm1pre1: "101.1"
        property string fm1pre2: "97.1"
        property string fm1pre3: "94.7"
        property string fm1pre4: "91.7"
        property string fm1pre5: "101.9"
        property string fm1pre6: "88.7"

        property string fm1stat1: "WRIF"
        property string fm1stat2: "WXYT"
        property string fm1stat3: "WCSX"
        property string fm1stat4: "WUOM"
        property string fm1stat5: "WDET"
        property string fm1stat6: "CIMX"

        property string fm1song1: "Ace of Spades"
        property string fm1song2: "Sports Talk"
        property string fm1song3: "Born to Run"
        property string fm1song4: "Fresh Air"
        property string fm1song5: "The Craig Fahle Show"
        property string fm1song6: "State of Love and Trust"

        property string fm2pre1: "101.1"
        property string fm2pre2: "97.1"
        property string fm2pre3: "94.7"
        property string fm2pre4: "91.7"
        property string fm2pre5: "101.9"
        property string fm2pre6: "88.7"

        property string fm2stat1: "WRIF"
        property string fm2stat2: "WXYT"
        property string fm2stat3: "WCSX"
        property string fm2stat4: "WUOM"
        property string fm2stat5: "WDET"
        property string fm2stat6: "CIMX"

        property string fm2song1: "Ace of Spades"
        property string fm2song2: "Sports Talk"
        property string fm2song3: "Born to Run"
        property string fm2song4: "Fresh Air"
        property string fm2song5: "The Craig Fahle Show"
        property string fm2song6: "State of Love and Trust"

        property string fm3pre1: "101.1"
        property string fm3pre2: "97.1"
        property string fm3pre3: "94.7"
        property string fm3pre4: "91.7"
        property string fm3pre5: "101.9"
        property string fm3pre6: "88.7"

        property string fm3stat1: "WRIF"
        property string fm3stat2: "WXYT"
        property string fm3stat3: "WCSX"
        property string fm3stat4: "WUOM"
        property string fm3stat5: "WDET"
        property string fm3stat6: "CIMX"

        property string fm3song1: "Ace of Spades"
        property string fm3song2: "Sports Talk"
        property string fm3song3: "Born to Run"
        property string fm3song4: "Fresh Air"
        property string fm3song5: "The Craig Fahle Show"
        property string fm3song6: "State of Love and Trust"


        /*List Filtered Variables*/
        property string navEnrty:""
        property string filter: ""
        property variant uniqueChars: undefined
        property string navList1stItem:""
        property string filterPhone:""
    }

    // global conditions
    FConditionPool {
        id: condPool

        property bool amfmActiveSource: true
        property bool settingsOpen: false
        property bool dualBtnSt: true
        property bool drvHeatSeatSt: false
        property bool drvCoolSeatSt: false
        property bool passCoolSeatSt: false
        property bool passHeatSeatSt: false
        property bool heatWheelSt: false
        property bool heatWinSheildSt: true
        property bool defrostSt: true
        property bool pannelSt: false
        property bool floorSt: false

        property bool showMenu: true

    }


    Component.onCompleted: {
        FThemeProvider.resourcePath = Qt.resolvedUrl("Resources");
        FThemeProvider.theme = "Theme1";


    }
    property QtObject filtermodel: ListModel {
        ListElement { staticItem: "Five Guys" }
        ListElement { staticItem: "Archers Of Loaf" }
        ListElement { staticItem: "Bob Mould" }
        ListElement { staticItem: "Cat Power" }
        ListElement { staticItem: "Cloud Nothings"}
        ListElement { staticItem: "Dentist"}
        ListElement { staticItem: "Dirty Frank's" }
        ListElement { staticItem: "Grouplove" }
        ListElement { staticItem: "Hudson Bell"}
        ListElement { staticItem: "Japandroids" }
        ListElement { staticItem: "Macklemore & Ryan Lewis"}
        ListElement { staticItem: "The National"}
        ListElement { staticItem: "Titus Andronicus" }
        ListElement { staticItem: "Tito" }
        ListElement { staticItem: "Tamal" }
        ListElement { staticItem: "Taco" }
    }

    QtObject{
        id:sortList

        //Check if char exist on Phone DataModel
        function existChar(model, character){
            //console.log(model.get(3).staticItem.charAt(0).toLowerCase())
            for (var i = 0; i < model.count; i++) {
                var u =model.get(i).staticItem.charAt(0).toLowerCase()
                if (character=== u){
                    console.log(i)
                    return i;
                }

            }

        }

        // Check whether given character exists in array
        function exist(array, character) {
            console.log(array[0]);
            for (var i = 0; i < array.length; i++) {

                if (array[i] == character) return true;
            }
            return false;
        }

        // Check whether given filter matches the string (e.g. "ce" would match "Cecilia")
        // The check is case-insensitive
        function checkFilter(filter, string) {
            if (filter.length > string.length) return false;

            var filterlower = filter.toLowerCase();
            var stringlower = string.toLowerCase();

            for (var i = 0; i < filter.length; i++) {
                if (filterlower[i] != stringlower[i])
                    return false;
            }

            return true;
        }

        // Updates the filtermodel based on the current filter
        function updateFilterModel(name) {
            if (dataPool.filter.length > 0) {
                for (var i = filtermodel.count-1; i >= 0; i--) {
                    if (!checkFilter(dataPool.filter, filtermodel.get(i).staticItem))
                        filtermodel.remove(i)
                }
            }

            updateUniqueChars()
        }

        // Updates the array of unique first letters in the current index of the model
        function updateUniqueChars() {

            if (filtermodel.get(0) === undefined)
            {
                dataPool.navList1stItem=""
                return;

            }

            var characters = new Array();

            // If filter model has at most 1 item in it, no point in going
            // any further with filtering
            dataPool.navList1stItem=filtermodel.get(0).staticItem
            if (filtermodel.count > 1) {

                for (var i = 0; i < filtermodel.count; i++) {
                    var name = filtermodel.get(i).staticItem;

                    if (!exist(characters, name[dataPool.filter.length])) {
                        characters.push(name[dataPool.filter.length])
                    }
                }

                characters.sort()


            }


            dataPool.uniqueChars = characters

        }


        // Fills the filtermodel with contents from the source list's model
        function fillFilterModel(fullModel) {
            if (fullModel === undefined) return;
            filtermodel.clear();
            for (var i = 0; i < fullModel.count; i++) {
                filtermodel.append(fullModel.get(i))
            }

        }

    }

    FDisplay {

       /* modelPath:Qt.resolvedUrl(".")
        id: display
        //activeVariant: "ClassicTop"
        //activeVariant: "ClassicBottom"
        //activeVariant: "Tangier"
        viewCacheSize:0

        //width: 800
        //height: 480
//        xPixel: 800
//        yPixel: 480
        anchors.fill: parent
//        anchors { left: parent.left; top: parent.top;}

        priorityLayerCount: 9
        //initialView: "AutocompleteList"
        initialView: "Off"*/



        modelPath:Qt.resolvedUrl(".")
        id: display
        //activeVariant: "ClassicTop"
        //activeVariant: "ClassicBottom"
        //activeVariant: "Tangier"
        viewCacheSize:0


        width: 800
        height: 480

        xPixel: 800
        yPixel: 480

        anchors {
            horizontalCenter: parent.horizontalCenter;
            verticalCenter: parent.verticalCenter;
            verticalCenterOffset: 55
        }

        priorityLayerCount: 9
        initialView: "Off"
        //initialView: "NavTilesView"
    }

    Item
    {
        id: fHardwareKeybezel1
        width: 800
        height: 375
        x:10
        y:500

        // function keys
        TextHardkey {
            id: hk_OnOff
            width: 100
            height: 50
            anchors.left: parent.left
            anchors.leftMargin: 0
            anchors.top: parent.top
            anchors.topMargin: 0
            label: "On/Off"
        }

        BaseText {
            id: info
            text: dataPool.version
            color: "black"
            anchors.top: hk_OnOff.top
            anchors.left: hk_OnOff.right
            anchors.leftMargin: 20
        }


        FHardwareKey {
                   id: buttonUp
                   hardwareControlID: "buttonUp"
                   //commName: "buttonBack"

                   x:0
                   y:0
                   width: 60
                   height:25


                   keyboardKey: Qt.Key_Up
                   visible: false
               }

        FHardwareKey {
                   id: buttonDown
                   hardwareControlID: "buttonDown"
                   //commName: "buttonBack"

                   x:0
                   y:0
                   width: 60
                   height:25


                   keyboardKey: Qt.Key_Down
                   visible: false
               }

    }

}