1 /****************************************************************************
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Copyright (C) 2018, 2019 Konsulko Group
5 ** Contact: https://www.qt.io/licensing/
7 ** This file is part of the examples of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:BSD$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
19 ** Alternatively, you may use this file under the terms of the BSD license
22 ** "Redistribution and use in source and binary forms, with or without
23 ** modification, are permitted provided that the following conditions are
25 ** * Redistributions of source code must retain the above copyright
26 ** notice, this list of conditions and the following disclaimer.
27 ** * Redistributions in binary form must reproduce the above copyright
28 ** notice, this list of conditions and the following disclaimer in
29 ** the documentation and/or other materials provided with the
31 ** * Neither the name of The Qt Company Ltd nor the names of its
32 ** contributors may be used to endorse or promote products derived
33 ** from this software without specific prior written permission.
36 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
37 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
50 ****************************************************************************/
53 * NOTE: Originally written from scratch, but enough code was eventually
54 * pasted in from the Qt dashboard.qml example that its license text
59 import QtQuick.Window 2.1
60 import QtQuick.Controls 1.4
61 import QtQuick.Controls.Styles 1.4
62 import QtQuick.Extras 1.4
69 flags: Qt.FramelessWindowHint
70 style: ApplicationWindowStyle {
71 background: Rectangle {
82 x: (parent.width - width) / 2
94 height: parent.height * 0.75
95 spacing: (parent.width - (14 * parent.height * 0.75)) / 15
98 anchors.topMargin: (parent.height - height) /2
99 anchors.bottomMargin: (parent.height - height) /2
100 anchors.leftMargin: (parent.width - (14 * parent.height * 0.75)) / 15
101 anchors.rightMargin: (parent.width - (14 * parent.height * 0.75)) / 15
105 height: parent.height
114 anchors.verticalCenter: parent.verticalCenter
115 anchors.horizontalCenter: parent.horizontalCenter
117 height: parent.height * 0.75
119 direction: Qt.LeftArrow
120 on: valueSource.turnSignal == Qt.LeftArrow
126 height: parent.height
134 source: valueSource.startUp ? './images/AGL_Icons_Engine_yellow.svg' : './images/AGL_Icons_Engine.svg'
135 anchors.verticalCenter: parent.verticalCenter
136 anchors.horizontalCenter: parent.horizontalCenter
138 height: parent.height * 0.75
139 fillMode: Image.PreserveAspectFit
145 height: parent.height
153 source: valueSource.startUp ? './images/AGL_Icons_Oil_red.svg' : './images/AGL_Icons_Oil.svg'
154 anchors.verticalCenter: parent.verticalCenter
155 anchors.horizontalCenter: parent.horizontalCenter
157 height: parent.height * 0.75
158 fillMode: Image.PreserveAspectFit
164 height: parent.height
172 source: valueSource.startUp ? './images/AGL_Icons_Battery_red.svg' : './images/AGL_Icons_Battery.svg'
173 anchors.verticalCenter: parent.verticalCenter
174 anchors.horizontalCenter: parent.horizontalCenter
176 height: parent.height * 0.75
177 fillMode: Image.PreserveAspectFit
183 height: parent.height
191 source: valueSource.startUp ? './images/AGL_Icons_ABS_red.svg' : './images/AGL_Icons_ABS.svg'
192 anchors.verticalCenter: parent.verticalCenter
193 anchors.horizontalCenter: parent.horizontalCenter
195 height: parent.height * 0.75
196 fillMode: Image.PreserveAspectFit
202 height: parent.height
210 source: valueSource.startUp ? './images/AGL_Icons_ParkingBrake_red.svg' : './images/AGL_Icons_ParkingBrake.svg'
211 anchors.verticalCenter: parent.verticalCenter
212 anchors.horizontalCenter: parent.horizontalCenter
214 height: parent.height * 0.75
215 fillMode: Image.PreserveAspectFit
221 height: parent.height
230 anchors.verticalCenter: parent.verticalCenter
231 anchors.horizontalCenter: parent.horizontalCenter
232 horizontalAlignment: Text.AlignCenter
234 text: valueSource.prindle
236 font.pixelSize: parent.height * 0.85
243 height: parent.height
252 anchors.verticalCenter: parent.verticalCenter
253 anchors.horizontalCenter: parent.horizontalCenter
254 horizontalAlignment: Text.AlignCenter
256 text: valueSource.gear
258 font.pixelSize: parent.height * 0.85
264 height: parent.height
272 source: valueSource.startUp ? './images/AGL_Icons_Seatbelt_red.svg' : './images/AGL_Icons_Seatbelt.svg'
273 anchors.verticalCenter: parent.verticalCenter
274 anchors.horizontalCenter: parent.horizontalCenter
276 height: parent.height * 0.75
277 fillMode: Image.PreserveAspectFit
283 height: parent.height
291 source: valueSource.startUp ? './images/AGL_Icons_OpenDoor_red.svg' : './images/AGL_Icons_OpenDoor.svg'
292 anchors.verticalCenter: parent.verticalCenter
293 anchors.horizontalCenter: parent.horizontalCenter
295 height: parent.height * 0.75
296 fillMode: Image.PreserveAspectFit
302 height: parent.height
310 source: valueSource.startUp ? './images/AGL_Icons_Lights_red.svg' : './images/AGL_Icons_Lights.svg'
311 anchors.verticalCenter: parent.verticalCenter
312 anchors.horizontalCenter: parent.horizontalCenter
314 height: parent.height * 0.75
315 fillMode: Image.PreserveAspectFit
321 height: parent.height
329 source: valueSource.cruiseEnabled ? (valueSource.cruiseSet ? './images/AGL_Icons_CruiseControl_green.svg' : './images/AGL_Icons_CruiseControl_yellow.svg') : './images/AGL_Icons_CruiseControl.svg'
330 anchors.verticalCenter: parent.verticalCenter
331 anchors.horizontalCenter: parent.horizontalCenter
333 height: parent.height * 0.75
334 fillMode: Image.PreserveAspectFit
340 height: parent.height
348 source: valueSource.laneDepartureWarnEnabled ? './images/AGL_Icons_LaneDeparture_green.svg' : './images/AGL_Icons_LaneDeparture.svg'
349 anchors.verticalCenter: parent.verticalCenter
350 anchors.horizontalCenter: parent.horizontalCenter
352 height: parent.height * 0.75
353 fillMode: Image.PreserveAspectFit
359 height: parent.height
368 anchors.verticalCenter: parent.verticalCenter
369 anchors.horizontalCenter: parent.horizontalCenter
371 height: parent.height * 0.75
373 direction: Qt.RightArrow
374 on: valueSource.turnSignal == Qt.RightArrow
388 x: (parent.width - width) / 2
389 //y: (parent.height - height) / 2
390 width: parent.width * 0.9
393 maximumValue: valueSource.mphDisplay ? 140 : 220
394 value: valueSource.kph * valueSource.speedScaling
396 style: DashboardGaugeStyle {}
408 x: (parent.width - width) / 2
409 width: parent.width * 0.9
413 value: valueSource.rpm
415 style: TachometerStyle {}
420 value: valueSource.fuel
422 y: parent.width * 0.85
423 width: parent.width * 0.45
424 height: parent.height * 0.25
426 style: IconGaugeStyle {
429 icon: "./images/fuel-icon.png"
430 minWarningColor: Qt.rgba(0.5, 0, 0, 1)
432 tickmarkLabel: Text {
434 visible: styleData.value === 0 || styleData.value === 1
435 font.pixelSize: fuelGaugeStyle.toPixels(0.225)
436 text: styleData.value === 0 ? "E" : (styleData.value === 1 ? "F" : "")
443 value: valueSource.temperature
445 x: parent.width * 0.55
446 y: parent.width * 0.85
447 width: parent.width * 0.45
448 height: parent.height * 0.25
450 style: IconGaugeStyle {
453 icon: "./images/temperature-icon.png"
454 maxWarningColor: Qt.rgba(0.5, 0, 0, 1)
456 tickmarkLabel: Text {
458 visible: styleData.value === 0 || styleData.value === 1
459 font.pixelSize: tempGaugeStyle.toPixels(0.225)
460 text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "")
478 source: './images/Utility_Logo_Grey-01.svg'
479 x: (parent.width - width) / 2
480 y: (parent.height - height) / 2
481 width: parent.width / 2
487 source: './images/agl_title_793x211.png'
488 x: (parent.width - width) / 2