blob: 23236a69affa65ca7db5452fa160942a1b8eb4f9 (
plain)
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
|
import QtQuick 1.0
import com.javispedro.sowatch 1.0
import com.javispedro.sowatch.metawatch 1.0
MWPage {
id: page
Connections {
target: watch
onActiveChanged: {
console.log("watchface is now " + (watch.active ? "active" : "inactive"))
}
}
Column {
Item {
id: systemArea
// Firmware draws top 30 lines;
// ensure we do not draw anything on top
width: page.width
height: 30
}
Image {
width: page.width
height: 2
source: "idle_border.png"
}
Item {
width: page.width
height: 30
}
Image {
width: page.width
height: 2
source: "idle_border.png"
}
Item {
width: page.width
height: 2
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
height: 30
spacing: 8
Column {
spacing: 4
Image {
width: 24
height: 18
source: "idle_call.png"
}
Text {
id: labelCalls
anchors.horizontalCenter: parent.horizontalCenter
font.family: "MetaWatch Large caps 8pt"
font.pixelSize: 8
text: "0"
}
}
Column {
spacing: 2
Image {
width: 24
height: 18
source: "idle_msg.png"
}
Text {
id: labelMsgs
anchors.horizontalCenter: parent.horizontalCenter
font.family: "MetaWatch Large caps 8pt"
font.pixelSize: 8
text: "0"
}
}
Column {
spacing: 2
Image {
width: 24
height: 18
source: "idle_mail.png"
}
Text {
id: labelMails
anchors.horizontalCenter: parent.horizontalCenter
font.family: "MetaWatch Large caps 8pt"
font.pixelSize: 8
text: "0"
}
}
}
}
function updateUnreadCounts() {
labelCalls.text = notifications.fullCountByType(Notification.MissedCallNotification);
labelMsgs.text = notifications.fullCountByType(Notification.SmsNotification) +
notifications.fullCountByType(Notification.MmsNotification) +
notifications.fullCountByType(Notification.ImNotification);
labelMails.text = notifications.fullCountByType(Notification.EmailNotification);
console.log("unread mails = " + labelMails.text);
}
function updateWeather() {
var weather = notifications.getMostRecentByType(Notification.WeatherNotification);
if (typeof weather !== "undefined") {
// TODO
}
}
function update() {
updateUnreadCounts();
updateWeather();
}
Connections {
target: watch
onActiveChanged: {
if (watch.active) {
console.log("watchface active");
//updateUnreadCounts();
}
}
}
Connections {
target: notifications
onModelChanged: update();
}
}
|