File indexing completed on 2024-10-27 09:47:20

0001 /*
0002     SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include "config-kstars.h"
0009 #include "nan.h"
0010 
0011 #include <KXmlGuiWindow>
0012 #include <KLocalizedString>
0013 #include <QLabel>
0014 
0015 #include <QDockWidget>
0016 #include <qtdbusglobal.h>
0017 #ifdef HAVE_CFITSIO
0018 #include <QPointer>
0019 #endif
0020 
0021 // forward declaration is enough. We only need pointers
0022 class QActionGroup;
0023 class QDockWidget;
0024 class QPalette;
0025 class KActionMenu;
0026 class KConfigDialog;
0027 
0028 class KStarsData;
0029 class SkyPoint;
0030 class SkyMap;
0031 class GeoLocation;
0032 class FindDialog;
0033 class TimeStepBox;
0034 class ImageExporter;
0035 
0036 class AltVsTime;
0037 class WUTDialog;
0038 class WIView;
0039 class WILPSettings;
0040 class WIEquipSettings;
0041 class ObsConditions;
0042 class AstroCalc;
0043 class SkyCalendar;
0044 class ScriptBuilder;
0045 class PlanetViewer;
0046 class JMoonTool;
0047 class MoonPhaseTool;
0048 class FlagManager;
0049 class Execute;
0050 class ExportImageDialog;
0051 class PrintingWizard;
0052 class HorizonManager;
0053 class EyepieceField;
0054 class AddDeepSkyObject;
0055 
0056 class OpsCatalog;
0057 class OpsGuides;
0058 class OpsSolarSystem;
0059 class OpsSatellites;
0060 class OpsSupernovae;
0061 class OpsTerrain;
0062 class OpsImageOverlay;
0063 class OpsDeveloper;
0064 class OpsColors;
0065 class OpsAdvanced;
0066 class OpsINDI;
0067 class OpsEkos;
0068 class OpsFITS;
0069 class OpsXplanet;
0070 
0071 namespace Ekos
0072 {
0073 class Manager;
0074 }
0075 
0076 #ifdef HAVE_CFITSIO
0077 class FITSViewer;
0078 #endif
0079 
0080 /**
0081  *@class KStars
0082  *@short This is the main window for KStars.
0083  *In addition to the GUI elements, the class contains the program clock,
0084  KStarsData, and SkyMap objects.  It also contains functions for the \ref DBusInterface D-Bus interface.  KStars is now a singleton class. Use KStars::createInstance() to
0085  create an instance and KStars::Instance() to get a pointer to the instance
0086  *@author Jason Harris, Jasem Mutlaq
0087  *@version 1.1
0088  */
0089 
0090 class KStars : public KXmlGuiWindow
0091 {
0092         Q_OBJECT
0093         Q_CLASSINFO("D-Bus Interface", "org.kde.kstars")
0094         Q_SCRIPTABLE Q_PROPERTY(QString colorScheme READ colorScheme WRITE loadColorScheme NOTIFY colorSchemeChanged)
0095 
0096     public:
0097         Q_SCRIPTABLE QString colorScheme() const;
0098 
0099     private:
0100         /**
0101              * @short Constructor.
0102              * @param doSplash should the splash panel be displayed during
0103              * initialization.
0104              * @param startClockRunning should the clock be running on startup?
0105              * @param startDateString date (in string representation) to start running from.
0106              *
0107              * @todo Refer to documentation on date format.
0108              */
0109         explicit KStars(bool doSplash, bool startClockRunning = true, const QString &startDateString = QString());
0110 
0111     public:
0112         /**
0113              * @short Create an instance of this class. Destroy any previous instance
0114              * @param doSplash
0115              * @param clockrunning
0116              * @param startDateString
0117              * @note See KStars::KStars for details on parameters
0118              * @return a pointer to the instance
0119              */
0120         static KStars *createInstance(bool doSplash, bool clockrunning = true, const QString &startDateString = QString());
0121 
0122         /** @return a pointer to the instance of this class */
0123         inline static KStars *Instance()
0124         {
0125             return pinstance;
0126         }
0127 
0128         /** Destructor. */
0129         ~KStars() override;
0130 
0131         /** Syncs config file. Deletes objects. */
0132         void releaseResources();
0133 
0134         /** @return pointer to KStarsData object which contains application data. */
0135         inline KStarsData *data() const
0136         {
0137             return m_KStarsData;
0138         }
0139 
0140         /** @return pointer to SkyMap object which is the sky display widget. */
0141         inline SkyMap *map() const
0142         {
0143             return m_SkyMap;
0144         }
0145 
0146         inline FlagManager *flagManager() const
0147         {
0148             return m_FlagManager;
0149         }
0150 
0151         inline PrintingWizard *printingWizard() const
0152         {
0153             return m_PrintingWizard;
0154         }
0155 
0156 #ifdef HAVE_CFITSIO
0157         //        void addFITSViewer(const QSharedPointer<FITSViewer> &fv);
0158         const QSharedPointer<FITSViewer> &genericFITSViewer();
0159         const QSharedPointer<FITSViewer> &createFITSViewer();
0160         void clearAllViewers();
0161 #endif
0162 
0163         /** Add an item to the color-scheme action manu
0164              * @param name The name to use in the menu
0165              * @param actionName The internal name for the action (derived from filename)
0166              */
0167         void addColorMenuItem(QString name, const QString &actionName);
0168 
0169         /** Remove an item from the color-scheme action manu
0170              * @param actionName The internal name of the action (derived from filename)
0171              */
0172         void removeColorMenuItem(const QString &actionName);
0173 
0174         /** @short Apply config options throughout the program.
0175              * In most cases, options are set in the "Options" object directly,
0176              * but for some things we have to manually react to config changes.
0177              * @param doApplyFocus If true, then focus position will be set
0178              * from config file
0179              */
0180         void applyConfig(bool doApplyFocus = true);
0181 
0182         /** Sync Options to GUI, if any */
0183         void syncOps();
0184 
0185         void showImgExportDialog();
0186 
0187         void syncFOVActions();
0188 
0189         void hideAllFovExceptFirst();
0190 
0191         void selectNextFov();
0192 
0193         void selectPreviousFov();
0194 
0195         void showWISettingsUI();
0196 
0197         void showWI(ObsConditions *obs);
0198 
0199         /** Load HIPS information and repopulate menu. */
0200         void repopulateHIPS();
0201 
0202         void repopulateOrientation();
0203 
0204         WIEquipSettings *getWIEquipSettings()
0205         {
0206             return m_WIEquipmentSettings;
0207         }
0208 
0209     public Q_SLOTS:
0210         /** @defgroup DBusInterface DBus Interface
0211              KStars provides powerful scripting functionality via DBus. The most common DBus functions can be constructed and executed within the ScriptBuilder tool.
0212              Any 3rd party language or tool with support for DBus can access several interfaces provided by KStars:
0213             <ul>
0214             <li>KStars: Provides functions to manipulate the skymap including zoom, pan, and motion to selected objects. Add and remove object trails and labels. Wait for user input before running further actions.</li>
0215             <li>SimClock: Provides functions to start and stop time, set a different date and time, and to set the clock scale.</li>
0216             <li>Ekos: Provides functions to start and stop Ekos Manager, set Ekos connection mode, and access to Ekos modules:
0217                 <ul>
0218                 <li>Capture: Provides functions to capture images, load sequence queues, control filter wheel, and obtain information on job progress.</li>
0219                 <li>Focus: Provides functions to focus control in manual and automated mode. Start and stop focusing procedures and set autofocus options.</li>
0220                 <li>Guide: Provides functions to start and stop calibration and autoguiding procedures. Set calibration and autoguide options.</li>
0221                 <li>Align: Provides functions to solve images use online or offline astrometry.net solver.</li>
0222                 </ul>
0223             </li>
0224             </ul>
0225             */
0226 
0227         /*@{*/
0228 
0229         /** DBUS interface function.
0230              * Set focus to given Ra/Dec coordinates
0231              * @param ra the Right Ascension coordinate for the focus (in Hours)
0232              * @param dec the Declination coordinate for the focus (in Degrees)
0233              */
0234         Q_SCRIPTABLE Q_NOREPLY void setRaDec(double ra, double dec);
0235 
0236         /** DBUS interface function.
0237              * Set focus to given J2000.0 Ra/Dec coordinates
0238              * @param ra the J2000.0 Right Ascension coordinate for the focus (in Hours)
0239              * @param dec the J2000.0 Declination coordinate for the focus (in Degrees)
0240              */
0241         Q_SCRIPTABLE Q_NOREPLY void setRaDecJ2000(double ra0, double dec0);
0242 
0243         /** DBUS interface function.
0244              * Set focus to given Alt/Az coordinates.
0245              * @param alt the Altitude coordinate for the focus (in Degrees)
0246              * @param az the Azimuth coordinate for the focus (in Degrees)
0247              * @param altIsRefracted If set to true, the altitude is interpreted as if it were corrected for atmospheric refraction (i.e. the altitude is an apparent altitude)
0248              */
0249         Q_SCRIPTABLE Q_NOREPLY void setAltAz(double alt, double az, bool altIsRefracted = false);
0250 
0251         /** DBUS interface function.
0252              * Point in the direction described by the string argument.
0253              * @param direction either an object name, a compass direction (e.g., "north"), or "zenith"
0254              */
0255         Q_SCRIPTABLE Q_NOREPLY void lookTowards(const QString &direction);
0256 
0257         /** DBUS interface function.
0258              * Add a name label to the named object
0259              * @param name the name of the object to which the label will be attached
0260              */
0261         Q_SCRIPTABLE Q_NOREPLY void addLabel(const QString &name);
0262 
0263         /** DBUS interface function.
0264              * Remove a name label from the named object
0265              * @param name the name of the object from which the label will be removed
0266              */
0267         Q_SCRIPTABLE Q_NOREPLY void removeLabel(const QString &name);
0268 
0269         /** DBUS interface function.
0270              * Add a trail to the named solar system body
0271              * @param name the name of the body to which the trail will be attached
0272              */
0273         Q_SCRIPTABLE Q_NOREPLY void addTrail(const QString &name);
0274 
0275         /** DBUS interface function.
0276              * Remove a trail from the named solar system body
0277              * @param name the name of the object from which the trail will be removed
0278              */
0279         Q_SCRIPTABLE Q_NOREPLY void removeTrail(const QString &name);
0280 
0281         /** DBUS interface function.  Zoom in one step. */
0282         Q_SCRIPTABLE Q_NOREPLY void zoomIn();
0283 
0284         /** DBUS interface function.  Zoom out one step. */
0285         Q_SCRIPTABLE Q_NOREPLY void zoomOut();
0286 
0287         /** DBUS interface function.  reset to the default zoom level. */
0288         Q_SCRIPTABLE Q_NOREPLY void defaultZoom();
0289 
0290         /** DBUS interface function. Set zoom level to specified value.
0291              *  @param z the zoom level. Units are pixels per radian. */
0292         Q_SCRIPTABLE Q_NOREPLY void zoom(double z);
0293 
0294         /** DBUS interface function.  Set local time and date.
0295              * @param yr year of date
0296              * @param mth month of date
0297              * @param day day of date
0298              * @param hr hour of time
0299              * @param min minute of time
0300              * @param sec second of time
0301              */
0302         Q_SCRIPTABLE Q_NOREPLY void setLocalTime(int yr, int mth, int day, int hr, int min, int sec);
0303 
0304         /** DBUS interface function.  Set local time and date to present values acc. system clock
0305              * @note Just a proxy for slotSetTimeToNow(), but it is better to
0306              * keep the DBus interface separate from the internal methods.
0307              */
0308         Q_SCRIPTABLE Q_NOREPLY void setTimeToNow();
0309 
0310         /** DBUS interface function.  Delay further execution of DBUS commands.
0311              * @param t number of seconds to delay
0312              */
0313         Q_SCRIPTABLE Q_NOREPLY void waitFor(double t);
0314 
0315         /** DBUS interface function.  Pause further DBUS execution until a key is pressed.
0316              * @param k the key which will resume DBUS execution
0317              */
0318         Q_SCRIPTABLE Q_NOREPLY void waitForKey(const QString &k);
0319 
0320         /** DBUS interface function.  Toggle tracking.
0321              * @param track engage tracking if true; else disengage tracking
0322              */
0323         Q_SCRIPTABLE Q_NOREPLY void setTracking(bool track);
0324 
0325         /** DBUS interface function.  modify a view option.
0326              * @param option the name of the option to be modified
0327              * @param value the option's new value
0328              */
0329         Q_SCRIPTABLE Q_NOREPLY void changeViewOption(const QString &option, const QString &value);
0330 
0331         /** DBUS interface function.
0332              * @param name the name of the option to query
0333              * @return the current value of the named option
0334              * @note Deprecated because it's not clear how to list the options
0335              */
0336         Q_DECL_DEPRECATED Q_SCRIPTABLE QString getOption(const QString &name);
0337 
0338         /** DBUS interface function. Get the focus information as XML.
0339          */
0340         Q_SCRIPTABLE QString getFocusInformationXML();
0341 
0342         /** DBUS interface function.  Read config file.
0343              * This function is useful for restoring the user settings from the config file,
0344              * after having modified the settings in memory.
0345              * @sa writeConfig()
0346              */
0347         Q_SCRIPTABLE Q_NOREPLY void readConfig();
0348 
0349         /** DBUS interface function.  Write current settings to config file.
0350              * This function is useful for storing user settings before modifying them with a DBUS
0351              * script.  The original settings can be restored with readConfig().
0352              * @sa readConfig()
0353              */
0354         Q_SCRIPTABLE Q_NOREPLY void writeConfig();
0355 
0356         /** DBUS interface function.  Show text message in a popup window.
0357              * @note Not Yet Implemented
0358              * @param x x-coordinate for message window
0359              * @param y y-coordinate for message window
0360              * @param message the text to display in the message window
0361              */
0362         Q_SCRIPTABLE Q_NOREPLY void popupMessage(int x, int y, const QString &message);
0363 
0364         /** DBUS interface function.  Draw a line on the sky map.
0365              * @note Not Yet Implemented
0366              * @param x1 starting x-coordinate of line
0367              * @param y1 starting y-coordinate of line
0368              * @param x2 ending x-coordinate of line
0369              * @param y2 ending y-coordinate of line
0370              * @param speed speed at which line should appear from start to end points (in pixels per second)
0371              */
0372         Q_SCRIPTABLE Q_NOREPLY void drawLine(int x1, int y1, int x2, int y2, int speed);
0373 
0374         /** DBUS interface function.  Set the geographic location.
0375              * @param city the city name of the location
0376              * @param province the province name of the location
0377              * @param country the country name of the location
0378              * @return True if geographic location is found and set, false otherwise.
0379              */
0380         Q_SCRIPTABLE bool setGeoLocation(const QString &city, const QString &province, const QString &country);
0381 
0382         /**
0383          * @brief location Returns a JSON Object (as string) that contains the following information:
0384          * name: String
0385          * province: String
0386          * country: String
0387          * longitude: Double (-180 to +180)
0388          * latitude: Double (-90 to +90)
0389          * tz0 (Time zone without DST): Double
0390          * tz (Time zone with DST): Double
0391          * @return Stringified JSON object as described above.
0392          */
0393         Q_SCRIPTABLE QString location();
0394 
0395         /** DBUS interface function.  Set the GPS geographic location.
0396              * @param longitude longitude in degrees (-180 West to +180 East)
0397              * @param latitude latitude in degrees (-90 South to +90 North)
0398              * @param elevation site elevation in meters
0399              * @param tz0 Time zone offset WITHOUT daylight saving time.
0400              * @return True if geographic location is set, false otherwise.
0401              */
0402         Q_SCRIPTABLE bool setGPSLocation(double longitude, double latitude, double elevation, double tz0);
0403 
0404         /** DBUS interface function.  Modify a color.
0405              * @param colorName the name of the color to be modified (e.g., "SkyColor")
0406              * @param value the new color to use
0407              */
0408         Q_SCRIPTABLE Q_NOREPLY void setColor(const QString &colorName, const QString &value);
0409 
0410         /** DBUS interface function.  Load a color scheme.
0411              * @param name the name of the color scheme to load (e.g., "Moonless Night")
0412              */
0413         Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name);
0414 
0415         /** DBUS interface function.  Export the sky image to a file.
0416              * @param filename the filename for the exported image
0417              * @param width the width for the exported image. Map's width will be used if nothing or an invalid value is supplied.
0418              * @param height the height for the exported image. Map's height will be used if nothing or an invalid value is supplied.
0419              * @param includeLegend should we include a legend?
0420              */
0421         Q_SCRIPTABLE Q_NOREPLY void exportImage(const QString &filename, int width = -1, int height = -1,
0422                                                 bool includeLegend = false);
0423 
0424         /** DBUS interface function.  Return a URL to retrieve Digitized Sky Survey image.
0425              * @param objectName name of the object.
0426              * @note If the object is note found, the string "ERROR" is returned.
0427              */
0428         Q_SCRIPTABLE QString getDSSURL(const QString &objectName);
0429 
0430         /** DBUS interface function.  Return a URL to retrieve Digitized Sky Survey image.
0431              * @param RA_J2000 J2000.0 RA
0432              * @param Dec_J2000 J2000.0 Declination
0433              * @param width width of the image, in arcminutes (default = 15)
0434              * @param height height of the image, in arcminutes (default = 15)
0435              */
0436         Q_SCRIPTABLE QString getDSSURL(double RA_J2000, double Dec_J2000, float width = 15, float height = 15);
0437 
0438         /** DBUS interface function.  Return XML containing information about a sky object
0439              * @param objectName name of the object.
0440              * @param fallbackToInternet Attempt to resolve the name using internet databases if not found
0441              * @param storeInternetResolved If we fell back to the internet, save the result in DSO database for future offline access
0442              * @note If the object was not found, the XML is empty.
0443              */
0444         Q_SCRIPTABLE QString getObjectDataXML(const QString &objectName,
0445                                               bool fallbackToInternet = false,
0446                                               bool storeInternetResolved = true);
0447 
0448         /** DBUS interface function.  Return XML containing position info about a sky object
0449              * @param objectName name of the object.
0450              * @note If the object was not found, the XML is empty.
0451              */
0452         Q_SCRIPTABLE QString getObjectPositionInfo(const QString &objectName);
0453 
0454         /** DBUS interface function. Render eyepiece view and save it in the file(s) specified
0455              * @note See EyepieceField::renderEyepieceView() for more info. This is a DBus proxy that calls that method, and then writes the resulting image(s) to file(s).
0456              * @note Important: If imagePath is empty, but overlay is true, or destPathImage is supplied, this method will make a blocking DSS download.
0457              */
0458         Q_SCRIPTABLE Q_NOREPLY void renderEyepieceView(const QString &objectName, const QString &destPathChart,
0459                 const double fovWidth = -1.0, const double fovHeight = -1.0,
0460                 const double rotation = 0.0, const double scale = 1.0,
0461                 const bool flip = false, const bool invert = false,
0462                 QString imagePath            = QString(),
0463                 const QString &destPathImage = QString(), const bool overlay = false,
0464                 const bool invertColors = false);
0465 
0466         /** DBUS interface function.  Set the approx field-of-view
0467              * @param FOV_Degrees field of view in degrees
0468              */
0469         Q_SCRIPTABLE Q_NOREPLY void setApproxFOV(double FOV_Degrees);
0470 
0471         /** DBUS interface function.  Get the dimensions of the Sky Map.
0472              * @return a string containing widthxheight in pixels.
0473              */
0474         Q_SCRIPTABLE QString getSkyMapDimensions();
0475 
0476         /** DBUS interface function.  Return a newline-separated list of objects in the observing wishlist.
0477              * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list.
0478              */
0479         Q_SCRIPTABLE QString getObservingWishListObjectNames();
0480 
0481         /** DBUS interface function.  Return a newline-separated list of objects in the observing session plan.
0482              * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list.
0483              */
0484         Q_SCRIPTABLE QString getObservingSessionPlanObjectNames();
0485 
0486         /** DBUS interface function.  Print the sky image.
0487              * @param usePrintDialog if true, the KDE print dialog will be shown; otherwise, default parameters will be used
0488              * @param useChartColors if true, the "Star Chart" color scheme will be used for the printout, which will save ink.
0489              */
0490         Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors);
0491 
0492         /** DBUS interface function.  Open FITS image.
0493              * @param imageUrl URL of FITS image to load. For a local file the prefix must be file:// For example
0494              * if the file is located at /home/john/m42.fits then the full URL is file:///home/john/m42.fits
0495              */
0496         Q_SCRIPTABLE Q_NOREPLY void openFITS(const QUrl &imageUrl);
0497 
0498         /** @}*/
0499 
0500     signals:
0501         /** DBUS interface notification. Color scheme was updated.
0502          */
0503         void colorSchemeChanged();
0504 
0505     public Q_SLOTS:
0506         /**
0507              * Update time-dependent data and (possibly) repaint the sky map.
0508              * @param automaticDSTchange change DST status automatically?
0509              */
0510         void updateTime(const bool automaticDSTchange = true);
0511 
0512         /** action slot: sync kstars clock to system time */
0513         void slotSetTimeToNow();
0514 
0515         /** Apply new settings and redraw skymap */
0516         void slotApplyConfigChanges();
0517 
0518         /** Apply new settings for WI */
0519         void slotApplyWIConfigChanges();
0520 
0521         /** Called when zoom level is changed. Enables/disables zoom
0522              *  actions and updates status bar. */
0523         void slotZoomChanged();
0524 
0525         /** action slot: Allow user to specify a field-of-view angle for the display window in degrees,
0526              * and set the zoom level accordingly. */
0527         void slotSetZoom();
0528 
0529         /** action slot: Toggle whether kstars is tracking current position */
0530         void slotTrack();
0531 
0532         /** action slot: open dialog for selecting a new geographic location */
0533         void slotGeoLocator();
0534 
0535         /**
0536          * @brief slotSetTelescopeEnabled call when telescope comes online or goes offline.
0537          * @param enable True if telescope is online and connected, false otherwise.
0538          */
0539         void slotSetTelescopeEnabled(bool enable);
0540 
0541         /**
0542          * @brief slotSetDomeEnabled call when dome comes online or goes offline.
0543          * @param enable True if dome is online and connected, false otherwise.
0544          */
0545         void slotSetDomeEnabled(bool enable);
0546 
0547         /** Delete FindDialog because ObjNames list has changed in KStarsData due to
0548              * reloading star data. So list in FindDialog must be new filled with current data. */
0549         void clearCachedFindDialog();
0550 
0551         /** Remove all trails which may have been added to solar system bodies */
0552         void slotClearAllTrails();
0553 
0554         /** Display position in the status bar. */
0555         void slotShowPositionBar(SkyPoint *);
0556 
0557         /** action slot: open Flag Manager */
0558         void slotFlagManager();
0559 
0560         /** Show the eyepiece view tool */
0561         void slotEyepieceView(SkyPoint *sp, const QString &imagePath = QString());
0562 
0563         /** Show the DSO Catalog Management GUI */
0564         void slotDSOCatalogGUI();
0565 
0566         /** action slot: open KStars startup wizard */
0567         void slotWizard();
0568 
0569         void updateLocationFromWizard(const GeoLocation &geo);
0570 
0571         WIView *wiView()
0572         {
0573             return m_WIView;
0574         }
0575 
0576         bool isWIVisible()
0577         {
0578             if (!m_WIView)
0579                 return false;
0580             if (!m_wiDock)
0581                 return false;
0582             return m_wiDock->isVisible();
0583         }
0584 
0585         //FIXME Port to QML2
0586         //#if 0
0587         /** action slot: open What's Interesting settings window */
0588         void slotWISettings();
0589 
0590         /** action slot: toggle What's Interesting window */
0591         void slotToggleWIView();
0592         //#endif
0593 
0594     private slots:
0595         /** action slot: open a dialog for setting the time and date */
0596         void slotSetTime();
0597 
0598         /** action slot: toggle whether kstars clock is running or not */
0599         void slotToggleTimer();
0600 
0601         /** action slot: advance one step forward in time */
0602         void slotStepForward();
0603 
0604         /** action slot: advance one step backward in time */
0605         void slotStepBackward();
0606 
0607         /** action slot: open dialog for finding a named object */
0608         void slotFind();
0609 
0610         /** action slot: open KNewStuff window to download extra data. */
0611         void slotDownload();
0612 
0613         /** action slot: open KStars calculator to compute astronomical ephemeris */
0614         void slotCalculator();
0615 
0616         /** action slot: open Elevation vs. Time tool */
0617         void slotAVT();
0618 
0619         /** action slot: open What's up tonight dialog */
0620         void slotWUT();
0621 
0622         /** action slot: open Sky Calendar tool */
0623         void slotCalendar();
0624 
0625         /** action slot: open the glossary */
0626         void slotGlossary();
0627 
0628         /** action slot: open ScriptBuilder dialog */
0629         void slotScriptBuilder();
0630 
0631         /** action slot: open Solar system viewer */
0632         void slotSolarSystem();
0633 
0634         /** action slot: open Jupiter Moons tool */
0635         void slotJMoonTool();
0636 
0637         /** action slot: open Moon Phase Calendar tool */
0638         void slotMoonPhaseTool();
0639 
0640 #if 0
0641         /** action slot: open Telescope wizard */
0642         void slotTelescopeWizard();
0643 #endif
0644 
0645         /** action slot: open INDI driver panel */
0646         void slotINDIDriver();
0647 
0648         /** action slot: open INDI control panel */
0649         void slotINDIPanel();
0650 
0651         /** action slot: open Ekos panel */
0652         void slotEkos();
0653 
0654         /** action slot: Track with the telescope (INDI) */
0655         void slotINDITelescopeTrack();
0656 
0657         /**
0658          * Action slot: Slew with the telescope (INDI)
0659          *
0660          * @param focused_object Slew to the focused object or the mouse pointer if false.
0661          *
0662          */
0663         void slotINDITelescopeSlew(bool focused_object = true);
0664         void slotINDITelescopeSlewMousePointer();
0665 
0666         /**
0667          * Action slot: Sync the telescope (INDI)
0668          *
0669          * @param focused_object Sync the position of the focused object or the mouse pointer if false.
0670          *
0671          */
0672         void slotINDITelescopeSync(bool focused_object = true);
0673         void slotINDITelescopeSyncMousePointer();
0674 
0675         /** action slot: Abort any telescope motion (INDI) */
0676         void slotINDITelescopeAbort();
0677 
0678         /** action slot: Park the telescope (INDI) */
0679         void slotINDITelescopePark();
0680 
0681         /** action slot: Unpark the telescope (INDI) */
0682         void slotINDITelescopeUnpark();
0683 
0684         /** action slot: Park the dome (INDI) */
0685         void slotINDIDomePark();
0686 
0687         /** action slot: UnPark the dome (INDI) */
0688         void slotINDIDomeUnpark();
0689 
0690         /** action slot: open dialog for setting the view options */
0691         void slotViewOps();
0692 
0693         /** finish setting up after the kstarsData has finished */
0694         void datainitFinished();
0695 
0696         /** Open FITS image. */
0697         void slotOpenFITS();
0698         void slotBlink();
0699 
0700         /** Action slot to save the sky image to a file.*/
0701         void slotExportImage();
0702 
0703         /** Action slot to select a DBUS script and run it.*/
0704         void slotRunScript();
0705 
0706         /** Action slot to print skymap. */
0707         void slotPrint();
0708 
0709         /** Action slot to start Printing Wizard. */
0710         void slotPrintingWizard();
0711 
0712         /** Action slot to show tip-of-the-day window. */
0713         void slotTipOfDay();
0714 
0715         /** Action slot to set focus coordinates manually (opens FocusDialog). */
0716         void slotManualFocus();
0717 
0718         /** Meta-slot to point the focus at special points (zenith, N, S, E, W).
0719              * Uses the name of the Action which sent the Signal to identify the
0720              * desired direction.  */
0721         void slotPointFocus();
0722 
0723         /** Meta-slot to set the color scheme according to the name of the
0724              * Action which sent the activating signal.  */
0725         void slotColorScheme();
0726 
0727         /**
0728          * @brief slotThemeChanged save theme name in options
0729          */
0730         void slotThemeChanged();
0731 
0732         /** Select the Target symbol (a.k.a. field-of-view indicator) */
0733         void slotTargetSymbol(bool flag);
0734 
0735         /** Select the HIPS Source catalog. */
0736         void slotHIPSSource();
0737 
0738         /** Invoke the Field-of-View symbol editor window */
0739         void slotFOVEdit();
0740 
0741         /** Toggle between Equatorial and Ecliptic coordinate systems */
0742         void slotCoordSys();
0743 
0744         /** Set the map projection according to the menu selection */
0745         void slotMapProjection();
0746 
0747         /** Set the orientation parameters of the sky map */
0748         void slotSkyMapOrientation();
0749 
0750         /** Toggle display of the observing list tool*/
0751         void slotObsList();
0752 
0753         /** Meta-slot to handle display toggles for all of the viewtoolbar buttons.
0754              * uses the name of the sender to identify the item to change.  */
0755         void slotViewToolBar();
0756 
0757         /** Meta-slot to handle display toggles for all of the INDItoolbar buttons.
0758              * uses the name of the sender to identify the item to change.  */
0759         void slotINDIToolBar();
0760 
0761         /** Meta-slot to handle toggling display of GUI elements (toolbars and infoboxes)
0762              * uses name of the sender action to identify the widget to hide/show.  */
0763         void slotShowGUIItem(bool);
0764 
0765         /** Toggle to and from full screen mode */
0766         void slotFullScreen();
0767 
0768         /** Toggle whether to show the terrain image on the skymap. */
0769         void slotTerrain();
0770 
0771         /** Toggle whether to show image overlays on the skymap. */
0772         void slotImageOverlays();
0773 
0774         /** Save data to config file before exiting.*/
0775         void slotAboutToQuit();
0776 
0777         void slotEquipmentWriter();
0778 
0779         void slotObserverManager();
0780 
0781         void slotHorizonManager();
0782 
0783         void slotExecute();
0784 
0785         void slotPolarisHourAngle();
0786 
0787         /** Update comets orbital elements*/
0788         void slotUpdateComets(bool isAutoUpdate = false);
0789 
0790         /** Update asteroids orbital elements*/
0791         void slotUpdateAsteroids(bool isAutoUpdate = false);
0792 
0793         /** Update list of recent supernovae*/
0794         void slotUpdateSupernovae();
0795 
0796         /** Update satellites orbital elements*/
0797         void slotUpdateSatellites();
0798 
0799         /** Configure Notifications */
0800         void slotConfigureNotifications();
0801 
0802     private:
0803         /** Load FOV information and repopulate menu. */
0804         void repopulateFOV();
0805 
0806         /**
0807          * @brief populateThemes Populate application themes
0808          */
0809         void populateThemes();
0810 
0811         /** Initialize Menu bar, toolbars and all Actions. */
0812         void initActions();
0813 
0814         /** Prepare options dialog. */
0815         KConfigDialog* prepareOps();
0816 
0817         /** Initialize Status bar. */
0818         void initStatusBar();
0819 
0820         /** Initialize focus position */
0821         void initFocus();
0822 
0823         /** Build the KStars main window */
0824         void buildGUI();
0825 
0826         void closeEvent(QCloseEvent *event) override;
0827 
0828     public:
0829         /** Check if the KStars main window is shown */
0830         bool isGUIReady()
0831         {
0832             return m_SkyMap != nullptr;
0833         }
0834 
0835         /** Was KStars started with the clock running, or paused? */
0836         bool isStartedWithClockRunning()
0837         {
0838             return StartClockRunning;
0839         }
0840 
0841         /// Set to true when the application is being closed
0842         static bool Closing;
0843 
0844         /** @brief Override KStars UI resource file.
0845          * @note This is used by UI tests, which need to use the same resources with a different app name
0846          */
0847         static bool setResourceFile(QString const rc);
0848 
0849     private:
0850         /// Pointer to an instance of KStars
0851         static KStars *pinstance;
0852 
0853         // Resource file to load - overridable by UI tests
0854         static QString m_KStarsUIResource;
0855 
0856         KActionMenu *colorActionMenu { nullptr };
0857         KActionMenu *fovActionMenu { nullptr };
0858         KActionMenu *hipsActionMenu { nullptr };
0859         KActionMenu *orientationActionMenu { nullptr };
0860 
0861         KStarsData *m_KStarsData { nullptr };
0862         SkyMap *m_SkyMap { nullptr };
0863 
0864         // Widgets
0865         TimeStepBox *m_TimeStepBox { nullptr };
0866 
0867         // Dialogs & Tools
0868 
0869         // File Menu
0870         ExportImageDialog *m_ExportImageDialog { nullptr };
0871         PrintingWizard *m_PrintingWizard { nullptr };
0872 
0873         // Tool Menu
0874         AstroCalc *m_AstroCalc { nullptr };
0875         AltVsTime *m_AltVsTime { nullptr };
0876         SkyCalendar *m_SkyCalendar { nullptr };
0877         ScriptBuilder *m_ScriptBuilder { nullptr };
0878         PlanetViewer *m_PlanetViewer { nullptr };
0879         WUTDialog *m_WUTDialog { nullptr };
0880         JMoonTool *m_JMoonTool { nullptr };
0881         FlagManager *m_FlagManager { nullptr };
0882         HorizonManager *m_HorizonManager { nullptr };
0883         EyepieceField *m_EyepieceView { nullptr };
0884 #ifdef HAVE_CFITSIO
0885         QSharedPointer<FITSViewer> m_GenericFITSViewer;
0886         QList<QSharedPointer<FITSViewer>> m_FITSViewers;
0887 #endif
0888 
0889 #ifdef HAVE_INDI
0890         QPointer<Ekos::Manager> m_EkosManager;
0891 #endif
0892 
0893         AddDeepSkyObject *m_addDSODialog { nullptr };
0894 
0895         // FIXME Port to QML2
0896         //#if 0
0897         WIView *m_WIView { nullptr };
0898         WILPSettings *m_WISettings { nullptr };
0899         WIEquipSettings *m_WIEquipmentSettings { nullptr };
0900         ObsConditions *m_ObsConditions { nullptr };
0901         QDockWidget *m_wiDock { nullptr };
0902         //#endif
0903 
0904         QActionGroup *projectionGroup { nullptr };
0905         QActionGroup *skymapOrientationGroup { nullptr };
0906         QActionGroup *cschemeGroup { nullptr };
0907         QActionGroup *hipsGroup { nullptr };
0908         QActionGroup *telescopeGroup { nullptr };
0909         QActionGroup *domeGroup { nullptr };
0910 
0911         bool DialogIsObsolete { false };
0912         bool StartClockRunning { false };
0913         QString StartDateString;
0914         QLabel AltAzField, RADecField, J2000RADecField;
0915         //QPalette OriginalPalette, DarkPalette;
0916 
0917         OpsCatalog *opcatalog { nullptr };
0918         OpsGuides *opguides { nullptr };
0919         OpsTerrain *opterrain { nullptr };
0920         OpsImageOverlay *opsImageOverlay { nullptr };
0921         OpsDeveloper *opsdeveloper { nullptr };
0922         OpsSolarSystem *opsolsys { nullptr };
0923         OpsSatellites *opssatellites { nullptr };
0924         OpsSupernovae *opssupernovae { nullptr };
0925         OpsColors *opcolors { nullptr };
0926         OpsAdvanced *opadvanced { nullptr };
0927         OpsINDI *opsindi { nullptr };
0928         OpsEkos *opsekos { nullptr };
0929         OpsFITS *opsfits { nullptr };
0930         OpsXplanet *opsxplanet { nullptr };
0931 
0932         friend class TestArtificialHorizon;
0933 };