-rw-r--r-- | noncore/tools/clock/clock.h | 112 |
1 files changed, 58 insertions, 54 deletions
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index 00d097d..c063a9b 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -20,50 +20,39 @@ | |||
20 | #ifndef CLOCK_H | 20 | #ifndef CLOCK_H |
21 | #define CLOCK_H | 21 | #define CLOCK_H |
22 | 22 | ||
23 | #include "clockbase.h" | ||
24 | #include "alarmdlgbase.h" | ||
23 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
24 | #include <qvbox.h> | ||
25 | #include <qpixmap.h> | ||
26 | 26 | ||
27 | class QLCDNumber; | ||
28 | class QLabel; | ||
29 | class QTimer; | 27 | class QTimer; |
30 | class QRadioButton; | 28 | class QLabel; |
31 | class QPushButton; | 29 | class QDialog; |
32 | class QDateTime; | 30 | class AnalogClock; |
31 | class QBoxLayout; | ||
32 | class QToolButton; | ||
33 | 33 | ||
34 | class AnalogClock : public QFrame | 34 | class AlarmDlg: public AlarmDlgBase |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | AnalogClock( QWidget * parent = 0, const char * name = 0 ); | 39 | AlarmDlg(QWidget *parent = 0, const char *name = 0, bool modal = TRUE, |
40 | 40 | const QString &txt = "Alarm"); | |
41 | QSizePolicy sizePolicy() const; | ||
42 | |||
43 | void display( const QTime& time ); | ||
44 | |||
45 | |||
46 | protected: | ||
47 | void drawContents( QPainter *p ); | ||
48 | |||
49 | private: | ||
50 | 41 | ||
51 | QPixmap bg; | 42 | void setText(const QString &txt); |
52 | QTime currTime; | ||
53 | QTime prevTime; | ||
54 | bool clear; | ||
55 | 43 | ||
56 | QPoint rotate( QPoint center, QPoint p, int angle ); | ||
57 | void drawPointers ( QPainter *, const QRect &r, const QColor &c, const QTime &t, const QTime *t2 = 0 ); | ||
58 | 44 | ||
45 | private slots: | ||
46 | void checkSnooze(void); | ||
47 | void changePrompt(int minutes); | ||
59 | }; | 48 | }; |
60 | 49 | ||
61 | class Clock : public QVBox | 50 | class Clock : public ClockBase |
62 | { | 51 | { |
63 | Q_OBJECT | 52 | Q_OBJECT |
64 | 53 | ||
65 | public: | 54 | public: |
66 | Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); | 55 | Clock( QWidget *parent=0, const char *name=0, WFlags fl=0 ); |
67 | ~Clock(); | 56 | ~Clock(); |
68 | QDateTime when; | 57 | QDateTime when; |
69 | bool bSound; | 58 | bool bSound; |
@@ -71,41 +60,56 @@ public: | |||
71 | static QString appName() { return QString::fromLatin1("clock"); } | 60 | static QString appName() { return QString::fromLatin1("clock"); } |
72 | 61 | ||
73 | private slots: | 62 | private slots: |
74 | void slotSet(); | 63 | void stopStartStopWatch(); |
75 | void slotReset(); | 64 | void resetStopWatch(); |
76 | void modeSelect(int); | 65 | void prevLap(); |
66 | void nextLap(); | ||
67 | void lapTimeout(); | ||
68 | void tabChanged(QWidget*); | ||
77 | void updateClock(); | 69 | void updateClock(); |
78 | void changeClock( bool ); | 70 | void changeClock( bool ); |
79 | void slotSetAlarm(); | 71 | void setDailyAmPm( int ); |
80 | void slotSnooze(); | 72 | void setDailyMinute( int ); |
81 | void slotToggleAlarm(); | 73 | void dailyEdited(); |
82 | void alarmOn(); | 74 | void enableDaily( bool ); |
83 | void alarmOff(); | ||
84 | void appMessage(const QCString& msg, const QByteArray& data); | 75 | void appMessage(const QCString& msg, const QByteArray& data); |
85 | void timerEvent( QTimerEvent *e ); | 76 | void alarmTimeout(); |
86 | void slotAdjustTime(); | 77 | void applyDailyAlarm(); |
78 | void scheduleApplyDailyAlarm(); | ||
79 | void slotBrowseMp3File(); | ||
80 | |||
81 | protected: | ||
82 | QDateTime nextAlarm( int h, int m ); | ||
83 | int dayBtnIdx( int ) const; | ||
84 | void closeEvent( QCloseEvent *e ); | ||
85 | void updateLap(); | ||
86 | void setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs ); | ||
87 | bool eventFilter( QObject *, QEvent * ); | ||
88 | bool spinBoxValid( QSpinBox *sb ); | ||
89 | bool validDaysSelected(void); | ||
87 | 90 | ||
88 | void slotStartTimer(); | ||
89 | void slotStopTimer(); | ||
90 | void slotResetTimer(); | ||
91 | void setSwatchMode( int ); | ||
92 | private: | 91 | private: |
93 | bool alarmBool; | ||
94 | QTimer *t; | 92 | QTimer *t; |
95 | QLCDNumber *lcd; | 93 | QTimer *alarmt; |
96 | QLabel *date; | ||
97 | QLabel *ampmLabel; | ||
98 | QPushButton *set, *reset, *alarmBtn, *snoozeBtn, *alarmOffBtn; | ||
99 | QRadioButton *clockRB, *swatchRB; | ||
100 | AnalogClock *aclock; | ||
101 | QTime swatch_start; | 94 | QTime swatch_start; |
102 | int swatch_totalms; | 95 | int swatch_totalms; |
96 | QArray<int> swatch_splitms; | ||
103 | bool swatch_running; | 97 | bool swatch_running; |
98 | int swatch_currLap; | ||
99 | int swatch_dispLap; | ||
100 | QToolButton *prevLapBtn; | ||
101 | QToolButton *nextLapBtn; | ||
102 | QTimer *lapTimer; | ||
103 | AnalogClock* analogStopwatch; | ||
104 | QLCDNumber* stopwatchLcd; | ||
105 | QBoxLayout *swLayout; | ||
104 | bool ampm; | 106 | bool ampm; |
105 | void clearClock(); | 107 | bool onMonday; |
106 | void clearTimer(); | 108 | int alarmCount; |
107 | void startSWatch(); | 109 | AlarmDlg* alarmDlg; |
108 | void stopSWatch(); | 110 | QToolButton **dayBtn; |
111 | bool init; | ||
112 | QTimer *applyAlarmTimer; | ||
109 | }; | 113 | }; |
110 | 114 | ||
111 | #endif | 115 | #endif |