-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathresistance-is-futile.qml
138 lines (128 loc) · 4.12 KB
/
resistance-is-futile.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
/*
* Copyright (C) 2022 - 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]
}
Rectangle {
id: logoArea
color: "transparent"
anchors {
centerIn: parent
verticalCenterOffset: -parent.height * 0.272
}
width: parent.width * 0.12
height: parent.height * 0.12
Image {
id: asteroidLogo
visible: !displayAmbient
source: "../watchfaces-img/asteroid-logo.svg"
antialiasing: true
anchors.fill: parent
opacity: 0.7
Text {
id: asteroidSlogan
visible: !displayAmbient
font {
family: "Raleway"
pixelSize: parent.height * 0.31
}
color: "white"
horizontalAlignment: Text.AlignHCenter
anchors {
centerIn: parent
verticalCenterOffset: -parent.height * 0.005
}
text: "<b>AsteroidOS</b><br>Free Your Wrist"
}
}
MouseArea {
anchors.fill: parent
onPressAndHold: asteroidLogo.visible = !asteroidLogo.visible
}
}
Text {
id: datetext
anchors {
centerIn: parent
verticalCenterOffset: parent.height * 0.25
}
font {
family: "Titillium"
weight: Font.Thin
pixelSize: parent.height * 0.06
}
color: "white"
text: wallClock.time.toLocaleString(Qt.locale(), "ddd dd");
}
Rectangle {
id: time
color: displayAmbient ? "#371102" : "#6e2304"
anchors.centerIn: parent
height: parent.height * 0.30
width: parent.width
Repeater{
id: digits
model: 4
Rectangle {
color: ["black","brown","red","orange","yellow","green","blue","violet","gray","white"][getTimeDigit(wallClock.time, index)]
opacity: displayAmbient ? 0.7 : 1
height: parent.height
width: parent.width * 0.1
x: parent.width / 5 * index + parent.width / 10
}
}
}
Text {
id: ampm
visible: use12H.value
anchors {
centerIn: parent
horizontalCenterOffset: parent.width * 0.4
}
font {
family: "Titillium"
weight: Font.Bold
pixelSize: parent.height * 0.05
}
color: "white"
text: wallClock.time.toLocaleString(Qt.locale(), "ap");
}
Image{
id: resistorImage
antialiasing: true
opacity: displayAmbient ? 0.6 : 1.0
source: "../watchfaces-img/resistor.svg"
width: parent.width * 0.0625
height: parent.height * 0.1250
transform : [
Rotation {
origin.x : resistorImage.width/2
origin.y : resistorImage.height + parent.height * 0.369
angle: wallClock.time.getSeconds() * 6
},
Translate {
x: (parent.width - resistorImage.width)/2
y: parent.height/2 - (resistorImage.height + parent.height * 0.369)
}
]
}
}