Kstars

kstarsinit.cpp
1 /*
2  SPDX-FileCopyrightText: 2002 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "kstars.h"
8 
9 #include "fov.h"
10 #include "kspaths.h"
11 #include "kstarsdata.h"
12 #include "kstars_debug.h"
13 #include "Options.h"
14 #include "skymap.h"
15 #include "texturemanager.h"
16 #include "projections/projector.h"
17 #include "skycomponents/skymapcomposite.h"
18 #include "skyobjects/ksplanetbase.h"
19 #include "widgets/timespinbox.h"
20 #include "widgets/timestepbox.h"
21 #include "widgets/timeunitbox.h"
22 #include "hips/hipsmanager.h"
23 #include "auxiliary/thememanager.h"
24 
25 #ifdef HAVE_INDI
26 #include "indi/drivermanager.h"
27 #include "indi/guimanager.h"
28 #include "ekos/manager.h"
29 #endif
30 
31 #include <KActionCollection>
32 #include <KActionMenu>
33 #include <KTipDialog>
34 #include <KToggleAction>
35 #include <KToolBar>
36 
37 #include <QMenu>
38 #include <QStatusBar>
39 
40 //This file contains functions that kstars calls at startup (except constructors).
41 //These functions are declared in kstars.h
42 
43 namespace
44 {
45 // A lot of QAction is defined there. In order to decrease amount
46 // of boilerplate code a trick with << operator overloading is used.
47 // This makes code more concise and readable.
48 //
49 // When data type could not used directly. Either because of
50 // overloading rules or because one data type have different
51 // semantics its wrapped into struct.
52 //
53 // Downside is unfamiliar syntax and really unhelpful error
54 // messages due to general abuse of << overloading
55 
56 // Set QAction text
58 {
59  ka->setText(text);
60  return ka;
61 }
62 // Set icon for QAction
63 QAction *operator<<(QAction *ka, const QIcon &icon)
64 {
65  ka->setIcon(icon);
66  return ka;
67 }
68 // Set keyboard shortcut
69 QAction *operator<<(QAction *ka, const QKeySequence sh)
70 {
72  //ka->setShortcut(sh);
73  return ka;
74 }
75 
76 // Add action to group. AddToGroup struct acts as newtype wrapper
77 // in order to allow overloading.
78 struct AddToGroup
79 {
80  QActionGroup *grp;
81  AddToGroup(QActionGroup *g) : grp(g) {}
82 };
83 QAction *operator<<(QAction *ka, AddToGroup g)
84 {
85  g.grp->addAction(ka);
86  return ka;
87 }
88 
89 // Set checked property. Checked is newtype wrapper.
90 struct Checked
91 {
92  bool flag;
93  Checked(bool f) : flag(f) {}
94 };
95 QAction *operator<<(QAction *ka, Checked chk)
96 {
97  ka->setCheckable(true);
98  ka->setChecked(chk.flag);
99  return ka;
100 }
101 
102 // Set tool tip. ToolTip is used as newtype wrapper.
103 struct ToolTip
104 {
105  QString tip;
106  ToolTip(QString msg) : tip(msg) {}
107 };
108 QAction *operator<<(QAction *ka, const ToolTip &tool)
109 {
110  ka->setToolTip(tool.tip);
111  return ka;
112 }
113 
114 // Create new KToggleAction and connect slot to toggled(bool) signal
115 QAction *newToggleAction(KActionCollection *col, QString name, QString text, QObject *receiver, const char *member)
116 {
117  QAction *ka = col->add<KToggleAction>(name) << text;
118  QObject::connect(ka, SIGNAL(toggled(bool)), receiver, member);
119  return ka;
120 }
121 }
122 
123 // Resource file override - used by UI tests
124 QString KStars::m_KStarsUIResource = "kstarsui.rc";
126 {
127  if (QFile(rc).exists())
128  {
129  m_KStarsUIResource = rc;
130  return true;
131  }
132  else return false;
133 }
134 
135 
136 void KStars::initActions()
137 {
138  // Check if we have this specific Breeze icon. If not, try to set the theme search path and if appropriate, the icon theme rcc file
139  // in each OS
140  if (!QIcon::hasThemeIcon(QLatin1String("kstars_flag")))
141  KSTheme::Manager::instance()->setIconTheme(KSTheme::Manager::BREEZE_DARK_THEME);
142 
143  QAction *ka;
144 
145  // ==== File menu ================
146  ka = new QAction(QIcon::fromTheme("favorites"), i18n("Download New Data..."), this);
147  connect(ka, &QAction::triggered, this, &KStars::slotDownload);
149  ka->setWhatsThis(i18n("Downloads new data"));
150  ka->setToolTip(ka->whatsThis());
151  ka->setStatusTip(ka->whatsThis());
152  actionCollection()->addAction(QStringLiteral("get_data"), ka);
153 
154 #ifdef HAVE_CFITSIO
155  actionCollection()->addAction("open_file", this, SLOT(slotOpenFITS()))
156  << i18n("Open Image...") << QIcon::fromTheme("document-open")
158 #endif
159  actionCollection()->addAction("export_image", this, SLOT(slotExportImage()))
160  << i18n("&Save Sky Image...")
161  << QIcon::fromTheme("document-export-image");
162 
163  // 2017-09-17 Jasem: FIXME! Scripting does not work properly under non UNIX systems.
164  // It must be updated to use DBus session bus from Qt (like scheduler)
165 #ifndef Q_OS_WIN
166  actionCollection()->addAction("run_script", this, SLOT(slotRunScript()))
167  << i18n("&Run Script...") << QIcon::fromTheme("system-run")
169 #endif
170  actionCollection()->addAction("printing_wizard", this, SLOT(slotPrintingWizard()))
171  << i18nc("start Printing Wizard", "Printing &Wizard...");
172  ka = actionCollection()->addAction(KStandardAction::Print, "print", this, SLOT(slotPrint()));
173  ka->setIcon(QIcon::fromTheme("document-print"));
174  //actionCollection()->addAction( KStandardAction::Quit, "quit", this, SLOT(close) );
175  ka = actionCollection()->addAction(KStandardAction::Quit, "quit", qApp, SLOT(closeAllWindows()));
176  ka->setIcon(QIcon::fromTheme("application-exit"));
177 
178  // ==== Time Menu ================
179  actionCollection()->addAction("time_to_now", this, SLOT(slotSetTimeToNow()))
180  << i18n("Set Time to &Now") << QKeySequence(Qt::CTRL + Qt::Key_E)
181  << QIcon::fromTheme("clock");
182 
183  actionCollection()->addAction("time_dialog", this, SLOT(slotSetTime()))
184  << i18nc("set Clock to New Time", "&Set Time...") << QKeySequence(Qt::CTRL + Qt::Key_S)
185  << QIcon::fromTheme("clock");
186 
187  ka = actionCollection()->add<KToggleAction>("clock_startstop")
188  << i18n("Stop &Clock")
189  << QIcon::fromTheme("media-playback-pause");
190  if (!StartClockRunning)
191  ka->toggle();
192  QObject::connect(ka, SIGNAL(triggered()), this, SLOT(slotToggleTimer()));
193 
194  // If we are started in --paused state make sure the icon reflects that now
195  if (StartClockRunning == false)
196  {
197  QAction *a = actionCollection()->action("clock_startstop");
198  if (a)
199  a->setIcon(QIcon::fromTheme("run-build-install-root"));
200  }
201 
202  QObject::connect(data()->clock(), &SimClock::clockToggled, [ = ](bool toggled)
203  {
204  QAction *a = actionCollection()->action("clock_startstop");
205  if (a)
206  {
207  a->setChecked(toggled);
208  // Many users forget to unpause KStars, so we are using run-build-install-root icon which is red
209  // and stands out from the rest of the icons so users are aware when KStars is paused visually
210  a->setIcon(toggled ? QIcon::fromTheme("run-build-install-root") : QIcon::fromTheme("media-playback-pause"));
211  a->setToolTip(toggled ? i18n("Resume Clock") : i18n("Stop Clock"));
212  }
213  });
214  //UpdateTime() if clock is stopped (so hidden objects get drawn)
215  QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), this, SLOT(updateTime()));
216  actionCollection()->addAction("time_step_forward", this, SLOT(slotStepForward()))
217  << i18n("Advance One Step Forward in Time")
218  << QIcon::fromTheme("media-skip-forward")
220  actionCollection()->addAction("time_step_backward", this, SLOT(slotStepBackward()))
221  << i18n("Advance One Step Backward in Time")
222  << QIcon::fromTheme("media-skip-backward")
224 
225  // ==== Pointing Menu ================
226  actionCollection()->addAction("zenith", this, SLOT(slotPointFocus())) << i18n("&Zenith") << QKeySequence("Z");
227  actionCollection()->addAction("north", this, SLOT(slotPointFocus())) << i18n("&North") << QKeySequence("N");
228  actionCollection()->addAction("east", this, SLOT(slotPointFocus())) << i18n("&East") << QKeySequence("E");
229  actionCollection()->addAction("south", this, SLOT(slotPointFocus())) << i18n("&South") << QKeySequence("S");
230  actionCollection()->addAction("west", this, SLOT(slotPointFocus())) << i18n("&West") << QKeySequence("W");
231 
232  actionCollection()->addAction("find_object", this, SLOT(slotFind()))
233  << i18n("&Find Object...") << QIcon::fromTheme("edit-find")
235  actionCollection()->addAction("track_object", this, SLOT(slotTrack()))
236  << i18n("Engage &Tracking")
237  << QIcon::fromTheme("object-locked")
239  actionCollection()->addAction("manual_focus", this, SLOT(slotManualFocus()))
240  << i18n("Set Coordinates &Manually...") << QKeySequence(Qt::CTRL + Qt::Key_M);
241 
242  QAction *action;
243 
244  // ==== View Menu ================
245  action = actionCollection()->addAction(KStandardAction::ZoomIn, "zoom_in", map(), SLOT(slotZoomIn()));
246  action->setIcon(QIcon::fromTheme("zoom-in"));
247 
248  action = actionCollection()->addAction(KStandardAction::ZoomOut, "zoom_out", map(), SLOT(slotZoomOut()));
249  action->setIcon(QIcon::fromTheme("zoom-out"));
250 
251  actionCollection()->addAction("zoom_default", map(), SLOT(slotZoomDefault()))
252  << i18n("&Default Zoom") << QIcon::fromTheme("zoom-fit-best")
254  actionCollection()->addAction("zoom_set", this, SLOT(slotSetZoom()))
255  << i18n("&Zoom to Angular Size...")
256  << QIcon::fromTheme("zoom-original")
258 
259  action = actionCollection()->addAction(KStandardAction::FullScreen, this, SLOT(slotFullScreen()));
260  action->setIcon(QIcon::fromTheme("view-fullscreen"));
261 
262  actionCollection()->addAction("coordsys", this, SLOT(slotCoordSys()))
263  << (Options::useAltAz() ? i18n("Switch to Star Globe View (Equatorial &Coordinates)") :
264  i18n("Switch to Horizonal View (Horizontal &Coordinates)"))
265  << QKeySequence("Space");
266 
267  actionCollection()->addAction("toggle_terrain", this, SLOT(slotTerrain()))
268  << (Options::showTerrain() ? i18n("Hide Terrain") :
269  i18n("Show Terrain"))
270  << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T);
271 
272  actionCollection()->addAction("project_lambert", this, SLOT(slotMapProjection()))
273  << i18n("&Lambert Azimuthal Equal-area") << QKeySequence("F5") << AddToGroup(projectionGroup)
274  << Checked(Options::projection() == Projector::Lambert);
275  actionCollection()->addAction("project_azequidistant", this, SLOT(slotMapProjection()))
276  << i18n("&Azimuthal Equidistant") << QKeySequence("F6") << AddToGroup(projectionGroup)
277  << Checked(Options::projection() == Projector::AzimuthalEquidistant);
278  actionCollection()->addAction("project_orthographic", this, SLOT(slotMapProjection()))
279  << i18n("&Orthographic") << QKeySequence("F7") << AddToGroup(projectionGroup)
280  << Checked(Options::projection() == Projector::Orthographic);
281  actionCollection()->addAction("project_equirectangular", this, SLOT(slotMapProjection()))
282  << i18n("&Equirectangular") << QKeySequence("F8") << AddToGroup(projectionGroup)
283  << Checked(Options::projection() == Projector::Equirectangular);
284  actionCollection()->addAction("project_stereographic", this, SLOT(slotMapProjection()))
285  << i18n("&Stereographic") << QKeySequence("F9") << AddToGroup(projectionGroup)
286  << Checked(Options::projection() == Projector::Stereographic);
287  actionCollection()->addAction("project_gnomonic", this, SLOT(slotMapProjection()))
288  << i18n("&Gnomonic") << QKeySequence("F10") << AddToGroup(projectionGroup)
289  << Checked(Options::projection() == Projector::Gnomonic);
290 
291  //Settings Menu:
292  //Info Boxes option actions
293  QAction *kaBoxes = actionCollection()->add<KToggleAction>("show_boxes")
294  << i18nc("Show the information boxes", "Show &Info Boxes") << Checked(Options::showInfoBoxes());
295  connect(kaBoxes, SIGNAL(toggled(bool)), map(), SLOT(slotToggleInfoboxes(bool)));
296  kaBoxes->setChecked(Options::showInfoBoxes());
297 
298  ka = actionCollection()->add<KToggleAction>("show_time_box")
299  << i18nc("Show time-related info box", "Show &Time Box");
300  connect(kaBoxes, SIGNAL(toggled(bool)), ka, SLOT(setEnabled(bool)));
301  connect(ka, SIGNAL(toggled(bool)), map(), SLOT(slotToggleTimeBox(bool)));
302  ka->setChecked(Options::showTimeBox());
303  ka->setEnabled(Options::showInfoBoxes());
304 
305  ka = actionCollection()->add<KToggleAction>("show_focus_box")
306  << i18nc("Show focus-related info box", "Show &Focus Box");
307  connect(kaBoxes, SIGNAL(toggled(bool)), ka, SLOT(setEnabled(bool)));
308  connect(ka, SIGNAL(toggled(bool)), map(), SLOT(slotToggleFocusBox(bool)));
309  ka->setChecked(Options::showFocusBox());
310  ka->setEnabled(Options::showInfoBoxes());
311 
312  ka = actionCollection()->add<KToggleAction>("show_location_box")
313  << i18nc("Show location-related info box", "Show &Location Box");
314  connect(kaBoxes, SIGNAL(toggled(bool)), ka, SLOT(setEnabled(bool)));
315  connect(ka, SIGNAL(toggled(bool)), map(), SLOT(slotToggleGeoBox(bool)));
316  ka->setChecked(Options::showGeoBox());
317  ka->setEnabled(Options::showInfoBoxes());
318 
319  //Toolbar options
320  newToggleAction(actionCollection(), "show_mainToolBar", i18n("Show Main Toolbar"), toolBar("kstarsToolBar"),
321  SLOT(setVisible(bool)));
322  newToggleAction(actionCollection(), "show_viewToolBar", i18n("Show View Toolbar"), toolBar("viewToolBar"),
323  SLOT(setVisible(bool)));
324 
325  //Statusbar view options
326  newToggleAction(actionCollection(), "show_statusBar", i18n("Show Statusbar"), this, SLOT(slotShowGUIItem(bool)));
327  newToggleAction(actionCollection(), "show_sbAzAlt", i18n("Show Az/Alt Field"), this, SLOT(slotShowGUIItem(bool)));
328  newToggleAction(actionCollection(), "show_sbRADec", i18n("Show RA/Dec Field"), this, SLOT(slotShowGUIItem(bool)));
329  newToggleAction(actionCollection(), "show_sbJ2000RADec", i18n("Show J2000.0 RA/Dec Field"), this,
330  SLOT(slotShowGUIItem(bool)));
331 
332 
333  populateThemes();
334 
335  //Color scheme actions. These are added to the "colorschemes" KActionMenu.
336  colorActionMenu = actionCollection()->add<KActionMenu>("colorschemes");
337  colorActionMenu->setText(i18n("C&olor Schemes"));
338  addColorMenuItem(i18n("&Classic"), "cs_classic");
339  addColorMenuItem(i18n("&Star Chart"), "cs_chart");
340  addColorMenuItem(i18n("&Night Vision"), "cs_night");
341  addColorMenuItem(i18n("&Moonless Night"), "cs_moonless-night");
342 
343  //Add any user-defined color schemes:
344  //determine filename in local user KDE directory tree.
345  QFile file(KSPaths::locate(QStandardPaths::AppLocalDataLocation, "colors.dat"));
346  if (file.exists() && file.open(QIODevice::ReadOnly))
347  {
348  QTextStream stream(&file);
349  while (!stream.atEnd())
350  {
351  QString line = stream.readLine();
352  QString schemeName = line.left(line.indexOf(':'));
353  QString actionname = "cs_" + line.mid(line.indexOf(':') + 1, line.indexOf('.') - line.indexOf(':') - 1);
354  addColorMenuItem(i18n(schemeName.toLocal8Bit()), actionname.toLocal8Bit());
355  }
356  file.close();
357  }
358 
359  //Add FOV Symbol actions
360  fovActionMenu = actionCollection()->add<KActionMenu>("fovsymbols");
361  fovActionMenu->setText(i18n("&FOV Symbols"));
362  fovActionMenu->setDelayed(false);
363  fovActionMenu->setIcon(QIcon::fromTheme("crosshairs"));
365  repopulateFOV();
366 
367  //Add HIPS Sources actions
368  hipsActionMenu = actionCollection()->add<KActionMenu>("hipssources");
369  hipsActionMenu->setText(i18n("HiPS All Sky Overlay"));
370  hipsActionMenu->setDelayed(false);
371  hipsActionMenu->setIcon(QIcon::fromTheme("view-preview"));
372  HIPSManager::Instance()->readSources();
373  repopulateHIPS();
374 
375  actionCollection()->addAction("geolocation", this, SLOT(slotGeoLocator()))
376  << i18nc("Location on Earth", "&Geographic...")
377  << QIcon::fromTheme("kstars_xplanet")
379 
380  // Configure Notifications
381 #ifdef HAVE_NOTIFYCONFIG
382  KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection());
383 #endif
384 
385  // Prepare the options dialog early for modules to connect signals
386  prepareOps();
387 
388  ka = actionCollection()->addAction(KStandardAction::Preferences, "configure", this, SLOT(slotViewOps()));
389  //I am not sure what icon preferences is supposed to be.
390  //ka->setIcon( QIcon::fromTheme(""));
391 
392  actionCollection()->addAction("startwizard", this, SLOT(slotWizard()))
393  << i18n("Startup Wizard...")
394  << QIcon::fromTheme("tools-wizard");
395 
396  // Manual data entry
397  actionCollection()->addAction("dso_catalog_gui", this, SLOT(slotDSOCatalogGUI()))
398  << i18n("Manage DSO Catalogs");
399 
400  // Updates actions
401  actionCollection()->addAction("update_comets", this, SLOT(slotUpdateComets()))
402  << i18n("Update Comets Orbital Elements");
403  actionCollection()->addAction("update_asteroids", this, SLOT(slotUpdateAsteroids()))
404  << i18n("Update Asteroids Orbital Elements");
405  actionCollection()->addAction("update_supernovae", this, SLOT(slotUpdateSupernovae()))
406  << i18n("Update Recent Supernovae Data");
407  actionCollection()->addAction("update_satellites", this, SLOT(slotUpdateSatellites()))
408  << i18n("Update Satellites Orbital Elements");
409 
410  //Tools Menu:
411  actionCollection()->addAction("astrocalculator", this, SLOT(slotCalculator()))
412  << i18n("Calculator")
413  << QIcon::fromTheme("accessories-calculator")
415 
416  /* FIXME Enable once port to KF5 is complete for moonphasetool
417  actionCollection()->addAction("moonphasetool", this, SLOT(slotMoonPhaseTool()) )
418  << i18n("Moon Phase Calendar");
419  */
420 
421  actionCollection()->addAction("obslist", this, SLOT(slotObsList()))
422  << i18n("Observation Planner") << QKeySequence(Qt::CTRL + Qt::Key_L);
423 
424  actionCollection()->addAction("altitude_vs_time", this, SLOT(slotAVT()))
425  << i18n("Altitude vs. Time") << QKeySequence(Qt::CTRL + Qt::Key_A);
426 
427  actionCollection()->addAction("whats_up_tonight", this, SLOT(slotWUT()))
428  << i18n("What's up Tonight") << QKeySequence(Qt::CTRL + Qt::Key_U);
429 
430  //FIXME Port to QML2
431  //#if 0
432  actionCollection()->addAction("whats_interesting", this, SLOT(slotToggleWIView()))
433  << i18n("What's Interesting...") << QKeySequence(Qt::CTRL + Qt::Key_W);
434  //#endif
435 
436  actionCollection()->addAction("XPlanet", map(), SLOT(slotStartXplanetViewer()))
437  << i18n("XPlanet Solar System Simulator") << QKeySequence(Qt::CTRL + Qt::Key_X);
438 
439  actionCollection()->addAction("skycalendar", this, SLOT(slotCalendar())) << i18n("Sky Calendar");
440 
441 #ifdef HAVE_INDI
442  ka = actionCollection()->addAction("ekos", this, SLOT(slotEkos()))
443  << i18n("Ekos") << QKeySequence(Qt::CTRL + Qt::Key_K);
445 #endif
446 
447  //FIXME: implement glossary
448  // ka = actionCollection()->addAction("glossary");
449  // ka->setText( i18n("Glossary...") );
450  // ka->setShortcuts( QKeySequence(Qt::CTRL+Qt::Key_K ) );
451  // connect( ka, SIGNAL(triggered()), this, SLOT(slotGlossary()) );
452 
453  // 2017-09-17 Jasem: FIXME! Scripting does not work properly under non UNIX systems.
454  // It must be updated to use DBus session bus from Qt (like scheduler)
455 #ifndef Q_OS_WIN
456  actionCollection()->addAction("scriptbuilder", this, SLOT(slotScriptBuilder()))
457  << i18n("Script Builder") << QKeySequence(Qt::CTRL + Qt::Key_B);
458 #endif
459 
460  actionCollection()->addAction("solarsystem", this, SLOT(slotSolarSystem()))
461  << i18n("Solar System") << QKeySequence(Qt::CTRL + Qt::Key_Y);
462 
463  // Disabled until fixed later
464  actionCollection()->addAction("jmoontool", this, SLOT(slotJMoonTool()) )
465  << i18n("Jupiter's Moons")
467 
468  actionCollection()->addAction("flagmanager", this, SLOT(slotFlagManager())) << i18n("Flags");
469 
470  actionCollection()->addAction("equipmentwriter", this, SLOT(slotEquipmentWriter()))
471  << i18n("List your &Equipment...") << QIcon::fromTheme("kstars") << QKeySequence(Qt::CTRL + Qt::Key_0);
472  actionCollection()->addAction("manageobserver", this, SLOT(slotObserverManager()))
473  << i18n("Manage Observer...") << QIcon::fromTheme("im-user") << QKeySequence(Qt::CTRL + Qt::Key_1);
474 
475  //TODO only enable it when finished
476  actionCollection()->addAction("artificialhorizon", this, SLOT(slotHorizonManager()))
477  << i18n("Artificial Horizon...");
478 
479  // ==== observation menu - execute ================
480  actionCollection()->addAction("execute", this, SLOT(slotExecute()))
481  << i18n("Execute the Session Plan...") << QKeySequence(Qt::CTRL + Qt::Key_2);
482 
483  // ==== observation menu - polaris hour angle ================
484  actionCollection()->addAction("polaris_hour_angle", this, SLOT(slotPolarisHourAngle()))
485  << i18n("Polaris Hour Angle...");
486 
487  // ==== devices Menu ================
488 #ifdef HAVE_INDI
489 #ifndef Q_OS_WIN
490 #if 0
491  actionCollection()->addAction("telescope_wizard", this, SLOT(slotTelescopeWizard()))
492  << i18n("Telescope Wizard...")
493  << QIcon::fromTheme("tools-wizard");
494 #endif
495 #endif
496  actionCollection()->addAction("device_manager", this, SLOT(slotINDIDriver()))
497  << i18n("Device Manager...")
498  << QIcon::fromTheme("network-server")
500  actionCollection()->addAction("custom_drivers", DriverManager::Instance(), SLOT(showCustomDrivers()))
501  << i18n("Custom Drivers...")
502  << QIcon::fromTheme("address-book-new");
503  ka = actionCollection()->addAction("indi_cpl", this, SLOT(slotINDIPanel()))
504  << i18n("INDI Control Panel...")
507  ka->setEnabled(false);
508 #else
509  //FIXME need to disable/hide devices submenu in the tools menu. It is created from the kstarsui.rc file
510  //but I don't know how to hide/disable it yet. menuBar()->findChildren<QMenu *>() does not return any children that I can
511  //iterate over. Anyway to resolve this?
512 #endif
513 
514  //Help Menu:
515  ka = actionCollection()->addAction(KStandardAction::TipofDay, "help_tipofday", this, SLOT(slotTipOfDay()));
516  ka->setWhatsThis(i18n("Displays the Tip of the Day"));
517  ka->setIcon(QIcon::fromTheme("help-hint"));
518  // KStandardAction::help(this, SLOT(appHelpActivated()), actionCollection(), "help_contents" );
519 
520  //Add timestep widget for toolbar
521  m_TimeStepBox = new TimeStepBox(toolBar("kstarsToolBar"));
522  // Add a tool tip to TimeStep describing the weird nature of time steps
523  QString TSBToolTip = i18nc("Tooltip describing the nature of the time step control",
524  "Use this to set the rate at which time in the simulation flows.\nFor time step \'X\' "
525  "up to 10 minutes, time passes at the rate of \'X\' per second.\nFor time steps larger "
526  "than 10 minutes, frames are displayed at an interval of \'X\'.");
527  m_TimeStepBox->setToolTip(TSBToolTip);
528  m_TimeStepBox->tsbox()->setToolTip(TSBToolTip);
529  QWidgetAction *wa = new QWidgetAction(this);
530  wa->setDefaultWidget(m_TimeStepBox);
531 
532  // Add actions for the timestep widget's functions
533  actionCollection()->addAction("timestep_control", wa) << i18n("Time step control");
534  const auto unitbox = m_TimeStepBox->unitbox();
535  ka = actionCollection()->addAction("timestep_increase_units", unitbox->increaseUnitsAction());
537  ka = actionCollection()->addAction("timestep_decrease_units", unitbox->decreaseUnitsAction());
539 
540  // ==== viewToolBar actions ================
541  actionCollection()->add<KToggleAction>("show_stars", this, SLOT(slotViewToolBar()))
542  << i18nc("Toggle Stars in the display", "Stars")
543  << QIcon::fromTheme("kstars_stars")
544  << ToolTip(i18n("Toggle stars"));
545  actionCollection()->add<KToggleAction>("show_deepsky", this, SLOT(slotViewToolBar()))
546  << i18nc("Toggle Deep Sky Objects in the display", "Deep Sky")
547  << QIcon::fromTheme("kstars_deepsky")
548  << ToolTip(i18n("Toggle deep sky objects"));
549  actionCollection()->add<KToggleAction>("show_planets", this, SLOT(slotViewToolBar()))
550  << i18nc("Toggle Solar System objects in the display", "Solar System")
551  << QIcon::fromTheme("kstars_planets")
552  << ToolTip(i18n("Toggle Solar system objects"));
553  actionCollection()->add<KToggleAction>("show_clines", this, SLOT(slotViewToolBar()))
554  << i18nc("Toggle Constellation Lines in the display", "Const. Lines")
555  << QIcon::fromTheme("kstars_clines")
556  << ToolTip(i18n("Toggle constellation lines"));
557  actionCollection()->add<KToggleAction>("show_cnames", this, SLOT(slotViewToolBar()))
558  << i18nc("Toggle Constellation Names in the display", "Const. Names")
559  << QIcon::fromTheme("kstars_cnames")
560  << ToolTip(i18n("Toggle constellation names"));
561  actionCollection()->add<KToggleAction>("show_cbounds", this, SLOT(slotViewToolBar()))
562  << i18nc("Toggle Constellation Boundaries in the display", "C. Boundaries")
563  << QIcon::fromTheme("kstars_cbound")
564  << ToolTip(i18n("Toggle constellation boundaries"));
565  actionCollection()->add<KToggleAction>("show_constellationart", this, SLOT(slotViewToolBar()))
566  << xi18nc("Toggle Constellation Art in the display", "C. Art (BETA)")
567  << QIcon::fromTheme("kstars_constellationart")
568  << ToolTip(xi18n("Toggle constellation art (BETA)"));
569  actionCollection()->add<KToggleAction>("show_mw", this, SLOT(slotViewToolBar()))
570  << i18nc("Toggle Milky Way in the display", "Milky Way")
571  << QIcon::fromTheme("kstars_mw")
572  << ToolTip(i18n("Toggle milky way"));
573  actionCollection()->add<KToggleAction>("show_equatorial_grid", this, SLOT(slotViewToolBar()))
574  << i18nc("Toggle Equatorial Coordinate Grid in the display", "Equatorial coord. grid")
575  << QIcon::fromTheme("kstars_grid")
576  << ToolTip(i18n("Toggle equatorial coordinate grid"));
577  actionCollection()->add<KToggleAction>("show_horizontal_grid", this, SLOT(slotViewToolBar()))
578  << i18nc("Toggle Horizontal Coordinate Grid in the display", "Horizontal coord. grid")
579  << QIcon::fromTheme("kstars_hgrid")
580  << ToolTip(i18n("Toggle horizontal coordinate grid"));
581  actionCollection()->add<KToggleAction>("show_horizon", this, SLOT(slotViewToolBar()))
582  << i18nc("Toggle the opaque fill of the ground polygon in the display", "Ground")
583  << QIcon::fromTheme("kstars_horizon")
584  << ToolTip(i18n("Toggle opaque ground"));
585  actionCollection()->add<KToggleAction>("show_flags", this, SLOT(slotViewToolBar()))
586  << i18nc("Toggle flags in the display", "Flags")
587  << QIcon::fromTheme("kstars_flag")
588  << ToolTip(i18n("Toggle flags"));
589  actionCollection()->add<KToggleAction>("show_satellites", this, SLOT(slotViewToolBar()))
590  << i18nc("Toggle satellites in the display", "Satellites")
591  << QIcon::fromTheme("kstars_satellites")
592  << ToolTip(i18n("Toggle satellites"));
593  actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT(slotViewToolBar()))
594  << i18nc("Toggle supernovae in the display", "Supernovae")
595  << QIcon::fromTheme("kstars_supernovae")
596  << ToolTip(i18n("Toggle supernovae"));
597  actionCollection()->add<KToggleAction>("show_whatsinteresting", this, SLOT(slotToggleWIView()))
598  << i18nc("Toggle What's Interesting", "What's Interesting")
599  << QIcon::fromTheme("view-list-details")
600  << ToolTip(i18n("Toggle What's Interesting"));
601 
602 #ifdef HAVE_INDI
603  // ==== INDIToolBar actions ================
604  actionCollection()->add<KToggleAction>("show_ekos", this, SLOT(slotINDIToolBar()))
605  << i18nc("Toggle Ekos in the display", "Ekos")
606  << QIcon::fromTheme("kstars_ekos")
607  << ToolTip(i18n("Toggle Ekos"));
608  ka = actionCollection()->add<KToggleAction>("show_control_panel", this, SLOT(slotINDIToolBar()))
609  << i18nc("Toggle the INDI Control Panel in the display", "INDI Control Panel")
610  << QIcon::fromTheme("kstars_indi")
611  << ToolTip(i18n("Toggle INDI Control Panel"));
612  ka->setEnabled(false);
613  ka = actionCollection()->add<KToggleAction>("show_fits_viewer", this, SLOT(slotINDIToolBar()))
614  << i18nc("Toggle the FITS Viewer in the display", "FITS Viewer")
615  << QIcon::fromTheme("kstars_fitsviewer")
616  << ToolTip(i18n("Toggle FITS Viewer"));
617  ka->setEnabled(false);
618 
619  ka = actionCollection()->add<KToggleAction>("show_sensor_fov", this, SLOT(slotINDIToolBar()))
620  << i18nc("Toggle the sensor Field of View", "Sensor FOV")
621  << QIcon::fromTheme("archive-extract")
622  << ToolTip(i18n("Toggle Sensor FOV"));
623  ka->setEnabled(false);
624  ka->setChecked(Options::showSensorFOV());
625 
626  ka = actionCollection()->add<KToggleAction>("show_mosaic_panel", this, SLOT(slotINDIToolBar()))
627  << i18nc("Toggle the Mosaic Panel", "Mosaic Panel")
628  << QIcon::fromTheme("zoom-draw")
629  << ToolTip(i18n("Toggle Mosaic Panel"));
630  ka->setEnabled(true);
631  ka->setChecked(Options::showMosaicPanel());
632 
633  ka = actionCollection()->add<KToggleAction>("show_mount_box", this, SLOT(slotINDIToolBar()))
634  << i18nc("Toggle the Mount Control Panel", "Mount Control")
635  << QIcon::fromTheme("draw-text")
636  << ToolTip(i18n("Toggle Mount Control Panel"));
637  telescopeGroup->addAction(ka);
638 
639  ka = actionCollection()->add<KToggleAction>("lock_telescope", this, SLOT(slotINDIToolBar()))
640  << i18nc("Toggle the telescope center lock in display", "Center Telescope")
641  << QIcon::fromTheme("center_telescope", QIcon(":/icons/center_telescope.svg"))
642  << ToolTip(i18n("Toggle Lock Telescope Center"));
643  telescopeGroup->addAction(ka);
644 
645  ka = actionCollection()->add<KToggleAction>("telescope_track", this, SLOT(slotINDITelescopeTrack()))
646  << i18n("Toggle Telescope Tracking")
647  << QIcon::fromTheme("object-locked");
648  telescopeGroup->addAction(ka);
649  ka = actionCollection()->addAction("telescope_slew", this, SLOT(slotINDITelescopeSlew()))
650  << i18n("Slew telescope to the focused object")
651  << QIcon::fromTheme("object-rotate-right");
652  telescopeGroup->addAction(ka);
653  ka = actionCollection()->addAction("telescope_sync", this, SLOT(slotINDITelescopeSync()))
654  << i18n("Sync telescope to the focused object")
655  << QIcon::fromTheme("media-record");
656  telescopeGroup->addAction(ka);
657  ka = actionCollection()->addAction("telescope_abort", this, SLOT(slotINDITelescopeAbort()))
658  << i18n("Abort telescope motions")
659  << QIcon::fromTheme("process-stop");
661  telescopeGroup->addAction(ka);
662  ka = actionCollection()->addAction("telescope_park", this, SLOT(slotINDITelescopePark()))
663  << i18n("Park telescope")
664  << QIcon::fromTheme("flag-red");
665  telescopeGroup->addAction(ka);
666  ka = actionCollection()->addAction("telescope_unpark", this, SLOT(slotINDITelescopeUnpark()))
667  << i18n("Unpark telescope")
668  << QIcon::fromTheme("flag-green");
670  telescopeGroup->addAction(ka);
671 
672  actionCollection()->addAction("telescope_slew_mouse", this, SLOT(slotINDITelescopeSlewMousePointer()))
673  << i18n("Slew the telescope to the mouse pointer position");
674 
675  actionCollection()->addAction("telescope_sync_mouse", this, SLOT(slotINDITelescopeSyncMousePointer()))
676  << i18n("Sync the telescope to the mouse pointer position");
677 
678  // Disable all telescope actions by default
679  telescopeGroup->setEnabled(false);
680 
681  // Dome Actions
682  ka = actionCollection()->addAction("dome_park", this, SLOT(slotINDIDomePark()))
683  << i18n("Park dome")
684  << QIcon::fromTheme("dome-park", QIcon(":/icons/dome-park.svg"));
685  domeGroup->addAction(ka);
686  ka = actionCollection()->addAction("dome_unpark", this, SLOT(slotINDIDomeUnpark()))
687  << i18n("Unpark dome")
688  << QIcon::fromTheme("dome-unpark", QIcon(":/icons/dome-unpark.svg"));
690  domeGroup->addAction(ka);
691 
692  domeGroup->setEnabled(false);
693 #endif
694 }
695 
696 void KStars::repopulateFOV()
697 {
698  // Read list of all FOVs
699  //qDeleteAll( data()->availFOVs );
700  data()->availFOVs = FOVManager::getFOVs();
701  data()->syncFOV();
702 
703  // Iterate through FOVs
704  fovActionMenu->menu()->clear();
705  foreach (FOV *fov, data()->availFOVs)
706  {
707  KToggleAction *kta = actionCollection()->add<KToggleAction>(fov->name());
708  kta->setText(fov->name());
709  if (Options::fOVNames().contains(fov->name()))
710  {
711  kta->setChecked(true);
712  }
713 
714  fovActionMenu->addAction(kta);
715  connect(kta, SIGNAL(toggled(bool)), this, SLOT(slotTargetSymbol(bool)));
716  }
717  // Add menu bottom
718  QAction *ka = actionCollection()->addAction("edit_fov", this, SLOT(slotFOVEdit())) << i18n("Edit FOV Symbols...");
719  fovActionMenu->addSeparator();
720  fovActionMenu->addAction(ka);
721 }
722 
724 {
725  // Iterate through actions
726  hipsActionMenu->menu()->clear();
727  // Remove all actions
728  QList<QAction*> actions = hipsGroup->actions();
729 
730  for (auto &action : actions)
731  hipsGroup->removeAction(action);
732 
733  QAction *ka = actionCollection()->addAction(i18n("None"), this, SLOT(slotHIPSSource()))
734  << i18n("None") << AddToGroup(hipsGroup)
735  << Checked(Options::hIPSSource() == "None");
736 
737  hipsActionMenu->addAction(ka);
738  hipsActionMenu->addSeparator();
739 
740  for (QMap<QString, QString> source : HIPSManager::Instance()->getHIPSSources())
741  {
742  QString title = source.value("obs_title");
743 
744  QAction *newAction = actionCollection()->addAction(title, this, SLOT(slotHIPSSource()))
745  << title << AddToGroup(hipsGroup)
746  << Checked(Options::hIPSSource() == title);
747 
748  hipsActionMenu->addAction(newAction);
749  }
750 
751  // Hips settings
752  ka = actionCollection()->addAction("hipssettings", HIPSManager::Instance(),
753  SLOT(showSettings())) << i18n("HiPS Settings...");
754  hipsActionMenu->addSeparator();
755  hipsActionMenu->addAction(ka);
756 }
757 
758 void KStars::initStatusBar()
759 {
760  statusBar()->showMessage(i18n(" Welcome to KStars "));
761 
762  QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
763 
764  AltAzField.setHidden(!Options::showAltAzField());
765  AltAzField.setText(s);
766  statusBar()->insertPermanentWidget(0, &AltAzField);
767 
768  RADecField.setHidden(!Options::showRADecField());
769  RADecField.setText(s);
770  statusBar()->insertPermanentWidget(1, &RADecField);
771 
772  J2000RADecField.setHidden(!Options::showJ2000RADecField());
773  J2000RADecField.setText(s);
774  statusBar()->insertPermanentWidget(2, &J2000RADecField);
775 
776  if (!Options::showStatusBar())
777  statusBar()->hide();
778 }
779 
780 void KStars::datainitFinished()
781 {
782  //Time-related connections
783  connect(data()->clock(), &SimClock::timeAdvanced, this, [this]()
784  {
785  updateTime();
786  });
787  connect(data()->clock(), &SimClock::timeChanged, this, [this]()
788  {
789  updateTime();
790  });
791 
792  //Add GUI elements to main window
793  buildGUI();
794 
796 
798  connect(m_TimeStepBox, &TimeStepBox::scaleChanged, data(), &KStarsData::setTimeDirection);
799  connect(m_TimeStepBox, &TimeStepBox::scaleChanged, data()->clock(), &SimClock::setClockScale);
800 
801  //Do not start the clock if "--paused" specified on the cmd line
802  if (StartClockRunning)
803  {
804  // The initial time is set when KStars is first executed
805  // but until all data is loaded, some time elapsed already so we need to synchronize if no Start Date string
806  // was supplied to KStars
807  if (StartDateString.isEmpty())
809 
810  data()->clock()->start();
811  }
812 
813  // Connect cache function for Find dialog
814  connect(data(), SIGNAL(clearCache()), this, SLOT(clearCachedFindDialog()));
815 
816  //Propagate config settings
817  applyConfig(false);
818 
819  //show the window. must be before kswizard and messageboxes
820  show();
821 
822  //Initialize focus
823  initFocus();
824 
825  data()->setFullTimeUpdate();
826  updateTime();
827 
828  // Initial State
829  qCDebug(KSTARS) << "Date/Time is:" << data()->clock()->utc().toString();
830  qCDebug(KSTARS) << "Location:" << data()->geo()->fullName();
831  qCDebug(KSTARS) << "TZ0:" << data()->geo()->TZ0() << "TZ:" << data()->geo()->TZ();
832 
833  KSTheme::Manager::instance()->setCurrentTheme(Options::currentTheme());
834 
835  //If this is the first startup, show the wizard
836  if (Options::runStartupWizard())
837  {
838  slotWizard();
839  }
840 
841  //Show TotD
842  KTipDialog::showTip(this, "kstars/tips");
843 
844  // Update comets and asteroids if enabled.
845  if (Options::orbitalElementsAutoUpdate())
846  {
847  slotUpdateComets(true);
848  slotUpdateAsteroids(true);
849  }
850 
851 #ifdef HAVE_INDI
852  Ekos::Manager::Instance()->initialize();
853 #endif
854 }
855 
856 void KStars::initFocus()
857 {
858  //Case 1: tracking on an object
859  if (Options::isTracking() && Options::focusObject() != i18n("nothing"))
860  {
861  SkyObject *oFocus;
862  if (Options::focusObject() == i18n("star"))
863  {
864  SkyPoint p(Options::focusRA(), Options::focusDec());
865  double maxrad = 1.0;
866 
867  oFocus = data()->skyComposite()->starNearest(&p, maxrad);
868  }
869  else
870  {
871  oFocus = data()->objectNamed(Options::focusObject());
872  }
873 
874  if (oFocus)
875  {
876  map()->setFocusObject(oFocus);
877  map()->setClickedObject(oFocus);
878  map()->setFocusPoint(oFocus);
879  }
880  else
881  {
882  qWarning() << "Cannot center on " << Options::focusObject() << ": no object found.";
883  }
884 
885  //Case 2: not tracking, and using Alt/Az coords. Set focus point using
886  //FocusRA as the Azimuth, and FocusDec as the Altitude
887  }
888  else if (!Options::isTracking() && Options::useAltAz())
889  {
890  SkyPoint pFocus;
891  pFocus.setAz(Options::focusRA());
892  pFocus.setAlt(Options::focusDec());
893  pFocus.HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
894  map()->setFocusPoint(&pFocus);
895 
896  //Default: set focus point using FocusRA as the RA and
897  //FocusDec as the Dec
898  }
899  else
900  {
901  SkyPoint pFocus(Options::focusRA(), Options::focusDec());
902  pFocus.EquatorialToHorizontal(data()->lst(), data()->geo()->lat());
903  map()->setFocusPoint(&pFocus);
904  }
905  data()->setSnapNextFocus();
906  map()->setDestination(*map()->focusPoint());
907  map()->setFocus(map()->destination());
908 
909  map()->showFocusCoords();
910 
911  //Check whether initial position is below the horizon.
912  if (Options::useAltAz() && Options::showGround() && map()->focus()->alt().Degrees() <= SkyPoint::altCrit)
913  {
914  QString caption = i18n("Initial Position is Below Horizon");
915  QString message =
916  i18n("The initial position is below the horizon.\nWould you like to reset to the default position?");
917  if (KMessageBox::warningYesNo(this, message, caption, KGuiItem(i18n("Reset Position")),
918  KGuiItem(i18n("Do Not Reset")), "dag_start_below_horiz") == KMessageBox::Yes)
919  {
920  map()->setClickedObject(nullptr);
921  map()->setFocusObject(nullptr);
922  Options::setIsTracking(false);
923 
924  data()->setSnapNextFocus(true);
925 
926  SkyPoint DefaultFocus;
927  DefaultFocus.setAz(180.0);
928  DefaultFocus.setAlt(45.0);
929  DefaultFocus.HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
930  map()->setDestination(DefaultFocus);
931  }
932  }
933 
934  //If there is a focusObject() and it is a SS body, add a temporary Trail
935  if (map()->focusObject() && map()->focusObject()->isSolarSystem() && Options::useAutoTrail())
936  {
937  ((KSPlanetBase *)map()->focusObject())->addToTrail();
938  data()->temporaryTrail = true;
939  }
940 }
941 
942 void KStars::buildGUI()
943 {
944  //create the texture manager
946  //create the skymap
947  m_SkyMap = SkyMap::Create();
948  connect(m_SkyMap, SIGNAL(mousePointChanged(SkyPoint*)), SLOT(slotShowPositionBar(SkyPoint*)));
949  connect(m_SkyMap, SIGNAL(zoomChanged()), SLOT(slotZoomChanged()));
950  setCentralWidget(m_SkyMap);
951 
952  //Initialize menus, toolbars, and statusbars
953  initStatusBar();
954  initActions();
955 
956  // Setup GUI from the settings file
957  // UI tests provide the default settings file from the resources explicitly file to render UI properly
958  setupGUI(StandardWindowOptions(Default), m_KStarsUIResource);
959 
960  //get focus of keyboard and mouse actions (for example zoom in with +)
961  map()->QWidget::setFocus();
962  resize(Options::windowWidth(), Options::windowHeight());
963 
964  // check zoom in/out buttons
965  if (Options::zoomFactor() >= MAXZOOM)
966  actionCollection()->action("zoom_in")->setEnabled(false);
967  if (Options::zoomFactor() <= MINZOOM)
968  actionCollection()->action("zoom_out")->setEnabled(false);
969 }
970 
971 void KStars::populateThemes()
972 {
973  KSTheme::Manager::instance()->setThemeMenuAction(new QMenu(i18n("&Themes"), this));
974  KSTheme::Manager::instance()->registerThemeActions(this);
975 
976  connect(KSTheme::Manager::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged()));
977 }
978 
979 void KStars::slotThemeChanged()
980 {
981  Options::setCurrentTheme(KSTheme::Manager::instance()->currentThemeName());
982 }
void setEnabled(bool)
Definition: fov.h:27
QAction * addAction(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition: kstars.cpp:567
QAction * action(const QString &name) const
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition: skypoint.h:194
QString xi18nc(const char *context, const char *text, const TYPE &arg...)
void setShortcutContext(Qt::ShortcutContext context)
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition: skymap.h:377
QList< QAction * > actions() const const
void setText(const QString &)
void addAction(QAction *action)
QString fullName() const
Definition: geolocation.cpp:46
void setDelayed(bool delayed)
void slotFlagManager()
action slot: open Flag Manager
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
void clockToggled(bool)
This is an signal that is called on either clock start or clock stop with an appropriate boolean argu...
void slotSetTimeToNow()
action slot: sync kstars clock to system time
void setTimeDirection(float scale)
Sets the direction of time and stores it in bool TimeRunForwards.
Definition: kstarsdata.cpp:359
void setDefaultShortcut(QAction *action, const QKeySequence &shortcut)
void slotToggleWIView()
action slot: toggle What's Interesting window
void setCentralWidget(QWidget *widget)
double TZ0() const
Definition: geolocation.h:136
QIcon fromTheme(const QString &name)
void showFocusCoords()
Update object name and coordinates in the Focus InfoBox.
Definition: skymap.cpp:292
void timeChanged()
The time has changed (emitted by setUTC() )
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:429
double TZ() const
Definition: geolocation.h:142
SkyMap * map() const
Definition: kstars.h:143
static KStarsDateTime currentDateTimeUtc()
void slotDSOCatalogGUI()
Show the DSO Catalog Management GUI.
void setShortcut(const QKeySequence &shortcut)
QString xi18n(const char *text, const TYPE &arg...)
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
Definition: kstarsdata.cpp:313
QString caption()
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition: skypoint.cpp:77
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition: skymap.cpp:336
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
ButtonCode warningYesNo(QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
void slotSetZoom()
action slot: Allow user to specify a field-of-view angle for the display window in degrees,...
void setDefaultWidget(QWidget *widget)
void hide()
void setupGUI(const QSize &defaultSize, StandardWindowOptions options=Default, const QString &xmlfile=QString())
static KStars * Instance()
Definition: kstars.h:125
void showMessage(const QString &message, int timeout)
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition: skymap.cpp:968
virtual void setVisible(bool visible)
QMenu * menu() const const
void setIcon(const QIcon &icon)
void removeAction(QAction *action)
void setHidden(bool hidden)
void timeAdvanced()
The clock has ticked (emitted by tick() )
void changeDateTime(const KStarsDateTime &newDate)
Change the current simulation date/time to the KStarsDateTime argument.
Definition: kstarsdata.cpp:327
QString i18n(const char *text, const TYPE &arg...)
QList< QAction * > actions() const const
void setStatusTip(const QString &statusTip)
ActionType * add(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
static bool setResourceFile(QString const rc)
Override KStars UI resource file.
Definition: kstarsinit.cpp:125
bool isEmpty() const const
GeoLocation * geo()
Definition: kstarsdata.h:229
int insertPermanentWidget(int index, QWidget *widget, int stretch)
void slotShowPositionBar(SkyPoint *)
Display position in the status bar.
QAction * configureNotifications(const QObject *recvr, const char *slot, QObject *parent)
void slotWizard()
action slot: open KStars startup wizard
QFlags< StandardWindowOption > StandardWindowOptions
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition: skymap.h:203
Q_INVOKABLE SimClock * clock()
Definition: kstarsdata.h:217
void setText(const QString &text)
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition: skymap.cpp:331
bool hasThemeIcon(const QString &name)
GeoCoordinates geo(const QVariant &location)
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
void slotZoomChanged()
Called when zoom level is changed.
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition: skymap.cpp:928
void setWhatsThis(const QString &what)
void setFocus(SkyPoint *f)
sets the central focus point of the sky map.
Definition: skymap.cpp:942
void setEnabled(bool)
void setCheckable(bool)
static const double altCrit
Critical height for atmospheric refraction corrections.
Definition: skypoint.h:718
static TextureManager * Create()
Create the instance of TextureManager.
QStatusBar * statusBar() const const
void show()
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:165
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition: kstarsdata.h:282
Q_SCRIPTABLE Q_NOREPLY void start()
DBUS function to start the SimClock.
Definition: simclock.cpp:120
void resize(int w, int h)
void repopulateHIPS()
Load HIPS information and repopulate menu.
Definition: kstarsinit.cpp:723
void triggered(bool checked)
void slotTrack()
action slot: Toggle whether kstars is tracking current position
void setAz(dms az)
Sets Az, the Azimuth.
Definition: skypoint.h:230
Composite spinbox for specifying a time step. This composite widget consists of a TimeSpinBox (a QSpi...
Definition: timestepbox.h:27
QAction * action(const char *name) const
virtual KActionCollection * actionCollection() const
KToolBar * toolBar(const QString &name=QString())
void setToolTip(const QString &tip)
void setEnabled(bool)
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition: skymap.h:261
void setToolTip(const QString &)
void skyUpdate(bool)
Should be used to refresh skymap.
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:450
TimeSpinBox * tsbox() const
Definition: timestepbox.h:35
QString left(int n) const const
QString name(StandardShortcut id)
void scaleChanged(float)
The timestep has changed.
Q_SCRIPTABLE Q_NOREPLY void setClockScale(double scale)
DBUS function to set scale of simclock.
Definition: simclock.cpp:169
static const QList< FOV * > & readFOVs()
Read list of FOVs from "fov.dat".
Definition: fov.cpp:76
static void showTip(const QString &tipFile=QString(), bool force=false)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void toggle()
void HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates,...
Definition: skypoint.cpp:143
TimeUnitBox * unitbox() const
Definition: timestepbox.h:38
void clear()
void addColorMenuItem(QString name, const QString &actionName)
Add an item to the color-scheme action manu.
KStarsData * data() const
Definition: kstars.h:137
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
QByteArray toLocal8Bit() const const
QAction * addAction(QAction *action)
QString toString(Qt::DateFormat format) const const
void clearCachedFindDialog()
Delete FindDialog because ObjNames list has changed in KStarsData due to reloading star data.
Definition: kstars.cpp:305
void setChecked(bool)
QString mid(int position, int n) const const
SkyObject * starNearest(SkyPoint *p, double &maxrad)
const KStarsDateTime & utc() const
Definition: simclock.h:37
void slotGeoLocator()
action slot: open dialog for selecting a new geographic location
Information about an object in the sky.
Definition: skyobject.h:41
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
Definition: kstars.cpp:323
QString message
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
ApplicationShortcut
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.