Kstars

wutdialog.h
1 /*
2  SPDX-FileCopyrightText: 2003 Thomas Kabelmann <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "kstarsdata.h"
10 #include "kstarsdatetime.h"
11 #include "ui_wutdialog.h"
12 #include "catalogobject.h"
13 #include "catalogsdb.h"
14 
15 #include <QFrame>
16 #include <QDialog>
17 #include <qevent.h>
18 
19 class GeoLocation;
20 class SkyObject;
21 
22 class WUTDialogUI : public QFrame, public Ui::WUTDialog
23 {
24  Q_OBJECT
25 
26  public:
27  explicit WUTDialogUI(QWidget *p = nullptr);
28 };
29 
30 /**
31  * @class WUTDialog
32  *
33  * What's up tonight dialog is a window which lists all sky objects
34  * that will be visible during the next night.
35  *
36  * @author Thomas Kabelmann
37  * @version 1.0
38  */
39 class WUTDialog : public QDialog
40 {
41  Q_OBJECT
42 
43  public:
44  /** Constructor */
45  explicit WUTDialog(QWidget *ks, bool session = false,
46  GeoLocation *geo = KStarsData::Instance()->geo(),
47  KStarsDateTime lt = KStarsData::Instance()->lt());
48  virtual ~WUTDialog() override = default;
49 
50  /**
51  * @short Check visibility of object
52  * @p o the object to check
53  * @return true if visible
54  */
55  bool checkVisibility(const SkyObject *o);
56 
57  public slots:
58  /**
59  * @short Determine which objects are visible, and store them in
60  * an array of lists, classified by object type
61  */
62  void init();
63 
64  private slots:
65  /**
66  * @short Load the list of visible objects for selected object type.
67  * @p category the string describing the type of object
68  */
69  void slotLoadList(const QString &category);
70 
71  /** Display the rise/transit/set times for selected object */
72  void slotDisplayObject(const QString &name);
73 
74  /**
75  * @short Apply user's choice of what part of the night should be examined:
76  * @li 0: Evening only (sunset to midnight)
77  * @li 1: Morning only (midnight to sunrise)
78  * @li 2: All night (sunset to sunrise)
79  */
80  void slotEveningMorning(int flag);
81 
82  /**
83  * @short Adjust the date for the WUT tool
84  * @note this does NOT affect the date of the sky map
85  */
86  void slotChangeDate();
87 
88  /**
89  * @short Adjust the geographic location for the WUT tool
90  * @note this does NOT affect the geographic location for the sky map
91  */
92  void slotChangeLocation();
93 
94  /** Open the detail dialog for the current object */
95  void slotDetails();
96 
97  /** Center the display on the current object */
98  void slotCenter();
99 
100  /** Add the object to the observing list */
101  void slotObslist();
102 
103  /** Filters the objects displayed by Magnitude */
104  void slotChangeMagnitude();
105 
106  void updateMag();
107 
108  /**
109  * Load skyobjects from the DSO database and return an `ObjectLists` like
110  * vector.
111  *
112  * \param category The category for which to load the dsos.
113  * \param types The types to load.
114  */
116  load_dso(const QString &category, const std::vector<SkyObject::TYPE> &types);
117 
118  private:
119  QSet<const SkyObject *> &visibleObjects(const QString &category);
120  const SkyObject * findVisibleObject(const QString &name);
121  bool isCategoryInitialized(const QString &category);
122  /** @short Initialize all SIGNAL/SLOT connections, used in constructor */
123  void makeConnections();
124  /** @short Initialize category list, used in constructor */
125  void initCategories();
126 
127  void showEvent(QShowEvent *event) override;
128 
129  WUTDialogUI *WUT{ nullptr };
130  bool session { false };
131  QTime sunRiseTomorrow, sunSetToday, sunRiseToday, moonRise, moonSet;
132  KStarsDateTime T0, UT0, Tomorrow, TomorrowUT, Evening, EveningUT;
133  GeoLocation *geo { nullptr };
134  int EveningFlag { 0 };
135  float m_Mag{ 0 };
136  QTimer *timer{ nullptr };
137  QStringList m_Categories;
139  QHash<QString, bool> m_CategoryInitialized;
141 };
Q_OBJECTQ_OBJECT
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
virtual bool event(QEvent *event) override
bool checkVisibility(const SkyObject *o)
Check visibility of object o the object to check.
Definition: wutdialog.cpp:437
virtual void showEvent(QShowEvent *event) override
void init()
Determine which objects are visible, and store them in an array of lists, classified by object type.
Definition: wutdialog.cpp:109
WUTDialog(QWidget *ks, bool session=false, GeoLocation *geo=KStarsData::Instance() ->geo(), KStarsDateTime lt=KStarsData::Instance() ->lt())
Constructor.
Definition: wutdialog.cpp:26
Information about an object in the sky.
Definition: skyobject.h:41
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.