summaryrefslogtreecommitdiff
path: root/noncore/tools/clock/clock.h
Unidiff
Diffstat (limited to 'noncore/tools/clock/clock.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.h87
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
26class QLCDNumber;
27class QLabel;
28class QTimer;
29class QRadioButton;
30class QPushButton;
31
32class AnalogClock : public QFrame
33{
34 Q_OBJECT
35
36public:
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
44protected:
45 void drawContents( QPainter *p );
46
47private:
48 QPoint rotate( QPoint center, QPoint p, int angle );
49
50 QTime currTime;
51 QTime prevTime;
52 bool clear;
53};
54
55class Clock : public QVBox
56{
57 Q_OBJECT
58
59public:
60 Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 );
61 ~Clock();
62
63private slots:
64 void slotSet();
65 void slotReset();
66 void modeSelect(int);
67 void updateClock();
68 void changeClock( bool );
69
70private:
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