author | paule <paule> | 2007-01-13 07:42:23 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:42:23 (UTC) |
commit | a1360b0af73518d97ebe63ad3cd156cd8b57c8b5 (patch) (unidiff) | |
tree | 2630d54134a775f48254624273a8b381e77e39c0 | |
parent | b1075202780c1d807c9d9f5286a2ffa7714bae51 (diff) | |
download | opie-a1360b0af73518d97ebe63ad3cd156cd8b57c8b5.zip opie-a1360b0af73518d97ebe63ad3cd156cd8b57c8b5.tar.gz opie-a1360b0af73518d97ebe63ad3cd156cd8b57c8b5.tar.bz2 |
* Increase font size (fixes bug #1597)
* Improve usability of snooze function (fixes bug #1598)
* Fix stretched icon (fixes bug #1616)
-rw-r--r-- | noncore/tools/clock/alarmdlgbase.ui | 490 | ||||
-rw-r--r-- | noncore/tools/clock/clock.cpp | 19 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 1 |
3 files changed, 494 insertions, 16 deletions
diff --git a/noncore/tools/clock/alarmdlgbase.ui b/noncore/tools/clock/alarmdlgbase.ui index 63759f3..944f532 100644 --- a/noncore/tools/clock/alarmdlgbase.ui +++ b/noncore/tools/clock/alarmdlgbase.ui | |||
@@ -1,154 +1,636 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>AlarmDlgBase</class> | 2 | <class>AlarmDlgBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>AlarmDlgBase</cstring> | 7 | <cstring>AlarmDlgBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>124</width> | 14 | <width>199</width> |
15 | <height>92</height> | 15 | <height>243</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <vbox> | 25 | <vbox> |
26 | <property stdset="1"> | 26 | <property stdset="1"> |
27 | <name>margin</name> | 27 | <name>margin</name> |
28 | <number>6</number> | 28 | <number>11</number> |
29 | </property> | 29 | </property> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>spacing</name> | 31 | <name>spacing</name> |
32 | <number>6</number> | 32 | <number>6</number> |
33 | </property> | 33 | </property> |
34 | <widget> | 34 | <widget> |
35 | <class>QLayoutWidget</class> | 35 | <class>QLayoutWidget</class> |
36 | <property stdset="1"> | 36 | <property stdset="1"> |
37 | <name>name</name> | 37 | <name>name</name> |
38 | <cstring>Layout1</cstring> | 38 | <cstring>Layout1</cstring> |
39 | </property> | 39 | </property> |
40 | <hbox> | 40 | <hbox> |
41 | <property stdset="1"> | 41 | <property stdset="1"> |
42 | <name>margin</name> | 42 | <name>margin</name> |
43 | <number>0</number> | 43 | <number>0</number> |
44 | </property> | 44 | </property> |
45 | <property stdset="1"> | 45 | <property stdset="1"> |
46 | <name>spacing</name> | 46 | <name>spacing</name> |
47 | <number>6</number> | 47 | <number>6</number> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QLabel</class> | 50 | <class>QLabel</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>pixmap</cstring> | 53 | <cstring>pixmap</cstring> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>scaledContents</name> | 56 | <name>scaledContents</name> |
57 | <bool>true</bool> | 57 | <bool>false</bool> |
58 | </property> | 58 | </property> |
59 | </widget> | 59 | </widget> |
60 | <spacer> | 60 | <spacer> |
61 | <property> | 61 | <property> |
62 | <name>name</name> | 62 | <name>name</name> |
63 | <cstring>Spacer1</cstring> | 63 | <cstring>Spacer1</cstring> |
64 | </property> | 64 | </property> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>orientation</name> | 66 | <name>orientation</name> |
67 | <enum>Horizontal</enum> | 67 | <enum>Horizontal</enum> |
68 | </property> | 68 | </property> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>sizeType</name> | 70 | <name>sizeType</name> |
71 | <enum>Expanding</enum> | 71 | <enum>Expanding</enum> |
72 | </property> | 72 | </property> |
73 | <property> | 73 | <property> |
74 | <name>sizeHint</name> | 74 | <name>sizeHint</name> |
75 | <size> | 75 | <size> |
76 | <width>20</width> | 76 | <width>20</width> |
77 | <height>20</height> | 77 | <height>20</height> |
78 | </size> | 78 | </size> |
79 | </property> | 79 | </property> |
80 | </spacer> | 80 | </spacer> |
81 | <widget> | 81 | <widget> |
82 | <class>QLabel</class> | 82 | <class>QLabel</class> |
83 | <property stdset="1"> | 83 | <property stdset="1"> |
84 | <name>name</name> | 84 | <name>name</name> |
85 | <cstring>alarmDlgLabel</cstring> | 85 | <cstring>alarmDlgLabel</cstring> |
86 | </property> | 86 | </property> |
87 | <property stdset="1"> | 87 | <property stdset="1"> |
88 | <name>text</name> | 88 | <name>text</name> |
89 | <string>TextLabel1</string> | 89 | <string>TextLabel1</string> |
90 | </property> | 90 | </property> |
91 | <property stdset="1"> | ||
92 | <name>scaledContents</name> | ||
93 | <bool>false</bool> | ||
94 | </property> | ||
91 | </widget> | 95 | </widget> |
92 | </hbox> | 96 | </hbox> |
93 | </widget> | 97 | </widget> |
94 | <widget> | 98 | <widget> |
95 | <class>QLayoutWidget</class> | 99 | <class>QLayoutWidget</class> |
96 | <property stdset="1"> | 100 | <property stdset="1"> |
97 | <name>name</name> | 101 | <name>name</name> |
98 | <cstring>Layout2</cstring> | 102 | <cstring>Layout2</cstring> |
99 | </property> | 103 | </property> |
100 | <hbox> | 104 | <hbox> |
101 | <property stdset="1"> | 105 | <property stdset="1"> |
102 | <name>margin</name> | 106 | <name>margin</name> |
103 | <number>0</number> | 107 | <number>0</number> |
104 | </property> | 108 | </property> |
105 | <property stdset="1"> | 109 | <property stdset="1"> |
106 | <name>spacing</name> | 110 | <name>spacing</name> |
107 | <number>6</number> | 111 | <number>6</number> |
108 | </property> | 112 | </property> |
109 | <widget> | 113 | <widget> |
110 | <class>QLabel</class> | 114 | <class>QLabel</class> |
111 | <property stdset="1"> | 115 | <property stdset="1"> |
112 | <name>name</name> | 116 | <name>name</name> |
113 | <cstring>TextLabel2</cstring> | 117 | <cstring>TextLabel2</cstring> |
114 | </property> | 118 | </property> |
115 | <property stdset="1"> | 119 | <property stdset="1"> |
116 | <name>text</name> | 120 | <name>text</name> |
117 | <string>Snooze</string> | 121 | <string>Snooze</string> |
118 | </property> | 122 | </property> |
119 | </widget> | 123 | </widget> |
120 | <widget> | 124 | <widget> |
121 | <class>QSpinBox</class> | 125 | <class>QSpinBox</class> |
122 | <property stdset="1"> | 126 | <property stdset="1"> |
123 | <name>name</name> | 127 | <name>name</name> |
124 | <cstring>snoozeTime</cstring> | 128 | <cstring>snoozeTime</cstring> |
125 | </property> | 129 | </property> |
126 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>caption</name> | ||
132 | <string></string> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
127 | <name>suffix</name> | 135 | <name>suffix</name> |
128 | <string> mins</string> | 136 | <string> mins</string> |
129 | </property> | 137 | </property> |
130 | <property stdset="1"> | 138 | <property stdset="1"> |
131 | <name>maxValue</name> | 139 | <name>maxValue</name> |
132 | <number>60</number> | 140 | <number>60</number> |
133 | </property> | 141 | </property> |
134 | <property stdset="1"> | 142 | <property stdset="1"> |
135 | <name>lineStep</name> | 143 | <name>lineStep</name> |
136 | <number>5</number> | 144 | <number>5</number> |
137 | </property> | 145 | </property> |
146 | <property stdset="1"> | ||
147 | <name>value</name> | ||
148 | <number>5</number> | ||
149 | </property> | ||
150 | <property> | ||
151 | <name>layoutMargin</name> | ||
152 | </property> | ||
138 | </widget> | 153 | </widget> |
139 | </hbox> | 154 | </hbox> |
140 | </widget> | 155 | </widget> |
141 | <widget> | 156 | <widget> |
142 | <class>QPushButton</class> | 157 | <class>QPushButton</class> |
143 | <property stdset="1"> | 158 | <property stdset="1"> |
144 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>cmdSnooze</cstring> | ||
161 | </property> | ||
162 | <property stdset="1"> | ||
163 | <name>minimumSize</name> | ||
164 | <size> | ||
165 | <width>0</width> | ||
166 | <height>100</height> | ||
167 | </size> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>palette</name> | ||
171 | <palette> | ||
172 | <active> | ||
173 | <color> | ||
174 | <red>0</red> | ||
175 | <green>0</green> | ||
176 | <blue>0</blue> | ||
177 | </color> | ||
178 | <color> | ||
179 | <red>255</red> | ||
180 | <green>128</green> | ||
181 | <blue>128</blue> | ||
182 | </color> | ||
183 | <color> | ||
184 | <red>255</red> | ||
185 | <green>255</green> | ||
186 | <blue>255</blue> | ||
187 | </color> | ||
188 | <color> | ||
189 | <red>255</red> | ||
190 | <green>191</green> | ||
191 | <blue>191</blue> | ||
192 | </color> | ||
193 | <color> | ||
194 | <red>127</red> | ||
195 | <green>64</green> | ||
196 | <blue>64</blue> | ||
197 | </color> | ||
198 | <color> | ||
199 | <red>170</red> | ||
200 | <green>85</green> | ||
201 | <blue>85</blue> | ||
202 | </color> | ||
203 | <color> | ||
204 | <red>0</red> | ||
205 | <green>0</green> | ||
206 | <blue>0</blue> | ||
207 | </color> | ||
208 | <color> | ||
209 | <red>255</red> | ||
210 | <green>255</green> | ||
211 | <blue>255</blue> | ||
212 | </color> | ||
213 | <color> | ||
214 | <red>0</red> | ||
215 | <green>0</green> | ||
216 | <blue>0</blue> | ||
217 | </color> | ||
218 | <color> | ||
219 | <red>255</red> | ||
220 | <green>255</green> | ||
221 | <blue>255</blue> | ||
222 | </color> | ||
223 | <color> | ||
224 | <red>238</red> | ||
225 | <green>238</green> | ||
226 | <blue>230</blue> | ||
227 | </color> | ||
228 | <color> | ||
229 | <red>0</red> | ||
230 | <green>0</green> | ||
231 | <blue>0</blue> | ||
232 | </color> | ||
233 | <color> | ||
234 | <red>255</red> | ||
235 | <green>221</green> | ||
236 | <blue>118</blue> | ||
237 | </color> | ||
238 | <color> | ||
239 | <red>0</red> | ||
240 | <green>0</green> | ||
241 | <blue>0</blue> | ||
242 | </color> | ||
243 | </active> | ||
244 | <disabled> | ||
245 | <color> | ||
246 | <red>128</red> | ||
247 | <green>128</green> | ||
248 | <blue>128</blue> | ||
249 | </color> | ||
250 | <color> | ||
251 | <red>255</red> | ||
252 | <green>128</green> | ||
253 | <blue>128</blue> | ||
254 | </color> | ||
255 | <color> | ||
256 | <red>255</red> | ||
257 | <green>255</green> | ||
258 | <blue>255</blue> | ||
259 | </color> | ||
260 | <color> | ||
261 | <red>255</red> | ||
262 | <green>166</green> | ||
263 | <blue>166</blue> | ||
264 | </color> | ||
265 | <color> | ||
266 | <red>127</red> | ||
267 | <green>64</green> | ||
268 | <blue>64</blue> | ||
269 | </color> | ||
270 | <color> | ||
271 | <red>170</red> | ||
272 | <green>85</green> | ||
273 | <blue>85</blue> | ||
274 | </color> | ||
275 | <color> | ||
276 | <red>0</red> | ||
277 | <green>0</green> | ||
278 | <blue>0</blue> | ||
279 | </color> | ||
280 | <color> | ||
281 | <red>255</red> | ||
282 | <green>255</green> | ||
283 | <blue>255</blue> | ||
284 | </color> | ||
285 | <color> | ||
286 | <red>128</red> | ||
287 | <green>128</green> | ||
288 | <blue>128</blue> | ||
289 | </color> | ||
290 | <color> | ||
291 | <red>255</red> | ||
292 | <green>255</green> | ||
293 | <blue>255</blue> | ||
294 | </color> | ||
295 | <color> | ||
296 | <red>238</red> | ||
297 | <green>238</green> | ||
298 | <blue>230</blue> | ||
299 | </color> | ||
300 | <color> | ||
301 | <red>0</red> | ||
302 | <green>0</green> | ||
303 | <blue>0</blue> | ||
304 | </color> | ||
305 | <color> | ||
306 | <red>255</red> | ||
307 | <green>221</green> | ||
308 | <blue>118</blue> | ||
309 | </color> | ||
310 | <color> | ||
311 | <red>0</red> | ||
312 | <green>0</green> | ||
313 | <blue>0</blue> | ||
314 | </color> | ||
315 | </disabled> | ||
316 | <inactive> | ||
317 | <color> | ||
318 | <red>0</red> | ||
319 | <green>0</green> | ||
320 | <blue>0</blue> | ||
321 | </color> | ||
322 | <color> | ||
323 | <red>255</red> | ||
324 | <green>128</green> | ||
325 | <blue>128</blue> | ||
326 | </color> | ||
327 | <color> | ||
328 | <red>255</red> | ||
329 | <green>255</green> | ||
330 | <blue>255</blue> | ||
331 | </color> | ||
332 | <color> | ||
333 | <red>255</red> | ||
334 | <green>166</green> | ||
335 | <blue>166</blue> | ||
336 | </color> | ||
337 | <color> | ||
338 | <red>127</red> | ||
339 | <green>64</green> | ||
340 | <blue>64</blue> | ||
341 | </color> | ||
342 | <color> | ||
343 | <red>170</red> | ||
344 | <green>85</green> | ||
345 | <blue>85</blue> | ||
346 | </color> | ||
347 | <color> | ||
348 | <red>0</red> | ||
349 | <green>0</green> | ||
350 | <blue>0</blue> | ||
351 | </color> | ||
352 | <color> | ||
353 | <red>255</red> | ||
354 | <green>255</green> | ||
355 | <blue>255</blue> | ||
356 | </color> | ||
357 | <color> | ||
358 | <red>0</red> | ||
359 | <green>0</green> | ||
360 | <blue>0</blue> | ||
361 | </color> | ||
362 | <color> | ||
363 | <red>255</red> | ||
364 | <green>255</green> | ||
365 | <blue>255</blue> | ||
366 | </color> | ||
367 | <color> | ||
368 | <red>238</red> | ||
369 | <green>238</green> | ||
370 | <blue>230</blue> | ||
371 | </color> | ||
372 | <color> | ||
373 | <red>0</red> | ||
374 | <green>0</green> | ||
375 | <blue>0</blue> | ||
376 | </color> | ||
377 | <color> | ||
378 | <red>255</red> | ||
379 | <green>221</green> | ||
380 | <blue>118</blue> | ||
381 | </color> | ||
382 | <color> | ||
383 | <red>0</red> | ||
384 | <green>0</green> | ||
385 | <blue>0</blue> | ||
386 | </color> | ||
387 | </inactive> | ||
388 | </palette> | ||
389 | </property> | ||
390 | <property stdset="1"> | ||
391 | <name>text</name> | ||
392 | <string>Snooze</string> | ||
393 | </property> | ||
394 | </widget> | ||
395 | <widget> | ||
396 | <class>QPushButton</class> | ||
397 | <property stdset="1"> | ||
398 | <name>name</name> | ||
145 | <cstring>cmdOk</cstring> | 399 | <cstring>cmdOk</cstring> |
146 | </property> | 400 | </property> |
147 | <property stdset="1"> | 401 | <property stdset="1"> |
402 | <name>minimumSize</name> | ||
403 | <size> | ||
404 | <width>0</width> | ||
405 | <height>32</height> | ||
406 | </size> | ||
407 | </property> | ||
408 | <property stdset="1"> | ||
409 | <name>palette</name> | ||
410 | <palette> | ||
411 | <active> | ||
412 | <color> | ||
413 | <red>0</red> | ||
414 | <green>0</green> | ||
415 | <blue>0</blue> | ||
416 | </color> | ||
417 | <color> | ||
418 | <red>192</red> | ||
419 | <green>255</green> | ||
420 | <blue>192</blue> | ||
421 | </color> | ||
422 | <color> | ||
423 | <red>255</red> | ||
424 | <green>255</green> | ||
425 | <blue>255</blue> | ||
426 | </color> | ||
427 | <color> | ||
428 | <red>223</red> | ||
429 | <green>255</green> | ||
430 | <blue>223</blue> | ||
431 | </color> | ||
432 | <color> | ||
433 | <red>96</red> | ||
434 | <green>127</green> | ||
435 | <blue>96</blue> | ||
436 | </color> | ||
437 | <color> | ||
438 | <red>128</red> | ||
439 | <green>170</green> | ||
440 | <blue>128</blue> | ||
441 | </color> | ||
442 | <color> | ||
443 | <red>0</red> | ||
444 | <green>0</green> | ||
445 | <blue>0</blue> | ||
446 | </color> | ||
447 | <color> | ||
448 | <red>255</red> | ||
449 | <green>255</green> | ||
450 | <blue>255</blue> | ||
451 | </color> | ||
452 | <color> | ||
453 | <red>0</red> | ||
454 | <green>0</green> | ||
455 | <blue>0</blue> | ||
456 | </color> | ||
457 | <color> | ||
458 | <red>255</red> | ||
459 | <green>255</green> | ||
460 | <blue>255</blue> | ||
461 | </color> | ||
462 | <color> | ||
463 | <red>238</red> | ||
464 | <green>238</green> | ||
465 | <blue>230</blue> | ||
466 | </color> | ||
467 | <color> | ||
468 | <red>0</red> | ||
469 | <green>0</green> | ||
470 | <blue>0</blue> | ||
471 | </color> | ||
472 | <color> | ||
473 | <red>255</red> | ||
474 | <green>221</green> | ||
475 | <blue>118</blue> | ||
476 | </color> | ||
477 | <color> | ||
478 | <red>0</red> | ||
479 | <green>0</green> | ||
480 | <blue>0</blue> | ||
481 | </color> | ||
482 | </active> | ||
483 | <disabled> | ||
484 | <color> | ||
485 | <red>128</red> | ||
486 | <green>128</green> | ||
487 | <blue>128</blue> | ||
488 | </color> | ||
489 | <color> | ||
490 | <red>192</red> | ||
491 | <green>255</green> | ||
492 | <blue>192</blue> | ||
493 | </color> | ||
494 | <color> | ||
495 | <red>255</red> | ||
496 | <green>255</green> | ||
497 | <blue>255</blue> | ||
498 | </color> | ||
499 | <color> | ||
500 | <red>230</red> | ||
501 | <green>255</green> | ||
502 | <blue>230</blue> | ||
503 | </color> | ||
504 | <color> | ||
505 | <red>96</red> | ||
506 | <green>127</green> | ||
507 | <blue>96</blue> | ||
508 | </color> | ||
509 | <color> | ||
510 | <red>128</red> | ||
511 | <green>170</green> | ||
512 | <blue>128</blue> | ||
513 | </color> | ||
514 | <color> | ||
515 | <red>0</red> | ||
516 | <green>0</green> | ||
517 | <blue>0</blue> | ||
518 | </color> | ||
519 | <color> | ||
520 | <red>255</red> | ||
521 | <green>255</green> | ||
522 | <blue>255</blue> | ||
523 | </color> | ||
524 | <color> | ||
525 | <red>128</red> | ||
526 | <green>128</green> | ||
527 | <blue>128</blue> | ||
528 | </color> | ||
529 | <color> | ||
530 | <red>255</red> | ||
531 | <green>255</green> | ||
532 | <blue>255</blue> | ||
533 | </color> | ||
534 | <color> | ||
535 | <red>238</red> | ||
536 | <green>238</green> | ||
537 | <blue>230</blue> | ||
538 | </color> | ||
539 | <color> | ||
540 | <red>0</red> | ||
541 | <green>0</green> | ||
542 | <blue>0</blue> | ||
543 | </color> | ||
544 | <color> | ||
545 | <red>255</red> | ||
546 | <green>221</green> | ||
547 | <blue>118</blue> | ||
548 | </color> | ||
549 | <color> | ||
550 | <red>0</red> | ||
551 | <green>0</green> | ||
552 | <blue>0</blue> | ||
553 | </color> | ||
554 | </disabled> | ||
555 | <inactive> | ||
556 | <color> | ||
557 | <red>0</red> | ||
558 | <green>0</green> | ||
559 | <blue>0</blue> | ||
560 | </color> | ||
561 | <color> | ||
562 | <red>192</red> | ||
563 | <green>255</green> | ||
564 | <blue>192</blue> | ||
565 | </color> | ||
566 | <color> | ||
567 | <red>255</red> | ||
568 | <green>255</green> | ||
569 | <blue>255</blue> | ||
570 | </color> | ||
571 | <color> | ||
572 | <red>230</red> | ||
573 | <green>255</green> | ||
574 | <blue>230</blue> | ||
575 | </color> | ||
576 | <color> | ||
577 | <red>96</red> | ||
578 | <green>127</green> | ||
579 | <blue>96</blue> | ||
580 | </color> | ||
581 | <color> | ||
582 | <red>128</red> | ||
583 | <green>170</green> | ||
584 | <blue>128</blue> | ||
585 | </color> | ||
586 | <color> | ||
587 | <red>0</red> | ||
588 | <green>0</green> | ||
589 | <blue>0</blue> | ||
590 | </color> | ||
591 | <color> | ||
592 | <red>255</red> | ||
593 | <green>255</green> | ||
594 | <blue>255</blue> | ||
595 | </color> | ||
596 | <color> | ||
597 | <red>0</red> | ||
598 | <green>0</green> | ||
599 | <blue>0</blue> | ||
600 | </color> | ||
601 | <color> | ||
602 | <red>255</red> | ||
603 | <green>255</green> | ||
604 | <blue>255</blue> | ||
605 | </color> | ||
606 | <color> | ||
607 | <red>238</red> | ||
608 | <green>238</green> | ||
609 | <blue>230</blue> | ||
610 | </color> | ||
611 | <color> | ||
612 | <red>0</red> | ||
613 | <green>0</green> | ||
614 | <blue>0</blue> | ||
615 | </color> | ||
616 | <color> | ||
617 | <red>255</red> | ||
618 | <green>221</green> | ||
619 | <blue>118</blue> | ||
620 | </color> | ||
621 | <color> | ||
622 | <red>0</red> | ||
623 | <green>0</green> | ||
624 | <blue>0</blue> | ||
625 | </color> | ||
626 | </inactive> | ||
627 | </palette> | ||
628 | </property> | ||
629 | <property stdset="1"> | ||
148 | <name>text</name> | 630 | <name>text</name> |
149 | <string>Close</string> | 631 | <string>Close</string> |
150 | </property> | 632 | </property> |
151 | </widget> | 633 | </widget> |
152 | </vbox> | 634 | </vbox> |
153 | </widget> | 635 | </widget> |
154 | </UI> | 636 | </UI> |
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 9b324e0..325a307 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -1,811 +1,808 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 | 20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 |
21 | // changes added and Copyright (C) by Holger Freyther 2004,2005 | 21 | // changes added and Copyright (C) by Holger Freyther 2004,2005 |
22 | 22 | ||
23 | #include "clock.h" | 23 | #include "clock.h" |
24 | 24 | ||
25 | #include "analogclock.h" | 25 | #include "analogclock.h" |
26 | 26 | ||
27 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
28 | 28 | ||
29 | #include <opie2/ofiledialog.h> | 29 | #include <opie2/ofiledialog.h> |
30 | #include <opie2/oresource.h> | 30 | #include <opie2/oresource.h> |
31 | 31 | ||
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/timestring.h> | 35 | #include <qpe/timestring.h> |
36 | #include <qpe/alarmserver.h> | 36 | #include <qpe/alarmserver.h> |
37 | #include <qpe/sound.h> | 37 | #include <qpe/sound.h> |
38 | #include <qsound.h> | 38 | #include <qsound.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | #include <qlcdnumber.h> | 43 | #include <qlcdnumber.h> |
44 | #include <qslider.h> | 44 | #include <qslider.h> |
45 | #include <qlabel.h> | 45 | #include <qlabel.h> |
46 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
49 | #include <qpainter.h> | 49 | #include <qpainter.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qdatetime.h> | 51 | #include <qdatetime.h> |
52 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
53 | #include <qcombobox.h> | 53 | #include <qcombobox.h> |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qgroupbox.h> | 55 | #include <qgroupbox.h> |
56 | #include <qlayout.h> | 56 | #include <qlayout.h> |
57 | #include <qhbox.h> | 57 | #include <qhbox.h> |
58 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
59 | 59 | ||
60 | static const int sw_prec = 2; | 60 | static const int sw_prec = 2; |
61 | static const int magic_daily = 2292922; | 61 | static const int magic_daily = 2292922; |
62 | static const int magic_countdown = 2292923; | 62 | static const int magic_countdown = 2292923; |
63 | static const int magic_snooze = 2292924; | 63 | static const int magic_snooze = 2292924; |
64 | static const int magic_playmp = 2292925; | 64 | static const int magic_playmp = 2292925; |
65 | static const char ALARM_CLOCK_CHANNEL [] = "QPE/Application/clock"; | 65 | static const char ALARM_CLOCK_CHANNEL [] = "QPE/Application/clock"; |
66 | static const char ALARM_CLOCK_MESSAGE [] = "alarm(QDateTime,int)"; | 66 | static const char ALARM_CLOCK_MESSAGE [] = "alarm(QDateTime,int)"; |
67 | 67 | ||
68 | #include <math.h> | 68 | #include <math.h> |
69 | #include <unistd.h> | 69 | #include <unistd.h> |
70 | #include <sys/types.h> | 70 | #include <sys/types.h> |
71 | 71 | ||
72 | #include <pthread.h> | 72 | #include <pthread.h> |
73 | 73 | ||
74 | 74 | ||
75 | static void toggleScreenSaver( bool on ) | 75 | static void toggleScreenSaver( bool on ) |
76 | { | 76 | { |
77 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); | 77 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); |
78 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); | 78 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void startPlayer() | 81 | static void startPlayer() |
82 | { | 82 | { |
83 | Config config( "qpe" ); | 83 | Config config( "qpe" ); |
84 | config.setGroup( "Time" ); | 84 | config.setGroup( "Time" ); |
85 | sleep(15); | 85 | sleep(15); |
86 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | 86 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); |
87 | e << config.readEntry( "mp3File", "" ); | 87 | e << config.readEntry( "mp3File", "" ); |
88 | } | 88 | } |
89 | 89 | ||
90 | class MySpinBox : public QSpinBox | 90 | class MySpinBox : public QSpinBox |
91 | { | 91 | { |
92 | public: | 92 | public: |
93 | QLineEdit *lineEdit() const { | 93 | QLineEdit *lineEdit() const { |
94 | return editor(); | 94 | return editor(); |
95 | } | 95 | } |
96 | }; | 96 | }; |
97 | 97 | ||
98 | // | 98 | // |
99 | // | 99 | // |
100 | // | 100 | // |
101 | AlarmDlg::AlarmDlg(QWidget *parent, const char *name, bool modal, | 101 | AlarmDlg::AlarmDlg(QWidget *parent, const char *name, bool modal, |
102 | const QString &txt) : | 102 | const QString &txt) : |
103 | AlarmDlgBase(parent, name, modal) | 103 | AlarmDlgBase(parent, name, modal) |
104 | { | 104 | { |
105 | // Increase font size to make it a little more readable | ||
106 | QFont f(font()); | ||
107 | f.setPointSize((int)(f.pointSize() * 1.7)); | ||
108 | setFont(f); | ||
109 | |||
105 | setCaption( tr("Clock") ); | 110 | setCaption( tr("Clock") ); |
106 | pixmap->setPixmap( Opie::Core::OResource::loadPixmap("clock/alarmbell") ); | 111 | pixmap->setPixmap( Opie::Core::OResource::loadPixmap("clock/alarmbell") ); |
107 | alarmDlgLabel->setText(txt); | 112 | alarmDlgLabel->setText(txt); |
108 | 113 | ||
109 | connect(snoozeTime, SIGNAL(valueChanged(int)), this, | 114 | connect(cmdSnooze, SIGNAL(clicked()), this, SLOT(checkSnooze())); |
110 | SLOT(changePrompt(int))); | 115 | connect(cmdOk, SIGNAL(clicked()), this, SLOT(accept())); |
111 | connect(cmdOk, SIGNAL(clicked()), this, SLOT(checkSnooze())); | ||
112 | } | 116 | } |
113 | 117 | ||
118 | |||
114 | // | 119 | // |
115 | // | 120 | // |
116 | // | 121 | // |
117 | void | 122 | void |
118 | AlarmDlg::setText(const QString &txt) | 123 | AlarmDlg::setText(const QString &txt) |
119 | { | 124 | { |
120 | alarmDlgLabel->setText(txt); | 125 | alarmDlgLabel->setText(txt); |
121 | } | 126 | } |
122 | 127 | ||
123 | // | 128 | // |
124 | // | 129 | // |
125 | // | 130 | // |
126 | void | 131 | void |
127 | AlarmDlg::checkSnooze(void) | 132 | AlarmDlg::checkSnooze(void) |
128 | { | 133 | { |
129 | // | 134 | // |
130 | // Ensure we have only one snooze alarm. | 135 | // Ensure we have only one snooze alarm. |
131 | // | 136 | // |
132 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, | 137 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, |
133 | ALARM_CLOCK_MESSAGE, magic_snooze); | 138 | ALARM_CLOCK_MESSAGE, magic_snooze); |
134 | 139 | ||
135 | if (snoozeTime->value() > 0) { | 140 | if (snoozeTime->value() > 0) { |
136 | QDateTime wake = QDateTime::currentDateTime(); | 141 | QDateTime wake = QDateTime::currentDateTime(); |
137 | wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes | 142 | wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes |
138 | 143 | ||
139 | AlarmServer::addAlarm(wake, ALARM_CLOCK_CHANNEL, | 144 | AlarmServer::addAlarm(wake, ALARM_CLOCK_CHANNEL, |
140 | ALARM_CLOCK_MESSAGE, magic_snooze); | 145 | ALARM_CLOCK_MESSAGE, magic_snooze); |
141 | } | 146 | } |
142 | accept(); | 147 | accept(); |
143 | } | 148 | } |
144 | 149 | ||
145 | 150 | ||
146 | 151 | ||
147 | void | ||
148 | AlarmDlg::changePrompt(int mins) | ||
149 | { | ||
150 | cmdOk->setText(mins > 0 ? tr("Snooze") : tr("Close") ); | ||
151 | } | ||
152 | |||
153 | |||
154 | |||
155 | Clock::Clock( QWidget * parent, const char *, WFlags f ) | 152 | Clock::Clock( QWidget * parent, const char *, WFlags f ) |
156 | : ClockBase( parent, "clock", f ), swatch_splitms(99), init(FALSE) // No tr | 153 | : ClockBase( parent, "clock", f ), swatch_splitms(99), init(FALSE) // No tr |
157 | { | 154 | { |
158 | alarmDlg = 0; | 155 | alarmDlg = 0; |
159 | swLayout = 0; | 156 | swLayout = 0; |
160 | dayBtn = new QToolButton * [7]; | 157 | dayBtn = new QToolButton * [7]; |
161 | 158 | ||
162 | Config config( "qpe" ); | 159 | Config config( "qpe" ); |
163 | config.setGroup("Time"); | 160 | config.setGroup("Time"); |
164 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 161 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
165 | onMonday = config.readBoolEntry( "MONDAY" ); | 162 | onMonday = config.readBoolEntry( "MONDAY" ); |
166 | 163 | ||
167 | connect( tabs, SIGNAL(currentChanged(QWidget*)), | 164 | connect( tabs, SIGNAL(currentChanged(QWidget*)), |
168 | this, SLOT(tabChanged(QWidget*)) ); | 165 | this, SLOT(tabChanged(QWidget*)) ); |
169 | 166 | ||
170 | analogStopwatch = new AnalogClock( swFrame ); | 167 | analogStopwatch = new AnalogClock( swFrame ); |
171 | stopwatchLcd = new QLCDNumber( swFrame ); | 168 | stopwatchLcd = new QLCDNumber( swFrame ); |
172 | stopwatchLcd->setFrameStyle( QFrame::NoFrame ); | 169 | stopwatchLcd->setFrameStyle( QFrame::NoFrame ); |
173 | stopwatchLcd->setSegmentStyle( QLCDNumber::Flat ); | 170 | stopwatchLcd->setSegmentStyle( QLCDNumber::Flat ); |
174 | stopwatchLcd->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred) ); | 171 | stopwatchLcd->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred) ); |
175 | 172 | ||
176 | analogClock->display( QTime::currentTime() ); | 173 | analogClock->display( QTime::currentTime() ); |
177 | clockLcd->setNumDigits( 5 ); | 174 | clockLcd->setNumDigits( 5 ); |
178 | clockLcd->setFixedWidth( clockLcd->sizeHint().width() ); | 175 | clockLcd->setFixedWidth( clockLcd->sizeHint().width() ); |
179 | date->setText( TimeString::dateString( QDate::currentDate(), TimeString::currentDateFormat() ) ); | 176 | date->setText( TimeString::dateString( QDate::currentDate(), TimeString::currentDateFormat() ) ); |
180 | if ( qApp->desktop()->width() < 200 ) | 177 | if ( qApp->desktop()->width() < 200 ) |
181 | date->setFont( QFont(date->font().family(), 14, QFont::Bold) ); | 178 | date->setFont( QFont(date->font().family(), 14, QFont::Bold) ); |
182 | if ( qApp->desktop()->height() > 240 ) { | 179 | if ( qApp->desktop()->height() > 240 ) { |
183 | clockLcd->setFixedHeight( 30 ); | 180 | clockLcd->setFixedHeight( 30 ); |
184 | stopwatchLcd->setFixedHeight( 30 ); | 181 | stopwatchLcd->setFixedHeight( 30 ); |
185 | } | 182 | } |
186 | 183 | ||
187 | connect( stopStart, SIGNAL(pressed()), SLOT(stopStartStopWatch()) ); | 184 | connect( stopStart, SIGNAL(pressed()), SLOT(stopStartStopWatch()) ); |
188 | connect( reset, SIGNAL(pressed()), SLOT(resetStopWatch()) ); | 185 | connect( reset, SIGNAL(pressed()), SLOT(resetStopWatch()) ); |
189 | 186 | ||
190 | t = new QTimer( this ); | 187 | t = new QTimer( this ); |
191 | connect( t, SIGNAL(timeout()), SLOT(updateClock()) ); | 188 | connect( t, SIGNAL(timeout()), SLOT(updateClock()) ); |
192 | t->start( 1000 ); | 189 | t->start( 1000 ); |
193 | 190 | ||
194 | applyAlarmTimer = new QTimer( this ); | 191 | applyAlarmTimer = new QTimer( this ); |
195 | connect( applyAlarmTimer, SIGNAL(timeout()), | 192 | connect( applyAlarmTimer, SIGNAL(timeout()), |
196 | this, SLOT(applyDailyAlarm()) ); | 193 | this, SLOT(applyDailyAlarm()) ); |
197 | 194 | ||
198 | alarmt = new QTimer( this ); | 195 | alarmt = new QTimer( this ); |
199 | connect( alarmt, SIGNAL(timeout()), SLOT(alarmTimeout()) ); | 196 | connect( alarmt, SIGNAL(timeout()), SLOT(alarmTimeout()) ); |
200 | 197 | ||
201 | connect( qApp, SIGNAL(timeChanged()), SLOT(updateClock()) ); | 198 | connect( qApp, SIGNAL(timeChanged()), SLOT(updateClock()) ); |
202 | connect( qApp, SIGNAL(timeChanged()), SLOT(applyDailyAlarm()) ); | 199 | connect( qApp, SIGNAL(timeChanged()), SLOT(applyDailyAlarm()) ); |
203 | 200 | ||
204 | swatch_running = FALSE; | 201 | swatch_running = FALSE; |
205 | swatch_totalms = 0; | 202 | swatch_totalms = 0; |
206 | swatch_currLap = 0; | 203 | swatch_currLap = 0; |
207 | swatch_dispLap = 0; | 204 | swatch_dispLap = 0; |
208 | stopwatchLcd->setNumDigits( 8+1+sw_prec ); | 205 | stopwatchLcd->setNumDigits( 8+1+sw_prec ); |
209 | stopwatchLcd->display( "00:00:00.00" ); | 206 | stopwatchLcd->display( "00:00:00.00" ); |
210 | 207 | ||
211 | QVBoxLayout *lvb = new QVBoxLayout( lapFrame ); | 208 | QVBoxLayout *lvb = new QVBoxLayout( lapFrame ); |
212 | nextLapBtn = new QToolButton( UpArrow, lapFrame ); | 209 | nextLapBtn = new QToolButton( UpArrow, lapFrame ); |
213 | connect( nextLapBtn, SIGNAL(clicked()), this, SLOT(nextLap()) ); | 210 | connect( nextLapBtn, SIGNAL(clicked()), this, SLOT(nextLap()) ); |
214 | nextLapBtn->setAccel( Key_Up ); | 211 | nextLapBtn->setAccel( Key_Up ); |
215 | lvb->addWidget( nextLapBtn ); | 212 | lvb->addWidget( nextLapBtn ); |
216 | prevLapBtn = new QToolButton( DownArrow, lapFrame ); | 213 | prevLapBtn = new QToolButton( DownArrow, lapFrame ); |
217 | connect( prevLapBtn, SIGNAL(clicked()), this, SLOT(prevLap()) ); | 214 | connect( prevLapBtn, SIGNAL(clicked()), this, SLOT(prevLap()) ); |
218 | prevLapBtn->setAccel( Key_Down ); | 215 | prevLapBtn->setAccel( Key_Down ); |
219 | prevLapBtn->setMinimumWidth( 15 ); | 216 | prevLapBtn->setMinimumWidth( 15 ); |
220 | lvb->addWidget( prevLapBtn ); | 217 | lvb->addWidget( prevLapBtn ); |
221 | prevLapBtn->setEnabled( FALSE ); | 218 | prevLapBtn->setEnabled( FALSE ); |
222 | nextLapBtn->setEnabled( FALSE ); | 219 | nextLapBtn->setEnabled( FALSE ); |
223 | 220 | ||
224 | reset->setEnabled( FALSE ); | 221 | reset->setEnabled( FALSE ); |
225 | 222 | ||
226 | lapLcd->setNumDigits( 8+1+sw_prec ); | 223 | lapLcd->setNumDigits( 8+1+sw_prec ); |
227 | lapLcd->display( "00:00:00.00" ); | 224 | lapLcd->display( "00:00:00.00" ); |
228 | 225 | ||
229 | splitLcd->setNumDigits( 8+1+sw_prec ); | 226 | splitLcd->setNumDigits( 8+1+sw_prec ); |
230 | splitLcd->display( "00:00:00.00" ); | 227 | splitLcd->display( "00:00:00.00" ); |
231 | 228 | ||
232 | lapNumLcd->display( 1 ); | 229 | lapNumLcd->display( 1 ); |
233 | 230 | ||
234 | lapTimer = new QTimer( this ); | 231 | lapTimer = new QTimer( this ); |
235 | connect( lapTimer, SIGNAL(timeout()), this, SLOT(lapTimeout()) ); | 232 | connect( lapTimer, SIGNAL(timeout()), this, SLOT(lapTimeout()) ); |
236 | 233 | ||
237 | for (uint s = 0; s < swatch_splitms.count(); s++ ) | 234 | for (uint s = 0; s < swatch_splitms.count(); s++ ) |
238 | swatch_splitms[(int)s] = 0; | 235 | swatch_splitms[(int)s] = 0; |
239 | 236 | ||
240 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | 237 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
241 | 238 | ||
242 | cdGroup->hide(); // XXX implement countdown timer. | 239 | cdGroup->hide(); // XXX implement countdown timer. |
243 | 240 | ||
244 | connect( dailyHour, SIGNAL(valueChanged(int)), this, SLOT(scheduleApplyDailyAlarm()) ); | 241 | connect( dailyHour, SIGNAL(valueChanged(int)), this, SLOT(scheduleApplyDailyAlarm()) ); |
245 | connect( dailyMinute, SIGNAL(valueChanged(int)), this, SLOT(setDailyMinute(int)) ); | 242 | connect( dailyMinute, SIGNAL(valueChanged(int)), this, SLOT(setDailyMinute(int)) ); |
246 | connect( dailyAmPm, SIGNAL(activated(int)), this, SLOT(setDailyAmPm(int)) ); | 243 | connect( dailyAmPm, SIGNAL(activated(int)), this, SLOT(setDailyAmPm(int)) ); |
247 | connect( dailyEnabled, SIGNAL(toggled(bool)), this, SLOT(enableDaily(bool)) ); | 244 | connect( dailyEnabled, SIGNAL(toggled(bool)), this, SLOT(enableDaily(bool)) ); |
248 | cdLcd->display( "00:00" ); | 245 | cdLcd->display( "00:00" ); |
249 | 246 | ||
250 | dailyMinute->setValidator(0); | 247 | dailyMinute->setValidator(0); |
251 | 248 | ||
252 | Config cConfig( "Clock" ); // No tr | 249 | Config cConfig( "Clock" ); // No tr |
253 | cConfig.setGroup( "Daily Alarm" ); | 250 | cConfig.setGroup( "Daily Alarm" ); |
254 | 251 | ||
255 | QStringList days; | 252 | QStringList days; |
256 | days.append( tr("Mon", "Monday") ); | 253 | days.append( tr("Mon", "Monday") ); |
257 | days.append( tr("Tue", "Tuesday") ); | 254 | days.append( tr("Tue", "Tuesday") ); |
258 | days.append( tr("Wed", "Wednesday") ); | 255 | days.append( tr("Wed", "Wednesday") ); |
259 | days.append( tr("Thu", "Thursday") ); | 256 | days.append( tr("Thu", "Thursday") ); |
260 | days.append( tr("Fri", "Friday") ); | 257 | days.append( tr("Fri", "Friday") ); |
261 | days.append( tr("Sat", "Saturday") ); | 258 | days.append( tr("Sat", "Saturday") ); |
262 | days.append( tr("Sun", "Sunday") ); | 259 | days.append( tr("Sun", "Sunday") ); |
263 | 260 | ||
264 | int i; | 261 | int i; |
265 | QHBoxLayout *hb = new QHBoxLayout( daysFrame ); | 262 | QHBoxLayout *hb = new QHBoxLayout( daysFrame ); |
266 | for ( i = 0; i < 7; i++ ) { | 263 | for ( i = 0; i < 7; i++ ) { |
267 | dayBtn[i] = new QToolButton( daysFrame ); | 264 | dayBtn[i] = new QToolButton( daysFrame ); |
268 | hb->addWidget( dayBtn[i] ); | 265 | hb->addWidget( dayBtn[i] ); |
269 | dayBtn[i]->setToggleButton( TRUE ); | 266 | dayBtn[i]->setToggleButton( TRUE ); |
270 | dayBtn[i]->setOn( TRUE ); | 267 | dayBtn[i]->setOn( TRUE ); |
271 | dayBtn[i]->setFocusPolicy( StrongFocus ); | 268 | dayBtn[i]->setFocusPolicy( StrongFocus ); |
272 | connect( dayBtn[i], SIGNAL(toggled(bool)), this, SLOT(scheduleApplyDailyAlarm()) ); | 269 | connect( dayBtn[i], SIGNAL(toggled(bool)), this, SLOT(scheduleApplyDailyAlarm()) ); |
273 | } | 270 | } |
274 | 271 | ||
275 | for ( i = 0; i < 7; i++ ) | 272 | for ( i = 0; i < 7; i++ ) |
276 | dayBtn[dayBtnIdx(i+1)]->setText( days[i] ); | 273 | dayBtn[dayBtnIdx(i+1)]->setText( days[i] ); |
277 | 274 | ||
278 | QStringList exclDays = cConfig.readListEntry( "ExcludeDays", ',' ); | 275 | QStringList exclDays = cConfig.readListEntry( "ExcludeDays", ',' ); |
279 | QStringList::Iterator it; | 276 | QStringList::Iterator it; |
280 | for ( it = exclDays.begin(); it != exclDays.end(); ++it ) { | 277 | for ( it = exclDays.begin(); it != exclDays.end(); ++it ) { |
281 | int d = (*it).toInt(); | 278 | int d = (*it).toInt(); |
282 | if ( d >= 1 && d <= 7 ) | 279 | if ( d >= 1 && d <= 7 ) |
283 | dayBtn[dayBtnIdx(d)]->setOn( FALSE ); | 280 | dayBtn[dayBtnIdx(d)]->setOn( FALSE ); |
284 | } | 281 | } |
285 | 282 | ||
286 | bool alarm = cConfig.readBoolEntry("Enabled", FALSE); | 283 | bool alarm = cConfig.readBoolEntry("Enabled", FALSE); |
287 | bool sound = cConfig.readBoolEntry("SoundEnabled", FALSE ); | 284 | bool sound = cConfig.readBoolEntry("SoundEnabled", FALSE ); |
288 | dailyEnabled->setChecked( alarm ); | 285 | dailyEnabled->setChecked( alarm ); |
289 | sndGroup->setEnabled( alarm ); | 286 | sndGroup->setEnabled( alarm ); |
290 | sndCheck->setChecked( sound ); | 287 | sndCheck->setChecked( sound ); |
291 | sndChoose->setEnabled( sound ); | 288 | sndChoose->setEnabled( sound ); |
292 | sndFileName->setEnabled( sound ); | 289 | sndFileName->setEnabled( sound ); |
293 | 290 | ||
294 | // FIXME ODP migrate to own config class.. merge config options | 291 | // FIXME ODP migrate to own config class.. merge config options |
295 | Config cfg_qpe( "qpe" ); | 292 | Config cfg_qpe( "qpe" ); |
296 | cfg_qpe.setGroup( "Time" ); | 293 | cfg_qpe.setGroup( "Time" ); |
297 | sndFileName->setText( cfg_qpe.readEntry( "mp3File" ) ); | 294 | sndFileName->setText( cfg_qpe.readEntry( "mp3File" ) ); |
298 | // | 295 | // |
299 | 296 | ||
300 | int m = cConfig.readNumEntry( "Minute", 0 ); | 297 | int m = cConfig.readNumEntry( "Minute", 0 ); |
301 | dailyMinute->setValue( m ); | 298 | dailyMinute->setValue( m ); |
302 | // dailyMinute->setPrefix( m <= 9 ? "0" : "" ); | 299 | // dailyMinute->setPrefix( m <= 9 ? "0" : "" ); |
303 | int h = cConfig.readNumEntry( "Hour", 7 ); | 300 | int h = cConfig.readNumEntry( "Hour", 7 ); |
304 | if ( ampm ) { | 301 | if ( ampm ) { |
305 | if (h > 12) { | 302 | if (h > 12) { |
306 | h -= 12; | 303 | h -= 12; |
307 | dailyAmPm->setCurrentItem( 1 ); | 304 | dailyAmPm->setCurrentItem( 1 ); |
308 | } | 305 | } |
309 | if (h == 0) h = 12; | 306 | if (h == 0) h = 12; |
310 | dailyHour->setMinValue( 1 ); | 307 | dailyHour->setMinValue( 1 ); |
311 | dailyHour->setMaxValue( 12 ); | 308 | dailyHour->setMaxValue( 12 ); |
312 | } else { | 309 | } else { |
313 | dailyAmPm->hide(); | 310 | dailyAmPm->hide(); |
314 | } | 311 | } |
315 | dailyHour->setValue( h ); | 312 | dailyHour->setValue( h ); |
316 | 313 | ||
317 | connect( ((MySpinBox*)dailyHour)->lineEdit(), SIGNAL(textChanged(const QString&)), | 314 | connect( ((MySpinBox*)dailyHour)->lineEdit(), SIGNAL(textChanged(const QString&)), |
318 | this, SLOT(dailyEdited()) ); | 315 | this, SLOT(dailyEdited()) ); |
319 | connect( ((MySpinBox*)dailyMinute)->lineEdit(), SIGNAL(textChanged(const QString&)), | 316 | connect( ((MySpinBox*)dailyMinute)->lineEdit(), SIGNAL(textChanged(const QString&)), |
320 | this, SLOT(dailyEdited()) ); | 317 | this, SLOT(dailyEdited()) ); |
321 | 318 | ||
322 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 319 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
323 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 320 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
324 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 321 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
325 | #endif | 322 | #endif |
326 | 323 | ||
327 | QTimer::singleShot( 0, this, SLOT(updateClock()) ); | 324 | QTimer::singleShot( 0, this, SLOT(updateClock()) ); |
328 | swFrame->installEventFilter( this ); | 325 | swFrame->installEventFilter( this ); |
329 | 326 | ||
330 | init = TRUE; | 327 | init = TRUE; |
331 | } | 328 | } |
332 | 329 | ||
333 | Clock::~Clock() | 330 | Clock::~Clock() |
334 | { | 331 | { |
335 | toggleScreenSaver( true ); | 332 | toggleScreenSaver( true ); |
336 | delete [] dayBtn; | 333 | delete [] dayBtn; |
337 | } | 334 | } |
338 | 335 | ||
339 | void Clock::updateClock() | 336 | void Clock::updateClock() |
340 | { | 337 | { |
341 | if ( tabs->currentPageIndex() == 0 ) { | 338 | if ( tabs->currentPageIndex() == 0 ) { |
342 | QTime tm = QDateTime::currentDateTime().time(); | 339 | QTime tm = QDateTime::currentDateTime().time(); |
343 | QString s; | 340 | QString s; |
344 | if ( ampm ) { | 341 | if ( ampm ) { |
345 | int hour = tm.hour(); | 342 | int hour = tm.hour(); |
346 | if (hour == 0) | 343 | if (hour == 0) |
347 | hour = 12; | 344 | hour = 12; |
348 | if (hour > 12) | 345 | if (hour > 12) |
349 | hour -= 12; | 346 | hour -= 12; |
350 | s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); | 347 | s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); |
351 | clockAmPm->setText( (tm.hour() >= 12) ? "PM" : "AM" ); | 348 | clockAmPm->setText( (tm.hour() >= 12) ? "PM" : "AM" ); |
352 | clockAmPm->show(); | 349 | clockAmPm->show(); |
353 | } else { | 350 | } else { |
354 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); | 351 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); |
355 | clockAmPm->hide(); | 352 | clockAmPm->hide(); |
356 | } | 353 | } |
357 | clockLcd->display( s ); | 354 | clockLcd->display( s ); |
358 | clockLcd->repaint( FALSE ); | 355 | clockLcd->repaint( FALSE ); |
359 | analogClock->display( QTime::currentTime() ); | 356 | analogClock->display( QTime::currentTime() ); |
360 | date->setText( TimeString::dateString( QDate::currentDate(), TimeString::currentDateFormat() ) ); | 357 | date->setText( TimeString::dateString( QDate::currentDate(), TimeString::currentDateFormat() ) ); |
361 | } else if ( tabs->currentPageIndex() == 1 ) { | 358 | } else if ( tabs->currentPageIndex() == 1 ) { |
362 | int totalms = swatch_totalms; | 359 | int totalms = swatch_totalms; |
363 | if ( swatch_running ) | 360 | if ( swatch_running ) |
364 | totalms += swatch_start.elapsed(); | 361 | totalms += swatch_start.elapsed(); |
365 | setSwatchLcd( stopwatchLcd, totalms, !swatch_running ); | 362 | setSwatchLcd( stopwatchLcd, totalms, !swatch_running ); |
366 | QTime swatch_time = QTime(0,0,0).addMSecs(totalms); | 363 | QTime swatch_time = QTime(0,0,0).addMSecs(totalms); |
367 | analogStopwatch->display( swatch_time ); | 364 | analogStopwatch->display( swatch_time ); |
368 | if ( swatch_dispLap == swatch_currLap ) { | 365 | if ( swatch_dispLap == swatch_currLap ) { |
369 | swatch_splitms[swatch_currLap] = swatch_totalms; | 366 | swatch_splitms[swatch_currLap] = swatch_totalms; |
370 | if ( swatch_running ) | 367 | if ( swatch_running ) |
371 | swatch_splitms[swatch_currLap] += swatch_start.elapsed(); | 368 | swatch_splitms[swatch_currLap] += swatch_start.elapsed(); |
372 | updateLap(); | 369 | updateLap(); |
373 | } | 370 | } |
374 | } else if ( tabs->currentPageIndex() == 2 ) { | 371 | } else if ( tabs->currentPageIndex() == 2 ) { |
375 | // nothing. | 372 | // nothing. |
376 | } | 373 | } |
377 | } | 374 | } |
378 | 375 | ||
379 | void Clock::changeClock( bool a ) | 376 | void Clock::changeClock( bool a ) |
380 | { | 377 | { |
381 | if ( ampm != a ) { | 378 | if ( ampm != a ) { |
382 | int minute = dailyMinute->value(); | 379 | int minute = dailyMinute->value(); |
383 | int hour = dailyHour->value(); | 380 | int hour = dailyHour->value(); |
384 | if ( ampm ) { | 381 | if ( ampm ) { |
385 | if (hour == 12) | 382 | if (hour == 12) |
386 | hour = 0; | 383 | hour = 0; |
387 | if (dailyAmPm->currentItem() == 1 ) | 384 | if (dailyAmPm->currentItem() == 1 ) |
388 | hour += 12; | 385 | hour += 12; |
389 | dailyHour->setMinValue( 0 ); | 386 | dailyHour->setMinValue( 0 ); |
390 | dailyHour->setMaxValue( 23 ); | 387 | dailyHour->setMaxValue( 23 ); |
391 | dailyAmPm->hide(); | 388 | dailyAmPm->hide(); |
392 | } else { | 389 | } else { |
393 | if (hour > 12) { | 390 | if (hour > 12) { |
394 | hour -= 12; | 391 | hour -= 12; |
395 | dailyAmPm->setCurrentItem( 1 ); | 392 | dailyAmPm->setCurrentItem( 1 ); |
396 | } | 393 | } |
397 | if (hour == 0) hour = 12; | 394 | if (hour == 0) hour = 12; |
398 | dailyHour->setMinValue( 1 ); | 395 | dailyHour->setMinValue( 1 ); |
399 | dailyHour->setMaxValue( 12 ); | 396 | dailyHour->setMaxValue( 12 ); |
400 | dailyAmPm->show(); | 397 | dailyAmPm->show(); |
401 | } | 398 | } |
402 | dailyMinute->setValue( minute ); | 399 | dailyMinute->setValue( minute ); |
403 | dailyHour->setValue( hour ); | 400 | dailyHour->setValue( hour ); |
404 | } | 401 | } |
405 | ampm = a; | 402 | ampm = a; |
406 | updateClock(); | 403 | updateClock(); |
407 | } | 404 | } |
408 | 405 | ||
409 | void Clock::stopStartStopWatch() | 406 | void Clock::stopStartStopWatch() |
410 | { | 407 | { |
411 | if ( swatch_running ) { | 408 | if ( swatch_running ) { |
412 | swatch_totalms += swatch_start.elapsed(); | 409 | swatch_totalms += swatch_start.elapsed(); |
413 | swatch_splitms[swatch_currLap] = swatch_totalms; | 410 | swatch_splitms[swatch_currLap] = swatch_totalms; |
414 | stopStart->setText( tr("Start") ); | 411 | stopStart->setText( tr("Start") ); |
415 | reset->setText( tr("Reset") ); | 412 | reset->setText( tr("Reset") ); |
416 | reset->setEnabled( TRUE ); | 413 | reset->setEnabled( TRUE ); |
417 | t->stop(); | 414 | t->stop(); |
418 | swatch_running = FALSE; | 415 | swatch_running = FALSE; |
419 | toggleScreenSaver( TRUE ); | 416 | toggleScreenSaver( TRUE ); |
420 | updateClock(); | 417 | updateClock(); |
421 | } else { | 418 | } else { |
422 | swatch_start.start(); | 419 | swatch_start.start(); |
423 | stopStart->setText( tr("Stop") ); | 420 | stopStart->setText( tr("Stop") ); |
424 | reset->setText( tr("Lap/Split") ); | 421 | reset->setText( tr("Lap/Split") ); |
425 | reset->setEnabled( swatch_currLap < 98 ); | 422 | reset->setEnabled( swatch_currLap < 98 ); |
426 | t->start( 1000 ); | 423 | t->start( 1000 ); |
427 | swatch_running = TRUE; | 424 | swatch_running = TRUE; |
428 | // disable screensaver while stop watch is running | 425 | // disable screensaver while stop watch is running |
429 | toggleScreenSaver( FALSE ); | 426 | toggleScreenSaver( FALSE ); |
430 | } | 427 | } |
431 | swatch_dispLap = swatch_currLap; | 428 | swatch_dispLap = swatch_currLap; |
432 | updateLap(); | 429 | updateLap(); |
433 | prevLapBtn->setEnabled( swatch_dispLap ); | 430 | prevLapBtn->setEnabled( swatch_dispLap ); |
434 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); | 431 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); |
435 | stopStart->setAccel( Key_Return ); | 432 | stopStart->setAccel( Key_Return ); |
436 | } | 433 | } |
437 | 434 | ||
438 | void Clock::resetStopWatch() | 435 | void Clock::resetStopWatch() |
439 | { | 436 | { |
440 | if ( swatch_running ) { | 437 | if ( swatch_running ) { |
441 | swatch_splitms[swatch_currLap] = swatch_totalms+swatch_start.elapsed(); | 438 | swatch_splitms[swatch_currLap] = swatch_totalms+swatch_start.elapsed(); |
442 | swatch_dispLap = swatch_currLap; | 439 | swatch_dispLap = swatch_currLap; |
443 | if ( swatch_currLap < 98 ) // allow up to 99 laps | 440 | if ( swatch_currLap < 98 ) // allow up to 99 laps |
444 | swatch_currLap++; | 441 | swatch_currLap++; |
445 | reset->setEnabled( swatch_currLap < 98 ); | 442 | reset->setEnabled( swatch_currLap < 98 ); |
446 | updateLap(); | 443 | updateLap(); |
447 | lapTimer->start( 2000, TRUE ); | 444 | lapTimer->start( 2000, TRUE ); |
448 | } else { | 445 | } else { |
449 | swatch_start.start(); | 446 | swatch_start.start(); |
450 | swatch_totalms = 0; | 447 | swatch_totalms = 0; |
451 | swatch_currLap = 0; | 448 | swatch_currLap = 0; |
452 | swatch_dispLap = 0; | 449 | swatch_dispLap = 0; |
453 | for ( uint i = 0; i < swatch_splitms.count(); i++ ) | 450 | for ( uint i = 0; i < swatch_splitms.count(); i++ ) |
454 | swatch_splitms[(int)i] = 0; | 451 | swatch_splitms[(int)i] = 0; |
455 | updateLap(); | 452 | updateLap(); |
456 | updateClock(); | 453 | updateClock(); |
457 | reset->setText( tr("Lap/Split") ); | 454 | reset->setText( tr("Lap/Split") ); |
458 | reset->setEnabled( FALSE ); | 455 | reset->setEnabled( FALSE ); |
459 | } | 456 | } |
460 | prevLapBtn->setEnabled( swatch_dispLap ); | 457 | prevLapBtn->setEnabled( swatch_dispLap ); |
461 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); | 458 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); |
462 | } | 459 | } |
463 | 460 | ||
464 | void Clock::prevLap() | 461 | void Clock::prevLap() |
465 | { | 462 | { |
466 | if ( swatch_dispLap > 0 ) { | 463 | if ( swatch_dispLap > 0 ) { |
467 | swatch_dispLap--; | 464 | swatch_dispLap--; |
468 | updateLap(); | 465 | updateLap(); |
469 | prevLapBtn->setEnabled( swatch_dispLap ); | 466 | prevLapBtn->setEnabled( swatch_dispLap ); |
470 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); | 467 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); |
471 | } | 468 | } |
472 | } | 469 | } |
473 | 470 | ||
474 | void Clock::nextLap() | 471 | void Clock::nextLap() |
475 | { | 472 | { |
476 | if ( swatch_dispLap < swatch_currLap ) { | 473 | if ( swatch_dispLap < swatch_currLap ) { |
477 | swatch_dispLap++; | 474 | swatch_dispLap++; |
478 | updateLap(); | 475 | updateLap(); |
479 | prevLapBtn->setEnabled( swatch_dispLap ); | 476 | prevLapBtn->setEnabled( swatch_dispLap ); |
480 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); | 477 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); |
481 | } | 478 | } |
482 | } | 479 | } |
483 | 480 | ||
484 | void Clock::lapTimeout() | 481 | void Clock::lapTimeout() |
485 | { | 482 | { |
486 | swatch_dispLap = swatch_currLap; | 483 | swatch_dispLap = swatch_currLap; |
487 | updateLap(); | 484 | updateLap(); |
488 | prevLapBtn->setEnabled( swatch_dispLap ); | 485 | prevLapBtn->setEnabled( swatch_dispLap ); |
489 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); | 486 | nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); |
490 | } | 487 | } |
491 | 488 | ||
492 | void Clock::updateLap() | 489 | void Clock::updateLap() |
493 | { | 490 | { |
494 | if ( swatch_running && swatch_currLap == swatch_dispLap ) { | 491 | if ( swatch_running && swatch_currLap == swatch_dispLap ) { |
495 | swatch_splitms[swatch_currLap] = swatch_totalms; | 492 | swatch_splitms[swatch_currLap] = swatch_totalms; |
496 | swatch_splitms[swatch_currLap] += swatch_start.elapsed(); | 493 | swatch_splitms[swatch_currLap] += swatch_start.elapsed(); |
497 | } | 494 | } |
498 | int split = swatch_splitms[swatch_dispLap]; | 495 | int split = swatch_splitms[swatch_dispLap]; |
499 | int lap; | 496 | int lap; |
500 | if ( swatch_dispLap > 0 ) | 497 | if ( swatch_dispLap > 0 ) |
501 | lap = swatch_splitms[swatch_dispLap] - swatch_splitms[swatch_dispLap-1]; | 498 | lap = swatch_splitms[swatch_dispLap] - swatch_splitms[swatch_dispLap-1]; |
502 | else | 499 | else |
503 | lap = swatch_splitms[swatch_dispLap]; | 500 | lap = swatch_splitms[swatch_dispLap]; |
504 | 501 | ||
505 | lapNumLcd->display( swatch_dispLap+1 ); | 502 | lapNumLcd->display( swatch_dispLap+1 ); |
506 | bool showMs = !swatch_running || swatch_dispLap!=swatch_currLap; | 503 | bool showMs = !swatch_running || swatch_dispLap!=swatch_currLap; |
507 | setSwatchLcd( lapLcd, lap, showMs ); | 504 | setSwatchLcd( lapLcd, lap, showMs ); |
508 | setSwatchLcd( splitLcd, split, showMs ); | 505 | setSwatchLcd( splitLcd, split, showMs ); |
509 | } | 506 | } |
510 | 507 | ||
511 | void Clock::setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs ) | 508 | void Clock::setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs ) |
512 | { | 509 | { |
513 | QTime swatch_time = QTime(0,0,0).addMSecs(ms); | 510 | QTime swatch_time = QTime(0,0,0).addMSecs(ms); |
514 | QString d = showMs ? QString::number(ms%1000+1000) : QString(" "); | 511 | QString d = showMs ? QString::number(ms%1000+1000) : QString(" "); |
515 | QString lcdtext = swatch_time.toString() + "." + d.right(3).left(sw_prec); | 512 | QString lcdtext = swatch_time.toString() + "." + d.right(3).left(sw_prec); |
516 | lcd->display( lcdtext ); | 513 | lcd->display( lcdtext ); |
517 | lcd->repaint( FALSE ); | 514 | lcd->repaint( FALSE ); |
518 | } | 515 | } |
519 | 516 | ||
520 | bool Clock::eventFilter( QObject *o, QEvent *e ) | 517 | bool Clock::eventFilter( QObject *o, QEvent *e ) |
521 | { | 518 | { |
522 | if ( o == swFrame && e->type() == QEvent::Resize ) { | 519 | if ( o == swFrame && e->type() == QEvent::Resize ) { |
523 | QResizeEvent *re = (QResizeEvent *)e; | 520 | QResizeEvent *re = (QResizeEvent *)e; |
524 | delete swLayout; | 521 | delete swLayout; |
525 | if ( re->size().height() < 80 || re->size().height()*3 < re->size().width() ) | 522 | if ( re->size().height() < 80 || re->size().height()*3 < re->size().width() ) |
526 | swLayout = new QHBoxLayout( swFrame ); | 523 | swLayout = new QHBoxLayout( swFrame ); |
527 | else | 524 | else |
528 | swLayout = new QVBoxLayout( swFrame ); | 525 | swLayout = new QVBoxLayout( swFrame ); |
529 | swLayout->addWidget( analogStopwatch ); | 526 | swLayout->addWidget( analogStopwatch ); |
530 | swLayout->addWidget( stopwatchLcd ); | 527 | swLayout->addWidget( stopwatchLcd ); |
531 | swLayout->activate(); | 528 | swLayout->activate(); |
532 | } | 529 | } |
533 | 530 | ||
534 | return FALSE; | 531 | return FALSE; |
535 | } | 532 | } |
536 | 533 | ||
537 | void Clock::tabChanged( QWidget * ) | 534 | void Clock::tabChanged( QWidget * ) |
538 | { | 535 | { |
539 | if ( tabs->currentPageIndex() == 0 ) { | 536 | if ( tabs->currentPageIndex() == 0 ) { |
540 | t->start(1000); | 537 | t->start(1000); |
541 | } else if ( tabs->currentPageIndex() == 1 ) { | 538 | } else if ( tabs->currentPageIndex() == 1 ) { |
542 | if ( !swatch_running ) | 539 | if ( !swatch_running ) |
543 | t->stop(); | 540 | t->stop(); |
544 | stopStart->setAccel( Key_Return ); | 541 | stopStart->setAccel( Key_Return ); |
545 | } else if ( tabs->currentPageIndex() == 2 ) { | 542 | } else if ( tabs->currentPageIndex() == 2 ) { |
546 | t->start(1000); | 543 | t->start(1000); |
547 | } | 544 | } |
548 | updateClock(); | 545 | updateClock(); |
549 | } | 546 | } |
550 | 547 | ||
551 | void Clock::setDailyAmPm(int) | 548 | void Clock::setDailyAmPm(int) |
552 | { | 549 | { |
553 | scheduleApplyDailyAlarm(); | 550 | scheduleApplyDailyAlarm(); |
554 | } | 551 | } |
555 | 552 | ||
556 | void Clock::setDailyMinute( int m ) | 553 | void Clock::setDailyMinute( int m ) |
557 | { | 554 | { |
558 | dailyMinute->setPrefix( m <= 9 ? "0" : "" ); | 555 | dailyMinute->setPrefix( m <= 9 ? "0" : "" ); |
559 | } | 556 | } |
560 | 557 | ||
561 | void Clock::dailyEdited() | 558 | void Clock::dailyEdited() |
562 | { | 559 | { |
563 | if ( spinBoxValid(dailyMinute) && spinBoxValid(dailyHour) ) | 560 | if ( spinBoxValid(dailyMinute) && spinBoxValid(dailyHour) ) |
564 | scheduleApplyDailyAlarm(); | 561 | scheduleApplyDailyAlarm(); |
565 | else | 562 | else |
566 | applyAlarmTimer->stop(); | 563 | applyAlarmTimer->stop(); |
567 | } | 564 | } |
568 | 565 | ||
569 | void Clock::enableDaily( bool ) | 566 | void Clock::enableDaily( bool ) |
570 | { | 567 | { |
571 | scheduleApplyDailyAlarm(); | 568 | scheduleApplyDailyAlarm(); |
572 | } | 569 | } |
573 | 570 | ||
574 | void Clock::appMessage( const QCString &msg, const QByteArray &data ) | 571 | void Clock::appMessage( const QCString &msg, const QByteArray &data ) |
575 | { | 572 | { |
576 | if ( msg == ALARM_CLOCK_MESSAGE ) { | 573 | if ( msg == ALARM_CLOCK_MESSAGE ) { |
577 | QDataStream ds(data,IO_ReadOnly); | 574 | QDataStream ds(data,IO_ReadOnly); |
578 | QDateTime when; | 575 | QDateTime when; |
579 | int t; | 576 | int t; |
580 | ds >> when >> t; | 577 | ds >> when >> t; |
581 | QTime theTime( when.time() ); | 578 | QTime theTime( when.time() ); |
582 | if ( t == magic_daily || t == magic_snooze || | 579 | if ( t == magic_daily || t == magic_snooze || |
583 | t == magic_playmp ) { | 580 | t == magic_playmp ) { |
584 | QString msg = tr("<b>Daily Alarm:</b><p>"); | 581 | QString msg = tr("<b>Daily Alarm:</b><p>"); |
585 | QString ts; | 582 | QString ts; |
586 | if ( ampm ) { | 583 | if ( ampm ) { |
587 | bool pm = FALSE; | 584 | bool pm = FALSE; |
588 | int h = theTime.hour(); | 585 | int h = theTime.hour(); |
589 | if (h > 12) { | 586 | if (h > 12) { |
590 | h -= 12; | 587 | h -= 12; |
591 | pm = TRUE; | 588 | pm = TRUE; |
592 | } | 589 | } |
593 | if (h == 0) h = 12; | 590 | if (h == 0) h = 12; |
594 | ts.sprintf( "%02d:%02d %s", h, theTime.minute(), pm?"PM":"AM" ); | 591 | ts.sprintf( "%02d:%02d %s", h, theTime.minute(), pm?"PM":"AM" ); |
595 | } else { | 592 | } else { |
596 | ts.sprintf( "%02d:%02d", theTime.hour(), theTime.minute() ); | 593 | ts.sprintf( "%02d:%02d", theTime.hour(), theTime.minute() ); |
597 | } | 594 | } |
598 | msg += ts; | 595 | msg += ts; |
599 | 596 | ||
600 | if (t == magic_playmp ) { | 597 | if (t == magic_playmp ) { |
601 | pthread_t thread; | 598 | pthread_t thread; |
602 | pthread_create(&thread,NULL, (void * (*) (void *))startPlayer, NULL/* &*/ ); | 599 | pthread_create(&thread,NULL, (void * (*) (void *))startPlayer, NULL/* &*/ ); |
603 | }else { | 600 | }else { |
604 | Sound::soundAlarm(); | 601 | Sound::soundAlarm(); |
605 | alarmCount = 0; | 602 | alarmCount = 0; |
606 | alarmt->start( 5000 ); | 603 | alarmt->start( 5000 ); |
607 | } | 604 | } |
608 | if ( !alarmDlg ) { | 605 | if ( !alarmDlg ) { |
609 | alarmDlg = new AlarmDlg(this); | 606 | alarmDlg = new AlarmDlg(this); |
610 | } | 607 | } |
611 | alarmDlg->setText(msg); | 608 | alarmDlg->setText(msg); |
612 | 609 | ||
613 | // Set for tomorrow, so user wakes up every day, even if they | 610 | // Set for tomorrow, so user wakes up every day, even if they |
614 | // don't confirm the dialog. Don't set it again when snoozing. | 611 | // don't confirm the dialog. Don't set it again when snoozing. |
615 | if (t != magic_snooze) { | 612 | if (t != magic_snooze) { |
616 | applyDailyAlarm(); | 613 | applyDailyAlarm(); |
617 | } | 614 | } |
618 | 615 | ||
619 | 616 | ||
620 | if ( !alarmDlg->isVisible() ) { | 617 | if ( !alarmDlg->isVisible() ) { |
621 | QPEApplication::execDialog(alarmDlg); | 618 | QPEApplication::execDialog(alarmDlg); |
622 | alarmt->stop(); | 619 | alarmt->stop(); |
623 | } | 620 | } |
624 | } else if ( t == magic_countdown ) { | 621 | } else if ( t == magic_countdown ) { |
625 | // countdown | 622 | // countdown |
626 | Sound::soundAlarm(); | 623 | Sound::soundAlarm(); |
627 | } | 624 | } |
628 | } else if ( msg == "setDailyEnabled(int)" ) { | 625 | } else if ( msg == "setDailyEnabled(int)" ) { |
629 | QDataStream ds(data,IO_ReadOnly); | 626 | QDataStream ds(data,IO_ReadOnly); |
630 | int enableDaily; | 627 | int enableDaily; |
631 | ds >> enableDaily; | 628 | ds >> enableDaily; |
632 | dailyEnabled->setChecked( enableDaily ); | 629 | dailyEnabled->setChecked( enableDaily ); |
633 | applyDailyAlarm(); | 630 | applyDailyAlarm(); |
634 | } else if ( msg == "editDailyAlarm()" ) { | 631 | } else if ( msg == "editDailyAlarm()" ) { |
635 | tabs->setCurrentPage(2); | 632 | tabs->setCurrentPage(2); |
636 | QPEApplication::setKeepRunning(); | 633 | QPEApplication::setKeepRunning(); |
637 | } else if (msg == "showClock()") { | 634 | } else if (msg == "showClock()") { |
638 | tabs->setCurrentPage(0); | 635 | tabs->setCurrentPage(0); |
639 | QPEApplication::setKeepRunning(); | 636 | QPEApplication::setKeepRunning(); |
640 | } else if (msg == "timerStart()" ) { | 637 | } else if (msg == "timerStart()" ) { |
641 | if ( !swatch_running ) | 638 | if ( !swatch_running ) |
642 | stopStartStopWatch(); | 639 | stopStartStopWatch(); |
643 | tabs->setCurrentPage(1); | 640 | tabs->setCurrentPage(1); |
644 | QPEApplication::setKeepRunning(); | 641 | QPEApplication::setKeepRunning(); |
645 | } else if (msg == "timerStop()" ) { | 642 | } else if (msg == "timerStop()" ) { |
646 | if ( swatch_running ) | 643 | if ( swatch_running ) |
647 | stopStartStopWatch(); | 644 | stopStartStopWatch(); |
648 | tabs->setCurrentPage(1); | 645 | tabs->setCurrentPage(1); |
649 | QPEApplication::setKeepRunning(); | 646 | QPEApplication::setKeepRunning(); |
650 | } else if (msg == "timerReset()" ) { | 647 | } else if (msg == "timerReset()" ) { |
651 | resetStopWatch(); | 648 | resetStopWatch(); |
652 | tabs->setCurrentPage(1); | 649 | tabs->setCurrentPage(1); |
653 | QPEApplication::setKeepRunning(); | 650 | QPEApplication::setKeepRunning(); |
654 | } | 651 | } |
655 | } | 652 | } |
656 | 653 | ||
657 | void Clock::alarmTimeout() | 654 | void Clock::alarmTimeout() |
658 | { | 655 | { |
659 | if ( alarmCount < 10 ) { | 656 | if ( alarmCount < 10 ) { |
660 | Sound::soundAlarm(); | 657 | Sound::soundAlarm(); |
661 | alarmCount++; | 658 | alarmCount++; |
662 | } else { | 659 | } else { |
663 | alarmCount = 0; | 660 | alarmCount = 0; |
664 | alarmt->stop(); | 661 | alarmt->stop(); |
665 | } | 662 | } |
666 | } | 663 | } |
667 | 664 | ||
668 | QDateTime Clock::nextAlarm( int h, int m ) | 665 | QDateTime Clock::nextAlarm( int h, int m ) |
669 | { | 666 | { |
670 | QDateTime now = QDateTime::currentDateTime(); | 667 | QDateTime now = QDateTime::currentDateTime(); |
671 | QTime at( h, m ); | 668 | QTime at( h, m ); |
672 | QDateTime when( now.date(), at ); | 669 | QDateTime when( now.date(), at ); |
673 | int count = 0; | 670 | int count = 0; |
674 | int dow = when.date().dayOfWeek(); | 671 | int dow = when.date().dayOfWeek(); |
675 | while ( when < now || !dayBtn[dayBtnIdx(dow)]->isOn() ) { | 672 | while ( when < now || !dayBtn[dayBtnIdx(dow)]->isOn() ) { |
676 | when = when.addDays( 1 ); | 673 | when = when.addDays( 1 ); |
677 | dow = when.date().dayOfWeek(); | 674 | dow = when.date().dayOfWeek(); |
678 | if ( ++count > 7 ) | 675 | if ( ++count > 7 ) |
679 | return QDateTime(); | 676 | return QDateTime(); |
680 | } | 677 | } |
681 | 678 | ||
682 | return when; | 679 | return when; |
683 | } | 680 | } |
684 | 681 | ||
685 | int Clock::dayBtnIdx( int d ) const | 682 | int Clock::dayBtnIdx( int d ) const |
686 | { | 683 | { |
687 | if ( onMonday ) | 684 | if ( onMonday ) |
688 | return d-1; | 685 | return d-1; |
689 | else if ( d == 7 ) | 686 | else if ( d == 7 ) |
690 | return 0; | 687 | return 0; |
691 | else | 688 | else |
692 | return d; | 689 | return d; |
693 | } | 690 | } |
694 | 691 | ||
695 | void Clock::scheduleApplyDailyAlarm() | 692 | void Clock::scheduleApplyDailyAlarm() |
696 | { | 693 | { |
697 | applyAlarmTimer->start( 5000, TRUE ); | 694 | applyAlarmTimer->start( 5000, TRUE ); |
698 | } | 695 | } |
699 | 696 | ||
700 | void Clock::applyDailyAlarm() | 697 | void Clock::applyDailyAlarm() |
701 | { | 698 | { |
702 | if ( !init ) | 699 | if ( !init ) |
703 | return; | 700 | return; |
704 | 701 | ||
705 | applyAlarmTimer->stop(); | 702 | applyAlarmTimer->stop(); |
706 | int minute = dailyMinute->value(); | 703 | int minute = dailyMinute->value(); |
707 | int hour = dailyHour->value(); | 704 | int hour = dailyHour->value(); |
708 | if ( ampm ) { | 705 | if ( ampm ) { |
709 | if (hour == 12) | 706 | if (hour == 12) |
710 | hour = 0; | 707 | hour = 0; |
711 | if (dailyAmPm->currentItem() == 1 ) | 708 | if (dailyAmPm->currentItem() == 1 ) |
712 | hour += 12; | 709 | hour += 12; |
713 | } | 710 | } |
714 | 711 | ||
715 | Config config( "Clock" ); | 712 | Config config( "Clock" ); |
716 | config.setGroup( "Daily Alarm" ); | 713 | config.setGroup( "Daily Alarm" ); |
717 | config.writeEntry( "Hour", hour ); | 714 | config.writeEntry( "Hour", hour ); |
718 | config.writeEntry( "Minute", minute ); | 715 | config.writeEntry( "Minute", minute ); |
719 | 716 | ||
720 | bool enableDaily = dailyEnabled->isChecked(); | 717 | bool enableDaily = dailyEnabled->isChecked(); |
721 | bool isSound = sndCheck->isChecked(); | 718 | bool isSound = sndCheck->isChecked(); |
722 | int isMagic = isSound ? magic_playmp : magic_daily; | 719 | int isMagic = isSound ? magic_playmp : magic_daily; |
723 | config.writeEntry( "Enabled", enableDaily ); | 720 | config.writeEntry( "Enabled", enableDaily ); |
724 | config.writeEntry( "SoundEnabled", isSound ); | 721 | config.writeEntry( "SoundEnabled", isSound ); |
725 | 722 | ||
726 | QString exclDays; | 723 | QString exclDays; |
727 | int exclCount = 0; | 724 | int exclCount = 0; |
728 | for ( int i = 1; i <= 7; i++ ) { | 725 | for ( int i = 1; i <= 7; i++ ) { |
729 | if ( !dayBtn[dayBtnIdx(i)]->isOn() ) { | 726 | if ( !dayBtn[dayBtnIdx(i)]->isOn() ) { |
730 | if ( !exclDays.isEmpty() ) | 727 | if ( !exclDays.isEmpty() ) |
731 | exclDays += ","; | 728 | exclDays += ","; |
732 | exclDays += QString::number( i ); | 729 | exclDays += QString::number( i ); |
733 | exclCount++; | 730 | exclCount++; |
734 | } | 731 | } |
735 | } | 732 | } |
736 | config.writeEntry( "ExcludeDays", exclDays ); | 733 | config.writeEntry( "ExcludeDays", exclDays ); |
737 | 734 | ||
738 | /* try to delete all */ | 735 | /* try to delete all */ |
739 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, | 736 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, |
740 | ALARM_CLOCK_MESSAGE, magic_daily); | 737 | ALARM_CLOCK_MESSAGE, magic_daily); |
741 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, | 738 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, |
742 | ALARM_CLOCK_MESSAGE, magic_playmp ); | 739 | ALARM_CLOCK_MESSAGE, magic_playmp ); |
743 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, | 740 | AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL, |
744 | ALARM_CLOCK_MESSAGE, magic_snooze); | 741 | ALARM_CLOCK_MESSAGE, magic_snooze); |
745 | 742 | ||
746 | if ( enableDaily && exclCount < 7 ) { | 743 | if ( enableDaily && exclCount < 7 ) { |
747 | QDateTime when = nextAlarm( hour, minute ); | 744 | QDateTime when = nextAlarm( hour, minute ); |
748 | AlarmServer::addAlarm(when, ALARM_CLOCK_CHANNEL, | 745 | AlarmServer::addAlarm(when, ALARM_CLOCK_CHANNEL, |
749 | ALARM_CLOCK_MESSAGE, isMagic); | 746 | ALARM_CLOCK_MESSAGE, isMagic); |
750 | } | 747 | } |
751 | } | 748 | } |
752 | 749 | ||
753 | bool Clock::validDaysSelected(void) | 750 | bool Clock::validDaysSelected(void) |
754 | { | 751 | { |
755 | for ( int i = 1; i <= 7; i++ ) { | 752 | for ( int i = 1; i <= 7; i++ ) { |
756 | if ( dayBtn[dayBtnIdx(i)]->isOn() ) { | 753 | if ( dayBtn[dayBtnIdx(i)]->isOn() ) { |
757 | return TRUE; | 754 | return TRUE; |
758 | } | 755 | } |
759 | } | 756 | } |
760 | return FALSE; | 757 | return FALSE; |
761 | } | 758 | } |
762 | 759 | ||
763 | void Clock::closeEvent( QCloseEvent *e ) | 760 | void Clock::closeEvent( QCloseEvent *e ) |
764 | { | 761 | { |
765 | if (dailyEnabled->isChecked()) { | 762 | if (dailyEnabled->isChecked()) { |
766 | if (!validDaysSelected()) { | 763 | if (!validDaysSelected()) { |
767 | QMessageBox::warning(this, tr("Select Day"), | 764 | QMessageBox::warning(this, tr("Select Day"), |
768 | tr("Daily alarm requires at least\none day to be selected.")); | 765 | tr("Daily alarm requires at least\none day to be selected.")); |
769 | return; | 766 | return; |
770 | } | 767 | } |
771 | } | 768 | } |
772 | 769 | ||
773 | applyDailyAlarm(); | 770 | applyDailyAlarm(); |
774 | ClockBase::closeEvent(e); | 771 | ClockBase::closeEvent(e); |
775 | } | 772 | } |
776 | 773 | ||
777 | bool Clock::spinBoxValid( QSpinBox *sb ) | 774 | bool Clock::spinBoxValid( QSpinBox *sb ) |
778 | { | 775 | { |
779 | bool valid = TRUE; | 776 | bool valid = TRUE; |
780 | QString tv = sb->text(); | 777 | QString tv = sb->text(); |
781 | for ( uint i = 0; i < tv.length(); i++ ) { | 778 | for ( uint i = 0; i < tv.length(); i++ ) { |
782 | if ( !tv[0].isDigit() ) | 779 | if ( !tv[0].isDigit() ) |
783 | valid = FALSE; | 780 | valid = FALSE; |
784 | } | 781 | } |
785 | bool ok = FALSE; | 782 | bool ok = FALSE; |
786 | int v = tv.toInt( &ok ); | 783 | int v = tv.toInt( &ok ); |
787 | if ( !ok ) | 784 | if ( !ok ) |
788 | valid = FALSE; | 785 | valid = FALSE; |
789 | if ( v < sb->minValue() || v > sb->maxValue() ) | 786 | if ( v < sb->minValue() || v > sb->maxValue() ) |
790 | valid = FALSE; | 787 | valid = FALSE; |
791 | 788 | ||
792 | return valid; | 789 | return valid; |
793 | } | 790 | } |
794 | 791 | ||
795 | void Clock::slotBrowseMp3File() { | 792 | void Clock::slotBrowseMp3File() { |
796 | Config config( "qpe" ); | 793 | Config config( "qpe" ); |
797 | config.setGroup("Time"); | 794 | config.setGroup("Time"); |
798 | 795 | ||
799 | QMap<QString, QStringList> map; | 796 | QMap<QString, QStringList> map; |
800 | map.insert(tr("All"), QStringList() ); | 797 | map.insert(tr("All"), QStringList() ); |
801 | QStringList text; | 798 | QStringList text; |
802 | text << "audio/*"; | 799 | text << "audio/*"; |
803 | map.insert(tr("Audio"), text ); | 800 | map.insert(tr("Audio"), text ); |
804 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 2, QPEApplication::qpeDir() + "sounds/", QString::null, map); | 801 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 2, QPEApplication::qpeDir() + "sounds/", QString::null, map); |
805 | if(!str.isEmpty() ) { | 802 | if(!str.isEmpty() ) { |
806 | config.writeEntry("mp3Alarm",1); | 803 | config.writeEntry("mp3Alarm",1); |
807 | config.writeEntry("mp3File",str); | 804 | config.writeEntry("mp3File",str); |
808 | sndFileName->setText( str ); | 805 | sndFileName->setText( str ); |
809 | scheduleApplyDailyAlarm(); | 806 | scheduleApplyDailyAlarm(); |
810 | } | 807 | } |
811 | } | 808 | } |
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index c063a9b..10bbfef 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h | |||
@@ -1,116 +1,115 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef CLOCK_H | 20 | #ifndef CLOCK_H |
21 | #define CLOCK_H | 21 | #define CLOCK_H |
22 | 22 | ||
23 | #include "clockbase.h" | 23 | #include "clockbase.h" |
24 | #include "alarmdlgbase.h" | 24 | #include "alarmdlgbase.h" |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | 26 | ||
27 | class QTimer; | 27 | class QTimer; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QDialog; | 29 | class QDialog; |
30 | class AnalogClock; | 30 | class AnalogClock; |
31 | class QBoxLayout; | 31 | class QBoxLayout; |
32 | class QToolButton; | 32 | class QToolButton; |
33 | 33 | ||
34 | class AlarmDlg: public AlarmDlgBase | 34 | class AlarmDlg: public AlarmDlgBase |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | AlarmDlg(QWidget *parent = 0, const char *name = 0, bool modal = TRUE, | 39 | AlarmDlg(QWidget *parent = 0, const char *name = 0, bool modal = TRUE, |
40 | const QString &txt = "Alarm"); | 40 | const QString &txt = "Alarm"); |
41 | 41 | ||
42 | void setText(const QString &txt); | 42 | void setText(const QString &txt); |
43 | 43 | ||
44 | 44 | ||
45 | private slots: | 45 | private slots: |
46 | void checkSnooze(void); | 46 | void checkSnooze(void); |
47 | void changePrompt(int minutes); | ||
48 | }; | 47 | }; |
49 | 48 | ||
50 | class Clock : public ClockBase | 49 | class Clock : public ClockBase |
51 | { | 50 | { |
52 | Q_OBJECT | 51 | Q_OBJECT |
53 | 52 | ||
54 | public: | 53 | public: |
55 | Clock( QWidget *parent=0, const char *name=0, WFlags fl=0 ); | 54 | Clock( QWidget *parent=0, const char *name=0, WFlags fl=0 ); |
56 | ~Clock(); | 55 | ~Clock(); |
57 | QDateTime when; | 56 | QDateTime when; |
58 | bool bSound; | 57 | bool bSound; |
59 | int hour, minute, snoozeTime; | 58 | int hour, minute, snoozeTime; |
60 | static QString appName() { return QString::fromLatin1("clock"); } | 59 | static QString appName() { return QString::fromLatin1("clock"); } |
61 | 60 | ||
62 | private slots: | 61 | private slots: |
63 | void stopStartStopWatch(); | 62 | void stopStartStopWatch(); |
64 | void resetStopWatch(); | 63 | void resetStopWatch(); |
65 | void prevLap(); | 64 | void prevLap(); |
66 | void nextLap(); | 65 | void nextLap(); |
67 | void lapTimeout(); | 66 | void lapTimeout(); |
68 | void tabChanged(QWidget*); | 67 | void tabChanged(QWidget*); |
69 | void updateClock(); | 68 | void updateClock(); |
70 | void changeClock( bool ); | 69 | void changeClock( bool ); |
71 | void setDailyAmPm( int ); | 70 | void setDailyAmPm( int ); |
72 | void setDailyMinute( int ); | 71 | void setDailyMinute( int ); |
73 | void dailyEdited(); | 72 | void dailyEdited(); |
74 | void enableDaily( bool ); | 73 | void enableDaily( bool ); |
75 | void appMessage(const QCString& msg, const QByteArray& data); | 74 | void appMessage(const QCString& msg, const QByteArray& data); |
76 | void alarmTimeout(); | 75 | void alarmTimeout(); |
77 | void applyDailyAlarm(); | 76 | void applyDailyAlarm(); |
78 | void scheduleApplyDailyAlarm(); | 77 | void scheduleApplyDailyAlarm(); |
79 | void slotBrowseMp3File(); | 78 | void slotBrowseMp3File(); |
80 | 79 | ||
81 | protected: | 80 | protected: |
82 | QDateTime nextAlarm( int h, int m ); | 81 | QDateTime nextAlarm( int h, int m ); |
83 | int dayBtnIdx( int ) const; | 82 | int dayBtnIdx( int ) const; |
84 | void closeEvent( QCloseEvent *e ); | 83 | void closeEvent( QCloseEvent *e ); |
85 | void updateLap(); | 84 | void updateLap(); |
86 | void setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs ); | 85 | void setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs ); |
87 | bool eventFilter( QObject *, QEvent * ); | 86 | bool eventFilter( QObject *, QEvent * ); |
88 | bool spinBoxValid( QSpinBox *sb ); | 87 | bool spinBoxValid( QSpinBox *sb ); |
89 | bool validDaysSelected(void); | 88 | bool validDaysSelected(void); |
90 | 89 | ||
91 | private: | 90 | private: |
92 | QTimer *t; | 91 | QTimer *t; |
93 | QTimer *alarmt; | 92 | QTimer *alarmt; |
94 | QTime swatch_start; | 93 | QTime swatch_start; |
95 | int swatch_totalms; | 94 | int swatch_totalms; |
96 | QArray<int> swatch_splitms; | 95 | QArray<int> swatch_splitms; |
97 | bool swatch_running; | 96 | bool swatch_running; |
98 | int swatch_currLap; | 97 | int swatch_currLap; |
99 | int swatch_dispLap; | 98 | int swatch_dispLap; |
100 | QToolButton *prevLapBtn; | 99 | QToolButton *prevLapBtn; |
101 | QToolButton *nextLapBtn; | 100 | QToolButton *nextLapBtn; |
102 | QTimer *lapTimer; | 101 | QTimer *lapTimer; |
103 | AnalogClock* analogStopwatch; | 102 | AnalogClock* analogStopwatch; |
104 | QLCDNumber* stopwatchLcd; | 103 | QLCDNumber* stopwatchLcd; |
105 | QBoxLayout *swLayout; | 104 | QBoxLayout *swLayout; |
106 | bool ampm; | 105 | bool ampm; |
107 | bool onMonday; | 106 | bool onMonday; |
108 | int alarmCount; | 107 | int alarmCount; |
109 | AlarmDlg* alarmDlg; | 108 | AlarmDlg* alarmDlg; |
110 | QToolButton **dayBtn; | 109 | QToolButton **dayBtn; |
111 | bool init; | 110 | bool init; |
112 | QTimer *applyAlarmTimer; | 111 | QTimer *applyAlarmTimer; |
113 | }; | 112 | }; |
114 | 113 | ||
115 | #endif | 114 | #endif |
116 | 115 | ||