Kstars

kstars.h
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
3  SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #pragma once
7 
8 #include "config-kstars.h"
9 #include "nan.h"
10 
11 #include <KXmlGuiWindow>
12 #include <KLocalizedString>
13 #include <QLabel>
14 
15 #include <QDockWidget>
16 #include <qtdbusglobal.h>
17 #ifdef HAVE_CFITSIO
18 #include <QPointer>
19 #endif
20 
21 // forward declaration is enough. We only need pointers
22 class QActionGroup;
23 class QDockWidget;
24 class QPalette;
25 class KActionMenu;
26 class KConfigDialog;
27 
28 class KStarsData;
29 class SkyPoint;
30 class SkyMap;
31 class GeoLocation;
32 class FindDialog;
33 class TimeStepBox;
34 class ImageExporter;
35 
36 class AltVsTime;
37 class WUTDialog;
38 class WIView;
39 class WILPSettings;
40 class WIEquipSettings;
41 class ObsConditions;
42 class AstroCalc;
43 class SkyCalendar;
44 class ScriptBuilder;
45 class PlanetViewer;
46 class JMoonTool;
47 class MoonPhaseTool;
48 class FlagManager;
49 class Execute;
50 class ExportImageDialog;
51 class PrintingWizard;
52 class HorizonManager;
53 class EyepieceField;
54 class AddDeepSkyObject;
55 
56 class OpsCatalog;
57 class OpsGuides;
58 class OpsSolarSystem;
59 class OpsSatellites;
60 class OpsSupernovae;
61 class OpsTerrain;
62 class OpsImageOverlay;
63 class OpsDeveloper;
64 class OpsColors;
65 class OpsAdvanced;
66 class OpsINDI;
67 class OpsEkos;
68 class OpsFITS;
69 class OpsXplanet;
70 
71 namespace Ekos
72 {
73 class Manager;
74 }
75 
76 #ifdef HAVE_CFITSIO
77 class FITSViewer;
78 #endif
79 
80 /**
81  *@class KStars
82  *@short This is the main window for KStars.
83  *In addition to the GUI elements, the class contains the program clock,
84  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
85  create an instance and KStars::Instance() to get a pointer to the instance
86  *@author Jason Harris, Jasem Mutlaq
87  *@version 1.1
88  */
89 
90 class KStars : public KXmlGuiWindow
91 {
92  Q_OBJECT
93  Q_CLASSINFO("D-Bus Interface", "org.kde.kstars")
94  Q_SCRIPTABLE Q_PROPERTY(QString colorScheme READ colorScheme WRITE loadColorScheme NOTIFY colorSchemeChanged)
95 
96  public:
97  Q_SCRIPTABLE QString colorScheme() const;
98 
99  private:
100  /**
101  * @short Constructor.
102  * @param doSplash should the splash panel be displayed during
103  * initialization.
104  * @param startClockRunning should the clock be running on startup?
105  * @param startDateString date (in string representation) to start running from.
106  *
107  * @todo Refer to documentation on date format.
108  */
109  explicit KStars(bool doSplash, bool startClockRunning = true, const QString &startDateString = QString());
110 
111  public:
112  /**
113  * @short Create an instance of this class. Destroy any previous instance
114  * @param doSplash
115  * @param clockrunning
116  * @param startDateString
117  * @note See KStars::KStars for details on parameters
118  * @return a pointer to the instance
119  */
120  static KStars *createInstance(bool doSplash, bool clockrunning = true, const QString &startDateString = QString());
121 
122  /** @return a pointer to the instance of this class */
123  inline static KStars *Instance()
124  {
125  return pinstance;
126  }
127 
128  /** Destructor. */
129  ~KStars() override;
130 
131  /** Syncs config file. Deletes objects. */
132  void releaseResources();
133 
134  /** @return pointer to KStarsData object which contains application data. */
135  inline KStarsData *data() const
136  {
137  return m_KStarsData;
138  }
139 
140  /** @return pointer to SkyMap object which is the sky display widget. */
141  inline SkyMap *map() const
142  {
143  return m_SkyMap;
144  }
145 
146  inline FlagManager *flagManager() const
147  {
148  return m_FlagManager;
149  }
150 
151  inline PrintingWizard *printingWizard() const
152  {
153  return m_PrintingWizard;
154  }
155 
156 #ifdef HAVE_CFITSIO
157  // void addFITSViewer(const QSharedPointer<FITSViewer> &fv);
158  const QSharedPointer<FITSViewer> &genericFITSViewer();
159  const QSharedPointer<FITSViewer> &createFITSViewer();
160  void clearAllViewers();
161 #endif
162 
163  /** Add an item to the color-scheme action manu
164  * @param name The name to use in the menu
165  * @param actionName The internal name for the action (derived from filename)
166  */
167  void addColorMenuItem(QString name, const QString &actionName);
168 
169  /** Remove an item from the color-scheme action manu
170  * @param actionName The internal name of the action (derived from filename)
171  */
172  void removeColorMenuItem(const QString &actionName);
173 
174  /** @short Apply config options throughout the program.
175  * In most cases, options are set in the "Options" object directly,
176  * but for some things we have to manually react to config changes.
177  * @param doApplyFocus If true, then focus position will be set
178  * from config file
179  */
180  void applyConfig(bool doApplyFocus = true);
181 
182  /** Sync Options to GUI, if any */
183  void syncOps();
184 
185  void showImgExportDialog();
186 
187  void syncFOVActions();
188 
189  void hideAllFovExceptFirst();
190 
191  void selectNextFov();
192 
193  void selectPreviousFov();
194 
195  void showWISettingsUI();
196 
197  void showWI(ObsConditions *obs);
198 
199  /** Load HIPS information and repopulate menu. */
200  void repopulateHIPS();
201 
202  void repopulateOrientation();
203 
204  WIEquipSettings *getWIEquipSettings()
205  {
206  return m_WIEquipmentSettings;
207  }
208 
209  public Q_SLOTS:
210  /** @defgroup DBusInterface DBus Interface
211  KStars provides powerful scripting functionality via DBus. The most common DBus functions can be constructed and executed within the ScriptBuilder tool.
212  Any 3rd party language or tool with support for DBus can access several interfaces provided by KStars:
213  <ul>
214  <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>
215  <li>SimClock: Provides functions to start and stop time, set a different date and time, and to set the clock scale.</li>
216  <li>Ekos: Provides functions to start and stop Ekos Manager, set Ekos connection mode, and access to Ekos modules:
217  <ul>
218  <li>Capture: Provides functions to capture images, load sequence queues, control filter wheel, and obtain information on job progress.</li>
219  <li>Focus: Provides functions to focus control in manual and automated mode. Start and stop focusing procedures and set autofocus options.</li>
220  <li>Guide: Provides functions to start and stop calibration and autoguiding procedures. Set calibration and autoguide options.</li>
221  <li>Align: Provides functions to solve images use online or offline astrometry.net solver.</li>
222  </ul>
223  </li>
224  </ul>
225  */
226 
227  /*@{*/
228 
229  /** DBUS interface function.
230  * Set focus to given Ra/Dec coordinates
231  * @param ra the Right Ascension coordinate for the focus (in Hours)
232  * @param dec the Declination coordinate for the focus (in Degrees)
233  */
234  Q_SCRIPTABLE Q_NOREPLY void setRaDec(double ra, double dec);
235 
236  /** DBUS interface function.
237  * Set focus to given J2000.0 Ra/Dec coordinates
238  * @param ra the J2000.0 Right Ascension coordinate for the focus (in Hours)
239  * @param dec the J2000.0 Declination coordinate for the focus (in Degrees)
240  */
241  Q_SCRIPTABLE Q_NOREPLY void setRaDecJ2000(double ra0, double dec0);
242 
243  /** DBUS interface function.
244  * Set focus to given Alt/Az coordinates.
245  * @param alt the Altitude coordinate for the focus (in Degrees)
246  * @param az the Azimuth coordinate for the focus (in Degrees)
247  * @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)
248  */
249  Q_SCRIPTABLE Q_NOREPLY void setAltAz(double alt, double az, bool altIsRefracted = false);
250 
251  /** DBUS interface function.
252  * Point in the direction described by the string argument.
253  * @param direction either an object name, a compass direction (e.g., "north"), or "zenith"
254  */
255  Q_SCRIPTABLE Q_NOREPLY void lookTowards(const QString &direction);
256 
257  /** DBUS interface function.
258  * Add a name label to the named object
259  * @param name the name of the object to which the label will be attached
260  */
261  Q_SCRIPTABLE Q_NOREPLY void addLabel(const QString &name);
262 
263  /** DBUS interface function.
264  * Remove a name label from the named object
265  * @param name the name of the object from which the label will be removed
266  */
267  Q_SCRIPTABLE Q_NOREPLY void removeLabel(const QString &name);
268 
269  /** DBUS interface function.
270  * Add a trail to the named solar system body
271  * @param name the name of the body to which the trail will be attached
272  */
273  Q_SCRIPTABLE Q_NOREPLY void addTrail(const QString &name);
274 
275  /** DBUS interface function.
276  * Remove a trail from the named solar system body
277  * @param name the name of the object from which the trail will be removed
278  */
279  Q_SCRIPTABLE Q_NOREPLY void removeTrail(const QString &name);
280 
281  /** DBUS interface function. Zoom in one step. */
282  Q_SCRIPTABLE Q_NOREPLY void zoomIn();
283 
284  /** DBUS interface function. Zoom out one step. */
285  Q_SCRIPTABLE Q_NOREPLY void zoomOut();
286 
287  /** DBUS interface function. reset to the default zoom level. */
288  Q_SCRIPTABLE Q_NOREPLY void defaultZoom();
289 
290  /** DBUS interface function. Set zoom level to specified value.
291  * @param z the zoom level. Units are pixels per radian. */
292  Q_SCRIPTABLE Q_NOREPLY void zoom(double z);
293 
294  /** DBUS interface function. Set local time and date.
295  * @param yr year of date
296  * @param mth month of date
297  * @param day day of date
298  * @param hr hour of time
299  * @param min minute of time
300  * @param sec second of time
301  */
302  Q_SCRIPTABLE Q_NOREPLY void setLocalTime(int yr, int mth, int day, int hr, int min, int sec);
303 
304  /** DBUS interface function. Set local time and date to present values acc. system clock
305  * @note Just a proxy for slotSetTimeToNow(), but it is better to
306  * keep the DBus interface separate from the internal methods.
307  */
308  Q_SCRIPTABLE Q_NOREPLY void setTimeToNow();
309 
310  /** DBUS interface function. Delay further execution of DBUS commands.
311  * @param t number of seconds to delay
312  */
313  Q_SCRIPTABLE Q_NOREPLY void waitFor(double t);
314 
315  /** DBUS interface function. Pause further DBUS execution until a key is pressed.
316  * @param k the key which will resume DBUS execution
317  */
318  Q_SCRIPTABLE Q_NOREPLY void waitForKey(const QString &k);
319 
320  /** DBUS interface function. Toggle tracking.
321  * @param track engage tracking if true; else disengage tracking
322  */
323  Q_SCRIPTABLE Q_NOREPLY void setTracking(bool track);
324 
325  /** DBUS interface function. modify a view option.
326  * @param option the name of the option to be modified
327  * @param value the option's new value
328  */
329  Q_SCRIPTABLE Q_NOREPLY void changeViewOption(const QString &option, const QString &value);
330 
331  /** DBUS interface function.
332  * @param name the name of the option to query
333  * @return the current value of the named option
334  * @note Deprecated because it's not clear how to list the options
335  */
336  Q_DECL_DEPRECATED Q_SCRIPTABLE QString getOption(const QString &name);
337 
338  /** DBUS interface function. Get the focus information as XML.
339  */
340  Q_SCRIPTABLE QString getFocusInformationXML();
341 
342  /** DBUS interface function. Read config file.
343  * This function is useful for restoring the user settings from the config file,
344  * after having modified the settings in memory.
345  * @sa writeConfig()
346  */
347  Q_SCRIPTABLE Q_NOREPLY void readConfig();
348 
349  /** DBUS interface function. Write current settings to config file.
350  * This function is useful for storing user settings before modifying them with a DBUS
351  * script. The original settings can be restored with readConfig().
352  * @sa readConfig()
353  */
354  Q_SCRIPTABLE Q_NOREPLY void writeConfig();
355 
356  /** DBUS interface function. Show text message in a popup window.
357  * @note Not Yet Implemented
358  * @param x x-coordinate for message window
359  * @param y y-coordinate for message window
360  * @param message the text to display in the message window
361  */
362  Q_SCRIPTABLE Q_NOREPLY void popupMessage(int x, int y, const QString &message);
363 
364  /** DBUS interface function. Draw a line on the sky map.
365  * @note Not Yet Implemented
366  * @param x1 starting x-coordinate of line
367  * @param y1 starting y-coordinate of line
368  * @param x2 ending x-coordinate of line
369  * @param y2 ending y-coordinate of line
370  * @param speed speed at which line should appear from start to end points (in pixels per second)
371  */
372  Q_SCRIPTABLE Q_NOREPLY void drawLine(int x1, int y1, int x2, int y2, int speed);
373 
374  /** DBUS interface function. Set the geographic location.
375  * @param city the city name of the location
376  * @param province the province name of the location
377  * @param country the country name of the location
378  * @return True if geographic location is found and set, false otherwise.
379  */
380  Q_SCRIPTABLE bool setGeoLocation(const QString &city, const QString &province, const QString &country);
381 
382  /**
383  * @brief location Returns a JSON Object (as string) that contains the following information:
384  * name: String
385  * province: String
386  * country: String
387  * longitude: Double (-180 to +180)
388  * latitude: Double (-90 to +90)
389  * tz0 (Time zone without DST): Double
390  * tz (Time zone with DST): Double
391  * @return Stringified JSON object as described above.
392  */
393  Q_SCRIPTABLE QString location();
394 
395  /** DBUS interface function. Set the GPS geographic location.
396  * @param longitude longitude in degrees (-180 West to +180 East)
397  * @param latitude latitude in degrees (-90 South to +90 North)
398  * @param elevation site elevation in meters
399  * @param tz0 Time zone offset WITHOUT daylight saving time.
400  * @return True if geographic location is set, false otherwise.
401  */
402  Q_SCRIPTABLE bool setGPSLocation(double longitude, double latitude, double elevation, double tz0);
403 
404  /** DBUS interface function. Modify a color.
405  * @param colorName the name of the color to be modified (e.g., "SkyColor")
406  * @param value the new color to use
407  */
408  Q_SCRIPTABLE Q_NOREPLY void setColor(const QString &colorName, const QString &value);
409 
410  /** DBUS interface function. Load a color scheme.
411  * @param name the name of the color scheme to load (e.g., "Moonless Night")
412  */
413  Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name);
414 
415  /** DBUS interface function. Export the sky image to a file.
416  * @param filename the filename for the exported image
417  * @param width the width for the exported image. Map's width will be used if nothing or an invalid value is supplied.
418  * @param height the height for the exported image. Map's height will be used if nothing or an invalid value is supplied.
419  * @param includeLegend should we include a legend?
420  */
421  Q_SCRIPTABLE Q_NOREPLY void exportImage(const QString &filename, int width = -1, int height = -1,
422  bool includeLegend = false);
423 
424  /** DBUS interface function. Return a URL to retrieve Digitized Sky Survey image.
425  * @param objectName name of the object.
426  * @note If the object is note found, the string "ERROR" is returned.
427  */
428  Q_SCRIPTABLE QString getDSSURL(const QString &objectName);
429 
430  /** DBUS interface function. Return a URL to retrieve Digitized Sky Survey image.
431  * @param RA_J2000 J2000.0 RA
432  * @param Dec_J2000 J2000.0 Declination
433  * @param width width of the image, in arcminutes (default = 15)
434  * @param height height of the image, in arcminutes (default = 15)
435  */
436  Q_SCRIPTABLE QString getDSSURL(double RA_J2000, double Dec_J2000, float width = 15, float height = 15);
437 
438  /** DBUS interface function. Return XML containing information about a sky object
439  * @param objectName name of the object.
440  * @param fallbackToInternet Attempt to resolve the name using internet databases if not found
441  * @param storeInternetResolved If we fell back to the internet, save the result in DSO database for future offline access
442  * @note If the object was not found, the XML is empty.
443  */
444  Q_SCRIPTABLE QString getObjectDataXML(const QString &objectName,
445  bool fallbackToInternet = false,
446  bool storeInternetResolved = true);
447 
448  /** DBUS interface function. Return XML containing position info about a sky object
449  * @param objectName name of the object.
450  * @note If the object was not found, the XML is empty.
451  */
452  Q_SCRIPTABLE QString getObjectPositionInfo(const QString &objectName);
453 
454  /** DBUS interface function. Render eyepiece view and save it in the file(s) specified
455  * @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).
456  * @note Important: If imagePath is empty, but overlay is true, or destPathImage is supplied, this method will make a blocking DSS download.
457  */
458  Q_SCRIPTABLE Q_NOREPLY void renderEyepieceView(const QString &objectName, const QString &destPathChart,
459  const double fovWidth = -1.0, const double fovHeight = -1.0,
460  const double rotation = 0.0, const double scale = 1.0,
461  const bool flip = false, const bool invert = false,
462  QString imagePath = QString(),
463  const QString &destPathImage = QString(), const bool overlay = false,
464  const bool invertColors = false);
465 
466  /** DBUS interface function. Set the approx field-of-view
467  * @param FOV_Degrees field of view in degrees
468  */
469  Q_SCRIPTABLE Q_NOREPLY void setApproxFOV(double FOV_Degrees);
470 
471  /** DBUS interface function. Get the dimensions of the Sky Map.
472  * @return a string containing widthxheight in pixels.
473  */
474  Q_SCRIPTABLE QString getSkyMapDimensions();
475 
476  /** DBUS interface function. Return a newline-separated list of objects in the observing wishlist.
477  * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list.
478  */
480 
481  /** DBUS interface function. Return a newline-separated list of objects in the observing session plan.
482  * @note Unfortunately, unnamed objects are troublesome. Hopefully, we don't have them on the observing list.
483  */
485 
486  /** DBUS interface function. Print the sky image.
487  * @param usePrintDialog if true, the KDE print dialog will be shown; otherwise, default parameters will be used
488  * @param useChartColors if true, the "Star Chart" color scheme will be used for the printout, which will save ink.
489  */
490  Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors);
491 
492  /** DBUS interface function. Open FITS image.
493  * @param imageUrl URL of FITS image to load. For a local file the prefix must be file:// For example
494  * if the file is located at /home/john/m42.fits then the full URL is file:///home/john/m42.fits
495  */
496  Q_SCRIPTABLE Q_NOREPLY void openFITS(const QUrl &imageUrl);
497 
498  /** @}*/
499 
500  signals:
501  /** DBUS interface notification. Color scheme was updated.
502  */
503  void colorSchemeChanged();
504 
505  public Q_SLOTS:
506  /**
507  * Update time-dependent data and (possibly) repaint the sky map.
508  * @param automaticDSTchange change DST status automatically?
509  */
510  void updateTime(const bool automaticDSTchange = true);
511 
512  /** action slot: sync kstars clock to system time */
513  void slotSetTimeToNow();
514 
515  /** Apply new settings and redraw skymap */
516  void slotApplyConfigChanges();
517 
518  /** Apply new settings for WI */
520 
521  /** Called when zoom level is changed. Enables/disables zoom
522  * actions and updates status bar. */
523  void slotZoomChanged();
524 
525  /** action slot: Allow user to specify a field-of-view angle for the display window in degrees,
526  * and set the zoom level accordingly. */
527  void slotSetZoom();
528 
529  /** action slot: Toggle whether kstars is tracking current position */
530  void slotTrack();
531 
532  /** action slot: open dialog for selecting a new geographic location */
533  void slotGeoLocator();
534 
535  /**
536  * @brief slotSetTelescopeEnabled call when telescope comes online or goes offline.
537  * @param enable True if telescope is online and connected, false otherwise.
538  */
539  void slotSetTelescopeEnabled(bool enable);
540 
541  /**
542  * @brief slotSetDomeEnabled call when dome comes online or goes offline.
543  * @param enable True if dome is online and connected, false otherwise.
544  */
545  void slotSetDomeEnabled(bool enable);
546 
547  /** Delete FindDialog because ObjNames list has changed in KStarsData due to
548  * reloading star data. So list in FindDialog must be new filled with current data. */
549  void clearCachedFindDialog();
550 
551  /** Remove all trails which may have been added to solar system bodies */
552  void slotClearAllTrails();
553 
554  /** Display position in the status bar. */
556 
557  /** action slot: open Flag Manager */
558  void slotFlagManager();
559 
560  /** Show the eyepiece view tool */
561  void slotEyepieceView(SkyPoint *sp, const QString &imagePath = QString());
562 
563  /** Show the DSO Catalog Management GUI */
564  void slotDSOCatalogGUI();
565 
566  /** action slot: open KStars startup wizard */
567  void slotWizard();
568 
569  void updateLocationFromWizard(const GeoLocation &geo);
570 
571  WIView *wiView()
572  {
573  return m_WIView;
574  }
575 
576  bool isWIVisible()
577  {
578  if (!m_WIView)
579  return false;
580  if (!m_wiDock)
581  return false;
582  return m_wiDock->isVisible();
583  }
584 
585  //FIXME Port to QML2
586  //#if 0
587  /** action slot: open What's Interesting settings window */
588  void slotWISettings();
589 
590  /** action slot: toggle What's Interesting window */
591  void slotToggleWIView();
592  //#endif
593 
594  private slots:
595  /** action slot: open a dialog for setting the time and date */
596  void slotSetTime();
597 
598  /** action slot: toggle whether kstars clock is running or not */
599  void slotToggleTimer();
600 
601  /** action slot: advance one step forward in time */
602  void slotStepForward();
603 
604  /** action slot: advance one step backward in time */
605  void slotStepBackward();
606 
607  /** action slot: open dialog for finding a named object */
608  void slotFind();
609 
610  /** action slot: open KNewStuff window to download extra data. */
611  void slotDownload();
612 
613  /** action slot: open KStars calculator to compute astronomical ephemeris */
614  void slotCalculator();
615 
616  /** action slot: open Elevation vs. Time tool */
617  void slotAVT();
618 
619  /** action slot: open What's up tonight dialog */
620  void slotWUT();
621 
622  /** action slot: open Sky Calendar tool */
623  void slotCalendar();
624 
625  /** action slot: open the glossary */
626  void slotGlossary();
627 
628  /** action slot: open ScriptBuilder dialog */
629  void slotScriptBuilder();
630 
631  /** action slot: open Solar system viewer */
632  void slotSolarSystem();
633 
634  /** action slot: open Jupiter Moons tool */
635  void slotJMoonTool();
636 
637  /** action slot: open Moon Phase Calendar tool */
638  void slotMoonPhaseTool();
639 
640 #if 0
641  /** action slot: open Telescope wizard */
642  void slotTelescopeWizard();
643 #endif
644 
645  /** action slot: open INDI driver panel */
646  void slotINDIDriver();
647 
648  /** action slot: open INDI control panel */
649  void slotINDIPanel();
650 
651  /** action slot: open Ekos panel */
652  void slotEkos();
653 
654  /** action slot: Track with the telescope (INDI) */
655  void slotINDITelescopeTrack();
656 
657  /**
658  * Action slot: Slew with the telescope (INDI)
659  *
660  * @param focused_object Slew to the focused object or the mouse pointer if false.
661  *
662  */
663  void slotINDITelescopeSlew(bool focused_object = true);
664  void slotINDITelescopeSlewMousePointer();
665 
666  /**
667  * Action slot: Sync the telescope (INDI)
668  *
669  * @param focused_object Sync the position of the focused object or the mouse pointer if false.
670  *
671  */
672  void slotINDITelescopeSync(bool focused_object = true);
673  void slotINDITelescopeSyncMousePointer();
674 
675  /** action slot: Abort any telescope motion (INDI) */
676  void slotINDITelescopeAbort();
677 
678  /** action slot: Park the telescope (INDI) */
679  void slotINDITelescopePark();
680 
681  /** action slot: Unpark the telescope (INDI) */
682  void slotINDITelescopeUnpark();
683 
684  /** action slot: Park the dome (INDI) */
685  void slotINDIDomePark();
686 
687  /** action slot: UnPark the dome (INDI) */
688  void slotINDIDomeUnpark();
689 
690  /** action slot: open dialog for setting the view options */
691  void slotViewOps();
692 
693  /** finish setting up after the kstarsData has finished */
694  void datainitFinished();
695 
696  /** Open FITS image. */
697  void slotOpenFITS();
698 
699  /** Action slot to save the sky image to a file.*/
700  void slotExportImage();
701 
702  /** Action slot to select a DBUS script and run it.*/
703  void slotRunScript();
704 
705  /** Action slot to print skymap. */
706  void slotPrint();
707 
708  /** Action slot to start Printing Wizard. */
709  void slotPrintingWizard();
710 
711  /** Action slot to show tip-of-the-day window. */
712  void slotTipOfDay();
713 
714  /** Action slot to set focus coordinates manually (opens FocusDialog). */
715  void slotManualFocus();
716 
717  /** Meta-slot to point the focus at special points (zenith, N, S, E, W).
718  * Uses the name of the Action which sent the Signal to identify the
719  * desired direction. */
720  void slotPointFocus();
721 
722  /** Meta-slot to set the color scheme according to the name of the
723  * Action which sent the activating signal. */
724  void slotColorScheme();
725 
726  /**
727  * @brief slotThemeChanged save theme name in options
728  */
729  void slotThemeChanged();
730 
731  /** Select the Target symbol (a.k.a. field-of-view indicator) */
732  void slotTargetSymbol(bool flag);
733 
734  /** Select the HIPS Source catalog. */
735  void slotHIPSSource();
736 
737  /** Invoke the Field-of-View symbol editor window */
738  void slotFOVEdit();
739 
740  /** Toggle between Equatorial and Ecliptic coordinate systems */
741  void slotCoordSys();
742 
743  /** Set the map projection according to the menu selection */
744  void slotMapProjection();
745 
746  /** Set the orientation parameters of the sky map */
747  void slotSkyMapOrientation();
748 
749  /** Toggle display of the observing list tool*/
750  void slotObsList();
751 
752  /** Meta-slot to handle display toggles for all of the viewtoolbar buttons.
753  * uses the name of the sender to identify the item to change. */
754  void slotViewToolBar();
755 
756  /** Meta-slot to handle display toggles for all of the INDItoolbar buttons.
757  * uses the name of the sender to identify the item to change. */
758  void slotINDIToolBar();
759 
760  /** Meta-slot to handle toggling display of GUI elements (toolbars and infoboxes)
761  * uses name of the sender action to identify the widget to hide/show. */
762  void slotShowGUIItem(bool);
763 
764  /** Toggle to and from full screen mode */
765  void slotFullScreen();
766 
767  /** Toggle whether to show the terrain image on the skymap. */
768  void slotTerrain();
769 
770  /** Toggle whether to show image overlays on the skymap. */
771  void slotImageOverlays();
772 
773  /** Save data to config file before exiting.*/
774  void slotAboutToQuit();
775 
776  void slotEquipmentWriter();
777 
778  void slotObserverManager();
779 
780  void slotHorizonManager();
781 
782  void slotExecute();
783 
784  void slotPolarisHourAngle();
785 
786  /** Update comets orbital elements*/
787  void slotUpdateComets(bool isAutoUpdate = false);
788 
789  /** Update asteroids orbital elements*/
790  void slotUpdateAsteroids(bool isAutoUpdate = false);
791 
792  /** Update list of recent supernovae*/
793  void slotUpdateSupernovae();
794 
795  /** Update satellites orbital elements*/
796  void slotUpdateSatellites();
797 
798  /** Configure Notifications */
799  void slotConfigureNotifications();
800 
801  private:
802  /** Load FOV information and repopulate menu. */
803  void repopulateFOV();
804 
805  /**
806  * @brief populateThemes Populate application themes
807  */
808  void populateThemes();
809 
810  /** Initialize Menu bar, toolbars and all Actions. */
811  void initActions();
812 
813  /** Prepare options dialog. */
814  KConfigDialog* prepareOps();
815 
816  /** Initialize Status bar. */
817  void initStatusBar();
818 
819  /** Initialize focus position */
820  void initFocus();
821 
822  /** Build the KStars main window */
823  void buildGUI();
824 
825  void closeEvent(QCloseEvent *event) override;
826 
827  public:
828  /** Check if the KStars main window is shown */
829  bool isGUIReady()
830  {
831  return m_SkyMap != nullptr;
832  }
833 
834  /** Was KStars started with the clock running, or paused? */
836  {
837  return StartClockRunning;
838  }
839 
840  /// Set to true when the application is being closed
841  static bool Closing;
842 
843  /** @brief Override KStars UI resource file.
844  * @note This is used by UI tests, which need to use the same resources with a different app name
845  */
846  static bool setResourceFile(QString const rc);
847 
848  private:
849  /// Pointer to an instance of KStars
850  static KStars *pinstance;
851 
852  // Resource file to load - overridable by UI tests
853  static QString m_KStarsUIResource;
854 
855  KActionMenu *colorActionMenu { nullptr };
856  KActionMenu *fovActionMenu { nullptr };
857  KActionMenu *hipsActionMenu { nullptr };
858  KActionMenu *orientationActionMenu { nullptr };
859 
860  KStarsData *m_KStarsData { nullptr };
861  SkyMap *m_SkyMap { nullptr };
862 
863  // Widgets
864  TimeStepBox *m_TimeStepBox { nullptr };
865 
866  // Dialogs & Tools
867 
868  // File Menu
869  ExportImageDialog *m_ExportImageDialog { nullptr };
870  PrintingWizard *m_PrintingWizard { nullptr };
871 
872  // Tool Menu
873  AstroCalc *m_AstroCalc { nullptr };
874  AltVsTime *m_AltVsTime { nullptr };
875  SkyCalendar *m_SkyCalendar { nullptr };
876  ScriptBuilder *m_ScriptBuilder { nullptr };
877  PlanetViewer *m_PlanetViewer { nullptr };
878  WUTDialog *m_WUTDialog { nullptr };
879  JMoonTool *m_JMoonTool { nullptr };
880  FlagManager *m_FlagManager { nullptr };
881  HorizonManager *m_HorizonManager { nullptr };
882  EyepieceField *m_EyepieceView { nullptr };
883 #ifdef HAVE_CFITSIO
884  QSharedPointer<FITSViewer> m_GenericFITSViewer;
885  QList<QSharedPointer<FITSViewer>> m_FITSViewers;
886 #endif
887 
888 #ifdef HAVE_INDI
889  QPointer<Ekos::Manager> m_EkosManager;
890 #endif
891 
892  AddDeepSkyObject *m_addDSODialog { nullptr };
893 
894  // FIXME Port to QML2
895  //#if 0
896  WIView *m_WIView { nullptr };
897  WILPSettings *m_WISettings { nullptr };
898  WIEquipSettings *m_WIEquipmentSettings { nullptr };
899  ObsConditions *m_ObsConditions { nullptr };
900  QDockWidget *m_wiDock { nullptr };
901  //#endif
902 
903  QActionGroup *projectionGroup { nullptr };
904  QActionGroup *skymapOrientationGroup { nullptr };
905  QActionGroup *cschemeGroup { nullptr };
906  QActionGroup *hipsGroup { nullptr };
907  QActionGroup *telescopeGroup { nullptr };
908  QActionGroup *domeGroup { nullptr };
909 
910  bool DialogIsObsolete { false };
911  bool StartClockRunning { false };
912  QString StartDateString;
913  QLabel AltAzField, RADecField, J2000RADecField;
914  //QPalette OriginalPalette, DarkPalette;
915 
916  OpsCatalog *opcatalog { nullptr };
917  OpsGuides *opguides { nullptr };
918  OpsTerrain *opterrain { nullptr };
919  OpsImageOverlay *opsImageOverlay { nullptr };
920  OpsDeveloper *opsdeveloper { nullptr };
921  OpsSolarSystem *opsolsys { nullptr };
922  OpsSatellites *opssatellites { nullptr };
923  OpsSupernovae *opssupernovae { nullptr };
924  OpsColors *opcolors { nullptr };
925  OpsAdvanced *opadvanced { nullptr };
926  OpsINDI *opsindi { nullptr };
927  OpsEkos *opsekos { nullptr };
928  OpsFITS *opsfits { nullptr };
929  OpsXplanet *opsxplanet { nullptr };
930 
931  friend class TestArtificialHorizon;
932 };
Q_OBJECTQ_OBJECT
Q_SCRIPTABLE QString getObjectDataXML(const QString &objectName, bool fallbackToInternet=false, bool storeInternetResolved=true)
DBUS interface function.
Definition: kstarsdbus.cpp:738
Q_SCRIPTABLE Q_NOREPLY void defaultZoom()
DBUS interface function.
Definition: kstarsdbus.cpp:197
Q_DECL_DEPRECATED Q_SCRIPTABLE QString getOption(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:375
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition: kstars.cpp:556
Q_PROPERTY(...)
Q_SCRIPTABLE Q_NOREPLY void drawLine(int x1, int y1, int x2, int y2, int speed)
DBUS interface function.
Definition: kstarsdbus.cpp:248
bool isStartedWithClockRunning()
Was KStars started with the clock running, or paused?
Definition: kstars.h:835
void slotSetDomeEnabled(bool enable)
slotSetDomeEnabled call when dome comes online or goes offline.
void slotFlagManager()
action slot: open Flag Manager
Class representing Printing Wizard for KStars printed documents (currently only finder charts).
Q_SCRIPTABLE Q_NOREPLY void removeTrail(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:172
Q_SLOTSQ_SLOTS
Q_SCRIPTABLE Q_NOREPLY void waitFor(double t)
DBUS interface function.
Definition: kstarsdbus.cpp:212
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:76
Q_SCRIPTABLE Q_NOREPLY void waitForKey(const QString &k)
DBUS interface function.
Definition: kstarsdbus.cpp:222
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
void slotSetTelescopeEnabled(bool enable)
slotSetTelescopeEnabled call when telescope comes online or goes offline.
Q_CLASSINFO(Name, Value)
void slotSetTimeToNow()
action slot: sync kstars clock to system time
void slotToggleWIView()
action slot: toggle What's Interesting window
Shows a moon phase calendar for an entire month.
Definition: moonphasetool.h:37
Backends for exporting a sky image, either raster or vector, with a legend.
Definition: imageexporter.h:23
Q_SCRIPTABLE QString getObservingSessionPlanObjectNames()
DBUS interface function.
Definition: kstarsdbus.cpp:982
bool event(QEvent *event) override
Q_SCRIPTABLE Q_NOREPLY void addLabel(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:142
Manages adding/removing and editing regions and points associated with user-customized artificial hor...
Find Object Dialog.
Definition: finddialog.h:42
void colorSchemeChanged()
DBUS interface notification.
void slotApplyConfigChanges()
Apply new settings and redraw skymap.
Manages the QML user interface for What's Interesting. WIView is used to display the QML UI using a Q...
Definition: wiview.h:32
Q_SCRIPTABLE QString getFocusInformationXML()
DBUS interface function.
Definition: kstarsdbus.cpp:395
SkyMap * map() const
Definition: kstars.h:141
void slotDSOCatalogGUI()
Show the DSO Catalog Management GUI.
Q_SCRIPTABLE Q_NOREPLY void lookTowards(const QString &direction)
DBUS interface function.
Definition: kstarsdbus.cpp:75
Flag manager Dialog box to add and remove flags.
Definition: flagmanager.h:35
Q_SCRIPTABLE Q_NOREPLY void setColor(const QString &colorName, const QString &value)
DBUS interface function.
Definition: kstarsdbus.cpp:616
Q_SCRIPTABLE QString getObjectPositionInfo(const QString &objectName)
DBUS interface function.
Definition: kstarsdbus.cpp:819
Q_SCRIPTABLE Q_NOREPLY void changeViewOption(const QString &option, const QString &value)
DBUS interface function.
Definition: kstarsdbus.cpp:419
void slotSetZoom()
action slot: Allow user to specify a field-of-view angle for the display window in degrees,...
Q_SCRIPTABLE Q_NOREPLY void readConfig()
DBUS interface function.
Definition: kstarsdbus.cpp:350
bool isGUIReady()
Check if the KStars main window is shown.
Definition: kstars.h:829
static KStars * Instance()
Definition: kstars.h:123
Export sky image dialog.
Q_SCRIPTABLE Q_NOREPLY void zoomOut()
DBUS interface function.
Definition: kstarsdbus.cpp:192
bool isVisible() const const
Q_SCRIPTABLE Q_NOREPLY void setAltAz(double alt, double az, bool altIsRefracted=false)
DBUS interface function.
Definition: kstarsdbus.cpp:61
Renders the view through the eyepiece of various telescope types.
Definition: eyepiecefield.h:36
User interface for "Light Pollution Settings" page in WI settings dialog This class deals with light ...
Definition: wilpsettings.h:22
This is the base class for the KStars astronomical calculator.
Definition: astrocalc.h:25
Q_SCRIPTABLE bool setGeoLocation(const QString &city, const QString &province, const QString &country)
DBUS interface function.
Definition: kstarsdbus.cpp:271
void syncOps()
Sync Options to GUI, if any.
User interface for "Equipment Type and Parameters" page in WI settings dialog.
Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:631
the Altitude vs. Time Tool. Plot the altitude as a function of time for any list of objects,...
Definition: altvstime.h:40
static bool setResourceFile(QString const rc)
Override KStars UI resource file.
Definition: kstarsinit.cpp:125
Q_SCRIPTABLE QString getSkyMapDimensions()
DBUS interface function.
Definition: kstarsdbus.cpp:998
void releaseResources()
Syncs config file.
Definition: kstars.cpp:273
Primary window to view monochrome and color FITS images. The FITSviewer can open multiple images each...
Definition: fitsviewer.h:49
void slotShowPositionBar(SkyPoint *)
Display position in the status bar.
void slotWizard()
action slot: open KStars startup wizard
Q_SCRIPTABLE Q_NOREPLY void setTracking(bool track)
DBUS interface function.
Definition: kstarsdbus.cpp:237
Q_SCRIPTABLE Q_NOREPLY void zoomIn()
DBUS interface function.
Definition: kstarsdbus.cpp:187
Display the positions of Jupiter's moons as a function of time.
Definition: jmoontool.h:23
Q_SCRIPTABLE Q_NOREPLY void setLocalTime(int yr, int mth, int day, int hr, int min, int sec)
DBUS interface function.
Definition: kstarsdbus.cpp:202
Q_SCRIPTABLE Q_NOREPLY void zoom(double z)
DBUS interface function.
Definition: kstarsdbus.cpp:182
Q_SCRIPTABLE Q_NOREPLY void renderEyepieceView(const QString &objectName, const QString &destPathChart, const double fovWidth=-1.0, const double fovHeight=-1.0, const double rotation=0.0, const double scale=1.0, const bool flip=false, const bool invert=false, QString imagePath=QString(), const QString &destPathImage=QString(), const bool overlay=false, const bool invertColors=false)
DBUS interface function.
Definition: kstarsdbus.cpp:918
void slotZoomChanged()
Called when zoom level is changed.
This is the main window for KStars. In addition to the GUI elements, the class contains the program c...
Definition: kstars.h:90
Display an overhead view of the solar system.
Definition: planetviewer.h:37
void slotApplyWIConfigChanges()
Apply new settings for WI.
Q_SCRIPTABLE Q_NOREPLY void writeConfig()
DBUS interface function.
Definition: kstarsdbus.cpp:367
Q_SCRIPTABLE QString location()
location Returns a JSON Object (as string) that contains the following information: name: String prov...
Definition: kstarsdbus.cpp:253
Q_SCRIPTABLE Q_NOREPLY void openFITS(const QUrl &imageUrl)
DBUS interface function.
static bool Closing
Set to true when the application is being closed.
Definition: kstars.h:841
void repopulateHIPS()
Load HIPS information and repopulate menu.
Definition: kstarsinit.cpp:778
void slotTrack()
action slot: Toggle whether kstars is tracking current position
Primary class to handle all Ekos modules. The Ekos Manager class manages startup and shutdown of INDI...
Definition: manager.h:41
Composite spinbox for specifying a time step. This composite widget consists of a TimeSpinBox (a QSpi...
Definition: timestepbox.h:27
~KStars() override
Destructor.
Definition: kstars.cpp:247
Q_SCRIPTABLE QString getObservingWishListObjectNames()
DBUS interface function.
Definition: kstarsdbus.cpp:971
Q_SCRIPTABLE Q_NOREPLY void exportImage(const QString &filename, int width=-1, int height=-1, bool includeLegend=false)
DBUS interface function.
Definition: kstarsdbus.cpp:703
Canvas widget for displaying the sky bitmap; also handles user interaction events.
Definition: skymap.h:53
Catalog page of the Options window.
Definition: opscatalog.h:27
Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setRaDec(double ra, double dec)
DBUS interface function.
Definition: kstarsdbus.cpp:44
void slotWISettings()
action slot: open What's Interesting settings window
void removeColorMenuItem(const QString &actionName)
Remove an item from the color-scheme action manu.
void addColorMenuItem(QString name, const QString &actionName)
Add an item to the color-scheme action manu.
Q_SCRIPTABLE Q_NOREPLY void removeLabel(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:152
KStarsData * data() const
Definition: kstars.h:135
Q_SCRIPTABLE Q_NOREPLY void setApproxFOV(double FOV_Degrees)
DBUS interface function.
Definition: kstarsdbus.cpp:993
The Solar System page of the Options window.
Q_SCRIPTABLE Q_NOREPLY void setRaDecJ2000(double ra0, double dec0)
DBUS interface function.
Definition: kstarsdbus.cpp:51
void clearCachedFindDialog()
Delete FindDialog because ObjNames list has changed in KStarsData due to reloading star data.
Definition: kstars.cpp:292
Q_SCRIPTABLE Q_NOREPLY void addTrail(const QString &name)
DBUS interface function.
Definition: kstarsdbus.cpp:162
Q_SCRIPTABLE Q_NOREPLY void popupMessage(int x, int y, const QString &message)
DBUS interface function.
Definition: kstarsdbus.cpp:243
Q_SCRIPTABLE QString getDSSURL(const QString &objectName)
DBUS interface function.
Definition: kstarsdbus.cpp:719
void slotClearAllTrails()
Remove all trails which may have been added to solar system bodies.
void slotGeoLocator()
action slot: open dialog for selecting a new geographic location
The Colors page of the Options window.
Definition: opscolors.h:31
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
Definition: kstars.cpp:310
static KStars * createInstance(bool doSplash, bool clockrunning=true, const QString &startDateString=QString())
Create an instance of this class.
Definition: kstars.cpp:238
Q_SCRIPTABLE bool setGPSLocation(double longitude, double latitude, double elevation, double tz0)
DBUS interface function.
Definition: kstarsdbus.cpp:325
QString message
void slotEyepieceView(SkyPoint *sp, const QString &imagePath=QString())
Show the eyepiece view tool.
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
Q_SCRIPTABLE Q_NOREPLY void setTimeToNow()
DBUS interface function.
Definition: kstarsdbus.cpp:207
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Dec 6 2023 04:05:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.