summaryrefslogtreecommitdiff
path: root/app/gdp-hmi-launcher2/gdp-hmi-launcher2.qml
blob: caf764c6131221c34302dd4abb5e879545705912 (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
/**
 * Source codes are licensed under a Creative Commons Attribution 3.0 Unported
 * License. http://creativecommons.org/licenses/by/3.0/
 *
 * SPDX license identifier: CC-BY-3.0
 *
 * Initial code writters can be contacted at: info@quitcoding.com
 *
 * Copyright (C) 2015 GENIVI Alliance
 *
 * List of changes:
 * 16.Mar.2015, Sebastien Baudouin, modify the file to take in account our screen
 *                                  aspect ratio and the path where icons are
 *                                  stored and add a new item for powerOff
 *
 */
import QtQuick 2.0
import QtGraphicalEffects 1.0
import "content"

Item {
    id: mainView

    width: 1024
    height: 768

    signal appSelectSignal(string unit)
    signal requestOffSignal()

    QtObject {
        id: settings
        property real spotAnimationPosition: 0.0
        SequentialAnimation on spotAnimationPosition {
            loops: Animation.Infinite
            NumberAnimation { to: 30; duration: 2000; easing.type: Easing.InOutQuad }
            NumberAnimation { to: 0; duration: 2000; easing.type: Easing.InOutQuad }
        }
    }

    Image {
        anchors.fill: parent
        source: "file://usr/share/gdp/background_lab.jpg"
    }

    ContentModel {
        id: listModel
    }

    NMapLightSource {
        id: lightSourceItem
        z: 10
        lightPosX: mainView.width * 0.5
        lightPosY: mainView.height * 0.8 - settings.spotAnimationPosition * 5
        lightIntensity: 0.3
    }

    PathView {
        id: pathView
        anchors.fill: parent
        model: listModel
        delegate: ListItem {
            onIsSelectedChanged: {
                if (isSelected) {
                    nameTextItem.text = model.name
                }
            }
        }
        path: Path {
            startX: mainView.width*0.5; startY: mainView.height*0.68
            PathAttribute { name: "iconScale"; value: 0.8 }
            PathAttribute { name: "iconZ"; value: 100.0 }
            PathAttribute { name: "iconFog"; value: 0.0 }
            PathQuad { x: mainView.width*0.5; y: mainView.height*0.2; controlX: mainView.width*1.1; controlY: mainView.height*0.2 }
            PathAttribute { name: "iconScale"; value: 0.46 }
            PathAttribute { name: "iconZ"; value: 1.0 }
            PathAttribute { name: "iconFog"; value: 0.5 }
            PathQuad { x: mainView.width*0.5; y: mainView.height*0.68; controlX: -mainView.width*0.1; controlY: mainView.height*0.2 }
        }
        focus: true
        Keys.onPressed: {
            if (event.key === Qt.Key_Left) {
                pathView.decrementCurrentIndex();
                event.accepted = true;
            }
            if (event.key === Qt.Key_Right) {
                pathView.incrementCurrentIndex();
                event.accepted = true;
            }
        }
    }

    Text {
        id: nameTextItem
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.bottom: parent.bottom
        anchors.bottomMargin: parent.height * 0.08
        font.pixelSize: 68
        color: "#d0d0d0"
        style: Text.Outline
        styleColor: "#404040"
        visible: false
    }

    DropShadow {
        anchors.fill: nameTextItem
        horizontalOffset: 0
        verticalOffset: settings.spotAnimationPosition * 0.5 - 8
        radius: 14.0
        samples: 16
        color: "#000000"
        source: nameTextItem
        opacity: 0.6
    }

    Image {
        anchors.bottom: parent.bottom
        anchors.bottomMargin: parent.height * 0.01
        anchors.right: parent.right
        anchors.rightMargin: Math.max(8, parent.width * 0.15 - 100)
        source: "file://usr/share/gdp/arrow-right.png"
        MouseArea {
            anchors.fill: parent
            onClicked: pathView.incrementCurrentIndex()
        }
    }

    Image {
        anchors.bottom: parent.bottom
        anchors.bottomMargin: parent.height * 0.01
        anchors.left: parent.left
        anchors.leftMargin: Math.max(8, parent.width * 0.15 - 100)
        mirror: true
        source: "file://usr/share/gdp/arrow-right.png"
        MouseArea {
            anchors.fill: parent
            onClicked: pathView.decrementCurrentIndex()
        }
    }

    Image {
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.horizontalCenterOffset: 150
        source: "file://usr/share/gdp/spot.png"
        transformOrigin: Item.BottomRight
        width: 500
        height: 200
        rotation: settings.spotAnimationPosition * 0.8
        opacity: 0.2
    }

    Image {
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.horizontalCenterOffset: -150
        source: "file://usr/share/gdp/spot.png"
        mirror: true
        transformOrigin: Item.BottomLeft
        width: 500
        height: 200
        rotation: -settings.spotAnimationPosition * 0.8
        opacity: 0.2
    }

    PowerOffItem {
        id: powerOffItem
    }
}