1 /*
2     SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "ui_focusdialog.h"
10 
11 #include <QDialog>
12 
13 class QPushButton;
14 
15 class SkyPoint;
16 
17 class FocusDialogUI : public QFrame, public Ui::FocusDialog
18 {
19         Q_OBJECT
20 
21     public:
22         explicit FocusDialogUI(QWidget *parent = nullptr);
23 };
24 
25 /**
26  * @class FocusDialog
27  * @short A small dialog for setting the focus coordinates manually.
28  *
29  * @author Jason Harris
30  * @version 1.0
31  */
32 class FocusDialog : public QDialog
33 {
34         Q_OBJECT
35 
36     public:
37         /** Constructor. */
38         FocusDialog();
39 
40         /** @return pointer to the SkyPoint described by the entered RA, Dec */
point()41         inline SkyPoint *point()
42         {
43             return Point;
44         }
45 
46         /** @return suggested size of focus window. */
47         QSize sizeHint() const override;
48 
49         /** @return whether user set the AltAz coords */
usedAltAz()50         inline bool usedAltAz() const
51         {
52             return UsedAltAz;
53         }
54 
55         /** Show the Az/Alt page instead of the RA/Dec page. */
56         void activateAzAltPage() const;
57 
58     public slots:
59         /** If text has been entered in both KLineEdits, enable the Ok button. */
60         void checkLineEdits();
61 
62         /**
63          * Attempt to interpret the text in the KLineEdits as Ra and Dec values.
64          * If the point is validated, close the window.
65          */
66         void validatePoint();
67 
68     private:
69         SkyPoint *Point { nullptr };
70         FocusDialogUI *fd { nullptr };
71         bool UsedAltAz { false };
72         QPushButton *okB { nullptr };
73         bool UseJNow { true };
74 };
75