moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / timedialog.h
blobe1d5c60c07c40065fbc86cff8b779b10391b3596
1 /***************************************************************************
2 timedialog.h - K Desktop Planetarium
3 -------------------
4 begin : Sun Feb 11 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef TIMEDIALOG_H
19 #define TIMEDIALOG_H
21 #include <kdialogbase.h>
22 #include <qvariant.h>
24 #include "kstarsdatetime.h"
26 class QHBoxLayout;
27 class QVBoxLayout;
28 class ExtDatePicker;
29 class QSpinBox;
30 class QLabel;
31 class QPushButton;
32 class KStars;
34 /**@class TimeDialog
35 *A class for adjusting the Time and Date. Contains a ExtDatePicker widget
36 *for selecting the date, and three QSpinBoxes for selecting the Hour,
37 *Minute and Second. There is also a "Now" QPushbutton for selecting the
38 *Time and Date from the system clock.
39 *@short Dialog for adjusting the Time and Date.
40 *@author Jason Harris
41 *@version 0.9
44 class TimeDialog : public KDialogBase {
45 Q_OBJECT
46 public:
47 /**
48 *Constructor. Creates widgets and packs them into QLayouts.
49 *Connects Signals and Slots.
51 TimeDialog( const KStarsDateTime &now, QWidget* parent = 0 );
53 /**
54 *Destructor (empty)
56 ~TimeDialog() {}
58 /**@returns a QTime object with the selected time
60 QTime selectedTime( void );
62 /**@returns a ExtDate object with the selected date
64 ExtDate selectedDate( void );
66 /**@returns a KStarsDateTime object with the selected date and time
68 KStarsDateTime selectedDateTime( void );
70 public slots:
71 /**
72 *When the "Now" QPushButton is pressed, read the time and date
73 *from the system clock. Change the selected date in the ExtDatePicker
74 *to the system's date, and the displayed Hour, Minute and Second
75 *to the system time.
77 void setNow( void );
79 /**
80 *When the value of the HourBox QSpinBox is changed, prefix a "0" to
81 *the displayed text, if the value is less than 10.
83 *It would be nice if I could use one slot for these three widgets;
84 *my understanding is that the slot has no knowledge of which
85 *widget sent the signal...
87 void HourPrefix( int value );
89 /**
90 *When the value of the MinuteBox QSpinBox is changed, prefix a "0" to
91 *the displayed text, if the value is less than 10.
93 void MinutePrefix( int value );
95 /**
96 *When the value of the SecondBox QSpinBox is changed, prefix a "0" to
97 *the displayed text, if the value is less than 10.
99 void SecondPrefix( int value );
101 protected:
102 bool event( QEvent* );
103 void keyReleaseEvent( QKeyEvent* );
105 private:
106 KStars *ksw;
107 bool UTCNow;
108 QHBoxLayout *hlay;
109 QVBoxLayout *vlay;
110 ExtDatePicker *dPicker;
111 QSpinBox* HourBox;
112 QLabel* TextLabel1;
113 QSpinBox* MinuteBox;
114 QLabel* TextLabel1_2;
115 QSpinBox* SecondBox;
116 QPushButton* NowButton;
119 #endif