File indexing completed on 2024-04-21 14:46:27

0001 /*
0002     SPDX-FileCopyrightText: 2009 Prakash Mohan <prakash.mohan*@kdemail.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_execute.h"
0010 #include "oal/oal.h"
0011 #include "oal/session.h"
0012 #include "skyobjects/skyobject.h"
0013 
0014 #include <QDialog>
0015 
0016 class GeoLocation;
0017 class SkyObject;
0018 
0019 /**
0020  * @class Execute
0021  *
0022  * Executes an observation session.
0023  */
0024 class Execute : public QDialog
0025 {
0026     Q_OBJECT
0027 
0028   public:
0029     /** @short Default constructor */
0030     Execute();
0031 
0032     /**
0033      * @short This initializes the combo boxes, and sets up the
0034      * dateTime and geolocation from the OL
0035      */
0036     void init();
0037 
0038   public slots:
0039     /**
0040      * @short Function to handle the UI when the 'next' button is pressed
0041      * This calls the corresponding functions based on the currentIndex
0042      */
0043     void slotNext();
0044 
0045     /** Function to Save the session details */
0046     bool saveSession();
0047 
0048     /**
0049      * @short Function to save the user notes set for the current object in the target combo box
0050      */
0051     void addTargetNotes();
0052 
0053     void slotObserverAdd();
0054 
0055     /** @short Function to add the current observation to the observation list */
0056     bool addObservation();
0057 
0058     /**
0059      * @short Function to handle the state of current observation, and hiding the execute window
0060      */
0061     void slotEndSession();
0062 
0063     /** @short Opens the location dialog for setting the current location */
0064     void slotLocation();
0065 
0066     /** @short Loads the sessionlist from the OL into the target combo box */
0067     void loadTargets();
0068 
0069     /** @short Sorts the target list using the scheduled time */
0070     void sortTargetList();
0071 
0072     /**
0073      * @short set the currentTarget when the user selection is changed in the target combo box
0074      */
0075     void slotSetTarget(const QString &name);
0076 
0077     /** @short loads the equipment list from the global logObject into the comboBoxes */
0078     void loadEquipment();
0079 
0080     /** @short loads the observer list from the global logObject into the comboBoxes */
0081     void loadObservers();
0082 
0083     /** @short loads the observation edit page
0084          */
0085     void loadObservationTab();
0086 
0087     /**
0088      * @short get object name. If star has no name, generate a name based on catalog number.
0089      * @param o sky object
0090      * @param translated set to true if the translated name is required.
0091      */
0092     QString getObjectName(const SkyObject *o, bool translated = true);
0093 
0094     void selectNextTarget();
0095 
0096     void loadCurrentItems();
0097 
0098     void slotSetCurrentObjects();
0099 
0100     void slotSlew();
0101 
0102     void slotShowSession();
0103 
0104     void slotShowTargets();
0105 
0106     int findIndexOfTarget(QString);
0107 
0108     void slotAddObject();
0109 
0110     void slotRemoveObject();
0111 
0112   private:
0113     Ui::Execute ui;
0114     OAL::Session *currentSession { nullptr };
0115     OAL::Log *logObject { nullptr };
0116     OAL::Observer *currentObserver { nullptr };
0117     OAL::Scope *currentScope { nullptr };
0118     OAL::Eyepiece *currentEyepiece { nullptr };
0119     OAL::Lens *currentLens { nullptr };
0120     OAL::Filter *currentFilter { nullptr };
0121     GeoLocation *geo { nullptr };
0122     SkyObject *currentTarget { nullptr };
0123     int nextSession { 0 };
0124     int nextObservation { 0 };
0125     int nextSite { 0 };
0126 };