File indexing completed on 2024-05-19 11:23:42

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_focusdialog.h"
0010 
0011 #include <QDialog>
0012 
0013 class QPushButton;
0014 
0015 class SkyPoint;
0016 
0017 class FocusDialogUI : public QFrame, public Ui::FocusDialog
0018 {
0019         Q_OBJECT
0020 
0021     public:
0022         explicit FocusDialogUI(QWidget *parent = nullptr);
0023 };
0024 
0025 /**
0026  * @class FocusDialog
0027  * @short A small dialog for setting the focus coordinates manually.
0028  *
0029  * @author Jason Harris
0030  * @version 1.0
0031  */
0032 class FocusDialog : public QDialog
0033 {
0034         Q_OBJECT
0035 
0036     public:
0037         /** Constructor. */
0038         FocusDialog();
0039 
0040         /** @return pointer to the SkyPoint described by the entered RA, Dec */
0041         inline SkyPoint *point()
0042         {
0043             return Point;
0044         }
0045 
0046         /** @return suggested size of focus window. */
0047         QSize sizeHint() const override;
0048 
0049         /** @return whether user set the AltAz coords */
0050         inline bool usedAltAz() const
0051         {
0052             return UsedAltAz;
0053         }
0054 
0055         /** Show the Az/Alt page instead of the RA/Dec page. */
0056         void activateAzAltPage() const;
0057 
0058     public slots:
0059         /** If text has been entered in both KLineEdits, enable the Ok button. */
0060         void checkLineEdits();
0061 
0062         /**
0063          * Attempt to interpret the text in the KLineEdits as Ra and Dec values.
0064          * If the point is validated, close the window.
0065          */
0066         void validatePoint();
0067 
0068     private:
0069         SkyPoint *Point { nullptr };
0070         FocusDialogUI *fd { nullptr };
0071         bool UsedAltAz { false };
0072         QPushButton *okB { nullptr };
0073 };