-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathnixie-delight.qml
126 lines (118 loc) · 3.98 KB
/
nixie-delight.qml
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
/*
* Copyright (C) 2021 - Ed Beroset <github.com/beroset>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.12
import QtGraphicalEffects 1.12
Item {
function getTimeDigit(t, index) {
var timestring = t.toLocaleString(Qt.locale(), (use12H.value ? "hhmmss ap" : "HHmmss"));
return timestring[index]
}
Repeater{
id: digits
model: 4
Item {
id: digitHolder
property var sizefactor: parent.width / 2 / 289
width: parent.width / 6
height: parent.width / 3
x: parent.width / 5 * index + parent.width / 8
y: parent.height / 3
Image {
id: nixieBackground
visible: !displayAmbient
scale: sizefactor
anchors {
centerIn: parent
verticalCenterOffset: parent.height * 0.15
}
opacity: displayAmbient ? 0.6 : 1.0
source: "../watchfaces-img/nixie-delight-nixie.png"
}
Text {
id: digit
anchors.centerIn: parent
font.pixelSize: nixieBackground.height*0.35 * sizefactor
font.family: "Montserrat"
font.weight: Font.Light
color: "orange"
visible: !displayAmbient
horizontalAlignment: Text.AlignHCenter
text: getTimeDigit(wallClock.time, index)
}
Glow {
anchors.fill: digit
radius: displayAmbient ? 10 : 20
samples: 19
color: "darkorange"
source: digit
}
}
}
Text {
visible: !displayAmbient
font.pixelSize: parent.height*0.10
font.family: "Feronia"
color: "brown"
style: Text.Outline
styleColor: "darkorange"
horizontalAlignment: Text.AlignHCenter
anchors {
centerIn: parent
verticalCenterOffset: parent.width*0.30
}
text: "Asteroid OS"
}
Repeater{
id: secondMarks
model: 60
Rectangle {
id: second
visible: !displayAmbient
antialiasing : true
color: "black"
width: parent.width * 0.04
height: parent.height * 0.04
radius: parent.height * 0.02
transform: [
Rotation {
origin.x: second.width/2
origin.y: second.height + parent.height*0.45
angle: (index)*360/secondMarks.count
},
Translate {
x: (parent.width - second.width)/2
y: parent.height/2 - (second.height + parent.height * 0.45)
}
]
Rectangle {
anchors.centerIn: parent
height: parent.height * 0.8
width: parent.width * 0.8
radius: parent.width * 0.4
color: "orange"
opacity: wallClock.time.getSeconds() == index ? 1 : 0
layer.enabled: wallClock.time.getSeconds() == index
layer.effect: Glow {
radius: 7
samples: 15
color: "darkorange"
}
}
}
}
}