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()
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();
397 for (
auto &a : telescopeGroup->
actions())
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()
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)
602 m_WIView =
new WIView(
nullptr);
604 m_wiDock->
setStyleSheet(
"QDockWidget::title{background-color:black;}");
611 connect(m_wiDock, SIGNAL(visibilityChanged(
bool)),
613 SLOT(setChecked(
bool)));
622void KStars::slotCalendar()
626 m_SkyCalendar->
show();
629void KStars::slotGlossary()
640void KStars::slotScriptBuilder()
642 if (!m_ScriptBuilder)
644 m_ScriptBuilder->
show();
647void KStars::slotSolarSystem()
651 m_PlanetViewer->
show();
654void KStars::slotJMoonTool()
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."));
712void KStars::slotINDIPanel()
717 QString indiServerDir = Options::indiServer();
720 if (Options::indiServerIsInternal())
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())
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())
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)
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)
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);
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");
1165 page = dialog->
addPage(opsfits,
i18n(
"FITS"),
"kstars_fitsviewer");
1171 page = dialog->
addPage(opsindi,
i18n(
"INDI"),
"kstars_indi");
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();
1233void KStars::slotSetTime()
1241 if (Options::useAltAz())
1243 if (
map()->focusObject())
1246 data()->geo()->lat());
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)
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"));
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?"),
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?"),
1476 switchColors =
true;
1482void KStars::slotPrintingWizard()
1484 if (m_PrintingWizard)
1486 delete m_PrintingWizard;
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)
1550void KStars::slotStepForward()
1552 if (
data()->clock()->isActive())
1558void KStars::slotStepBackward()
1560 if (
data()->clock()->isActive())
1567void KStars::slotPointFocus()
1570 map()->stopTracking();
1574 Options::useRefraction());
1587 if (Options::isTracking())
1589 Options::setIsTracking(
false);
1596 if (planet &&
data()->temporaryTrail)
1599 data()->temporaryTrail =
false;
1612 Options::setIsTracking(
true);
1622void KStars::slotManualFocus()
1639 double realAlt(focusDialog->point()->alt().Degrees());
1640 double realDec(focusDialog->point()->dec().Degrees());
1641 if (Options::useAltAz() && realAlt > 89.0)
1643 focusDialog->point()->setAlt(89.0);
1644 focusDialog->point()->HorizontalToEquatorial(
data()->lst(),
1645 data()->geo()->lat());
1647 if (!Options::useAltAz() && realDec > 89.0)
1649 focusDialog->point()->setDec(89.0);
1650 focusDialog->point()->EquatorialToHorizontal(
data()->lst(),
1656 if (Options::isTracking())
1669 if (Options::useAltAz())
1673 focusDialog->point()->az(),
false);
1678 focusDialog->point()->dec());
1682 if (Options::useAltAz() && realAlt > 89.0)
1684 if (!Options::useAltAz() && realDec > 89.0)
1688 if (focusDialog->usedAltAz())
1689 map()->stopTracking();
1704 ki18nc(
"approximate field of view",
"Approximate FOV: %1 degrees");
1709 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcminutes");
1715 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcseconds");
1731 i18nc(
"The user should enter an angle for the field-of-view of the display",
1732 "Enter Desired Field-of-View Angle"),
1733 i18n(
"Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1742void KStars::slotCoordSys()
1744 if (Options::useAltAz())
1746 Options::setUseAltAz(
false);
1747 if (Options::useRefraction())
1749 if (
map()->focusObject())
1756 data()->geo()->lat());
1761 ->
setText(
i18n(
"Switch to Horizontal View (Horizontal &Coordinates)"));
1763 ->
action(
"up_orientation")
1764 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Up"));
1766 ->
action(
"down_orientation")
1767 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Down"));
1768 erectObserverCorrectionGroup->
setEnabled(
false);
1772 Options::setUseAltAz(
true);
1773 if (Options::useRefraction())
1780 ->
setText(
i18n(
"Switch to Star Globe View (Equatorial &Coordinates)"));
1782 ->
action(
"up_orientation")
1783 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Up"));
1785 ->
action(
"down_orientation")
1786 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Down"));
1787 erectObserverCorrectionGroup->
setEnabled(
true);
1793void KStars::slotSkyMapOrientation()
1797 Options::setSkyRotation(0.0);
1801 Options::setSkyRotation(180.0);
1805 Options::setErectObserverCorrection(
1812void KStars::slotMapProjection()
1815 Options::setProjection(Projector::Lambert);
1817 Options::setProjection(Projector::AzimuthalEquidistant);
1819 Options::setProjection(Projector::Orthographic);
1821 Options::setProjection(Projector::Equirectangular);
1823 Options::setProjection(Projector::Stereographic);
1825 Options::setProjection(Projector::Gnomonic);
1828 qCDebug(KSTARS) <<
"Projection system: " << Options::projection();
1834void KStars::slotColorScheme()
1839void KStars::slotTargetSymbol(
bool flag)
1856 Options::setFOVNames(names);
1864void KStars::slotApplySkyMapView(
const QString &viewName)
1870 qCWarning(KSTARS) <<
"View named " << viewName <<
" not found!";
1876 Options::setUseAltAz(!view->useAltAz);
1879 Options::setMirrorSkyMap(view->mirror);
1882 int erectObserverCorrection = 0;
1883 double viewAngle = view->viewAngle;
1884 if (view->erectObserver && view->useAltAz)
1888 erectObserverCorrection = 1;
1893 erectObserverCorrection = 2;
1902 Options::setErectObserverCorrection(erectObserverCorrection);
1904 if (!std::isnan(view->fov))
1908 repopulateOrientation();
1909 qCDebug(KSTARS) <<
"Alt/Az: " << Options::useAltAz()
1910 <<
"Mirror: " << Options::mirrorSkyMap()
1911 <<
"Rotation: " << Options::skyRotation()
1912 <<
"Erect Obs: " << Options::erectObserverCorrection()
1913 <<
"FOV: " << view->fov;
1918void KStars::slotHIPSSource()
1921 Q_ASSERT(selectedAction !=
nullptr);
1923 QString selectedSource = selectedAction->
text().remove(
'&');
1927 if (selectedSource ==
i18n(
"None"))
1928 HIPSManager::Instance()->setCurrentSource(
"None");
1930 HIPSManager::Instance()->setCurrentSource(selectedSource);
1935void KStars::slotEditViews()
1946void KStars::slotFOVEdit()
1957void KStars::slotObsList()
1959 m_KStarsData->observingList()->
show();
1962void KStars::slotImagingPlanner()
1965 m_KStarsData->imagingPlanner()->show();
1969void KStars::slotEquipmentWriter()
1972 equipmentdlg->loadEquipment();
1973 equipmentdlg->exec();
1974 delete equipmentdlg;
1977void KStars::slotObserverManager()
1980 m_observerAdd->exec();
1981 delete m_observerAdd;
1984void KStars::slotHorizonManager()
1986 if (!m_HorizonManager)
1989 connect(m_SkyMap, SIGNAL(positionClicked(
SkyPoint *)), m_HorizonManager,
1993 m_HorizonManager->
show();
1996void KStars::slotExecute()
1998 KStarsData::Instance()->executeSession()->init();
1999 KStarsData::Instance()->executeSession()->show();
2002void KStars::slotPolarisHourAngle()
2009void KStars::slotFullScreen()
2024void KStars::slotTerrain()
2026 Options::setShowTerrain(!Options::showTerrain());
2028 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
2029 opterrain->syncOptions();
2034void KStars::slotImageOverlays()
2036 Options::setShowImageOverlays(!Options::showImageOverlays());
2038 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
2039 opsImageOverlay->syncOptions();
2047 if (
map()->focusObject() &&
map()->focusObject()->isSolarSystem() &&
2048 data()->temporaryTrail)
2059void KStars::slotShowGUIItem(
bool show)
2064 Options::setShowStatusBar(
show);
2070 Options::setShowAltAzField(
show);
2076 Options::setShowRADecField(
show);
2082 Options::setShowJ2000RADecField(
show);
2097 if (actionName.
mid(3) ==
2098 cg.
readEntry(
"ColorSchemeFile",
"moonless-night.colors").
remove(
".colors"))
2105 connect(kta, SIGNAL(toggled(
bool)),
this, SLOT(slotColorScheme()));
2110 qCDebug(KSTARS) <<
"removing " << actionName;
2114void KStars::slotAboutToQuit()
2116 if (m_SkyMap ==
nullptr)
2120 DriverManager::Instance()->disconnectClients();
2131 Options::setWindowWidth(
width());
2132 Options::setWindowHeight(
height());
2143 quit->start(
"killall kdeinit5");
2144 quit->waitForFinished(1000);
2145 quit->start(
"killall klauncher");
2146 quit->waitForFinished(1000);
2147 quit->start(
"killall kioslave");
2148 quit->waitForFinished(1000);
2149 quit->start(
"killall kio_http_cache_cleaner");
2150 quit->waitForFinished(1000);
2157 if (Options::showAltAzField())
2160 if (Options::useAltAz())
2168 if (Options::showRADecField())
2171 lastUpdate.
setDJD(KStarsData::Instance()->updateNum()->getJD());
2180 if (Options::showJ2000RADecField())
2186 p0 = pOrig.
catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2195void KStars::slotUpdateComets(
bool isAutoUpdate)
2197 data()->
skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2201void KStars::slotUpdateAsteroids(
bool isAutoUpdate)
2203 data()->
skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2207void KStars::slotUpdateSupernovae()
2212void KStars::slotUpdateSatellites()
2217void KStars::slotConfigureNotifications()
2219#ifdef HAVE_NOTIFYCONFIG
2225 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.
FOVDialog is dialog to select a Field-of-View indicator (or create a new one)
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,...
Manages adding/removing and editing regions and points associated with user-customized artificial hor...
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.
Dialog to add new observers.
The Advanced Tab of the Options window.
The Catalog page for the Options window.
The Colors page allows the user to adjust all of the colors used to display the night sky.
The Developer Tab of the Options window.
Enables the user to set remote connection devices and options in addition to online and offline astro...
The FITS Tab of the Options window.
The guide page enables to user to select to turn on and off guide overlays such as constellation line...
Enables the user to change several INDI options including default ports for common devices,...
The terrain page enables to user to manage the options for image overlays.
The Satellites Tab of the Options window.
The Solar System page for the Options window.
The Supernovae Tab of the Options window.
The terrain page enables to user to manage the options for the terrain overlay.
Display an overhead view of the solar system.
Class representing Printing Wizard for KStars printed documents (currently only finder charts).
double fov() const
Return the FOV of this projection.
void updateTLEs()
Download new TLE files.
A GUI tool for building behavioral DBus scripts for KStars.
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.
SkyPoint * mousePoint()
Retrieve the mouse pointer position.
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.
ViewsDialog is dialog to select a Sky Map View (or create a new one)
User interface for "Equipment Type and Parameters" page in WI settings dialog.
void populateScopeListWidget()
Populates scope list widget in UI with list of telescopes from KStars userdb.
void setAperture()
Set aperture to use.
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.
void onReloadIconClicked()
public slot - Reload list of visible sky-objects.
void updateObservingConditions()
What's up tonight dialog is a window which lists all sky objects that will be visible during the next...
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)
QList< QAction * > actions() const const
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 setText(const QString &)
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