Kstars

kstars.cpp
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "kstars.h"
8 
9 #include "config-kstars.h"
10 #include "version.h"
11 
12 #include "fov.h"
13 #include "kactionmenu.h"
14 #include "kstarsadaptor.h"
15 #include "kstarsdata.h"
16 #include "kstarssplash.h"
17 #include "observinglist.h"
18 #include "Options.h"
19 #include "skymap.h"
20 #include "skyqpainter.h"
21 #include "texturemanager.h"
22 #include "dialogs/finddialog.h"
23 #include "dialogs/exportimagedialog.h"
24 #include "skycomponents/starblockfactory.h"
25 #ifdef HAVE_INDI
26 #include "ekos/manager.h"
27 #include "indi/drivermanager.h"
28 #include "indi/guimanager.h"
29 #include "indi/indilistener.h"
30 #endif
31 
32 #ifdef HAVE_CFITSIO
33 #include "fitsviewer/fitsviewer.h"
34 #endif
35 
36 #include <KActionCollection>
37 #include <KToolBar>
38 
39 #ifdef Q_OS_WIN
40 #include <QProcess>
41 #endif
42 #include <QStatusBar>
43 #include <QMenu>
44 
45 #include <kstars_debug.h>
46 
47 KStars *KStars::pinstance = nullptr;
48 bool KStars::Closing = false;
49 
50 KStars::KStars(bool doSplash, bool clockrun, const QString &startdate)
51  : KXmlGuiWindow(), StartClockRunning(clockrun), StartDateString(startdate)
52 {
53  // FIXME Hack to set RTL direction for Arabic
54  // This is not a solution. It seems qtbase_ar.qm needs to take care of this?
55  // qttranslations5-l10n does not contain qtbase_ar.qm
56  // It seems qtbase_ar.ts does not exist for Qt 5.9 at all and needs to be translated.
57  // https://wiki.qt.io/Qt_Localization
58  if (i18n("Sky") == "السماء")
60 
61  setWindowTitle(i18nc("@title:window", "KStars"));
62 
63  // Set thread stack size to 32MB
65 
66  // Initialize logging settings
67  if (Options::disableLogging())
69  else if (Options::logToFile())
71  else
73 
75 
76  qCInfo(KSTARS) << "Welcome to KStars" << KSTARS_VERSION << KSTARS_BUILD_RELEASE;
77  qCInfo(KSTARS) << "Build:" << KSTARS_BUILD_TS;
78  qCInfo(KSTARS) << "OS:" << QSysInfo::productType();
79  qCInfo(KSTARS) << "API:" << QSysInfo::buildAbi();
80  qCInfo(KSTARS) << "Arch:" << QSysInfo::currentCpuArchitecture();
81  qCInfo(KSTARS) << "Kernel Type:" << QSysInfo::kernelType();
82  qCInfo(KSTARS) << "Kernel Version:" << QSysInfo::kernelVersion();
83  qCInfo(KSTARS) << "Qt Version:" << QT_VERSION_STR;
84 
85  new KstarsAdaptor(
86  this); // NOTE the weird case convention, which cannot be changed as the file is generated by the moc.
87 
88 #ifdef Q_OS_OSX
89 
90  QString vlcPlugins = QDir(QCoreApplication::applicationDirPath() + "/../PlugIns/vlc").absolutePath();
91  qputenv("VLC_PLUGIN_PATH", vlcPlugins.toLatin1());
92  QString phonon_backend_path = QDir(QCoreApplication::applicationDirPath() +
93  "/../PlugIns/phonon4qt5_backend/phonon_vlc.so").absolutePath();
94  qputenv("PHONON_BACKEND", phonon_backend_path.toLatin1());
95 
97  QString path = env.value("PATH", "");
98  env.insert("PATH", "/usr/bin:/usr/local/bin:\"" + QCoreApplication::applicationDirPath() + "\":" + path);
99 
100  QProcess dbusCheck;
101  dbusCheck.setProcessEnvironment(env);
102 
103  QString pluginsDir = QDir(QCoreApplication::applicationDirPath() + "/../PlugIns").absolutePath();
104  QString dbusPlist = pluginsDir + "/dbus/org.freedesktop.dbus-kstars.plist";
105  QFile file(dbusPlist);
106  if (file.open(QIODevice::ReadOnly))
107  {
108  QTextStream in(&file);
109  QString pListText = in.readAll();
110  file.close();
111  int programArgsLeft = pListText.indexOf("<key>ProgramArguments</key>");
112  int programArgsRight = pListText.indexOf("</array>", programArgsLeft) + 8 - programArgsLeft;
113  QString currentProgramArgs = pListText.mid(programArgsLeft, programArgsRight);
114  QString newProgramArguments = ""
115  "<key>ProgramArguments</key>\n"
116  " <array>\n"
117  " <string>" +
119  "/dbus-daemon</string>\n"
120  " <string>--nofork</string>\n"
121  " <string>--config-file=" +
122  pluginsDir +
123  "/dbus/kstars.conf</string>\n"
124  " </array>";
125  pListText.replace(currentProgramArgs, newProgramArguments);
126  if (file.open(QIODevice::WriteOnly))
127  {
128  QTextStream stream(&file);
129  stream << pListText;
130  file.close();
131 
132  dbusCheck.start("chmod 775 " + dbusPlist);
133  dbusCheck.waitForFinished();
134  dbusCheck.start("launchctl load -w \"" + dbusPlist + "\"");
135  dbusCheck.waitForFinished();
136  qDebug("Starting DBus");
137  }
138  else
139  {
140  qDebug("DBus File Write Error");
141  }
142  }
143  else
144  {
145  qDebug("DBus File Read Error");
146  }
147 #endif
148 
149  QDBusConnection::sessionBus().registerObject("/KStars", this);
150  QDBusConnection::sessionBus().registerService("org.kde.kstars");
151 
152 #ifdef HAVE_CFITSIO
153  m_GenericFITSViewer.clear();
154 #endif
155 
156  // Set pinstance to yourself
157  pinstance = this;
158 
159  connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(slotAboutToQuit()));
160 
161  //Initialize QActionGroups
162  projectionGroup = new QActionGroup(this);
163  cschemeGroup = new QActionGroup(this);
164  hipsGroup = new QActionGroup(this);
165  telescopeGroup = new QActionGroup(this);
166  telescopeGroup->setExclusive(false);
167  domeGroup = new QActionGroup(this);
168  domeGroup->setExclusive(false);
169  skymapOrientationGroup = new QActionGroup(this);
170 
171 
172  m_KStarsData = KStarsData::Create();
173  Q_ASSERT(m_KStarsData);
174  //Set Geographic Location from Options
175  m_KStarsData->setLocationFromOptions();
176 
177  //Initialize Time and Date
178  bool datetimeSet = false;
179  if (StartDateString.isEmpty() == false)
180  {
181  KStarsDateTime startDate = KStarsDateTime::fromString(StartDateString);
182  if (startDate.isValid())
183  data()->changeDateTime(data()->geo()->LTtoUT(startDate));
184  else
185  data()->changeDateTime(KStarsDateTime::currentDateTimeUtc());
186 
187  datetimeSet = true;
188  }
189  // JM 2016-11-15: Not need to set it again as it was initialized in the ctor of SimClock
190  /*
191  else
192  data()->changeDateTime( KStarsDateTime::currentDateTimeUtc() );
193  */
194 
195  // If we are starting paused (--paused is not in the command line) change datetime in data
196  if (StartClockRunning == false)
197  {
198  qCInfo(KSTARS) << "KStars is started in paused state.";
199  if (datetimeSet == false)
200  data()->changeDateTime(KStarsDateTime::currentDateTimeUtc());
201  }
202 
203  // Setup splash screen
204  KStarsSplash *splash = nullptr;
205  if (doSplash)
206  {
207  splash = new KStarsSplash(nullptr);
208  connect(m_KStarsData, SIGNAL(progressText(QString)), splash, SLOT(setMessage(QString)));
209  splash->show();
210  }
211  else
212  {
213  connect(m_KStarsData, SIGNAL(progressText(QString)), m_KStarsData, SLOT(slotConsoleMessage(QString)));
214  }
215 
216  /*
217  //set up Dark color scheme for application windows
218  DarkPalette = QPalette(QColor("black"), QColor("black"));
219  DarkPalette.setColor(QPalette::Inactive, QPalette::WindowText, QColor("red"));
220  DarkPalette.setColor(QPalette::Normal, QPalette::WindowText, QColor("red"));
221  DarkPalette.setColor(QPalette::Normal, QPalette::Base, QColor("black"));
222  DarkPalette.setColor(QPalette::Normal, QPalette::Text, QColor(238, 0, 0));
223  DarkPalette.setColor(QPalette::Normal, QPalette::Highlight, QColor(238, 0, 0));
224  DarkPalette.setColor(QPalette::Normal, QPalette::HighlightedText, QColor("black"));
225  DarkPalette.setColor(QPalette::Inactive, QPalette::Text, QColor(238, 0, 0));
226  DarkPalette.setColor(QPalette::Inactive, QPalette::Base, QColor(30, 10, 10));
227  //store original color scheme
228  OriginalPalette = QApplication::palette();
229  */
230 
231  //Initialize data. When initialization is complete, it will run dataInitFinished()
232  if (!m_KStarsData->initialize())
233  return;
234  delete splash;
235  datainitFinished();
236 }
237 
238 KStars *KStars::createInstance(bool doSplash, bool clockrun, const QString &startdate)
239 {
240  delete pinstance;
241  // pinstance is set directly in constructor.
242  new KStars(doSplash, clockrun, startdate);
243  Q_ASSERT(pinstance && "pinstance must be non NULL");
244  return pinstance;
245 }
246 
248 {
250  Q_ASSERT(pinstance);
251  pinstance = nullptr;
252 #ifdef PROFILE_COORDINATE_CONVERSION
253  qDebug() << Q_FUNC_INFO << "Spent " << SkyPoint::cpuTime_EqToHz << " seconds in " << SkyPoint::eqToHzCalls
254  << " calls to SkyPoint::EquatorialToHorizontal, for an average of "
255  << 1000. * (SkyPoint::cpuTime_EqToHz / SkyPoint::eqToHzCalls) << " ms per call";
256 #endif
257 
258 #ifdef COUNT_DMS_SINCOS_CALLS
259  qDebug() << Q_FUNC_INFO << "Constructed " << dms::dms_constructor_calls << " dms objects, of which " <<
260  dms::dms_with_sincos_called
261  << " had trigonometric functions called on them = "
262  << (float(dms::dms_with_sincos_called) / float(dms::dms_constructor_calls)) * 100. << "%";
263  qDebug() << Q_FUNC_INFO << "Of the " << dms::trig_function_calls << " calls to sin/cos/sincos on dms objects, "
264  << dms::redundant_trig_function_calls << " were redundant = "
265  << ((float(dms::redundant_trig_function_calls) / float(dms::trig_function_calls)) * 100.) << "%";
266  qDebug() << Q_FUNC_INFO << "We had " << CachingDms::cachingdms_bad_uses << " bad uses of CachingDms in all, compared to "
267  << CachingDms::cachingdms_constructor_calls << " constructed CachingDms objects = "
268  << (float(CachingDms::cachingdms_bad_uses) / float(CachingDms::cachingdms_constructor_calls)) * 100.
269  << "% bad uses";
270 #endif
271 }
272 
274 {
275  delete m_KStarsData;
276  m_KStarsData = nullptr;
277  delete StarBlockFactory::Instance();
281 
282 #ifdef HAVE_INDI
283  GUIManager::release();
285  DriverManager::release();
286 #endif
287 
290 }
291 
293 {
294 #if 0
295  if (m_FindDialog) // dialog is cached
296  {
297  /** Delete findDialog only if it is not opened */
298  if (m_FindDialog->isHidden())
299  {
300  delete m_FindDialog;
301  m_FindDialog = nullptr;
302  DialogIsObsolete = false;
303  }
304  else
305  DialogIsObsolete = true; // dialog was opened so it could not deleted
306  }
307 #endif
308 }
309 
310 void KStars::applyConfig(bool doApplyFocus)
311 {
312  if (Options::isTracking())
313  {
314  actionCollection()->action("track_object")->setText(i18n("Stop &Tracking"));
316  ->action("track_object")
317  ->setIcon(QIcon::fromTheme("document-encrypt"));
318  }
319 
321  ->action("coordsys")
322  ->setText(Options::useAltAz() ? i18n("Switch to Star Globe View (Equatorial &Coordinates)") :
323  i18n("Switch to Horizontal View (Horizontal &Coordinates)"));
324 
325  actionCollection()->action("show_time_box")->setChecked(Options::showTimeBox());
326  actionCollection()->action("show_location_box")->setChecked(Options::showGeoBox());
327  actionCollection()->action("show_focus_box")->setChecked(Options::showFocusBox());
328  actionCollection()->action("show_statusBar")->setChecked(Options::showStatusBar());
329  actionCollection()->action("show_sbAzAlt")->setChecked(Options::showAltAzField());
330  actionCollection()->action("show_sbRADec")->setChecked(Options::showRADecField());
331  actionCollection()->action("show_sbJ2000RADec")->setChecked(Options::showJ2000RADecField());
332  actionCollection()->action("show_stars")->setChecked(Options::showStars());
333  actionCollection()->action("show_deepsky")->setChecked(Options::showDeepSky());
334  actionCollection()->action("show_planets")->setChecked(Options::showSolarSystem());
335  actionCollection()->action("show_clines")->setChecked(Options::showCLines());
336  actionCollection()->action("show_constellationart")->setChecked(Options::showConstellationArt());
337  actionCollection()->action("show_cnames")->setChecked(Options::showCNames());
338  actionCollection()->action("show_cbounds")->setChecked(Options::showCBounds());
339  actionCollection()->action("show_mw")->setChecked(Options::showMilkyWay());
340  actionCollection()->action("show_equatorial_grid")->setChecked(Options::showEquatorialGrid());
341  actionCollection()->action("show_horizontal_grid")->setChecked(Options::showHorizontalGrid());
342  actionCollection()->action("show_horizon")->setChecked(Options::showGround());
343  actionCollection()->action("show_flags")->setChecked(Options::showFlags());
344  actionCollection()->action("show_supernovae")->setChecked(Options::showSupernovae());
345  actionCollection()->action("show_satellites")->setChecked(Options::showSatellites());
346  actionCollection()->action("erect_observer_correction")->setChecked(Options::erectObserverCorrection());
347  actionCollection()->action("erect_observer_correction")->setEnabled(Options::useAltAz());
348  statusBar()->setVisible(Options::showStatusBar());
349 
350  //color scheme
351  m_KStarsData->colorScheme()->loadFromConfig();
352  //QApplication::setPalette(Options::darkAppColors() ? DarkPalette : OriginalPalette);
353  /**
354  //Note: This uses style sheets to set the dark colors, this should be cross platform. Palettes have a different behavior on OS X and Windows as opposed to Linux.
355  //It might be a good idea to use stylesheets in the future instead of palettes but this will work for now for OS X.
356  //This is also in KStarsDbus.cpp. If you change it, change it in BOTH places.
357  @code
358  #ifdef Q_OS_OSX
359  if (Options::darkAppColors())
360  qApp->setStyleSheet(
361  "QWidget { background-color: black; color:red; "
362  "selection-background-color:rgb(30,30,30);selection-color:white}"
363  "QToolBar { border:none }"
364  "QTabBar::tab:selected { background-color:rgb(50,50,50) }"
365  "QTabBar::tab:!selected { background-color:rgb(30,30,30) }"
366  "QPushButton { background-color:rgb(50,50,50);border-width:1px; border-style:solid;border-color:black}"
367  "QPushButton::disabled { background-color:rgb(10,10,10);border-width:1px; "
368  "border-style:solid;border-color:black }"
369  "QToolButton:Checked { background-color:rgb(30,30,30); border:none }"
370  "QComboBox { background-color:rgb(30,30,30); }"
371  "QComboBox::disabled { background-color:rgb(10,10,10) }"
372  "QScrollBar::handle { background: rgb(30,30,30) }"
373  "QSpinBox { border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }"
374  "QDoubleSpinBox { border-width:1px; border-style:solid; border-color:rgb(30,30,30) }"
375  "QLineEdit { border-width: 1px; border-style: solid; border-color:rgb(30,30,30) }"
376  "QCheckBox::indicator:unchecked { background-color:rgb(30,30,30);border-width:1px; "
377  "border-style:solid;border-color:black }"
378  "QCheckBox::indicator:checked { background-color:red;border-width:1px; "
379  "border-style:solid;border-color:black }"
380  "QRadioButton::indicator:unchecked { background-color:rgb(30,30,30) }"
381  "QRadioButton::indicator:checked { background-color:red }"
382  "QRoundProgressBar { alternate-background-color:black }"
383  "QDateTimeEdit {background-color:rgb(30,30,30); border-width: 1px; border-style:solid; "
384  "border-color:rgb(30,30,30) }"
385  "QHeaderView { color:red;background-color:black }"
386  "QHeaderView::Section { background-color:rgb(30,30,30) }"
387  "QTableCornerButton::section{ background-color:rgb(30,30,30) }"
388  "");
389  else
390  qApp->setStyleSheet("");
391  #endif
392  @endcode
393  **/
394 
395  //Set toolbar options from config file
396  toolBar("kstarsToolBar")->applySettings(KSharedConfig::openConfig()->group("MainToolBar"));
397  toolBar("viewToolBar")->applySettings(KSharedConfig::openConfig()->group("ViewToolBar"));
398 
399  //Geographic location
401 
402  //Focus
403  if (doApplyFocus)
404  {
405  SkyObject *fo = data()->objectNamed(Options::focusObject());
406  if (fo && fo != map()->focusObject())
407  {
408  map()->setClickedObject(fo);
409  map()->setClickedPoint(fo);
410  map()->slotCenter();
411  }
412 
413  if (!fo)
414  {
415  SkyPoint fp(Options::focusRA(), Options::focusDec());
416  if (fp.ra().Degrees() != map()->focus()->ra().Degrees() ||
417  fp.dec().Degrees() != map()->focus()->dec().Degrees())
418  {
419  map()->setClickedPoint(&fp);
420  map()->slotCenter();
421  }
422  }
423  }
424 }
425 
426 void KStars::showImgExportDialog()
427 {
428  if (m_ExportImageDialog)
429  m_ExportImageDialog->show();
430 }
431 
432 void KStars::syncFOVActions()
433 {
434  foreach (QAction *action, fovActionMenu->menu()->actions())
435  {
436  if (action->text().isEmpty())
437  {
438  continue;
439  }
440 
441  if (Options::fOVNames().contains(action->text().remove(0, 1)))
442  {
443  action->setChecked(true);
444  }
445  else
446  {
447  action->setChecked(false);
448  }
449  }
450 }
451 
452 void KStars::hideAllFovExceptFirst()
453 {
454  // When there is only one visible FOV symbol, we don't need to do anything
455  // Also, don't do anything if there are no available FOV symbols.
456  if (data()->visibleFOVs.size() == 1 || data()->availFOVs.isEmpty())
457  {
458  return;
459  }
460  else
461  {
462  // If there are no visible FOVs, select first available
463  if (data()->visibleFOVs.isEmpty())
464  {
465  Q_ASSERT(!data()->availFOVs.isEmpty());
466  Options::setFOVNames(QStringList(data()->availFOVs.first()->name()));
467  }
468  else
469  {
470  Options::setFOVNames(QStringList(data()->visibleFOVs.first()->name()));
471  }
472 
473  // Sync FOV and update skymap
474  data()->syncFOV();
475  syncFOVActions();
476  map()->update(); // SkyMap::forceUpdate() is not required, as FOVs are drawn as overlays
477  }
478 }
479 
480 void KStars::selectNextFov()
481 {
482  if (data()->getVisibleFOVs().isEmpty())
483  return;
484 
485  Q_ASSERT(!data()
486  ->getAvailableFOVs()
487  .isEmpty()); // The available FOVs had better not be empty if the visible ones are not.
488 
489  FOV *currentFov = data()->getVisibleFOVs().first();
490  int currentIdx = data()->availFOVs.indexOf(currentFov);
491 
492  // If current FOV is not the available FOV list or there is only 1 FOV available, then return
493  if (currentIdx == -1 || data()->availFOVs.size() < 2)
494  {
495  return;
496  }
497 
498  QStringList nextFovName;
499  if (currentIdx == data()->availFOVs.size() - 1)
500  {
501  nextFovName << data()->availFOVs.first()->name();
502  }
503  else
504  {
505  nextFovName << data()->availFOVs.at(currentIdx + 1)->name();
506  }
507 
508  Options::setFOVNames(nextFovName);
509  data()->syncFOV();
510  syncFOVActions();
511  map()->update();
512 }
513 
514 void KStars::selectPreviousFov()
515 {
516  if (data()->getVisibleFOVs().isEmpty())
517  return;
518 
519  Q_ASSERT(!data()
520  ->getAvailableFOVs()
521  .isEmpty()); // The available FOVs had better not be empty if the visible ones are not.
522 
523  FOV *currentFov = data()->getVisibleFOVs().first();
524  int currentIdx = data()->availFOVs.indexOf(currentFov);
525 
526  // If current FOV is not the available FOV list or there is only 1 FOV available, then return
527  if (currentIdx == -1 || data()->availFOVs.size() < 2)
528  {
529  return;
530  }
531 
532  QStringList prevFovName;
533  if (currentIdx == 0)
534  {
535  prevFovName << data()->availFOVs.last()->name();
536  }
537  else
538  {
539  prevFovName << data()->availFOVs.at(currentIdx - 1)->name();
540  }
541 
542  Options::setFOVNames(prevFovName);
543  data()->syncFOV();
544  syncFOVActions();
545  map()->update();
546 }
547 
548 //FIXME Port to QML2
549 //#if 0
550 void KStars::showWISettingsUI()
551 {
552  slotWISettings();
553 }
554 //#endif
555 
556 void KStars::updateTime(const bool automaticDSTchange)
557 {
558  // Due to frequently use of this function save data and map pointers for speedup.
559  // Save options and geo() to a pointer would not speedup because most of time options
560  // and geo will accessed only one time.
561  KStarsData *Data = data();
562  // dms oldLST( Data->lst()->Degrees() );
563 
564  Data->updateTime(Data->geo(), automaticDSTchange);
565 
566  //We do this outside of kstarsdata just to get the coordinates
567  //displayed in the infobox to update every second.
568  // if ( !Options::isTracking() && LST()->Degrees() > oldLST.Degrees() ) {
569  // int nSec = int( 3600.*( LST()->Hours() - oldLST.Hours() ) );
570  // Map->focus()->setRA( Map->focus()->ra().Hours() + double( nSec )/3600. );
571  // if ( Options::useAltAz() ) Map->focus()->EquatorialToHorizontal( LST(), geo()->lat() );
572  // Map->showFocusCoords();
573  // }
574 
575  //If time is accelerated beyond slewTimescale, then the clock's timer is stopped,
576  //so that it can be ticked manually after each update, in order to make each time
577  //step exactly equal to the timeScale setting.
578  //Wrap the call to manualTick() in a singleshot timer so that it doesn't get called until
579  //the skymap has been completely updated.
580  if (Data->clock()->isManualMode() && Data->clock()->isActive())
581  {
582  // Jasem 2017-11-13: Time for each update varies.
583  // Ideally we want to advance the simulation clock by
584  // the current clock scale (e.g. 1 hour) every 1 second
585  // of real time. However, the sky map update, depending on calculations and
586  // drawing of objects, takes variable time to complete.
587  //QTimer::singleShot(0, Data->clock(), SLOT(manualTick()));
588  QTimer::singleShot(1000, Data->clock(), SLOT(manualTick()));
589  }
590 }
591 
592 #ifdef HAVE_CFITSIO
593 const QSharedPointer<FITSViewer> &KStars::createFITSViewer()
594 {
595  if (Options::singleWindowCapturedFITS())
596  return KStars::Instance()->genericFITSViewer();
597  else
598  {
599  QSharedPointer<FITSViewer> newFITSViewer(new FITSViewer(Options::independentWindowFITS() ? nullptr : KStars::Instance()));
600  m_FITSViewers.append(newFITSViewer);
601  connect(newFITSViewer.get(), &FITSViewer::terminated, this, [ & ]()
602  {
603  m_FITSViewers.removeOne(newFITSViewer);
604  });
605  return m_FITSViewers.constLast();
606  }
607 }
608 
609 const QSharedPointer<FITSViewer> &KStars::genericFITSViewer()
610 {
611  if (m_GenericFITSViewer.isNull())
612  {
613  m_GenericFITSViewer.reset(new FITSViewer(Options::independentWindowFITS() ? nullptr : this));
614  connect(m_GenericFITSViewer.get(), &FITSViewer::terminated, this, [this]()
615  {
616  m_FITSViewers.removeOne(m_GenericFITSViewer);
617  m_GenericFITSViewer.clear();
618  });
619  m_FITSViewers.append(m_GenericFITSViewer);
620  }
621 
622  return m_GenericFITSViewer;
623 }
624 
625 void KStars::clearAllViewers()
626 {
627  for (auto &fv : m_FITSViewers)
628  fv->close();
629 
630  m_FITSViewers.clear();
631 }
632 #endif
633 
634 void KStars::closeEvent(QCloseEvent *event)
635 {
636  KStars::Closing = true;
638  slotAboutToQuit();
639 }
void start(const QString &program, const QStringList &arguments, QIODevice::OpenMode mode)
static void releaseImageCache()
Release the image cache.
Definition: skyqpainter.cpp:95
T & first()
Definition: fov.h:27
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition: kstars.cpp:556
QAction * action(const QString &name) const
QList< QAction * > actions() const const
void updateTime(GeoLocation *geo, const bool automaticDSTchange=true)
Update the Simulation Clock.
Definition: kstarsdata.cpp:234
bool waitForFinished(int msecs)
void setLocationFromOptions()
Set the GeoLocation according to the values stored in the configuration file.
Definition: kstarsdata.cpp:396
virtual void release(quint64 objid)
void setProcessEnvironment(const QProcessEnvironment &environment)
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
const QList< FOV * > getVisibleFOVs() const
Definition: kstarsdata.h:306
void update()
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition: skymap.cpp:1011
QIcon fromTheme(const QString &name)
QProcessEnvironment systemEnvironment()
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:429
bool event(QEvent *event) override
void loadFromConfig()
Read color-scheme data from the Config object.
QThreadPool * globalInstance()
void removeDatabase(const QString &connectionName)
static KStarsDateTime fromString(const QString &s)
SkyMap * map() const
Definition: kstars.h:141
QString applicationDirPath()
static KStarsDateTime currentDateTimeUtc()
QByteArray toLatin1() const const
bool registerObject(const QString &path, QObject *object, QDBusConnection::RegisterOptions options)
QString buildAbi()
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
QString productType()
static KStars * Instance()
Definition: kstars.h:123
virtual void setVisible(bool visible)
QMenu * menu() const const
void setIcon(const QIcon &icon)
static void UseFile()
Store all logs into the specified file.
Definition: ksutils.cpp:927
QString i18n(const char *text, const TYPE &arg...)
QDBusConnection sessionBus()
bool registerService(const QString &serviceName)
const CachingDms & dec() const
Definition: skypoint.h:269
the KStars Splash Screen.
Definition: kstarssplash.h:20
void releaseResources()
Syncs config file.
Definition: kstars.cpp:273
int indexOf(const T &value, int from) const const
static void SyncFilterRules()
SyncFilterRules Sync QtLogging filter rules from Options.
Definition: ksutils.cpp:1036
ColorScheme * colorScheme()
Definition: kstarsdata.h:172
Primary window to view monochrome and color FITS images. The FITSviewer can open multiple images each...
Definition: fitsviewer.h:49
GeoLocation * geo()
Definition: kstarsdata.h:230
static void releaseCache()
Release the FOV cache.
Definition: fov.cpp:154
const T & at(int i) const const
Q_INVOKABLE SimClock * clock()
Definition: kstarsdata.h:218
void setStackSize(uint stackSize)
void setText(const QString &text)
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition: skymap.cpp:363
bool isManualMode() const
Manual Mode is a new (04/2002) addition to the SimClock.
Definition: simclock.h:66
void insert(const QString &name, const QString &value)
GeoCoordinates geo(const QVariant &location)
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
This is the main window for KStars. In addition to the GUI elements, the class contains the program c...
Definition: kstars.h:90
QString absolutePath() const const
QString & replace(int position, int n, QChar after)
T & last()
void slotCenter()
Center the display at the point ClickedPoint.
Definition: skymap.cpp:377
QStatusBar * statusBar() const const
void show()
static void Disable()
Disable logging.
Definition: ksutils.cpp:1029
static bool Closing
Set to true when the application is being closed.
Definition: kstars.h:841
QAction * action(const char *name) const
~KStars() override
Destructor.
Definition: kstars.cpp:247
virtual KActionCollection * actionCollection() const
const CachingDms & ra() const
Definition: skypoint.h:263
KToolBar * toolBar(const QString &name=QString())
void setEnabled(bool)
QString path(const QString &relativePath)
const double & Degrees() const
Definition: dms.h:141
static void UseDefault()
Use the default logging mechanism.
Definition: ksutils.cpp:1024
QString currentCpuArchitecture()
virtual void closeEvent(QCloseEvent *event)
RightToLeft
bool isValid() const const
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void slotWISettings()
action slot: open What's Interesting settings window
QString kernelVersion()
KStarsData * data() const
Definition: kstars.h:135
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
void clearCachedFindDialog()
Delete FindDialog because ObjNames list has changed in KStarsData due to reloading star data.
Definition: kstars.cpp:292
void setChecked(bool)
Q_INVOKABLE bool isActive()
Whether the clock is active or not is a bit complicated by the introduction of "manual mode".
Definition: simclock.cpp:96
void setLayoutDirection(Qt::LayoutDirection direction)
QString mid(int position, int n) const const
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:310
static KStars * createInstance(bool doSplash, bool clockrunning=true, const QString &startDateString=QString())
Create an instance of this class.
Definition: kstars.cpp:238
QString value(const QString &name, const QString &defaultValue) const const
void applySettings(const KConfigGroup &cg)
static void Release()
Release the instance of TextureManager.
QString kernelType()
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 03:57:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.