-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathanalog-modern-steel.qml
269 lines (250 loc) · 8.52 KB
/
analog-modern-steel.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
* Copyright (C) 2021 - CosmosDev <github.com/CosmosDev>
* 2021 - Timo Könnecke <github.com/eLtMosen>
* 2016 - Sylvia van Os <[email protected]>
* 2015 - Florent Revest <[email protected]>
* 2012 - Vasiliy Sorokin <[email protected]>
* Aleksey Mikhailichenko <[email protected]>
* Arto Jalkanen <[email protected]>
* 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.9
Item {
property string imgPath: "../watchfaces-img/analog-modern-steel-"
Image {
source: !displayAmbient ? imgPath + "strokes.svg" : imgPath + "strokes-ambient.svg"
width: parent.width
height: parent.height
}
Text {
z: 0
id: digitalDisplay
font.pixelSize: parent.height*0.04
font.family: "Michroma"
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
centerIn: parent
verticalCenterOffset: -parent.width/4.5
}
text: if (use12H.value) {
wallClock.time.toLocaleString(Qt.locale(), "hh ap").slice(0, 2) + wallClock.time.toLocaleString(Qt.locale(), ":mm") }
else
wallClock.time.toLocaleString(Qt.locale(), "HH:mm")
}
Text {
z: 0
id: dowDisplay
font.pixelSize: parent.height*0.05
font.family: "Michroma"
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
centerIn: parent
horizontalCenterOffset: -parent.width/4.5
}
text: wallClock.time.toLocaleString(Qt.locale(), "ddd").toUpperCase()
}
Repeater {
model: 120
Rectangle {
z: 1
id: minuteStrokes
antialiasing : true
property var rotM: ((index) - 30)/120
property var centerX: parent.width/2-width/2
property var centerY: parent.height/2-height/2
x: centerX+Math.cos(rotM * 2 * Math.PI)*parent.width*0.46
y: centerY+Math.sin(rotM * 2 * Math.PI)*parent.width*0.46
color: "white"
width: parent.width*0.004
height: if (index % 2 == 0)
parent.height*0.03
else
parent.height*0.01
opacity: 0.6
transform: Rotation { origin.x: width/2; origin.y: height/2; angle: (index)*3}
}
}
Repeater {
model: 12
Text {
z: 1
id: hourNumbers
font.pixelSize: parent.height*0.08
font.family: "Michroma"
horizontalAlignment: Text.AlignHCenter
property var rotM: ((index * 5 ) - 15)/60
property var centerX: parent.width/2-width/2
property var centerY: parent.height/2-height/1.8
x: centerX+Math.cos(rotM * 2 * Math.PI)*parent.width*0.37
y: centerY+Math.sin(rotM * 2 * Math.PI)*parent.width*0.39
color: "white"
text: if (index === 0)
"12"
else
index
opacity: if ([0, 2, 4, 8, 10].includes(index) || (index == 6 && displayAmbient))
1
else
0
}
}
Rectangle {
z: 0
id: dayBackground
visible: !displayAmbient
width: parent.width*0.15
height: parent.height*0.15
radius: width*0.5
color: "#18181B"
anchors {
centerIn: parent
horizontalCenterOffset: parent.width/4
}
}
Text {
z: 1
id: dayDisplay
font.pixelSize: dayBackground.height*0.45
font.family: "Michroma"
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
centerIn: dayBackground
verticalCenterOffset: -dayBackground.width*0.05
}
text: wallClock.time.toLocaleString(Qt.locale(), "d").toUpperCase()
}
Rectangle {
z: 0
id: monthBackground
visible: !displayAmbient
width: parent.width*0.25
height: parent.height*0.25
radius: width*0.5
color: "#18181B"
anchors {
centerIn: parent
verticalCenterOffset: parent.height/3.5
}
Text {
z: 1
id: monthTwelve
font.pixelSize: parent.height*0.15
font.family: "Michroma"
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
text: "12"
}
Text {
z: 1
id: monthSix
font.pixelSize: parent.height*0.15
font.family: "Michroma"
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
text: "6"
}
Image {
id: monthSVG
z: 1
source: imgPath + "handle.svg"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height
transform: Rotation {
origin.x: monthBackground.width/2;
origin.y: monthBackground.height/2;
angle: (wallClock.time.getMonth() + 1)*30;
}
}
}
Repeater {
model: 12
Rectangle {
z: 1
id: monthStrokes
visible: !displayAmbient
antialiasing : true
property var rotM: ((index * 5 ) - 15)/60
property var centerX: monthBackground.x+monthBackground.width/2
property var centerY: monthBackground.y+monthBackground.height/2.1
x: centerX+Math.cos(rotM * 2 * Math.PI)*monthBackground.width*0.4
y: centerY+Math.sin(rotM * 2 * Math.PI)*monthBackground.width*0.4
color: "white"
opacity: if ([0, 6].includes(index))
0
else
1
width: monthBackground.width*0.014
height: monthBackground.height*0.05
radius: width*0.5
transform: Rotation { origin.x: width/2; origin.y: height/2; angle: (index*5)*6}
}
}
Image {
id: hourSVG
z: 2
source: !displayAmbient ? imgPath + "hour.svg" : imgPath + "hour-ambient.svg"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height
transform: Rotation {
origin.x: parent.width/2;
origin.y: parent.height/2;
angle: (wallClock.time.getHours()*30) + (wallClock.time.getMinutes()*0.5)
}
}
Image {
id: minuteSVG
z: 3
source: !displayAmbient ? imgPath + "minute.svg" : imgPath + "minute-ambient.svg"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height
transform: Rotation {
origin.x: parent.width/2;
origin.y: parent.height/2;
angle: (wallClock.time.getMinutes()*6)
}
}
Image {
id: secondSVG
z: 4
visible: !displayAmbient
source: imgPath + "second.svg"
anchors.centerIn: parent
width: parent.width
height: parent.height
transform: Rotation {
origin.x: parent.width/2;
origin.y: parent.height/2;
angle: (wallClock.time.getSeconds()*6)
}
}
}