1/* === This file is part of Calamares - <https://calamares.io> ===
2 *
3 *   SPDX-FileCopyrightText: 2020 - 2021 Anke Boersma <demm@kaosx.us>
4 *   SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 *   Calamares is Free Software: see the License-Identifier above.
7 *
8 */
9
10import io.calamares.ui 1.0
11
12import QtQuick 2.7
13import QtQuick.Controls 2.2
14import QtQuick.Layouts 1.3
15
16import org.kde.kirigami 2.7 as Kirigami
17
18Item {
19    readonly property color backgroundColor: Kirigami.Theme.backgroundColor //"#F5F5F5"
20    readonly property color headerBackgroundColor: Kirigami.Theme.alternateBackgroundColor //"#d3d3d3"
21    readonly property color backgroundLighterColor: "#ffffff"
22    readonly property color highlightColor: Kirigami.Theme.highlightColor //"#3498DB"
23    readonly property color textColor: Kirigami.Theme.textColor
24    readonly property color highlightedTextColor: Kirigami.Theme.highlightedTextColor
25
26    width: parent.width
27    height: parent.height
28    focus: true
29
30    Rectangle {
31        id: textArea
32        x: 28
33        y: 14
34        anchors.fill: parent
35        color: backgroundColor
36
37        Column {
38            id: languages
39            x: 130
40            y: 40
41
42            Rectangle {
43                width: 250
44                height: 140
45                color: headerBackgroundColor
46                Text {
47                    anchors.top: parent.top
48                    width: 240
49                    wrapMode: Text.WordWrap
50                    text: qsTr("<h1>Languages</h1> </br>
51                    The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(config.currentLanguageCode)
52                    font.pointSize: 10
53                }
54            }
55
56            Rectangle {
57                width: 250
58                height: 300
59
60                ScrollView {
61                    id: scroll1
62                    anchors.fill: parent
63                    contentHeight: 800
64                    ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
65
66                    ListView {
67                        id: list1
68                        focus: true
69                        clip: true
70                        width: parent.width
71
72                        model: config.supportedLocales
73
74                        currentIndex: -1 //model.currentLanguageCodeIndex
75                        delegate: ItemDelegate {
76
77                            hoverEnabled: true
78                            width: parent.width
79                            implicitHeight: 18
80                            highlighted: ListView.isCurrentItem
81                            Label {
82                                Layout.fillHeight: true
83                                Layout.fillWidth: true
84                                width: parent.width
85                                height: 18
86                                color: highlighted ? highlightedTextColor : textColor
87                                text: modelData
88                                background: Rectangle {
89
90                                    color: highlighted || hovered ? highlightColor : backgroundLighterColor
91                                    opacity: highlighted || hovered ? 0.5 : 0.9
92                                }
93
94                                MouseArea {
95                                    hoverEnabled: true
96                                    anchors.fill: parent
97                                    cursorShape: Qt.PointingHandCursor
98                                    onClicked: {
99                                        list1.currentIndex = index
100                                    }
101                                }
102                            }
103                        }
104                        onCurrentItemChanged: { config.currentLanguageCode = model[currentIndex] } /* This works because model is a stringlist */
105                    }
106                }
107            }
108        }
109
110        Column {
111            id: lc_numeric
112            x: 430
113            y: 40
114
115            Rectangle {
116                width: 250
117                height: 140
118                color: headerBackgroundColor
119                Text {
120                    anchors.top: parent.top
121                    width: 240
122                    wrapMode: Text.WordWrap
123                    text: qsTr("<h1>Locales</h1> </br>
124                    The system locale setting affects the numbers and dates format. The current setting is <strong>%1</strong>.").arg(config.currentLCCode)
125                    font.pointSize: 10
126                }
127            }
128
129            Rectangle {
130                width: 250
131                height: 300
132
133                ScrollView {
134                    id: scroll2
135                    anchors.fill: parent
136                    contentHeight: 800
137                    ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
138
139                    ListView {
140                        id: list2
141                        focus: true
142                        clip: true
143
144                        model: config.supportedLocales
145
146                        currentIndex: -1 //model.currentLCCodeIndex
147                        delegate: ItemDelegate {
148
149                            hoverEnabled: true
150                            width: parent.width
151                            implicitHeight: 18
152                            highlighted: ListView.isCurrentItem
153                            Label {
154                                Layout.fillHeight: true
155                                Layout.fillWidth: true
156                                width: parent.width
157                                height: 18
158                                color: highlighted ? highlightedTextColor : textColor
159                                text: modelData
160                                background: Rectangle {
161
162                                    color: highlighted || hovered ? highlightColor : backgroundLighterColor
163                                    opacity: highlighted || hovered ? 0.5 : 0.9
164                                }
165
166                                MouseArea {
167                                    hoverEnabled: true
168                                    anchors.fill: parent
169                                    cursorShape: Qt.PointingHandCursor
170                                    onClicked: {
171                                        list2.currentIndex = index
172                                    }
173                                }
174                            }
175                        }
176                        onCurrentItemChanged: { config.currentLCCode = model[currentIndex]; } /* This works because model is a stringlist */
177                    }
178                }
179            }
180
181        }
182
183        ToolButton {
184            id: toolButton
185            x: 19
186            y: 29
187            width: 105
188            height: 48
189            text: qsTr("Back")
190            hoverEnabled: true
191            onClicked: load.source = ""
192
193            Image {
194                id: image1
195                x: 0
196                y: 13
197                width: 22
198                height: 22
199                source: "img/chevron-left-solid.svg"
200                fillMode: Image.PreserveAspectFit
201            }
202        }
203    }
204}
205