-rw-r--r-- | noncore/tools/clock/clock.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h new file mode 100644 index 0000000..6dbebf7 --- a/dev/null +++ b/noncore/tools/clock/clock.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef CLOCK_H | ||
21 | #define CLOCK_H | ||
22 | |||
23 | #include <qdatetime.h> | ||
24 | #include <qvbox.h> | ||
25 | |||
26 | class QLCDNumber; | ||
27 | class QLabel; | ||
28 | class QTimer; | ||
29 | class QRadioButton; | ||
30 | class QPushButton; | ||
31 | |||
32 | class AnalogClock : public QFrame | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | |||
36 | public: | ||
37 | AnalogClock( QWidget * parent = 0, const char * name = 0 ) | ||
38 | : QFrame( parent, name ), clear(false) {} | ||
39 | |||
40 | QSizePolicy sizePolicy() const; | ||
41 | |||
42 | void display( const QTime& time ); | ||
43 | |||
44 | protected: | ||
45 | void drawContents( QPainter *p ); | ||
46 | |||
47 | private: | ||
48 | QPoint rotate( QPoint center, QPoint p, int angle ); | ||
49 | |||
50 | QTime currTime; | ||
51 | QTime prevTime; | ||
52 | bool clear; | ||
53 | }; | ||
54 | |||
55 | class Clock : public QVBox | ||
56 | { | ||
57 | Q_OBJECT | ||
58 | |||
59 | public: | ||
60 | Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); | ||
61 | ~Clock(); | ||
62 | |||
63 | private slots: | ||
64 | void slotSet(); | ||
65 | void slotReset(); | ||
66 | void modeSelect(int); | ||
67 | void updateClock(); | ||
68 | void changeClock( bool ); | ||
69 | |||
70 | private: | ||
71 | void clearClock(); | ||
72 | |||
73 | QTimer *t; | ||
74 | QLCDNumber *lcd; | ||
75 | QLabel *date; | ||
76 | QLabel *ampmLabel; | ||
77 | QPushButton *set, *reset; | ||
78 | QRadioButton *clockRB, *swatchRB; | ||
79 | AnalogClock *aclock; | ||
80 | QTime swatch_start; | ||
81 | int swatch_totalms; | ||
82 | bool swatch_running; | ||
83 | bool ampm; | ||
84 | }; | ||
85 | |||
86 | #endif | ||
87 | |||