summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-13 07:42:23 (UTC)
committer paule <paule>2007-01-13 07:42:23 (UTC)
commita1360b0af73518d97ebe63ad3cd156cd8b57c8b5 (patch) (unidiff)
tree2630d54134a775f48254624273a8b381e77e39c0
parentb1075202780c1d807c9d9f5286a2ffa7714bae51 (diff)
downloadopie-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)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/alarmdlgbase.ui490
-rw-r--r--noncore/tools/clock/clock.cpp19
-rw-r--r--noncore/tools/clock/clock.h1
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
@@ -41,178 +41,175 @@
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
60static const int sw_prec = 2; 60static const int sw_prec = 2;
61static const int magic_daily = 2292922; 61static const int magic_daily = 2292922;
62static const int magic_countdown = 2292923; 62static const int magic_countdown = 2292923;
63static const int magic_snooze = 2292924; 63static const int magic_snooze = 2292924;
64static const int magic_playmp = 2292925; 64static const int magic_playmp = 2292925;
65static const char ALARM_CLOCK_CHANNEL [] = "QPE/Application/clock"; 65static const char ALARM_CLOCK_CHANNEL [] = "QPE/Application/clock";
66static const char ALARM_CLOCK_MESSAGE [] = "alarm(QDateTime,int)"; 66static 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
75static void toggleScreenSaver( bool on ) 75static 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
81static void startPlayer() 81static 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
90class MySpinBox : public QSpinBox 90class MySpinBox : public QSpinBox
91{ 91{
92public: 92public:
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//
101AlarmDlg::AlarmDlg(QWidget *parent, const char *name, bool modal, 101AlarmDlg::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//
117void 122void
118AlarmDlg::setText(const QString &txt) 123AlarmDlg::setText(const QString &txt)
119{ 124{
120 alarmDlgLabel->setText(txt); 125 alarmDlgLabel->setText(txt);
121} 126}
122 127
123// 128//
124// 129//
125// 130//
126void 131void
127AlarmDlg::checkSnooze(void) 132AlarmDlg::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
147void
148AlarmDlg::changePrompt(int mins)
149{
150 cmdOk->setText(mins > 0 ? tr("Snooze") : tr("Close") );
151}
152
153
154
155Clock::Clock( QWidget * parent, const char *, WFlags f ) 152Clock::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 );
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,111 +1,110 @@
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
27class QTimer; 27class QTimer;
28class QLabel; 28class QLabel;
29class QDialog; 29class QDialog;
30class AnalogClock; 30class AnalogClock;
31class QBoxLayout; 31class QBoxLayout;
32class QToolButton; 32class QToolButton;
33 33
34class AlarmDlg: public AlarmDlgBase 34class AlarmDlg: public AlarmDlgBase
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38public: 38public:
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
45private slots: 45private slots:
46 void checkSnooze(void); 46 void checkSnooze(void);
47 void changePrompt(int minutes);
48}; 47};
49 48
50class Clock : public ClockBase 49class Clock : public ClockBase
51{ 50{
52 Q_OBJECT 51 Q_OBJECT
53 52
54public: 53public:
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
62private slots: 61private 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
81protected: 80protected:
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
91private: 90private:
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;