forked from AsteroidOS/unofficial-watchfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigital-noto-seconds.qml
142 lines (124 loc) · 4.28 KB
/
digital-noto-seconds.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
/*
* Copyright (C) 2022 - Commenter25 <github.com/Commenter25>
* Copyright (C) 2021 - Timo Könnecke <github.com/eLtMosen>
*
* 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/>.
*/
/* based off digital-shifted */
import QtQuick 2.9
import QtGraphicalEffects 1.15
Item {
id: root
property real arcEnd: wallClock.time.getSeconds() * 6
onArcEndChanged: seconds.requestPaint()
Canvas {
id: seconds
visible: !displayAmbient
anchors.fill: parent
rotation: -90
onPaint: {
var ctx = getContext("2d")
var x = root.width / 2
var y = root.height / 2
var start = 0
var end = Math.PI * (parent.arcEnd / 180)
ctx.reset()
ctx.beginPath()
ctx.lineCap="round"
ctx.arc(x, y, (root.width / 2) - parent.height * 0.124 / 2, start, end, false)
ctx.lineWidth = parent.height * 0.03
ctx.strokeStyle = "#CCC"
ctx.stroke()
}
}
Text {
id: colon
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
color: "#ffffff"
font {
pixelSize: root.height * .28
family: "Noto Sans"
}
anchors {
centerIn: root
horizontalCenterOffset: root.width * 0.01
verticalCenterOffset: root.width * -0.05
}
text: wallClock.time.toLocaleString(Qt.locale(), ":")
}
Text {
id: hourDisplay
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
color: "#ffffff"
font {
pixelSize: root.height * .25
letterSpacing: root.height * .004
family: "Noto Sans"
}
anchors {
right: colon.left
bottom: colon.bottom
}
/* TODO: allow removal of leading zero */
text: use12H.value ?
wallClock.time.toLocaleString(Qt.locale(), "hh ap").slice(0, 2) :
wallClock.time.toLocaleString(Qt.locale(), "HH")
}
Text {
id: minDisplay
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
color: "#ffffff"
font {
pixelSize: root.height * .25
letterSpacing: root.height * .004
family: "Noto Sans"
}
anchors {
left: colon.right
bottom: colon.bottom
}
text: wallClock.time.toLocaleString(Qt.locale(), "mm")
}
Text {
id: dateDisplay
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
color: "#ffffff"
font {
pixelSize: root.height * .07
letterSpacing: root.height * .006
family: "Noto Sans"
}
anchors {
horizontalCenter: root.horizontalCenter
top: colon.bottom
topMargin: root.height * -0.04
}
text: wallClock.time.toLocaleString(Qt.locale(), "ddd, MMM dd").replace(".","")
}
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 4
verticalOffset: 4
radius: 7.0
samples: 15
color: "#99000000"
}
}