File indexing completed on 2022-12-06 18:58:45

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