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"
93#include "xplanet/opsxplanet.h"
95#ifdef HAVE_NOTIFYCONFIG
96#include <KNotifyConfigWidget>
98#include <KActionCollection>
101#include <KToggleAction>
103#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
104#include <KNSWidgets/dialog.h>
106#include <kns3/downloaddialog.h>
109#include <QQuickWindow>
120void KStars::slotViewToolBar()
130 opcatalog->kcfg_ShowStars->setChecked(a->
isChecked());
138 opcatalog->kcfg_ShowDeepSky->setChecked(a->
isChecked());
143 Options::setShowSolarSystem(a->
isChecked());
146 opsolsys->kcfg_ShowSolarSystem->setChecked(a->
isChecked());
154 opguides->kcfg_ShowCLines->setChecked(a->
isChecked());
162 opguides->kcfg_ShowCNames->setChecked(a->
isChecked());
170 opguides->kcfg_ShowCBounds->setChecked(a->
isChecked());
175 Options::setShowConstellationArt(a->
isChecked());
178 opguides->kcfg_ShowConstellationArt->setChecked(a->
isChecked());
183 Options::setShowMilkyWay(a->
isChecked());
186 opguides->kcfg_ShowMilkyWay->setChecked(a->
isChecked());
194 Options::setAutoSelectGrid(
false);
195 Options::setShowEquatorialGrid(a->
isChecked());
198 opguides->kcfg_ShowEquatorialGrid->setChecked(a->
isChecked());
199 opguides->kcfg_AutoSelectGrid->setChecked(
false);
204 Options::setAutoSelectGrid(
false);
205 Options::setShowHorizontalGrid(a->
isChecked());
208 opguides->kcfg_ShowHorizontalGrid->setChecked(a->
isChecked());
209 opguides->kcfg_AutoSelectGrid->setChecked(
false);
215 if (!a->
isChecked() && Options::useRefraction())
217 QString caption =
i18n(
"Refraction effects disabled");
218 QString message =
i18n(
"When the horizon is switched off, refraction effects "
219 "are temporarily disabled.");
225 opguides->kcfg_ShowGround->setChecked(a->
isChecked());
230 Options::setSimulateDaytime(a->
isChecked());
233 opguides->kcfg_SimulateDaytime->setChecked(a->
isChecked());
241 opguides->kcfg_ShowFlags->setChecked(a->
isChecked());
246 Options::setShowSatellites(a->
isChecked());
249 opssatellites->kcfg_ShowSatellites->setChecked(a->
isChecked());
254 Options::setShowSupernovae(a->
isChecked());
257 opssupernovae->kcfg_ShowSupernovae->setChecked(a->
isChecked());
269void KStars::slotINDIToolBar()
278 GUIManager::Instance()->
raise();
283 GUIManager::Instance()->
hide();
289 Ekos::Manager::Instance()->
raise();
294 Ekos::Manager::Instance()->
hide();
298 for (
auto &oneDevice : INDIListener::devices())
300 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
303 if (oneDevice->isConnected() ==
false)
305 KSNotification::error(
i18n(
"Mount %1 is offline. Please connect and retry again.", oneDevice->getDeviceName()));
309 auto mount = oneDevice->getMount();
316 mount->centerUnlock();
320 KSNotification::sorry(
i18n(
"No connected mounts found."));
325 if (m_FITSViewers.isEmpty())
333 for (
auto &view : m_FITSViewers)
335 if (view->tabs().empty() ==
false)
338 view->activateWindow();
345 for (
auto &view : m_FITSViewers)
355 Ekos::Manager::Instance()->mountModule()->toggleMountToolBox();
361 Options::setShowSensorFOV(a->
isChecked());
362 for (
auto &oneFOV :
data()->getTransientFOVs())
364 if (oneFOV->objectName() ==
"sensor_fov")
365 oneFOV->setProperty(
"visible", a->
isChecked());
371 Options::setShowMosaicPanel(a->
isChecked());
374 auto scheduler = Ekos::Manager::Instance()->schedulerModule();
375 if (a->
isChecked() && scheduler && scheduler->moduleState()->schedulerState() != Ekos::SCHEDULER_RUNNING)
380 Ekos::FramingAssistantUI *assistant =
new Ekos::FramingAssistantUI();
396 for (
auto &a : telescopeGroup->
actions())
408 for (
auto &a : domeGroup->
actions())
417void KStars::slotCalculator()
429 Options::setRunStartupWizard(
false);
431 updateLocationFromWizard(*(wizard->geo()));
435void KStars::updateLocationFromWizard(
const GeoLocation &geo)
444 data()->isTimeRunningForward());
457 if (!Options::isTracking() && Options::useAltAz())
467void KStars::slotDownload()
469 KSNotification::event(
471 i18n(
"Due to a known issue in the kde frameworks, "
472 "updating already downloaded items is currently not possible. <br> "
473 "Please uninstall and reinstall them to update."));
476#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
477 auto dlg = std::make_unique<KNSWidgets::Dialog>(
":/kconfig/kstars.knsrc",
this);
479 auto dlg = std::make_unique<KNS3::DownloadDialog>(
":/kconfig/kstars.knsrc",
this);
488 const auto changed_entries = dlg->changedEntries();
491#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
494 for (
const KNS3::Entry &entry : changed_entries)
497 if (entry.category() !=
"dso")
500#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
501 const auto id = entry.uniqueId().toInt();
502 if (entry.status() == KNSCore::Entry::Installed)
504 const auto id = entry.id().toInt();
505 if (entry.status() == KNS3::Entry::Installed)
507 for (
const QString &name : entry.installedFiles())
511 const auto meta{ CatalogsDB::read_catalog_meta_from_file(name) };
517 i18n(
"The catalog \"%1\" is corrupt.", entry.name()));
521 if (meta.second.id !=
id)
525 i18n(
"The catalog \"%1\" is corrupt.<br>Expected id=%2 but "
527 entry.name(),
id, meta.second.id));
531 const auto success{ manager.import_catalog(name,
true) };
535 i18n(
"Could not import the catalog \"%1\"<br>%2",
536 entry.name(), success.second));
539#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
540 if (entry.status() == KNSCore::Entry::Deleted)
542 if (entry.status() == KNS3::Entry::Deleted)
545 manager.remove_catalog(
id);
556void KStars::slotAVT()
563void KStars::slotWUT()
592 dialog->
addPage(m_WISettings,
i18n(
"Light Pollution Settings"));
593 dialog->
addPage(m_WIEquipmentSettings,
594 i18n(
"Equipment Settings - Equipment Type and Parameters"));
596 if (m_WIEquipmentSettings)
607 m_WIView =
new WIView(
nullptr);
609 m_wiDock->
setStyleSheet(
"QDockWidget::title{background-color:black;}");
616 connect(m_wiDock, SIGNAL(visibilityChanged(
bool)),
618 SLOT(setChecked(
bool)));
627void KStars::slotCalendar()
631 m_SkyCalendar->
show();
634void KStars::slotGlossary()
645void KStars::slotScriptBuilder()
647 if (!m_ScriptBuilder)
649 m_ScriptBuilder->
show();
652void KStars::slotSolarSystem()
656 m_PlanetViewer->
show();
659void KStars::slotJMoonTool()
666void KStars::slotMoonPhaseTool()
677 m_FlagManager->
show();
681void KStars::slotTelescopeWizard()
686 QString indiServerDir = Options::indiServer();
689 if (Options::indiServerIsInternal())
697 <<
"/usr/local/bin" << indiServerDir;
703 KSNotification::error(
i18n(
"Unable to find INDI server. Please make sure the package that provides "
704 "the 'indiserver' binary is installed."));
717void KStars::slotINDIPanel()
722 QString indiServerDir = Options::indiServer();
725 if (Options::indiServerIsInternal())
733 <<
"/usr/local/bin" << indiServerDir;
739 KSNotification::error(
i18n(
740 "Unable to find INDI server. Please make sure the package that provides "
741 "the 'indiserver' binary is installed."));
746 GUIManager::Instance()->updateStatus(
true);
750void KStars::slotINDIDriver()
757 i18n(
"INDI Device Manager should only be used by advanced technical users. "
758 "It cannot be used with Ekos. Do you still want to open INDI device "
765 QString indiServerDir = Options::indiServer();
768 if (Options::indiServerIsInternal())
776 <<
"/usr/local/bin" << indiServerDir;
782 KSNotification::error(
i18n(
783 "Unable to find INDI server. Please make sure the package that provides "
784 "the 'indiserver' binary is installed."));
790 DriverManager::Instance()->
raise();
797void KStars::slotEkos()
804 QString indiServerDir = Options::indiServer();
807 if (Options::indiServerIsInternal())
815 <<
"/usr/local/bin" << indiServerDir;
821 KSNotification::error(
i18n(
822 "Unable to find INDI server. Please make sure the package that provides "
823 "the 'indiserver' binary is installed."));
829 if (Ekos::Manager::Instance()->
isVisible() &&
832 Ekos::Manager::Instance()->
hide();
836 Ekos::Manager::Instance()->
raise();
845void KStars::slotINDITelescopeTrack()
848 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
851 for (
auto &oneDevice : INDIListener::devices())
853 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
856 auto mount = oneDevice->getMount();
857 if (!mount ||
mount->isConnected() ==
false)
871void KStars::slotINDITelescopeSlew(
bool focused_object)
874 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
877 for (
auto &oneDevice : INDIListener::devices())
879 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
882 auto mount = oneDevice->getMount();
883 if (!mount ||
mount->isConnected() ==
false)
896 Q_UNUSED(focused_object)
900void KStars::slotINDITelescopeSlewMousePointer()
903 slotINDITelescopeSlew(
false);
907void KStars::slotINDITelescopeSync(
bool focused_object)
910 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
913 for (
auto &oneDevice : INDIListener::devices())
915 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
918 auto mount = oneDevice->getMount();
919 if (!mount ||
mount->isConnected() ==
false)
933 Q_UNUSED(focused_object)
937void KStars::slotINDITelescopeSyncMousePointer()
940 slotINDITelescopeSync(
false);
944void KStars::slotINDITelescopeAbort()
947 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
950 for (
auto &oneDevice : INDIListener::devices())
952 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
955 auto mount = oneDevice->getMount();
956 if (!mount ||
mount->isConnected() ==
false)
965void KStars::slotINDITelescopePark()
968 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
971 for (
auto &oneDevice : INDIListener::devices())
973 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
976 auto mount = oneDevice->getMount();
977 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
986void KStars::slotINDITelescopeUnpark()
989 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
992 for (
auto &oneDevice : INDIListener::devices())
994 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
997 auto mount = oneDevice->getMount();
998 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
1007void KStars::slotINDIDomePark()
1010 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1013 for (
auto &oneDevice : INDIListener::devices())
1015 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1018 auto dome = oneDevice->getDome();
1019 if (!dome || dome->isConnected() ==
false)
1021 if (dome->canPark())
1030void KStars::slotINDIDomeUnpark()
1033 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1036 for (
auto &oneDevice : INDIListener::devices())
1038 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1041 auto dome = oneDevice->getDome();
1042 if (!dome || dome->isConnected() ==
false)
1044 if (dome->canPark())
1058 GeoLocation *newLocation = locationdialog->selectedCity();
1070 data()->isTimeRunningForward());
1083 if (!Options::isTracking() && Options::useAltAz())
1086 data()->geo()->lat());
1094 delete locationdialog;
1097void KStars::slotViewOps()
1102 auto ops = prepareOps();
1106 ops->activateWindow();
1112 if (
nullptr != dialog)
1116 dialog =
new KConfigDialog(
this,
"settings", Options::self());
1120 dialog->
resize(800, 600);
1141 page = dialog->
addPage(opcatalog,
i18n(
"Catalogs"),
"kstars_catalog");
1144 page = dialog->
addPage(opsolsys,
i18n(
"Solar System"),
"kstars_solarsystem");
1147 page = dialog->
addPage(opssatellites,
i18n(
"Satellites"),
"kstars_satellites");
1150 page = dialog->
addPage(opssupernovae,
i18n(
"Supernovae"),
"kstars_supernovae");
1153 page = dialog->
addPage(opguides,
i18n(
"Guides"),
"kstars_guides");
1156 page = dialog->
addPage(opterrain,
i18n(
"Terrain"),
"kstars_terrain");
1159 page = dialog->
addPage(opsImageOverlay,
i18n(
"Image Overlays"),
"kstars_imageoverlay");
1161 KStarsData::Instance()->
skyComposite()->imageOverlay()->setWidgets(
1162 opsImageOverlay->table(), opsImageOverlay->statusDisplay(), opsImageOverlay->solvePushButton(),
1163 opsImageOverlay->tableTitleBox(), opsImageOverlay->solverProfile());
1165 page = dialog->
addPage(opcolors,
i18n(
"Colors"),
"kstars_colors");
1170 page = dialog->
addPage(opsfits,
i18n(
"FITS"),
"kstars_fitsviewer");
1176 page = dialog->
addPage(opsindi,
i18n(
"INDI"),
"kstars_indi");
1182 if (Ekos::Manager::Instance())
1183 Ekos::Manager::Instance()->setOptionsWidget(ekosOption, opsekos);
1188 opsxplanet =
new OpsXplanet(
this);
1189 page = dialog->
addPage(opsxplanet,
i18n(
"Xplanet"),
"kstars_xplanet");
1192 page = dialog->
addPage(opadvanced,
i18n(
"Advanced"),
"kstars_advanced");
1195 page = dialog->
addPage(opsdeveloper,
i18n(
"Developer"),
"kstars_developer");
1202 KStars::Instance()->appHelpActivated();
1211 opterrain->syncOptions();
1213 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
1215 opsImageOverlay->syncOptions();
1217 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
1222 Options::self()->save();
1232 Options::self()->save();
1238void KStars::slotSetTime()
1246 if (Options::useAltAz())
1248 if (
map()->focusObject())
1251 data()->geo()->lat());
1277 if (Options::useAltAz())
1279 if (
map()->focusObject())
1282 data()->geo()->lat());
1300void KStars::slotFind()
1305 (targetObject = FindDialog::Instance()->targetObject()))
1317void KStars::slotOpenFITS()
1320 auto fv = createFITSViewer();
1325void KStars::slotBlink()
1328 auto fv = createFITSViewer();
1333void KStars::slotExportImage()
1342 "Images (*.png *.jpeg *.gif *.bmp *.svg)");
1355 i18n(
"A file named \"%1\" already exists. Overwrite it?", fileURL.
fileName()),
1367 if (!m_ExportImageDialog)
1371 KStarsData::Instance()->imageExporter());
1375 m_ExportImageDialog->setOutputUrl(fileURL.
toLocalFile());
1379 m_ExportImageDialog->
show();
1382void KStars::slotRunScript()
1387 i18nc(
"Filter by file type: KStars Scripts.",
"KStars Scripts (*.kstars)"));
1395 KSNotification::sorry(
i18n(
"Executing remote scripts is not supported."));
1403 QString message =
i18n(
"Could not open file %1", f.fileName());
1404 KSNotification::sorry(message,
i18n(
"Could Not Open File"));
1412 while (!istream.atEnd())
1414 line = istream.readLine();
1415 if (line.
at(0) !=
'#' && line.
left(9) !=
"dbus-send")
1428 "The selected script contains unrecognized elements, "
1429 "indicating that it was not created using the KStars script builder. "
1430 "This script may not function properly, and it may even contain "
1432 "Would you like to execute it anyway?"),
1447 p.
start(f.fileName(), arguments);
1453 qApp->processEvents();
1462void KStars::slotPrint()
1464 bool switchColors(
false);
1467 if (
data()->colorScheme()->colorNamed(
"SkyColor") !=
QColor(255, 255, 255))
1470 i18n(
"You can save printer ink by using the \"Star Chart\" "
1471 "color scheme, which uses a white background. Would you like to "
1472 "temporarily switch to the Star Chart color scheme for printing?");
1475 nullptr, message,
i18n(
"Switch to Star Chart Colors?"),
1481 switchColors =
true;
1487void KStars::slotPrintingWizard()
1489 if (m_PrintingWizard)
1491 delete m_PrintingWizard;
1495 m_PrintingWizard->
show();
1498void KStars::slotToggleTimer()
1500 if (
data()->clock()->isActive())
1507 if (fabs(
data()->clock()->scale()) > Options::slewTimeScale())
1510 if (
data()->clock()->isManualMode())
1515 Options::setRunClock(
data()->clock()->isActive());
1518void KStars::slotRealTimeToogled(
bool checked)
1555void KStars::slotStepForward()
1557 if (
data()->clock()->isActive())
1563void KStars::slotStepBackward()
1565 if (
data()->clock()->isActive())
1572void KStars::slotPointFocus()
1575 map()->stopTracking();
1579 Options::useRefraction());
1592 if (Options::isTracking())
1594 Options::setIsTracking(
false);
1601 if (planet &&
data()->temporaryTrail)
1604 data()->temporaryTrail =
false;
1617 Options::setIsTracking(
true);
1627void KStars::slotManualFocus()
1644 double realAlt(focusDialog->point()->alt().Degrees());
1645 double realDec(focusDialog->point()->dec().Degrees());
1646 if (Options::useAltAz() && realAlt > 89.0)
1648 focusDialog->point()->setAlt(89.0);
1649 focusDialog->point()->HorizontalToEquatorial(
data()->lst(),
1650 data()->geo()->lat());
1652 if (!Options::useAltAz() && realDec > 89.0)
1654 focusDialog->point()->setDec(89.0);
1655 focusDialog->point()->EquatorialToHorizontal(
data()->lst(),
1661 if (Options::isTracking())
1674 if (Options::useAltAz())
1678 focusDialog->point()->az(),
false);
1683 focusDialog->point()->dec());
1687 if (Options::useAltAz() && realAlt > 89.0)
1689 if (!Options::useAltAz() && realDec > 89.0)
1693 if (focusDialog->usedAltAz())
1694 map()->stopTracking();
1709 ki18nc(
"approximate field of view",
"Approximate FOV: %1 degrees");
1714 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcminutes");
1720 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcseconds");
1736 i18nc(
"The user should enter an angle for the field-of-view of the display",
1737 "Enter Desired Field-of-View Angle"),
1738 i18n(
"Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1747void KStars::slotCoordSys()
1749 if (Options::useAltAz())
1751 Options::setUseAltAz(
false);
1752 if (Options::useRefraction())
1754 if (
map()->focusObject())
1761 data()->geo()->lat());
1766 ->
setText(
i18n(
"Switch to Horizontal View (Horizontal &Coordinates)"));
1768 ->
action(
"up_orientation")
1769 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Up"));
1771 ->
action(
"down_orientation")
1772 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Down"));
1773 erectObserverCorrectionGroup->
setEnabled(
false);
1777 Options::setUseAltAz(
true);
1778 if (Options::useRefraction())
1785 ->
setText(
i18n(
"Switch to Star Globe View (Equatorial &Coordinates)"));
1787 ->
action(
"up_orientation")
1788 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Up"));
1790 ->
action(
"down_orientation")
1791 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Down"));
1792 erectObserverCorrectionGroup->
setEnabled(
true);
1798void KStars::slotSkyMapOrientation()
1802 Options::setSkyRotation(0.0);
1806 Options::setSkyRotation(180.0);
1810 Options::setErectObserverCorrection(
1817void KStars::slotMapProjection()
1820 Options::setProjection(Projector::Lambert);
1822 Options::setProjection(Projector::AzimuthalEquidistant);
1824 Options::setProjection(Projector::Orthographic);
1826 Options::setProjection(Projector::Equirectangular);
1828 Options::setProjection(Projector::Stereographic);
1830 Options::setProjection(Projector::Gnomonic);
1833 qCDebug(KSTARS) <<
"Projection system: " << Options::projection();
1839void KStars::slotColorScheme()
1844void KStars::slotTargetSymbol(
bool flag)
1861 Options::setFOVNames(names);
1869void KStars::slotApplySkyMapView(
const QString &viewName)
1875 qCWarning(KSTARS) <<
"View named " << viewName <<
" not found!";
1881 Options::setUseAltAz(!view->useAltAz);
1884 Options::setMirrorSkyMap(view->mirror);
1887 int erectObserverCorrection = 0;
1888 double viewAngle = view->viewAngle;
1889 if (view->erectObserver && view->useAltAz)
1893 erectObserverCorrection = 1;
1898 erectObserverCorrection = 2;
1907 Options::setErectObserverCorrection(erectObserverCorrection);
1909 if (!std::isnan(view->fov))
1913 repopulateOrientation();
1914 qCDebug(KSTARS) <<
"Alt/Az: " << Options::useAltAz()
1915 <<
"Mirror: " << Options::mirrorSkyMap()
1916 <<
"Rotation: " << Options::skyRotation()
1917 <<
"Erect Obs: " << Options::erectObserverCorrection()
1918 <<
"FOV: " << view->fov;
1923void KStars::slotHIPSSource()
1926 Q_ASSERT(selectedAction !=
nullptr);
1928 QString selectedSource = selectedAction->
text().remove(
'&');
1932 if (selectedSource ==
i18n(
"None"))
1933 HIPSManager::Instance()->setCurrentSource(
"None");
1935 HIPSManager::Instance()->setCurrentSource(selectedSource);
1940void KStars::slotEditViews()
1951void KStars::slotFOVEdit()
1962void KStars::slotObsList()
1964 m_KStarsData->observingList()->
show();
1967void KStars::slotEquipmentWriter()
1970 equipmentdlg->loadEquipment();
1971 equipmentdlg->exec();
1972 delete equipmentdlg;
1975void KStars::slotObserverManager()
1978 m_observerAdd->exec();
1979 delete m_observerAdd;
1982void KStars::slotHorizonManager()
1984 if (!m_HorizonManager)
1987 connect(m_SkyMap, SIGNAL(positionClicked(
SkyPoint *)), m_HorizonManager,
1991 m_HorizonManager->
show();
1994void KStars::slotExecute()
1996 KStarsData::Instance()->executeSession()->init();
1997 KStarsData::Instance()->executeSession()->show();
2000void KStars::slotPolarisHourAngle()
2007void KStars::slotFullScreen()
2022void KStars::slotTerrain()
2024 Options::setShowTerrain(!Options::showTerrain());
2026 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
2027 opterrain->syncOptions();
2032void KStars::slotImageOverlays()
2034 Options::setShowImageOverlays(!Options::showImageOverlays());
2036 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
2037 opsImageOverlay->syncOptions();
2045 if (
map()->focusObject() &&
map()->focusObject()->isSolarSystem() &&
2046 data()->temporaryTrail)
2057void KStars::slotShowGUIItem(
bool show)
2062 Options::setShowStatusBar(
show);
2068 Options::setShowAltAzField(
show);
2074 Options::setShowRADecField(
show);
2080 Options::setShowJ2000RADecField(
show);
2095 if (actionName.
mid(3) ==
2096 cg.
readEntry(
"ColorSchemeFile",
"moonless-night.colors").
remove(
".colors"))
2103 connect(kta, SIGNAL(toggled(
bool)),
this, SLOT(slotColorScheme()));
2108 qCDebug(KSTARS) <<
"removing " << actionName;
2112void KStars::slotAboutToQuit()
2114 if (m_SkyMap ==
nullptr)
2118 DriverManager::Instance()->disconnectClients();
2129 Options::setWindowWidth(
width());
2130 Options::setWindowHeight(
height());
2141 quit->start(
"killall kdeinit5");
2142 quit->waitForFinished(1000);
2143 quit->start(
"killall klauncher");
2144 quit->waitForFinished(1000);
2145 quit->start(
"killall kioslave");
2146 quit->waitForFinished(1000);
2147 quit->start(
"killall kio_http_cache_cleaner");
2148 quit->waitForFinished(1000);
2155 if (Options::showAltAzField())
2158 if (Options::useAltAz())
2166 if (Options::showRADecField())
2169 lastUpdate.
setDJD(KStarsData::Instance()->updateNum()->getJD());
2178 if (Options::showJ2000RADecField())
2182 p0 = p->
catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2191void KStars::slotUpdateComets(
bool isAutoUpdate)
2193 data()->
skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2197void KStars::slotUpdateAsteroids(
bool isAutoUpdate)
2199 data()->
skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2203void KStars::slotUpdateSupernovae()
2208void KStars::slotUpdateSatellites()
2213void KStars::slotConfigureNotifications()
2215#ifdef HAVE_NOTIFYCONFIG
2221 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.
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...)
QString name(GameStandardAction id)
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