00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef CLOCK_H
00021 #define CLOCK_H
00022
00023 #include "clockbase.h"
00024 #include "alarmdlgbase.h"
00025 #include <qdatetime.h>
00026
00027 class QTimer;
00028 class QLabel;
00029 class QDialog;
00030 class AnalogClock;
00031 class QBoxLayout;
00032 class QToolButton;
00033
00034 class AlarmDlg: public AlarmDlgBase
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 AlarmDlg(QWidget *parent = 0, const char *name = 0, bool modal = TRUE,
00040 const QString &txt = "Alarm");
00041
00042 void setText(const QString &txt);
00043
00044
00045 private slots:
00046 void checkSnooze(void);
00047 void changePrompt(int minutes);
00048 };
00049
00050 class Clock : public ClockBase
00051 {
00052 Q_OBJECT
00053
00054 public:
00055 Clock( QWidget *parent=0, const char *name=0, WFlags fl=0 );
00056 ~Clock();
00057 QDateTime when;
00058 bool bSound;
00059 int hour, minute, snoozeTime;
00060 static QString appName() { return QString::fromLatin1("clock"); }
00061
00062 private slots:
00063 void stopStartStopWatch();
00064 void resetStopWatch();
00065 void prevLap();
00066 void nextLap();
00067 void lapTimeout();
00068 void tabChanged(QWidget*);
00069 void updateClock();
00070 void changeClock( bool );
00071 void setDailyAmPm( int );
00072 void setDailyMinute( int );
00073 void dailyEdited();
00074 void enableDaily( bool );
00075 void appMessage(const QCString& msg, const QByteArray& data);
00076 void alarmTimeout();
00077 void applyDailyAlarm();
00078 void scheduleApplyDailyAlarm();
00079 void slotBrowseMp3File();
00080
00081 protected:
00082 QDateTime nextAlarm( int h, int m );
00083 int dayBtnIdx( int ) const;
00084 void closeEvent( QCloseEvent *e );
00085 void updateLap();
00086 void setSwatchLcd( QLCDNumber *lcd, int ms, bool showMs );
00087 bool eventFilter( QObject *, QEvent * );
00088 bool spinBoxValid( QSpinBox *sb );
00089 bool validDaysSelected(void);
00090
00091 private:
00092 QTimer *t;
00093 QTimer *alarmt;
00094 QTime swatch_start;
00095 int swatch_totalms;
00096 QArray<int> swatch_splitms;
00097 bool swatch_running;
00098 int swatch_currLap;
00099 int swatch_dispLap;
00100 QToolButton *prevLapBtn;
00101 QToolButton *nextLapBtn;
00102 QTimer *lapTimer;
00103 AnalogClock* analogStopwatch;
00104 QLCDNumber* stopwatchLcd;
00105 QBoxLayout *swLayout;
00106 bool ampm;
00107 bool onMonday;
00108 int alarmCount;
00109 AlarmDlg* alarmDlg;
00110 QToolButton **dayBtn;
00111 bool init;
00112 QTimer *applyAlarmTimer;
00113 };
00114
00115 #endif
00116