Stellarium 0.15.2
DateTimeDialog.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2008 Nigel Kerr
4  * Copyright (C) 2012 Timothy Reaves
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19 */
20 
21 #ifndef _DATETIMEDIALOG_HPP_
22 #define _DATETIMEDIALOG_HPP_
23 
24 #include <QObject>
25 #include "StelDialog.hpp"
26 
27 class Ui_dateTimeDialogForm;
28 
29 class DateTimeDialog : public StelDialog
30 {
31  Q_OBJECT
32 public:
33  DateTimeDialog(QObject* parent);
34  ~DateTimeDialog();
35  double newJd();
36  bool valid(int y, int m, int d, int h, int min, int s);
37  bool validJd(double jday);
39  void styleChanged();
40 public slots:
41  void retranslate();
43  void setDateTime(double newJd);
44 
45  void close();
46 
47 
48 protected:
50  virtual void createDialogContent();
51  void connectSpinnerEvents() const;
52  void disconnectSpinnerEvents()const;
53 
54 private slots:
56  void yearChanged(int ny);
58  void monthChanged(int nm);
60  void dayChanged(int nd);
62  void hourChanged(int nh);
64  void minuteChanged(int nm);
66  void secondChanged(int ns);
68  void jdChanged(double njd);
70  void mjdChanged(double nmjd);
71 
72 private:
73  Ui_dateTimeDialogForm* ui;
74  int year;
75  int month;
76  int day;
77  int hour;
78  int minute;
79  int second;
80  double jd;
81  void pushToWidgets();
82  void setMjd(double mjd) { jd = 2400000.5 + mjd; }
83  double getMjd() { return jd - 2400000.5 ; }
84 };
85 
86 #endif // _DATETIMEDIALOG_HPP_
virtual void createDialogContent()
Initialize the dialog widgets and connect the signals/slots.
void setDateTime(double newJd)
update the editing display with new JD.
Base class for all the GUI windows in Stellarium.
Definition: StelDialog.hpp:72
void styleChanged()
Notify that the application style changed.