11#include "imageexporter.h"
12#include "kstarsdata.h"
13#include "kstars_debug.h"
14#include "ksnotification.h"
18#include "texturemanager.h"
19#include "dialogs/exportimagedialog.h"
20#include "dialogs/finddialog.h"
21#include "dialogs/focusdialog.h"
22#include "dialogs/fovdialog.h"
23#include "dialogs/viewsdialog.h"
24#include "dialogs/locationdialog.h"
25#include "dialogs/timedialog.h"
26#include "dialogs/catalogsdbui.h"
27#include "oal/execute.h"
28#include "oal/equipmentwriter.h"
29#include "oal/observeradd.h"
30#include "options/opsadvanced.h"
31#include "options/opscatalog.h"
32#include "options/opscolors.h"
33#include "options/opsguides.h"
34#include "options/opsterrain.h"
35#include "options/opsimageoverlay.h"
36#include "options/opsdeveloper.h"
37#include "options/opssatellites.h"
38#include "options/opssolarsystem.h"
39#include "options/opssupernovae.h"
40#include "printing/printingwizard.h"
41#include "projections/projector.h"
42#include "skycomponents/asteroidscomponent.h"
43#include "skycomponents/cometscomponent.h"
44#include "skycomponents/satellitescomponent.h"
45#include "skycomponents/skymapcomposite.h"
46#include "skycomponents/solarsystemcomposite.h"
47#include "skycomponents/supernovaecomponent.h"
48#include "skycomponents/catalogscomponent.h"
49#include "skycomponents/mosaiccomponent.h"
50#include "skycomponents/imageoverlaycomponent.h"
52#include "skyobjects/mosaictiles.h"
53#include "indi/indidome.h"
55#include "tools/altvstime.h"
56#include "tools/astrocalc.h"
57#include "tools/flagmanager.h"
58#include "tools/horizonmanager.h"
59#include "tools/observinglist.h"
60#include "tools/planetviewer.h"
61#include "tools/jmoontool.h"
62#include "tools/scriptbuilder.h"
63#include "tools/skycalendar.h"
64#include "tools/wutdialog.h"
65#include "tools/polarishourangle.h"
66#include "tools/whatsinteresting/wiequipsettings.h"
67#include "tools/whatsinteresting/wilpsettings.h"
68#include "tools/whatsinteresting/wiview.h"
69#include "hips/hipsmanager.h"
70#include "catalogsdb.h"
72#include <basedevice.h>
74#include "indi/opsindi.h"
75#include "indi/drivermanager.h"
76#include "indi/guimanager.h"
77#include "indi/indilistener.h"
81#include "fitsviewer/fitsviewer.h"
82#include "fitsviewer/opsfits.h"
84#include "ekos/manager.h"
85#include "ekos/scheduler/framingassistantui.h"
86#include "ekos/scheduler/scheduler.h"
87#include "ekos/scheduler/schedulermodulestate.h"
88#include "ekos/opsekos.h"
89#include "ekos/mount/mount.h"
90#include "tools/imagingplanner.h"
94#include "xplanet/opsxplanet.h"
96#ifdef HAVE_NOTIFYCONFIG
97#include <KNotifyConfigWidget>
99#include <KActionCollection>
100#include <KActionMenu>
102#include <KToggleAction>
104#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
105#include <KNSWidgets/dialog.h>
107#include <kns3/downloaddialog.h>
110#include <QQuickWindow>
121void KStars::slotViewToolBar()
123 KToggleAction *a = (KToggleAction *)
sender();
131 opcatalog->kcfg_ShowStars->setChecked(a->
isChecked());
139 opcatalog->kcfg_ShowDeepSky->setChecked(a->
isChecked());
144 Options::setShowSolarSystem(a->
isChecked());
147 opsolsys->kcfg_ShowSolarSystem->setChecked(a->
isChecked());
155 opguides->kcfg_ShowCLines->setChecked(a->
isChecked());
163 opguides->kcfg_ShowCNames->setChecked(a->
isChecked());
171 opguides->kcfg_ShowCBounds->setChecked(a->
isChecked());
176 Options::setShowConstellationArt(a->
isChecked());
179 opguides->kcfg_ShowConstellationArt->setChecked(a->
isChecked());
184 Options::setShowMilkyWay(a->
isChecked());
187 opguides->kcfg_ShowMilkyWay->setChecked(a->
isChecked());
195 Options::setAutoSelectGrid(
false);
196 Options::setShowEquatorialGrid(a->
isChecked());
199 opguides->kcfg_ShowEquatorialGrid->setChecked(a->
isChecked());
200 opguides->kcfg_AutoSelectGrid->setChecked(
false);
205 Options::setAutoSelectGrid(
false);
206 Options::setShowHorizontalGrid(a->
isChecked());
209 opguides->kcfg_ShowHorizontalGrid->setChecked(a->
isChecked());
210 opguides->kcfg_AutoSelectGrid->setChecked(
false);
216 if (!a->
isChecked() && Options::useRefraction())
218 QString caption =
i18n(
"Refraction effects disabled");
219 QString message =
i18n(
"When the horizon is switched off, refraction effects "
220 "are temporarily disabled.");
226 opguides->kcfg_ShowGround->setChecked(a->
isChecked());
231 Options::setSimulateDaytime(a->
isChecked());
234 opguides->kcfg_SimulateDaytime->setChecked(a->
isChecked());
242 opguides->kcfg_ShowFlags->setChecked(a->
isChecked());
247 Options::setShowSatellites(a->
isChecked());
250 opssatellites->kcfg_ShowSatellites->setChecked(a->
isChecked());
255 Options::setShowSupernovae(a->
isChecked());
258 opssupernovae->kcfg_ShowSupernovae->setChecked(a->
isChecked());
270void KStars::slotINDIToolBar()
279 GUIManager::Instance()->
raise();
284 GUIManager::Instance()->
hide();
290 Ekos::Manager::Instance()->
raise();
295 Ekos::Manager::Instance()->
hide();
299 for (
auto &oneDevice : INDIListener::devices())
301 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
304 if (oneDevice->isConnected() ==
false)
306 KSNotification::error(
i18n(
"Mount %1 is offline. Please connect and retry again.", oneDevice->getDeviceName()));
310 auto mount = oneDevice->getMount();
317 mount->centerUnlock();
321 KSNotification::sorry(
i18n(
"No connected mounts found."));
326 if (m_FITSViewers.isEmpty())
334 for (
auto &view : m_FITSViewers)
336 if (view->tabs().empty() ==
false)
339 view->activateWindow();
346 for (
auto &view : m_FITSViewers)
356 Ekos::Manager::Instance()->mountModule()->toggleMountToolBox();
362 Options::setShowSensorFOV(a->
isChecked());
363 for (
auto &oneFOV :
data()->getTransientFOVs())
365 if (oneFOV->objectName() ==
"sensor_fov")
366 oneFOV->setProperty(
"visible", a->
isChecked());
372 Options::setShowMosaicPanel(a->
isChecked());
375 auto scheduler = Ekos::Manager::Instance()->schedulerModule();
376 if (a->
isChecked() && scheduler && scheduler->moduleState()->schedulerState() != Ekos::SCHEDULER_RUNNING)
381 Ekos::FramingAssistantUI *assistant =
new Ekos::FramingAssistantUI();
394 telescopeGroup->setEnabled(enable);
397 for (
auto &a : telescopeGroup->actions())
406 domeGroup->setEnabled(enable);
409 for (
auto &a : domeGroup->actions())
418void KStars::slotCalculator()
430 Options::setRunStartupWizard(
false);
432 updateLocationFromWizard(*(wizard->geo()));
436void KStars::updateLocationFromWizard(
const GeoLocation &geo)
445 data()->isTimeRunningForward());
458 if (!Options::isTracking() && Options::useAltAz())
471#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
472 auto dlg = std::make_unique<KNSWidgets::Dialog>(
":/kconfig/kstars.knsrc",
this);
474 auto dlg = std::make_unique<KNS3::DownloadDialog>(
":/kconfig/kstars.knsrc",
this);
483 const auto changed_entries = dlg->changedEntries();
486#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
489 for (
const KNS3::Entry &entry : changed_entries)
492 if (entry.category() !=
"dso")
495#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
496 const auto id = entry.uniqueId().toInt();
497 if (entry.status() == KNSCore::Entry::Installed)
499 const auto id = entry.id().toInt();
500 if (entry.status() == KNS3::Entry::Installed)
502 for (
const QString &name : entry.installedFiles())
504 if (name.
endsWith(CatalogsDB::db_file_extension))
506 const auto meta{ CatalogsDB::read_catalog_meta_from_file(name) };
512 i18n(
"The catalog \"%1\" is corrupt.", entry.name()));
516 if (meta.second.id !=
id)
520 i18n(
"The catalog \"%1\" is corrupt.<br>Expected id=%2 but "
522 entry.name(),
id, meta.second.id));
526 const auto success{ manager.import_catalog(name,
true) };
530 i18n(
"Could not import the catalog \"%1\"<br>%2",
531 entry.name(), success.second));
534#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
535 if (entry.status() == KNSCore::Entry::Deleted)
537 if (entry.status() == KNS3::Entry::Deleted)
540 manager.remove_catalog(
id);
551void KStars::slotAVT()
558void KStars::slotWUT()
561 m_WUTDialog =
new WUTDialog(
this);
571 if (m_WIView && !m_wiDock->isVisible())
576 m_WIEquipmentSettings->populateScopeListWidget();
587 dialog->
addPage(m_WISettings,
i18n(
"Light Pollution Settings"));
588 dialog->
addPage(m_WIEquipmentSettings,
589 i18n(
"Equipment Settings - Equipment Type and Parameters"));
591 if (m_WIEquipmentSettings)
592 m_WIEquipmentSettings->setAperture();
602 m_WIView =
new WIView(
nullptr);
604 m_wiDock->setStyleSheet(
"QDockWidget::title{background-color:black;}");
605 m_wiDock->setObjectName(
"What's Interesting");
608 m_wiDock->setWidget(container);
609 m_wiDock->setMinimumWidth(400);
611 connect(m_wiDock, SIGNAL(visibilityChanged(
bool)),
613 SLOT(setChecked(
bool)));
614 m_wiDock->setVisible(
true);
618 m_wiDock->setVisible(!m_wiDock->isVisible());
622void KStars::slotCalendar()
626 m_SkyCalendar->
show();
629void KStars::slotGlossary()
640void KStars::slotScriptBuilder()
642 if (!m_ScriptBuilder)
643 m_ScriptBuilder =
new ScriptBuilder(
this);
644 m_ScriptBuilder->show();
647void KStars::slotSolarSystem()
650 m_PlanetViewer =
new PlanetViewer(
this);
651 m_PlanetViewer->show();
654void KStars::slotJMoonTool()
657 m_JMoonTool =
new JMoonTool(
this);
661void KStars::slotMoonPhaseTool()
672 m_FlagManager->show();
676void KStars::slotTelescopeWizard()
681 QString indiServerDir = Options::indiServer();
684 if (Options::indiServerIsInternal())
692 <<
"/usr/local/bin" << indiServerDir;
698 KSNotification::error(
i18n(
"Unable to find INDI server. Please make sure the package that provides "
699 "the 'indiserver' binary is installed."));
705 QPointer<telescopeWizardProcess> twiz =
new telescopeWizardProcess(
this);
712void KStars::slotINDIPanel()
717 QString indiServerDir = Options::indiServer();
720 if (Options::indiServerIsInternal())
723 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
728 <<
"/usr/local/bin" << indiServerDir;
734 KSNotification::error(
i18n(
735 "Unable to find INDI server. Please make sure the package that provides "
736 "the 'indiserver' binary is installed."));
741 GUIManager::Instance()->updateStatus(
true);
745void KStars::slotINDIDriver()
752 i18n(
"INDI Device Manager should only be used by advanced technical users. "
753 "It cannot be used with Ekos. Do you still want to open INDI device "
760 QString indiServerDir = Options::indiServer();
763 if (Options::indiServerIsInternal())
766 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
771 <<
"/usr/local/bin" << indiServerDir;
777 KSNotification::error(
i18n(
778 "Unable to find INDI server. Please make sure the package that provides "
779 "the 'indiserver' binary is installed."));
785 DriverManager::Instance()->
raise();
792void KStars::slotEkos()
799 QString indiServerDir = Options::indiServer();
802 if (Options::indiServerIsInternal())
805 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
810 <<
"/usr/local/bin" << indiServerDir;
816 KSNotification::error(
i18n(
817 "Unable to find INDI server. Please make sure the package that provides "
818 "the 'indiserver' binary is installed."));
824 if (Ekos::Manager::Instance()->
isVisible() &&
827 Ekos::Manager::Instance()->
hide();
831 Ekos::Manager::Instance()->
raise();
840void KStars::slotINDITelescopeTrack()
843 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
846 for (
auto &oneDevice : INDIListener::devices())
848 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
851 auto mount = oneDevice->getMount();
852 if (!mount ||
mount->isConnected() ==
false)
866void KStars::slotINDITelescopeSlew(
bool focused_object)
869 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
872 for (
auto &oneDevice : INDIListener::devices())
874 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
877 auto mount = oneDevice->getMount();
878 if (!mount ||
mount->isConnected() ==
false)
882 if (m_SkyMap->focusObject() !=
nullptr)
883 mount->Slew(m_SkyMap->focusObject());
886 mount->Slew(m_SkyMap->mousePoint());
891 Q_UNUSED(focused_object)
895void KStars::slotINDITelescopeSlewMousePointer()
898 slotINDITelescopeSlew(
false);
902void KStars::slotINDITelescopeSync(
bool focused_object)
905 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
908 for (
auto &oneDevice : INDIListener::devices())
910 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
913 auto mount = oneDevice->getMount();
914 if (!mount ||
mount->isConnected() ==
false)
919 if (m_SkyMap->focusObject() !=
nullptr)
920 mount->Sync(m_SkyMap->focusObject());
923 mount->Sync(m_SkyMap->mousePoint());
928 Q_UNUSED(focused_object)
932void KStars::slotINDITelescopeSyncMousePointer()
935 slotINDITelescopeSync(
false);
939void KStars::slotINDITelescopeAbort()
942 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
945 for (
auto &oneDevice : INDIListener::devices())
947 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
950 auto mount = oneDevice->getMount();
951 if (!mount ||
mount->isConnected() ==
false)
960void KStars::slotINDITelescopePark()
963 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
966 for (
auto &oneDevice : INDIListener::devices())
968 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
971 auto mount = oneDevice->getMount();
972 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
981void KStars::slotINDITelescopeUnpark()
984 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
987 for (
auto &oneDevice : INDIListener::devices())
989 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
992 auto mount = oneDevice->getMount();
993 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
1002void KStars::slotINDIDomePark()
1005 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1008 for (
auto &oneDevice : INDIListener::devices())
1010 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1013 auto dome = oneDevice->getDome();
1014 if (!dome || dome->isConnected() ==
false)
1016 if (dome->canPark())
1025void KStars::slotINDIDomeUnpark()
1028 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1031 for (
auto &oneDevice : INDIListener::devices())
1033 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1036 auto dome = oneDevice->getDome();
1037 if (!dome || dome->isConnected() ==
false)
1039 if (dome->canPark())
1053 GeoLocation *newLocation = locationdialog->selectedCity();
1065 data()->isTimeRunningForward());
1078 if (!Options::isTracking() && Options::useAltAz())
1081 data()->geo()->lat());
1089 delete locationdialog;
1092void KStars::slotViewOps()
1097 auto ops = prepareOps();
1101 ops->activateWindow();
1107 if (
nullptr != dialog)
1111 dialog =
new KConfigDialog(
this,
"settings", Options::self());
1115 dialog->
resize(800, 600);
1120 connect(dialog, SIGNAL(settingsChanged(QString)),
this,
1123 opcatalog =
new OpsCatalog();
1124 opguides =
new OpsGuides();
1125 opterrain =
new OpsTerrain();
1126 opsImageOverlay =
new OpsImageOverlay();
1127 opsdeveloper =
new OpsDeveloper();
1128 opsolsys =
new OpsSolarSystem();
1129 opssatellites =
new OpsSatellites();
1130 opssupernovae =
new OpsSupernovae();
1131 opcolors =
new OpsColors();
1132 opadvanced =
new OpsAdvanced();
1134 KPageWidgetItem *page;
1136 page = dialog->
addPage(opcatalog,
i18n(
"Catalogs"),
"kstars_catalog");
1139 page = dialog->
addPage(opsolsys,
i18n(
"Solar System"),
"kstars_solarsystem");
1142 page = dialog->
addPage(opssatellites,
i18n(
"Satellites"),
"kstars_satellites");
1145 page = dialog->
addPage(opssupernovae,
i18n(
"Supernovae"),
"kstars_supernovae");
1148 page = dialog->
addPage(opguides,
i18n(
"Guides"),
"kstars_guides");
1151 page = dialog->
addPage(opterrain,
i18n(
"Terrain"),
"kstars_terrain");
1154 page = dialog->
addPage(opsImageOverlay,
i18n(
"Image Overlays"),
"kstars_imageoverlay");
1156 KStarsData::Instance()->
skyComposite()->imageOverlay()->setWidgets(
1157 opsImageOverlay->table(), opsImageOverlay->statusDisplay(), opsImageOverlay->solvePushButton(),
1158 opsImageOverlay->tableTitleBox(), opsImageOverlay->solverProfile());
1160 page = dialog->
addPage(opcolors,
i18n(
"Colors"),
"kstars_colors");
1164 opsfits =
new OpsFITS();
1165 page = dialog->
addPage(opsfits,
i18n(
"FITS"),
"kstars_fitsviewer");
1170 opsindi =
new OpsINDI();
1171 page = dialog->
addPage(opsindi,
i18n(
"INDI"),
"kstars_indi");
1174 opsekos =
new OpsEkos();
1175 KPageWidgetItem *ekosOption = dialog->
addPage(opsekos,
i18n(
"Ekos"),
"kstars_ekos");
1177 if (Ekos::Manager::Instance())
1178 Ekos::Manager::Instance()->setOptionsWidget(ekosOption, opsekos);
1183 opsxplanet =
new OpsXplanet(
this);
1184 page = dialog->
addPage(opsxplanet,
i18n(
"Xplanet"),
"kstars_xplanet");
1187 page = dialog->
addPage(opadvanced,
i18n(
"Advanced"),
"kstars_advanced");
1190 page = dialog->
addPage(opsdeveloper,
i18n(
"Developer"),
"kstars_developer");
1197 KStars::Instance()->appHelpActivated();
1206 opterrain->syncOptions();
1208 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
1210 opsImageOverlay->syncOptions();
1212 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
1217 Options::self()->save();
1227 Options::self()->save();
1229 m_WIView->updateObservingConditions();
1230 m_WIView->onReloadIconClicked();
1233void KStars::slotSetTime()
1241 if (Options::useAltAz())
1243 if (
map()->focusObject())
1246 data()->geo()->lat());
1257 KSPlanetBase *planet =
dynamic_cast<KSPlanetBase *
>(
map()->
focusObject());
1272 if (Options::useAltAz())
1274 if (
map()->focusObject())
1277 data()->geo()->lat());
1295void KStars::slotFind()
1300 (targetObject = FindDialog::Instance()->targetObject()))
1312void KStars::slotOpenFITS()
1315 auto fv = createFITSViewer();
1320void KStars::slotBlink()
1323 auto fv = createFITSViewer();
1328void KStars::slotExportImage()
1337 "Images (*.png *.jpeg *.gif *.bmp *.svg)");
1350 i18n(
"A file named \"%1\" already exists. Overwrite it?", fileURL.
fileName()),
1362 if (!m_ExportImageDialog)
1364 m_ExportImageDialog =
new ExportImageDialog(
1366 KStarsData::Instance()->imageExporter());
1370 m_ExportImageDialog->setOutputUrl(fileURL.
toLocalFile());
1374 m_ExportImageDialog->show();
1377void KStars::slotRunScript()
1382 i18nc(
"Filter by file type: KStars Scripts.",
"KStars Scripts (*.kstars)"));
1390 KSNotification::sorry(
i18n(
"Executing remote scripts is not supported."));
1398 QString message =
i18n(
"Could not open file %1", f.fileName());
1399 KSNotification::sorry(message,
i18n(
"Could Not Open File"));
1403 QTextStream istream(&f);
1407 while (!istream.atEnd())
1409 line = istream.readLine();
1410 if (line.
at(0) !=
'#' && line.
left(9) !=
"dbus-send")
1423 "The selected script contains unrecognized elements, "
1424 "indicating that it was not created using the KStars script builder. "
1425 "This script may not function properly, and it may even contain "
1427 "Would you like to execute it anyway?"),
1428 i18n(
"Script Validation Failed"), KGuiItem(
i18n(
"Run Nevertheless")),
1441 QStringList arguments;
1442 p.
start(f.fileName(), arguments);
1448 qApp->processEvents();
1457void KStars::slotPrint()
1459 bool switchColors(
false);
1462 if (
data()->colorScheme()->colorNamed(
"SkyColor") != QColor(255, 255, 255))
1465 i18n(
"You can save printer ink by using the \"Star Chart\" "
1466 "color scheme, which uses a white background. Would you like to "
1467 "temporarily switch to the Star Chart color scheme for printing?");
1470 nullptr, message,
i18n(
"Switch to Star Chart Colors?"),
1471 KGuiItem(
i18n(
"Switch Color Scheme")), KGuiItem(
i18n(
"Do Not Switch")),
"askAgainPrintColors");
1476 switchColors =
true;
1482void KStars::slotPrintingWizard()
1484 if (m_PrintingWizard)
1486 delete m_PrintingWizard;
1489 m_PrintingWizard =
new PrintingWizard(
this);
1490 m_PrintingWizard->show();
1493void KStars::slotToggleTimer()
1495 if (
data()->clock()->isActive())
1502 if (fabs(
data()->clock()->scale()) > Options::slewTimeScale())
1505 if (
data()->clock()->isManualMode())
1510 Options::setRunClock(
data()->clock()->isActive());
1513void KStars::slotRealTimeToogled(
bool checked)
1518 QAction *a =
nullptr;
1529 m_TimeStepBox->setDisabled(
true);
1532 if (a) a->
setText(
i18n(
"Stop running clock in realtime"));
1536 QAction *a =
nullptr;
1547 m_TimeStepBox->setDisabled(
false);
1554void KStars::slotStepForward()
1556 if (
data()->clock()->isActive())
1562void KStars::slotStepBackward()
1564 if (
data()->clock()->isActive())
1571void KStars::slotPointFocus()
1574 map()->stopTracking();
1578 Options::useRefraction());
1591 if (Options::isTracking())
1593 Options::setIsTracking(
false);
1600 if (planet &&
data()->temporaryTrail)
1603 data()->temporaryTrail =
false;
1616 Options::setIsTracking(
true);
1626void KStars::slotManualFocus()
1643 double realAlt(focusDialog->point()->alt().Degrees());
1644 double realDec(focusDialog->point()->dec().Degrees());
1645 if (Options::useAltAz() && realAlt > 89.0)
1647 focusDialog->point()->setAlt(89.0);
1648 focusDialog->point()->HorizontalToEquatorial(
data()->lst(),
1649 data()->geo()->lat());
1651 if (!Options::useAltAz() && realDec > 89.0)
1653 focusDialog->point()->setDec(89.0);
1654 focusDialog->point()->EquatorialToHorizontal(
data()->lst(),
1660 if (Options::isTracking())
1673 if (Options::useAltAz())
1677 focusDialog->point()->az(),
false);
1682 focusDialog->point()->dec());
1686 if (Options::useAltAz() && realAlt > 89.0)
1688 if (!Options::useAltAz() && realDec > 89.0)
1692 if (focusDialog->usedAltAz())
1693 map()->stopTracking();
1708 ki18nc(
"approximate field of view",
"Approximate FOV: %1 degrees");
1713 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcminutes");
1719 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcseconds");
1735 i18nc(
"The user should enter an angle for the field-of-view of the display",
1736 "Enter Desired Field-of-View Angle"),
1737 i18n(
"Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1746void KStars::slotCoordSys()
1748 if (Options::useAltAz())
1750 Options::setUseAltAz(
false);
1751 if (Options::useRefraction())
1753 if (
map()->focusObject())
1760 data()->geo()->lat());
1765 ->
setText(
i18n(
"Switch to Horizontal View (Horizontal &Coordinates)"));
1767 ->
action(
"up_orientation")
1768 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Up"));
1770 ->
action(
"down_orientation")
1771 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Down"));
1772 erectObserverCorrectionGroup->setEnabled(
false);
1776 Options::setUseAltAz(
true);
1777 if (Options::useRefraction())
1784 ->
setText(
i18n(
"Switch to Star Globe View (Equatorial &Coordinates)"));
1786 ->
action(
"up_orientation")
1787 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Up"));
1789 ->
action(
"down_orientation")
1790 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Down"));
1791 erectObserverCorrectionGroup->setEnabled(
true);
1797void KStars::slotSkyMapOrientation()
1801 Options::setSkyRotation(0.0);
1805 Options::setSkyRotation(180.0);
1809 Options::setErectObserverCorrection(
1816void KStars::slotMapProjection()
1819 Options::setProjection(Projector::Lambert);
1821 Options::setProjection(Projector::AzimuthalEquidistant);
1823 Options::setProjection(Projector::Orthographic);
1825 Options::setProjection(Projector::Equirectangular);
1827 Options::setProjection(Projector::Stereographic);
1829 Options::setProjection(Projector::Gnomonic);
1832 qCDebug(KSTARS) <<
"Projection system: " << Options::projection();
1834 m_SkyMap->forceUpdate();
1838void KStars::slotColorScheme()
1843void KStars::slotTargetSymbol(
bool flag)
1845 qDebug() << Q_FUNC_INFO << QString(
"slotTargetSymbol: %1 %2").arg(
sender()->
objectName()).arg(flag);
1847 QStringList names = Options::fOVNames();
1860 Options::setFOVNames(names);
1868void KStars::slotApplySkyMapView(
const QString &viewName)
1874 qCWarning(KSTARS) <<
"View named " << viewName <<
" not found!";
1880 Options::setUseAltAz(!view->useAltAz);
1883 Options::setMirrorSkyMap(view->mirror);
1886 int erectObserverCorrection = 0;
1887 double viewAngle = view->viewAngle;
1888 if (view->erectObserver && view->useAltAz)
1892 erectObserverCorrection = 1;
1897 erectObserverCorrection = 2;
1906 Options::setErectObserverCorrection(erectObserverCorrection);
1908 if (!std::isnan(view->fov))
1912 repopulateOrientation();
1913 qCDebug(KSTARS) <<
"Alt/Az: " << Options::useAltAz()
1914 <<
"Mirror: " << Options::mirrorSkyMap()
1915 <<
"Rotation: " << Options::skyRotation()
1916 <<
"Erect Obs: " << Options::erectObserverCorrection()
1917 <<
"FOV: " << view->fov;
1922void KStars::slotHIPSSource()
1925 Q_ASSERT(selectedAction !=
nullptr);
1927 QString selectedSource = selectedAction->
text().remove(
'&');
1931 if (selectedSource ==
i18n(
"None"))
1932 HIPSManager::Instance()->setCurrentSource(
"None");
1934 HIPSManager::Instance()->setCurrentSource(selectedSource);
1939void KStars::slotEditViews()
1941 QPointer<ViewsDialog> viewsDialog =
new ViewsDialog(
this);
1950void KStars::slotFOVEdit()
1952 QPointer<FOVDialog> fovdlg =
new FOVDialog(
this);
1961void KStars::slotObsList()
1963 m_KStarsData->observingList()->show();
1966void KStars::slotImagingPlanner()
1969 m_KStarsData->imagingPlanner()->show();
1973void KStars::slotEquipmentWriter()
1975 QPointer<EquipmentWriter> equipmentdlg =
new EquipmentWriter();
1976 equipmentdlg->loadEquipment();
1977 equipmentdlg->exec();
1978 delete equipmentdlg;
1981void KStars::slotObserverManager()
1983 QPointer<ObserverAdd> m_observerAdd =
new ObserverAdd();
1984 m_observerAdd->exec();
1985 delete m_observerAdd;
1988void KStars::slotHorizonManager()
1990 if (!m_HorizonManager)
1992 m_HorizonManager =
new HorizonManager(
this);
1993 connect(m_SkyMap, SIGNAL(positionClicked(SkyPoint *)), m_HorizonManager,
1994 SLOT(addSkyPoint(SkyPoint *)));
1997 m_HorizonManager->show();
2000void KStars::slotExecute()
2002 KStarsData::Instance()->executeSession()->init();
2003 KStarsData::Instance()->executeSession()->show();
2006void KStars::slotPolarisHourAngle()
2008 QPointer<PolarisHourAngle> pHourAngle =
new PolarisHourAngle(
this);
2013void KStars::slotFullScreen()
2028void KStars::slotTerrain()
2030 Options::setShowTerrain(!Options::showTerrain());
2032 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
2033 opterrain->syncOptions();
2038void KStars::slotImageOverlays()
2040 Options::setShowImageOverlays(!Options::showImageOverlays());
2042 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
2043 opsImageOverlay->syncOptions();
2051 if (
map()->focusObject() &&
map()->focusObject()->isSolarSystem() &&
2052 data()->temporaryTrail)
2063void KStars::slotShowGUIItem(
bool show)
2068 Options::setShowStatusBar(
show);
2074 Options::setShowAltAzField(
show);
2075 AltAzField.setHidden(!
show);
2080 Options::setShowRADecField(
show);
2081 RADecField.setHidden(!
show);
2086 Options::setShowJ2000RADecField(
show);
2087 J2000RADecField.setHidden(!
show);
2098 colorActionMenu->addAction(kta);
2101 if (actionName.
mid(3) ==
2102 cg.
readEntry(
"ColorSchemeFile",
"moonless-night.colors").
remove(
".colors"))
2109 connect(kta, SIGNAL(toggled(
bool)),
this, SLOT(slotColorScheme()));
2114 qCDebug(KSTARS) <<
"removing " << actionName;
2118void KStars::slotAboutToQuit()
2120 if (m_SkyMap ==
nullptr)
2124 DriverManager::Instance()->disconnectClients();
2125 INDIListener::Instance()->disconnect();
2126 GUIManager::Instance()->disconnect();
2135 Options::setWindowWidth(
width());
2136 Options::setWindowHeight(
height());
2147 quit->start(
"killall kdeinit5");
2148 quit->waitForFinished(1000);
2149 quit->start(
"killall klauncher");
2150 quit->waitForFinished(1000);
2151 quit->start(
"killall kioslave");
2152 quit->waitForFinished(1000);
2153 quit->start(
"killall kio_http_cache_cleaner");
2154 quit->waitForFinished(1000);
2161 if (Options::showAltAzField())
2164 if (Options::useAltAz())
2170 AltAzField.setText(s);
2172 if (Options::showRADecField())
2175 lastUpdate.
setDJD(KStarsData::Instance()->updateNum()->getJD());
2181 RADecField.setText(s);
2184 if (Options::showJ2000RADecField())
2190 p0 = pOrig.
catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2195 J2000RADecField.setText(s);
2199void KStars::slotUpdateComets(
bool isAutoUpdate)
2201 data()->
skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2205void KStars::slotUpdateAsteroids(
bool isAutoUpdate)
2207 data()->
skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2211void KStars::slotUpdateSupernovae()
2216void KStars::slotUpdateSatellites()
2221void KStars::slotConfigureNotifications()
2223#ifdef HAVE_NOTIFYCONFIG
2229 auto *ui =
new CatalogsDBUI{
this, CatalogsDB::dso_db_path() };
This is the base class for the KStars astronomical calculator.
void dropCache()
Clear the internal cache and effectively reload all objects from the database.
A simple UI to manage downloaded and custom Catalogs.
Manages the catalog database and provides an interface to provide an interface to query and modify th...
void saveToConfig()
Save color-scheme data to the Config object.
static bool save()
Write list of FOVs to "fov.dat".
Flag manager Dialog box to add and remove flags.
A small dialog for setting the focus coordinates manually.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Q_INVOKABLE QAction * action(const QString &name) const
ActionType * add(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
KConfigGroup group(const QString &group)
static bool showDialog(const QString &name)
KPageWidgetItem * addPage(QWidget *page, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString(), bool manage=true)
static KConfigDialog * exists(const QString &name)
QString readEntry(const char *key, const char *aDefault=nullptr) const
KLocalizedString subs(const KLocalizedString &a, int fieldWidth=0, QChar fillChar=QLatin1Char(' ')) const
QPushButton * button(QDialogButtonBox::StandardButton which) const
void setIcon(const QIcon &icon)
A subclass of TrailObject that provides additional information needed for most solar system objects.
The Startup Wizard will be automatically opened when KStars runs for the first time.
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
void setNextDSTChange(const KStarsDateTime &dt)
Set the NextDSTChange member.
void setLocation(const GeoLocation &l)
Set the GeoLocation according to the argument.
void changeDateTime(const KStarsDateTime &newDate)
Change the current simulation date/time to the KStarsDateTime argument.
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
ColorScheme * colorScheme()
void syncLST()
Sync the LST with the simulation clock.
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
Q_INVOKABLE SimClock * clock()
void add_color_scheme(const QString &filename, const QString &name)
Register a color scheme with filename and name.
SkyMapComposite * skyComposite()
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
void setDJD(long double jd)
Assign the static_cast<long double> Julian Day value, which includes the time of day encoded in the f...
double epoch() const
This is (approximately) the year expressed as a floating-point value.
static KStarsDateTime currentDateTimeUtc()
void slotSetZoom()
action slot: Allow user to specify a field-of-view angle for the display window in degrees,...
void repopulateViews()
Load Views and repopulate menu.
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
void slotDownload()
action slot: open KNewStuff window to download extra data.
static KStars * Instance()
void slotToggleWIView()
action slot: toggle What's Interesting window
void slotDSOCatalogGUI()
Show the DSO Catalog Management GUI.
void syncOps()
Sync Options to GUI, if any.
void slotApplyWIConfigChanges()
Apply new settings for WI.
void slotWizard()
action slot: open KStars startup wizard
void slotTrack()
action slot: Toggle whether kstars is tracking current position
void addColorMenuItem(QString name, const QString &actionName)
Add an item to the color-scheme action manu.
KStarsData * data() const
void slotGeoLocator()
action slot: open dialog for selecting a new geographic location
void slotSetDomeEnabled(bool enable)
slotSetDomeEnabled call when dome comes online or goes offline.
Q_SCRIPTABLE Q_NOREPLY void writeConfig()
DBUS interface function.
void slotFlagManager()
action slot: open Flag Manager
void slotSetTelescopeEnabled(bool enable)
slotSetTelescopeEnabled call when telescope comes online or goes offline.
Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name)
DBUS interface function.
void slotWISettings()
action slot: open What's Interesting settings window
Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors)
DBUS interface function.
void slotClearAllTrails()
Remove all trails which may have been added to solar system bodies.
void removeColorMenuItem(const QString &actionName)
Remove an item from the color-scheme action manu.
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
static bool Closing
Set to true when the application is being closed.
void slotShowPositionBar(SkyPoint *)
Display position in the status bar.
void slotSetTimeToNow()
action slot: sync kstars clock to system time
void slotApplyConfigChanges()
Apply new settings and redraw skymap.
void slotZoomChanged()
Called when zoom level is changed.
virtual KActionCollection * actionCollection() const
virtual QAction * action(const QDomElement &element) const
Dialog for changing the geographic location of the observer.
double fov() const
Return the FOV of this projection.
void updateTLEs()
Download new TLE files.
void setManualMode(bool on=true)
Sets Manual Mode on/off according to the bool argument.
Q_SCRIPTABLE Q_NOREPLY void start()
DBUS function to start the SimClock.
Q_SCRIPTABLE Q_NOREPLY void stop()
DBUS function to stop the SimClock.
void manualTick(bool force=false, bool backward=false)
Equivalent of tick() for manual mode.
Draws Rise/Set/Transit curves for major solar system planets for any calendar year.
static bool save()
Commit the list of views to the database.
static std::optional< SkyMapView > viewNamed(const QString &name)
Get the view with the given name.
void setZoomFactor(double factor)
@ Set zoom factor.
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
void setupProjector()
Call to set up the projector before a draw cycle.
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
const Projector * projector() const
Get the current projector.
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
sets the destination point of the sky map, using its alt/az coordinates.
void setFocus(SkyPoint *f)
sets the central focus point of the sky map.
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
void slotCenter()
Center the display at the point ClickedPoint.
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
The sky coordinates of a point in the sky.
const CachingDms & dec() const
void setDec(dms d)
Sets Dec, the current Declination.
const CachingDms & ra() const
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
void setAlt(dms alt)
Sets Alt, the Altitude.
void HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates,...
SkyPoint catalogueCoord(long double jdf)
Computes the J2000.0 catalogue coordinates for this SkyPoint using the epoch removing aberration,...
void slotTriggerDataFileUpdate()
This initiates updating of the data file.
static void discoverTextureDirs()
Clear the cache and discover the directories to load textures from.
KStarsDateTime nextDSTChange() const
void reset_with_ltime(KStarsDateTime <ime, const double TZoffset, const bool time_runs_forward, const bool automaticDSTchange=false)
Recalculate next dst change and if DST is active by a given local time with timezone offset and time ...
void clearTrail()
clear the Trail
void addToTrail(const QString &label=QString())
adds a point to the planet's trail
static void clearTrailsExcept(SkyObject *o)
Remove trail for all objects but one which is passed as parameter.
User interface for "Equipment Type and Parameters" page in WI settings dialog.
User interface for "Light Pollution Settings" page in WI settings dialog This class deals with light ...
Manages the QML user interface for What's Interesting.
An angle, stored as degrees, but expressible in many ways.
const dms reduce() const
return the equivalent angle between 0 and 360 degrees.
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
const QString toHMSString(const bool machineReadable=false, const bool highPrecision=false) const
static constexpr double DegToRad
DegToRad is a const static member equal to the number of radians in one degree (dms::PI/180....
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
QString i18n(const char *text, const TYPE &arg...)
KIOCORE_EXPORT SimpleJob * mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, JobFlags flags=DefaultFlags)
GeoCoordinates geo(const QVariant &location)
ButtonCode warningContinueCancel(QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
void information(QWidget *parent, const QString &text, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
bool isChecked() const const
void setIcon(const QIcon &icon)
void setActionGroup(QActionGroup *group)
void setText(const QString &text)
QString applicationDirPath()
void finished(int result)
QString path() const const
bool exists() const const
QUrl getOpenFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, Options options, const QStringList &supportedSchemes)
QUrl getSaveFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, Options options, const QStringList &supportedSchemes)
QIcon fromTheme(const QString &name)
void append(QList< T > &&value)
void removeAt(qsizetype i)
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
QStatusBar * statusBar() const const
StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons, StandardButton defaultButton)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
T findChild(const QString &name, Qt::FindChildOptions options) const const
T qobject_cast(QObject *object)
QObject * sender() const const
void setObjectName(QAnyStringView name)
void start(OpenMode mode)
QProcess::ProcessState state() const const
bool waitForFinished(int msecs)
bool waitForStarted(int msecs)
QString findExecutable(const QString &executableName, const QStringList &paths)
void showMessage(const QString &message, int timeout)
QString arg(Args &&... args) const const
const QChar at(qsizetype position) const const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
QString left(qsizetype n) const const
QString mid(qsizetype position, qsizetype n) const const
QString number(double n, char format, int precision)
QString & remove(QChar ch, Qt::CaseSensitivity cs)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
qsizetype indexOf(const QRegularExpression &re, qsizetype from) const const
QString fileName(ComponentFormattingOptions options) const const
bool isEmpty() const const
bool isLocalFile() const const
bool isValid() const const
QString toLocalFile() const const