1 /* 2 SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org> 3 SPDX-License-Identifier: GPL-2.0-or-later 4 */ 5 6 #pragma once 7 8 #include "config-kstars.h" 9 10 #include <KXmlGuiWindow> 11 #include <KLocalizedString> 12 #include <QLabel> 13 14 #include <QDockWidget> 15 #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) 16 #include <QtDBus/qtdbusglobal.h> 17 #else 18 #include <QtDBus/qdbusmacros.h> 19 #endif 20 #ifdef HAVE_CFITSIO 21 #include <QPointer> 22 #endif 23 24 // forward declaration is enough. We only need pointers 25 class QActionGroup; 26 class QDockWidget; 27 class QPalette; 28 class KActionMenu; 29 class KConfigDialog; 30 31 class KStarsData; 32 class SkyPoint; 33 class SkyMap; 34 class GeoLocation; 35 class FindDialog; 36 class TimeStepBox; 37 class ImageExporter; 38 39 class AltVsTime; 40 class WUTDialog; 41 class WIView; 42 class WILPSettings; 43 class WIEquipSettings; 44 class ObsConditions; 45 class AstroCalc; 46 class SkyCalendar; 47 class ScriptBuilder; 48 class PlanetViewer; 49 class JMoonTool; 50 class MoonPhaseTool; 51 class FlagManager; 52 class Execute; 53 class ExportImageDialog; 54 class PrintingWizard; 55 class HorizonManager; 56 class EyepieceField; 57 class AddDeepSkyObject; 58 59 class OpsCatalog; 60 class OpsGuides; 61 class OpsSolarSystem; 62 class OpsSatellites; 63 class OpsSupernovae; 64 class OpsTerrain; 65 class OpsColors; 66 class OpsAdvanced; 67 class OpsINDI; 68 class OpsEkos; 69 class OpsFITS; 70 class OpsXplanet; 71 72 namespace Ekos 73 { 74 class Manager; 75 } 76 77 #ifdef HAVE_CFITSIO 78 class FITSViewer; 79 #endif 80 81 /** 82 *@class KStars 83 *@short This is the main window for KStars. 84 *In addition to the GUI elements, the class contains the program clock, 85 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 86 create an instance and KStars::Instance() to get a pointer to the instance 87 *@author Jason Harris, Jasem Mutlaq 88 *@version 1.1 89 */ 90 91 class KStars : public KXmlGuiWindow 92 { 93 Q_OBJECT 94 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars") 95 Q_SCRIPTABLE Q_PROPERTY(QString colorScheme READ colorScheme WRITE loadColorScheme NOTIFY colorSchemeChanged) 96 97 public: 98 Q_SCRIPTABLE QString colorScheme() const; 99 100 private: 101 /** 102 * @short Constructor. 103 * @param doSplash should the splash panel be displayed during 104 * initialization. 105 * @param startClockRunning should the clock be running on startup? 106 * @param startDateString date (in string representation) to start running from. 107 * 108 * @todo Refer to documentation on date format. 109 */ 110 explicit KStars(bool doSplash, bool startClockRunning = true, const QString &startDateString = QString()); 111 112 public: 113 /** 114 * @short Create an instance of this class. Destroy any previous instance 115 * @param doSplash 116 * @param clockrunning 117 * @param startDateString 118 * @note See KStars::KStars for details on parameters 119 * @return a pointer to the instance 120 */ 121 static KStars *createInstance(bool doSplash, bool clockrunning = true, const QString &startDateString = QString()); 122 123 /** @return a pointer to the instance of this class */ Instance()124 inline static KStars *Instance() 125 { 126 return pinstance; 127 } 128 129 /** Destructor. */ 130 ~KStars() override; 131 132 /** Syncs config file. Deletes objects. */ 133 void releaseResources(); 134 135 /** @return pointer to KStarsData object which contains application data. */ data()136 inline KStarsData *data() const 137 { 138 return m_KStarsData; 139 } 140 141 /** @return pointer to SkyMap object which is the sky display widget. */ map()142 inline SkyMap *map() const 143 { 144 return m_SkyMap; 145 } 146 flagManager()147 inline FlagManager *flagManager() const 148 { 149 return m_FlagManager; 150 } 151 printingWizard()152 inline PrintingWizard *printingWizard() const 153 { 154 return m_PrintingWizard; 155 } 156 157 #ifdef HAVE_CFITSIO 158 // void addFITSViewer(const QSharedPointer<FITSViewer> &fv); 159 const QPointer<FITSViewer> &genericFITSViewer(); 160 const QPointer<FITSViewer> &createFITSViewer(); 161 void clearAllViewers(); 162 #endif 163 164 /** Add an item to the color-scheme action manu 165 * @param name The name to use in the menu 166 * @param actionName The internal name for the action (derived from filename) 167 */ 168 void addColorMenuItem(QString name, const QString &actionName); 169 170 /** Remove an item from the color-scheme action manu 171 * @param actionName The internal name of the action (derived from filename) 172 */ 173 void removeColorMenuItem(const QString &actionName); 174 175 /** @short Apply config options throughout the program. 176 * In most cases, options are set in the "Options" object directly, 177 * but for some things we have to manually react to config changes. 178 * @param doApplyFocus If true, then focus position will be set 179 * from config file 180 */ 181 void applyConfig(bool doApplyFocus = true); 182 183 /** Sync Options to GUI, if any */ 184 void syncOps(); 185 186 void showImgExportDialog(); 187 188 void syncFOVActions(); 189 190 void hideAllFovExceptFirst(); 191 192 void selectNextFov(); 193 194 void selectPreviousFov(); 195 196 void showWISettingsUI(); 197 198 void showWI(ObsConditions *obs); 199 200 /** Load HIPS information and repopulate menu. */ 201 void repopulateHIPS(); 202 getWIEquipSettings()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 */ 473 Q_SCRIPTABLE QString getObservingWishListObjectNames(); 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 */ 478 Q_SCRIPTABLE QString getObservingSessionPlanObjectNames(); 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 */ 513 void slotApplyWIConfigChanges(); 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. */ 549 void slotShowPositionBar(SkyPoint *); 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 wiView()565 WIView *wiView() 566 { 567 return m_WIView; 568 } 569 isWIVisible()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 /** Toggle display of the observing list tool*/ 741 void slotObsList(); 742 743 /** Meta-slot to handle display toggles for all of the viewtoolbar buttons. 744 * uses the name of the sender to identify the item to change. */ 745 void slotViewToolBar(); 746 747 /** Meta-slot to handle display toggles for all of the INDItoolbar buttons. 748 * uses the name of the sender to identify the item to change. */ 749 void slotINDIToolBar(); 750 751 /** Meta-slot to handle toggling display of GUI elements (toolbars and infoboxes) 752 * uses name of the sender action to identify the widget to hide/show. */ 753 void slotShowGUIItem(bool); 754 755 /** Toggle to and from full screen mode */ 756 void slotFullScreen(); 757 758 /** Toggle whether to show the terrain image on the skymap. */ 759 void slotTerrain(); 760 761 /** Save data to config file before exiting.*/ 762 void slotAboutToQuit(); 763 764 void slotEquipmentWriter(); 765 766 void slotObserverManager(); 767 768 void slotHorizonManager(); 769 770 void slotExecute(); 771 772 void slotPolarisHourAngle(); 773 774 /** Update comets orbital elements*/ 775 void slotUpdateComets(bool isAutoUpdate = false); 776 777 /** Update asteroids orbital elements*/ 778 void slotUpdateAsteroids(bool isAutoUpdate = false); 779 780 /** Update list of recent supernovae*/ 781 void slotUpdateSupernovae(); 782 783 /** Update satellites orbital elements*/ 784 void slotUpdateSatellites(); 785 786 /** Configure Notifications */ 787 void slotConfigureNotifications(); 788 789 private: 790 /** Load FOV information and repopulate menu. */ 791 void repopulateFOV(); 792 793 /** 794 * @brief populateThemes Populate application themes 795 */ 796 void populateThemes(); 797 798 /** Initialize Menu bar, toolbars and all Actions. */ 799 void initActions(); 800 801 /** Prepare options dialog. */ 802 KConfigDialog* prepareOps(); 803 804 /** Initialize Status bar. */ 805 void initStatusBar(); 806 807 /** Initialize focus position */ 808 void initFocus(); 809 810 /** Build the KStars main window */ 811 void buildGUI(); 812 813 void closeEvent(QCloseEvent *event) override; 814 815 public: 816 /** Check if the KStars main window is shown */ isGUIReady()817 bool isGUIReady() 818 { 819 return m_SkyMap != nullptr; 820 } 821 822 /** Was KStars started with the clock running, or paused? */ isStartedWithClockRunning()823 bool isStartedWithClockRunning() 824 { 825 return StartClockRunning; 826 } 827 828 /// Set to true when the application is being closed 829 static bool Closing; 830 831 /** @brief Override KStars UI resource file. 832 * @note This is used by UI tests, which need to use the same resources with a different app name 833 */ 834 static bool setResourceFile(QString const rc); 835 836 private: 837 /// Pointer to an instance of KStars 838 static KStars *pinstance; 839 840 // Resource file to load - overridable by UI tests 841 static QString m_KStarsUIResource; 842 843 KActionMenu *colorActionMenu { nullptr }; 844 KActionMenu *fovActionMenu { nullptr }; 845 KActionMenu *hipsActionMenu { nullptr }; 846 847 KStarsData *m_KStarsData { nullptr }; 848 SkyMap *m_SkyMap { nullptr }; 849 850 // Widgets 851 TimeStepBox *m_TimeStepBox { nullptr }; 852 853 // Dialogs & Tools 854 855 // File Menu 856 ExportImageDialog *m_ExportImageDialog { nullptr }; 857 PrintingWizard *m_PrintingWizard { nullptr }; 858 859 // Tool Menu 860 AstroCalc *m_AstroCalc { nullptr }; 861 AltVsTime *m_AltVsTime { nullptr }; 862 SkyCalendar *m_SkyCalendar { nullptr }; 863 ScriptBuilder *m_ScriptBuilder { nullptr }; 864 PlanetViewer *m_PlanetViewer { nullptr }; 865 WUTDialog *m_WUTDialog { nullptr }; 866 JMoonTool *m_JMoonTool { nullptr }; 867 FlagManager *m_FlagManager { nullptr }; 868 HorizonManager *m_HorizonManager { nullptr }; 869 EyepieceField *m_EyepieceView { nullptr }; 870 #ifdef HAVE_CFITSIO 871 QPointer<FITSViewer> m_GenericFITSViewer; 872 QList<QPointer<FITSViewer>> m_FITSViewers; 873 #endif 874 875 #ifdef HAVE_INDI 876 QPointer<Ekos::Manager> m_EkosManager; 877 #endif 878 879 AddDeepSkyObject *m_addDSODialog { nullptr }; 880 881 // FIXME Port to QML2 882 //#if 0 883 WIView *m_WIView { nullptr }; 884 WILPSettings *m_WISettings { nullptr }; 885 WIEquipSettings *m_WIEquipmentSettings { nullptr }; 886 ObsConditions *m_ObsConditions { nullptr }; 887 QDockWidget *m_wiDock { nullptr }; 888 //#endif 889 890 QActionGroup *projectionGroup { nullptr }; 891 QActionGroup *cschemeGroup { nullptr }; 892 QActionGroup *hipsGroup { nullptr }; 893 QActionGroup *telescopeGroup { nullptr }; 894 QActionGroup *domeGroup { nullptr }; 895 896 bool DialogIsObsolete { false }; 897 bool StartClockRunning { false }; 898 QString StartDateString; 899 QLabel AltAzField, RADecField, J2000RADecField; 900 //QPalette OriginalPalette, DarkPalette; 901 902 OpsCatalog *opcatalog { nullptr }; 903 OpsGuides *opguides { nullptr }; 904 OpsTerrain *opterrain { nullptr }; 905 OpsSolarSystem *opsolsys { nullptr }; 906 OpsSatellites *opssatellites { nullptr }; 907 OpsSupernovae *opssupernovae { nullptr }; 908 OpsColors *opcolors { nullptr }; 909 OpsAdvanced *opadvanced { nullptr }; 910 OpsINDI *opsindi { nullptr }; 911 OpsEkos *opsekos { nullptr }; 912 OpsFITS *opsfits { nullptr }; 913 OpsXplanet *opsxplanet { nullptr }; 914 915 friend class TestArtificialHorizon; 916 }; 917