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

KDE's Doxygen guidelines are available online.