summaryrefslogtreecommitdiff
path: root/raveos-calamares-theme/etc/calamares/branding/raveos/show.qml
blob: c2c954baa96158a9e30efd82233e46d0cb17593b (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
import io.calamares.core 1.0

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import "RaveOS"

Rectangle {
    id: bemutato
    color: Stilus.hatter

    property bool activatedInCalamares: false
    property int aktualis: 0
    property real haladas: 0
    property string uzenet: ""

    readonly property var kepek: [
        { forras: "images/01-updates.png", leiras: qsTr("Start using it, not configuring it. RaveOS only updates when you want it to.") },
        { forras: "images/02-privacy.png", leiras: qsTr("Private for you, secure for you. We do not collect data about you.") },
        { forras: "images/03-filesystem.png", leiras: qsTr("EXT4/BTRFS file system that never fragments.") },
        { forras: "images/04-gaming.png", leiras: qsTr("Optimized for gaming at the deepest levels.") },
        { forras: "images/05-bugreport.png", leiras: qsTr("If something goes wrong, open an issue at git.rp1.hu. Thank you!") },
        { forras: "images/06-team-credits.png", leiras: qsTr("RaveOS Team. Thanks to every beta tester!") }
    ]
    readonly property int csapatKep: kepek.length - 1
    readonly property bool vegeFele: haladas >= 0.9

    function frissit() {
        haladas = Number(Global.value("raveosHaladas")) || 0
        uzenet = Global.value("raveosUzenet") || ""
        if (vegeFele && aktualis !== csapatKep) {
            aktualis = csapatKep
        }
    }

    function lapoz(irany) {
        aktualis = (aktualis + irany + kepek.length) % kepek.length
        leptetes.restart()
    }

    function onActivate() {
        activatedInCalamares = true
        aktualis = 0
        frissit()
    }

    function onLeave() {
        activatedInCalamares = false
    }

    Connections {
        target: Global
        function onChanged() {
            Qt.callLater(bemutato.frissit)
        }
    }

    Timer {
        id: leptetes
        interval: 8000
        repeat: true
        running: bemutato.activatedInCalamares && !bemutato.vegeFele
        onTriggered: bemutato.aktualis = bemutato.aktualis + 1 >= bemutato.csapatKep ? 0 : bemutato.aktualis + 1
    }

    component NyilGomb: Button {
        id: gomb
        property string ut: ""
        Layout.preferredWidth: 40
        Layout.preferredHeight: 40
        padding: 0
        background: Rectangle {
            color: gomb.hovered ? Stilus.aktiv : "transparent"
            border.width: 1
            border.color: Stilus.keretErosebb
        }
        contentItem: Canvas {
            onPaint: {
                var c = getContext("2d")
                c.reset()
                c.strokeStyle = Stilus.szoveg
                c.lineWidth = 2
                c.beginPath()
                var x = gomb.ut === "bal" ? [23, 17] : [17, 23]
                c.moveTo(x[0], 14)
                c.lineTo(x[1], 20)
                c.lineTo(x[0], 26)
                c.stroke()
            }
        }
    }

    ColumnLayout {
        anchors.fill: parent
        anchors.topMargin: 16
        anchors.bottomMargin: 16
        anchors.leftMargin: 24
        anchors.rightMargin: 24
        spacing: 10

        Item {
            Layout.fillWidth: true
            Layout.fillHeight: true

            Rectangle {
                id: keret
                anchors.horizontalCenter: parent.horizontalCenter
                width: Math.min(parent.width, parent.height * 16 / 9)
                height: width * 9 / 16
                color: "#141516"
                border.width: 1
                border.color: Stilus.keret
                clip: true

                Repeater {
                    model: bemutato.kepek

                    Image {
                        anchors.fill: parent
                        anchors.margins: 1
                        visible: index === bemutato.aktualis
                        source: modelData.forras
                        sourceSize.width: 1920
                        sourceSize.height: 1080
                        fillMode: Image.PreserveAspectFit
                        asynchronous: true
                        smooth: true
                        Accessible.role: Accessible.Graphic
                        Accessible.name: modelData.leiras
                    }
                }
            }
        }

        RowLayout {
            Layout.fillWidth: true
            spacing: 12

            Row {
                spacing: 6
                Repeater {
                    model: bemutato.kepek.length
                    Rectangle {
                        width: 24
                        height: 4
                        color: index === bemutato.aktualis ? Stilus.zold : Stilus.keretErosebb
                    }
                }
            }

            Text {
                text: (bemutato.aktualis + 1) + " / " + bemutato.kepek.length
                color: Stilus.szovegHalvany
                font.family: Stilus.mono
                font.pixelSize: 12
            }

            Item {
                Layout.fillWidth: true
            }

            NyilGomb {
                ut: "bal"
                Accessible.name: qsTr("Previous slide")
                onClicked: bemutato.lapoz(-1)
            }

            NyilGomb {
                ut: "jobb"
                Accessible.name: qsTr("Next slide")
                onClicked: bemutato.lapoz(1)
            }
        }

        ColumnLayout {
            Layout.fillWidth: true
            spacing: 8

            RowLayout {
                Layout.fillWidth: true
                spacing: 12

                Text {
                    Layout.fillWidth: true
                    text: bemutato.uzenet
                    elide: Text.ElideRight
                    color: Stilus.szoveg
                    font.family: Stilus.font
                    font.pixelSize: 14
                    font.weight: Font.DemiBold
                }

                Text {
                    text: Math.round(bemutato.haladas * 100) + "%"
                    color: Stilus.zold
                    font.family: Stilus.cim
                    font.weight: Font.Bold
                    font.pixelSize: 24
                }
            }

            Rectangle {
                Layout.fillWidth: true
                Layout.preferredHeight: 8
                color: Stilus.keret
                Accessible.role: Accessible.ProgressBar
                Accessible.name: qsTr("Installation progress")

                Rectangle {
                    width: parent.width * Math.max(0, Math.min(1, bemutato.haladas))
                    height: parent.height
                    color: Stilus.zold
                }
            }
        }
    }
}