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

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

Rectangle {
    id: lablec
    color: Stilus.hatter
    height: 73

    readonly property int lepesekSzama: Math.max(lepesek.count - 1, 0)
    readonly property int aktualis: ViewManager.currentStepIndex
    readonly property bool utolso: aktualis === lepesekSzama
    readonly property bool telepites: telepitesElindult && !utolso
    property bool telepitesElindult: false
    property bool naploLatszik: false

    function frissitAllapot() {
        naploLatszik = Global.value("raveosNaplo") === true
        telepitesElindult = Global.contains("raveosHaladas")
    }

    function cimke(szoveg) {
        return szoveg.replace("&", "")
    }

    Connections {
        target: Global
        function onChanged() {
            Qt.callLater(lablec.frissitAllapot)
        }
    }

    Repeater {
        id: lepesek
        model: ViewManager
        Item {}
    }

    Rectangle {
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.right: parent.right
        height: 1
        color: Stilus.keret
    }

    component SzovegGomb: Button {
        id: gomb
        Layout.preferredHeight: 44
        leftPadding: 16
        rightPadding: 16
        background: Rectangle { color: "transparent" }
        contentItem: Text {
            text: gomb.text
            color: gomb.hovered ? Stilus.szoveg : Stilus.szovegMasodlagos
            font.family: Stilus.font
            font.pixelSize: 14
            font.weight: Font.Medium
            verticalAlignment: Text.AlignVCenter
        }
    }

    component KeretesGomb: Button {
        id: gomb
        Layout.preferredHeight: 44
        leftPadding: 20
        rightPadding: 20
        background: Rectangle {
            color: gomb.hovered && gomb.enabled ? Stilus.aktiv : "transparent"
            border.width: 1
            border.color: gomb.enabled ? Stilus.keretErosebb : Stilus.keret
        }
        contentItem: Text {
            text: gomb.text
            color: gomb.enabled ? Stilus.szoveg : Stilus.szovegHalvany
            font.family: Stilus.font
            font.pixelSize: 14
            font.weight: Font.Medium
            verticalAlignment: Text.AlignVCenter
        }
    }

    component ZoldGomb: Button {
        id: gomb
        Layout.preferredHeight: 44
        leftPadding: 24
        rightPadding: 24
        background: Rectangle {
            color: !gomb.enabled ? "transparent" : (gomb.hovered ? Stilus.zoldHover : Stilus.zold)
            border.width: gomb.enabled ? 0 : 1
            border.color: Stilus.keret
        }
        contentItem: Text {
            text: gomb.text
            color: gomb.enabled ? Stilus.zoldonSzoveg : Stilus.szovegHalvany
            font.family: Stilus.font
            font.pixelSize: 14
            font.weight: Font.DemiBold
            verticalAlignment: Text.AlignVCenter
        }
    }

    RowLayout {
        anchors.fill: parent
        anchors.topMargin: 15
        anchors.bottomMargin: 14
        anchors.leftMargin: 56
        anchors.rightMargin: 56
        spacing: 12

        Text {
            text: qsTr("STEP %1 / %2").arg(lablec.aktualis).arg(lablec.lepesekSzama)
                  + (lablec.telepites ? " · " + qsTr("DO NOT TURN OFF THE COMPUTER") : "")
            color: Stilus.szovegHalvany
            font.family: Stilus.mono
            font.pixelSize: 12
        }

        Item {
            Layout.fillWidth: true
        }

        SzovegGomb {
            visible: !lablec.telepites && !lablec.utolso && ViewManager.quitVisible
            enabled: ViewManager.quitEnabled
            text: qsTr("Quit")
            onClicked: ViewManager.quit()
        }

        SzovegGomb {
            visible: lablec.telepites
            text: lablec.naploLatszik ? qsTr("Show slideshow") : qsTr("Open log")
            onClicked: Global.insert("raveosNaplo", !lablec.naploLatszik)
        }

        KeretesGomb {
            visible: !lablec.telepites && !lablec.utolso && ViewManager.backAndNextVisible
            enabled: ViewManager.backEnabled || lablec.aktualis === 1
            text: qsTr("Back")
            onClicked: lablec.aktualis === 1 ? ViewManager.goBackTo(0) : ViewManager.back()
        }

        ZoldGomb {
            visible: !lablec.utolso && ViewManager.backAndNextVisible
            enabled: ViewManager.nextEnabled && !lablec.telepites
            text: ViewManager.nextIcon === "run-install" ? lablec.cimke(ViewManager.nextLabel) : qsTr("Next")
            onClicked: ViewManager.next()
        }

        ZoldGomb {
            visible: lablec.utolso
            enabled: ViewManager.quitEnabled
            leftPadding: 28
            rightPadding: 28
            text: lablec.cimke(ViewManager.quitLabel)
            onClicked: ViewManager.quit()
        }
    }
}