summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/tools/wutdialog.h
blob: 3423ace0ac9203d04f253250339415a13919f508 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
/***************************************************************************
                          wutdialog.h  -  K Desktop Planetarium
                             -------------------
    begin                : Die Feb 25 2003
    copyright            : (C) 2003 by Thomas Kabelmann
    email                : tk78@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 WUTDIALOG_H
#define WUTDIALOG_H

#include <qwidget.h>
#include <kdialogbase.h>
#include "kstarsdatetime.h"

#define NCATEGORY 8

class KStars;
class ObjectNameList;
class GeoLocation;
class SkyObject;
class SkyObjectName;
class WUTDialogUI;
class QFrame;

/**@class WUTDialog
	*What's up tonight dialog is a window which lists all skyobjects that will
	*be visible during the next night.
	*@author Thomas Kabelmann
	*@version 1.0
	*/

class WUTDialog : public KDialogBase  {
	Q_OBJECT

	public:

		/**@short Constructor*/
		WUTDialog(KStars *ks);
		/**@short Destructor*/
		~WUTDialog();

	private slots:

		/**@short Load the list of visible objects for selected object type.
			*@p type the object-type classification number
			*@see the SkyObject TYPE enum
			*/
		void slotLoadList(int type);

		/**@short Determine which objects are visible, and store them in
			*an array of lists, classified by object type 
			*/
		void init();

		/**@short display the rise/transit/set times for selected object 
			*/
		void slotDisplayObject(QListBoxItem *item);

		/**@short Apply user's choice of what part of the night should 
			*be examined:
			*@li 0: Evening only (sunset to midnight)
			*@li 1: Morning only (midnight to sunrise)
			*@li 2: All night (sunset to sunrise)
			*/
		void slotEveningMorning( int index );

		/**@short Adjust the date for the WUT tool
			*@note this does NOT affect the date of the sky map 
			*/
		void slotChangeDate();
		
		/**@short Adjust the geographic location for the WUT tool
			*@note this does NOT affect the geographic location for the sky map
			*/
		void slotChangeLocation();
		
		/**@short open the detail dialog for the current object
			*/
		void slotDetails();

		/**@short center the display on the current object
			*/
		void slotCenter();
	private:

		KStars *kstars;
		WUTDialogUI *WUT;
		
		/**@short Initialize all SIGNAL/SLOT connections, used in constructor */
		void makeConnections();
		
		/**@short Initialize catgory list, used in constructor */
		void initCategories();
		
		/**@short Check visibility of object
			*@p oname the name of the object to check
			*@return true if visible
			*/
		bool checkVisibility(SkyObjectName *oname);

		/**@short split the objects in object-type categories */
		void splitObjectList();

		/**@short Append object to the correct object-type list. */
		void appendToList(SkyObjectName *o);

		ObjectNameList *objectList;

		QTime sunRiseTomorrow, sunSetToday, sunRiseToday, moonRise, moonSet;
		KStarsDateTime T0, UT0, Tomorrow, TomorrowUT, Evening, EveningUT;

		GeoLocation *geo;
		int EveningFlag;
		
		struct List {
			QPtrList <SkyObjectName> visibleList[NCATEGORY];
			bool initialized[NCATEGORY];
		} lists;

};

#endif