forked from xerxes2/panucci
/
themeGenerator.js
40 lines (38 loc) · 1.29 KB
/
themeGenerator.js
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
var themeButtons=new Array()
function createThemeButtons() {
var component
component = Qt.createComponent("SettingsButtonSmall.qml")
var button
var ypos = theme_text.y + (config.font_size * 2.5)
var count = 0
var i
for (i=0;i<themes.length;i++) {
button = component.createObject(settingsFlick.contentItem)
if (count == 0) {
button.x = settingsFlick.width / 25
button.y = ypos
count++
settingsFlick.contentHeight = ypos + (config.font_size * 5)
}
else if (count == 1) {
button.x = (settingsFlick.width / 25 * 2) + button.width
button.y = ypos
count++
}
else if (count == 2) {
button.x = (settingsFlick.width / 25 * 3) + (button.width * 2)
button.y = ypos
count++
}
else {
button.x = (settingsFlick.width / 25 * 4) + (button.width * 3)
button.y = ypos
count = 0
ypos = ypos + (config.font_size * 5)
}
button.text = themes[i].substr(0, 1).toUpperCase() + themes[i].substr(1)
button.checked = config.theme == button.text.toLowerCase() ? true : false
button.clicked.connect(themeButtonClicked)
themeButtons[i] = button
}
}