aboutsummaryrefslogtreecommitdiffstats
path: root/sysui/Cluster/Middle.qml
blob: e14b6c3cc8c8239f23450cc69e7da7aeb3ca3413 (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
/****************************************************************************
**
** Copyright (C) 2016 Pelagicore AG
** Contact: http://www.qt.io/ or http://www.pelagicore.com/
**
** This file is part of the Neptune IVI UI.
**
** $QT_BEGIN_LICENSE:GPL3-PELAGICORE$
** Commercial License Usage
** Licensees holding valid commercial Pelagicore Neptune IVI UI
** licenses may use this file in accordance with the commercial license
** agreement provided with the Software or, alternatively, in accordance
** with the terms contained in a written agreement between you and
** Pelagicore. For licensing terms and conditions, contact us at:
** http://www.pelagicore.com.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3 requirements will be
** met: http://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
** SPDX-License-Identifier: GPL-3.0
**
****************************************************************************/

import QtQuick 2.1
import QtGraphicalEffects 1.0
import utils 1.0
import service.statusbar 1.0
import service.apps 1.0

Item {
    id: root
    width: 1300
    height: 720

    focus: true

    signal zoomIn()
    signal zoomOut()

    Behavior on width {
        NumberAnimation { duration: 200}
    }

    Behavior on height {
        NumberAnimation { duration: 200}
    }

    ListView {
        id: stack
        anchors.fill: parent
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem
        highlightMoveDuration: 300
        interactive: false
        currentIndex: 0
        clip: true
        model: VisualItemModel {
            WidgetContainer {
                id: navContainer
                width: stack.width
                height: stack.height
                title: "NAVIGATOR"

                Tracer {}
            }
            WidgetContainer {
                id: musicContainer
                width: stack.width
                height: stack.height
                title: "MUSIC"
            }
            WidgetContainer {
                id: otherContainer
                width: stack.width
                height: stack.height
                title: "OTHER"
            }
        }

        Component.onCompleted: {
            StatusBarService.pageIndicatorSize = stack.count
            StatusBarService.currentPage = Qt.binding(function() { return stack.currentIndex})
            StatusBarService.clusterTitle = Qt.binding(function() { return currentItem.title})
        }
    }

    Connections {
        target: AppsService
        onClusterWidgetReady: {
//            if (category === "media") {
//                musicContainer.content = item
//                stack.currentIndex = 1
//            }
            if (category === "navigation") {
                navContainer.content = item
                stack.currentIndex = 0
            }
//            else {
//                otherContainer.content = item
//                stack.currentIndex = 2
//            }
        }
    }

    Keys.onPressed: {
        //print("key pressed", Qt.Key_Plus, event.key)
        if (event.key === Qt.Key_Right) {
            if (stack.currentIndex < stack.count)
                stack.currentIndex++
        }
        else if (event.key === Qt.Key_Left) {
            if (stack.currentIndex > 0)
                stack.currentIndex--
        }
        else if (event.key === Qt.Key_Plus) {
            root.zoomIn()
        }
        else if (event.key === Qt.Key_Minus) {
            root.zoomOut()
        }
    }

    Keys.forwardTo: stack.currentItem

//    Rectangle {
//        anchors.fill: parent
//    }

    LinearGradient {
        width: 300
        height: parent.height

        start: Qt.point(0, 0)
        end: Qt.point(width, 0)
        gradient: Gradient {
            GradientStop { position: 0.3; color: "#0c0c0c" }
            GradientStop { position: 1.0; color: "transparent" }
        }
    }

    LinearGradient {
        width: 300
        height: parent.height
        anchors.right: parent.right
        start: Qt.point(0, 0)
        end: Qt.point(width, 0)
        gradient: Gradient {
            GradientStop { position: 0.0; color: "transparent" }
            GradientStop { position: 0.7; color: "#0c0c0c" }
        }
    }


}