File indexing completed on 2024-04-14 03:43:16

0001 /*
0002     SPDX-FileCopyrightText: 2013 Samikshan Bairagya <samikshan@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_wiequipsettings.h"
0010 #include "obsconditions.h"
0011 #include "oal/scope.h"
0012 
0013 #define INVALID_APERTURE -1
0014 
0015 /**
0016  * @class WIEquipSettings
0017  * @brief User interface for "Equipment Type and Parameters" page in WI settings dialog
0018  *
0019  * @author Samikshan Bairagya
0020  * @author Jasem Mutlaq
0021  * @version 1.1
0022  */
0023 class WIEquipSettings : public QFrame, public Ui::WIEquipSettings
0024 {
0025     Q_OBJECT
0026 
0027   public:
0028     /** @enum ScopeItemRoles User-defined roles for scope item */
0029     enum ScopeItemRoles
0030     {
0031         Vendor = Qt::UserRole + 4,
0032         Model,
0033         Aperture,
0034         FocalLength,
0035         Type
0036     };
0037 
0038     WIEquipSettings();
0039 
0040     /** Inline method to return aperture */
0041     inline double getAperture() { return m_Aperture; }
0042 
0043     /** Set aperture to use */
0044     void setAperture();
0045 
0046     /** Inline method to return telescope type */
0047     inline ObsConditions::TelescopeType getTelType() { return m_TelType; }
0048 
0049     /** Populates scope list widget in UI with list of telescopes from KStars userdb. */
0050     void populateScopeListWidget();
0051 
0052   private:
0053     QList<OAL::Scope *> m_ScopeList;
0054     /// Aperture of equipment to use
0055     double m_Aperture { 0 };
0056     /// Telescope type
0057     ObsConditions::TelescopeType m_TelType { ObsConditions::Invalid };
0058 
0059   private slots:
0060     /** Private slot - Equipment type selected - Telescope */
0061     void slotTelescopeCheck(bool on);
0062 
0063     /** Private slot - Equipment type selected - Binoculars */
0064     void slotBinocularsCheck(bool on);
0065 
0066     /** Private slot - Telescope selected from KStars userdb */
0067     void slotScopeSelected(int row);
0068 
0069     /** Private slot - Add new telescope to KStars userdb */
0070     void slotAddNewScope();
0071 };