blob: b45bf1482f2a7122b8cd17993bc6f74ea26fc880 (
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
|
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Item {
id: welcomeRoot
anchors.fill: parent
// Adaptive background image
Image {
anchors.fill: parent
source: "images/raveos-welcome.png"
fillMode: Image.Stretch
smooth: true
}
// Bottom overlay for language selector
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 56
gradient: Gradient {
GradientStop { position: 0.0; color: "#002B2B2B" }
GradientStop { position: 1.0; color: "#DD2B2B2B" }
}
RowLayout {
anchors.centerIn: parent
spacing: 10
Image {
source: "qrc:/welcome/language-icon-48px.png"
width: 22
height: 22
smooth: true
}
ComboBox {
id: languageCombo
currentIndex: config.localeIndex
onActivated: function(idx) {
console.log("QML: activating locale idx=" + idx);
config.localeIndex = idx;
console.log("QML: after set, localeIndex=" + config.localeIndex);
}
implicitWidth: 260
implicitHeight: 36
Component.onCompleted: {
var m = config.languagesModel;
var items = [];
for (var i = 0; i < m.rowCount(); i++) {
var idx = m.index(i, 0);
var val = m.data(idx, Qt.DisplayRole);
items.push(val !== undefined ? val : m.data(idx, Qt.UserRole));
}
model = items;
currentIndex = config.localeIndex;
}
}
Connections {
target: config
function onLocaleIndexChanged() {
console.log("QML: localeIndexChanged signal fired! new=" + config.localeIndex);
languageCombo.currentIndex = config.localeIndex;
}
}
}
}
}
|