summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/timedialog.h
blob: 18d0558b0b7cfb5e4afcf4ec5b28c85d1348334d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/***************************************************************************
                          timedialog.h  -  Trinity Desktop Planetarium
                             -------------------
    begin                : Sun Feb 11 2001
    copyright            : (C) 2001 by Jason Harris
    email                : jharris@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TIMEDIALOG_H
#define TIMEDIALOG_H

#include <kdialogbase.h>
#include <tqvariant.h>

#include "kstarsdatetime.h"

class TQHBoxLayout;
class TQVBoxLayout;
class ExtDatePicker;
class TQSpinBox;
class TQLabel;
class TQPushButton;
class KStars;

/**@class TimeDialog 
	*A class for adjusting the Time and Date.  Contains a ExtDatePicker widget
	*for selecting the date, and three TQSpinBoxes for selecting the Hour,
	*Minute and Second.  There is also a "Now" TQPushbutton for selecting the
	*Time and Date from the system clock.
	*@short Dialog for adjusting the Time and Date.
	*@author Jason Harris
	*@version 0.9
	*/

class TimeDialog : public KDialogBase {
  TQ_OBJECT
  
public:
/**
	*Constructor.  Creates widgets and packs them into TQLayouts.
	*Connects	Signals and Slots.
	*/
	TimeDialog( const KStarsDateTime &now, TQWidget* parent = 0 );

/**
	*Destructor (empty)
	*/
	~TimeDialog() {}

/**@returns a TQTime object with the selected time
	*/
	TQTime selectedTime( void );

/**@returns a ExtDate object with the selected date
	*/
	ExtDate selectedDate( void );

/**@returns a KStarsDateTime object with the selected date and time
	*/
	KStarsDateTime selectedDateTime( void );

public slots:
/**
	*When the "Now" TQPushButton is pressed, read the time and date
	*from the system clock.  Change the selected date in the ExtDatePicker
	*to the system's date, and the displayed Hour, Minute and Second
	*to the system time.
	*/
  void setNow( void );

/**
	*When the value of the HourBox TQSpinBox is changed, prefix a "0" to
	*the displayed text, if the value is less than 10.
	*
	*It would be nice if I could use one slot for these three widgets;
	*my understanding is that the slot has no knowledge of which
	*widget sent the signal...
	*/
	void HourPrefix( int value );

/**
	*When the value of the MinuteBox TQSpinBox is changed, prefix a "0" to
	*the displayed text, if the value is less than 10.
	*/
	void MinutePrefix( int value );

/**
	*When the value of the SecondBox TQSpinBox is changed, prefix a "0" to
	*the displayed text, if the value is less than 10.
	*/
	void SecondPrefix( int value );

protected:
	void keyReleaseEvent( TQKeyEvent* );

private:
  KStars *ksw;
  bool UTCNow;
  TQHBoxLayout *hlay;
  TQVBoxLayout *vlay;
  ExtDatePicker *dPicker;
  TQSpinBox* HourBox;
  TQLabel* TextLabel1;
  TQSpinBox* MinuteBox;
  TQLabel* TextLabel1_2;
  TQSpinBox* SecondBox;
  TQPushButton* NowButton;
};

#endif