File indexing completed on 2024-04-21 03:42:45

0001 /*
0002     SPDX-FileCopyrightText: 2003 Jason Harris <kstars@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef FOVDIALOG_H_
0008 #define FOVDIALOG_H_
0009 
0010 #include <QPaintEvent>
0011 #include <QDialog>
0012 #include <QDoubleSpinBox>
0013 
0014 #include "fov.h"
0015 #include "ui_fovdialog.h"
0016 #include "ui_newfov.h"
0017 
0018 class FOVDialogUI : public QFrame, public Ui::FOVDialog
0019 {
0020         Q_OBJECT
0021     public:
0022         explicit FOVDialogUI(QWidget *parent = nullptr);
0023 };
0024 
0025 class NewFOVUI : public QFrame, public Ui::NewFOV
0026 {
0027         Q_OBJECT
0028     public:
0029         explicit NewFOVUI(QWidget *parent = nullptr);
0030 };
0031 
0032 /** @class FOVDialog
0033  *  FOVDialog is dialog to select a Field-of-View indicator (or create a new one)
0034     *@author Jason Harris
0035     *@version 1.0
0036     */
0037 class FOVDialog : public QDialog
0038 {
0039         Q_OBJECT
0040     public:
0041         explicit FOVDialog(QWidget *parent = nullptr);
0042         ~FOVDialog() override;
0043     private slots:
0044         void slotNewFOV();
0045         void slotEditFOV();
0046         void slotRemoveFOV();
0047         void slotSelect(int);
0048 
0049     private:
0050         /** Add new widget to list box */
0051         QListWidgetItem *addListWidget(FOV *f);
0052 
0053         unsigned int currentItem() const;
0054         FOVDialogUI *fov;
0055         static int fovID;
0056 };
0057 
0058 /** @class NewFOV
0059         * Dialog for defining a new FOV symbol
0060     *@author Jason Harris
0061     *@version 1.0
0062     */
0063 class NewFOV : public QDialog
0064 {
0065         Q_OBJECT
0066     public:
0067         /** Create new dialog
0068              * @param parent parent widget
0069              * @param fov widget to copy data from. If it's empty will create empty one.
0070              */
0071         explicit NewFOV(QWidget *parent = nullptr, const FOV *fov = nullptr);
0072         ~NewFOV() override = default;
0073         /** Return reference to FOV. */
0074         const FOV &getFOV() const
0075         {
0076             return f;
0077         }
0078 
0079     public slots:
0080         void slotBinocularFOVDistanceChanged(int index);
0081         void slotUpdateFOV();
0082         void slotComputeFOV();
0083         void slotEyepieceAFOVChanged(int index);
0084         void slotComputeTelescopeFL();
0085         void slotDetectFromINDI();
0086 
0087     private:
0088         FOV f;
0089         NewFOVUI *ui;
0090         QPushButton *okB;
0091 };
0092 
0093 /**
0094  *@class TelescopeFL
0095  *Dialog for calculating telescope focal length from f-number and diameter
0096  *@author Akarsh Simha
0097  *@version 1.0
0098  */
0099 
0100 class TelescopeFL : public QDialog
0101 {
0102         Q_OBJECT
0103     public:
0104         /**
0105              * Create a telescope focal length dialog
0106              * @param parent parent widget
0107              */
0108         explicit TelescopeFL(QWidget *parent = nullptr);
0109 
0110         ~TelescopeFL() override = default;
0111 
0112         /**
0113              * Compute and return the focal length in mm
0114              * @return focal length in mm
0115              */
0116         double computeFL() const;
0117 
0118     private:
0119         QDoubleSpinBox *aperture, *fNumber;
0120         QComboBox *apertureUnit;
0121 };
0122 
0123 #endif