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/eyepiecefield.h"
58#include "tools/flagmanager.h"
59#include "tools/horizonmanager.h"
60#include "tools/observinglist.h"
61#include "tools/planetviewer.h"
62#include "tools/jmoontool.h"
63#include "tools/scriptbuilder.h"
64#include "tools/skycalendar.h"
65#include "tools/wutdialog.h"
66#include "tools/polarishourangle.h"
67#include "tools/whatsinteresting/wiequipsettings.h"
68#include "tools/whatsinteresting/wilpsettings.h"
69#include "tools/whatsinteresting/wiview.h"
70#include "hips/hipsmanager.h"
71#include "catalogsdb.h"
73#include <basedevice.h>
75#include "indi/opsindi.h"
76#include "indi/drivermanager.h"
77#include "indi/guimanager.h"
78#include "indi/indilistener.h"
82#include "fitsviewer/fitsviewer.h"
83#include "fitsviewer/opsfits.h"
85#include "ekos/manager.h"
86#include "ekos/scheduler/framingassistantui.h"
87#include "ekos/scheduler/scheduler.h"
88#include "ekos/scheduler/schedulermodulestate.h"
89#include "ekos/opsekos.h"
90#include "ekos/mount/mount.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())
468void KStars::slotDownload()
470 KSNotification::event(
472 i18n(
"Due to a known issue in the kde frameworks, "
473 "updating already downloaded items is currently not possible. <br> "
474 "Please uninstall and reinstall them to update."));
477#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
478 auto dlg = std::make_unique<KNSWidgets::Dialog>(
":/kconfig/kstars.knsrc",
this);
480 auto dlg = std::make_unique<KNS3::DownloadDialog>(
":/kconfig/kstars.knsrc",
this);
489 const auto changed_entries = dlg->changedEntries();
492#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
495 for (
const KNS3::Entry &entry : changed_entries)
498 if (entry.category() !=
"dso")
501#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
502 const auto id = entry.uniqueId().toInt();
503 if (entry.status() == KNSCore::Entry::Installed)
505 const auto id = entry.id().toInt();
506 if (entry.status() == KNS3::Entry::Installed)
508 for (
const QString &name : entry.installedFiles())
512 const auto meta{ CatalogsDB::read_catalog_meta_from_file(name) };
518 i18n(
"The catalog \"%1\" is corrupt.", entry.name()));
522 if (meta.second.id !=
id)
526 i18n(
"The catalog \"%1\" is corrupt.<br>Expected id=%2 but "
528 entry.name(),
id, meta.second.id));
532 const auto success{ manager.import_catalog(name,
true) };
536 i18n(
"Could not import the catalog \"%1\"<br>%2",
537 entry.name(), success.second));
540#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
541 if (entry.status() == KNSCore::Entry::Deleted)
543 if (entry.status() == KNS3::Entry::Deleted)
546 manager.remove_catalog(
id);
557void KStars::slotAVT()
564void KStars::slotWUT()
593 dialog->
addPage(m_WISettings,
i18n(
"Light Pollution Settings"));
594 dialog->
addPage(m_WIEquipmentSettings,
595 i18n(
"Equipment Settings - Equipment Type and Parameters"));
597 if (m_WIEquipmentSettings)
608 m_WIView =
new WIView(
nullptr);
610 m_wiDock->
setStyleSheet(
"QDockWidget::title{background-color:black;}");
617 connect(m_wiDock, SIGNAL(visibilityChanged(
bool)),
619 SLOT(setChecked(
bool)));
628void KStars::slotCalendar()
632 m_SkyCalendar->
show();
635void KStars::slotGlossary()
646void KStars::slotScriptBuilder()
648 if (!m_ScriptBuilder)
650 m_ScriptBuilder->
show();
653void KStars::slotSolarSystem()
657 m_PlanetViewer->
show();
660void KStars::slotJMoonTool()
667void KStars::slotMoonPhaseTool()
678 m_FlagManager->
show();
682void KStars::slotTelescopeWizard()
687 QString indiServerDir = Options::indiServer();
690 if (Options::indiServerIsInternal())
698 <<
"/usr/local/bin" << indiServerDir;
704 KSNotification::error(
i18n(
"Unable to find INDI server. Please make sure the package that provides "
705 "the 'indiserver' binary is installed."));
718void KStars::slotINDIPanel()
723 QString indiServerDir = Options::indiServer();
726 if (Options::indiServerIsInternal())
734 <<
"/usr/local/bin" << indiServerDir;
740 KSNotification::error(
i18n(
741 "Unable to find INDI server. Please make sure the package that provides "
742 "the 'indiserver' binary is installed."));
747 GUIManager::Instance()->updateStatus(
true);
751void KStars::slotINDIDriver()
758 i18n(
"INDI Device Manager should only be used by advanced technical users. "
759 "It cannot be used with Ekos. Do you still want to open INDI device "
766 QString indiServerDir = Options::indiServer();
769 if (Options::indiServerIsInternal())
777 <<
"/usr/local/bin" << indiServerDir;
783 KSNotification::error(
i18n(
784 "Unable to find INDI server. Please make sure the package that provides "
785 "the 'indiserver' binary is installed."));
791 DriverManager::Instance()->
raise();
798void KStars::slotEkos()
805 QString indiServerDir = Options::indiServer();
808 if (Options::indiServerIsInternal())
816 <<
"/usr/local/bin" << indiServerDir;
822 KSNotification::error(
i18n(
823 "Unable to find INDI server. Please make sure the package that provides "
824 "the 'indiserver' binary is installed."));
830 if (Ekos::Manager::Instance()->
isVisible() &&
833 Ekos::Manager::Instance()->
hide();
837 Ekos::Manager::Instance()->
raise();
846void KStars::slotINDITelescopeTrack()
849 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
852 for (
auto &oneDevice : INDIListener::devices())
854 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
857 auto mount = oneDevice->getMount();
858 if (!mount ||
mount->isConnected() ==
false)
872void KStars::slotINDITelescopeSlew(
bool focused_object)
875 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
878 for (
auto &oneDevice : INDIListener::devices())
880 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
883 auto mount = oneDevice->getMount();
884 if (!mount ||
mount->isConnected() ==
false)
897 Q_UNUSED(focused_object)
901void KStars::slotINDITelescopeSlewMousePointer()
904 slotINDITelescopeSlew(
false);
908void KStars::slotINDITelescopeSync(
bool focused_object)
911 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
914 for (
auto &oneDevice : INDIListener::devices())
916 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
919 auto mount = oneDevice->getMount();
920 if (!mount ||
mount->isConnected() ==
false)
934 Q_UNUSED(focused_object)
938void KStars::slotINDITelescopeSyncMousePointer()
941 slotINDITelescopeSync(
false);
945void KStars::slotINDITelescopeAbort()
948 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
951 for (
auto &oneDevice : INDIListener::devices())
953 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
956 auto mount = oneDevice->getMount();
957 if (!mount ||
mount->isConnected() ==
false)
966void KStars::slotINDITelescopePark()
969 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
972 for (
auto &oneDevice : INDIListener::devices())
974 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
977 auto mount = oneDevice->getMount();
978 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
987void KStars::slotINDITelescopeUnpark()
990 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
993 for (
auto &oneDevice : INDIListener::devices())
995 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
998 auto mount = oneDevice->getMount();
999 if (!mount ||
mount->isConnected() ==
false ||
mount->canPark() ==
false)
1008void KStars::slotINDIDomePark()
1011 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1014 for (
auto &oneDevice : INDIListener::devices())
1016 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1019 auto dome = oneDevice->getDome();
1020 if (!dome || dome->isConnected() ==
false)
1022 if (dome->canPark())
1031void KStars::slotINDIDomeUnpark()
1034 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1037 for (
auto &oneDevice : INDIListener::devices())
1039 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1042 auto dome = oneDevice->getDome();
1043 if (!dome || dome->isConnected() ==
false)
1045 if (dome->canPark())
1059 GeoLocation *newLocation = locationdialog->selectedCity();
1071 data()->isTimeRunningForward());
1084 if (!Options::isTracking() && Options::useAltAz())
1087 data()->geo()->lat());
1095 delete locationdialog;
1098void KStars::slotViewOps()
1103 auto ops = prepareOps();
1107 ops->activateWindow();
1113 if (
nullptr != dialog)
1117 dialog =
new KConfigDialog(
this,
"settings", Options::self());
1121 dialog->resize(800, 600);
1142 page = dialog->
addPage(opcatalog,
i18n(
"Catalogs"),
"kstars_catalog");
1145 page = dialog->
addPage(opsolsys,
i18n(
"Solar System"),
"kstars_solarsystem");
1148 page = dialog->
addPage(opssatellites,
i18n(
"Satellites"),
"kstars_satellites");
1151 page = dialog->
addPage(opssupernovae,
i18n(
"Supernovae"),
"kstars_supernovae");
1154 page = dialog->
addPage(opguides,
i18n(
"Guides"),
"kstars_guides");
1157 page = dialog->
addPage(opterrain,
i18n(
"Terrain"),
"kstars_terrain");
1160 page = dialog->
addPage(opsImageOverlay,
i18n(
"Image Overlays"),
"kstars_imageoverlay");
1162 KStarsData::Instance()->
skyComposite()->imageOverlay()->setWidgets(
1163 opsImageOverlay->table(), opsImageOverlay->statusDisplay(), opsImageOverlay->solvePushButton(),
1164 opsImageOverlay->tableTitleBox(), opsImageOverlay->solverProfile());
1166 page = dialog->
addPage(opcolors,
i18n(
"Colors"),
"kstars_colors");
1171 page = dialog->
addPage(opsfits,
i18n(
"FITS"),
"kstars_fitsviewer");
1177 page = dialog->
addPage(opsindi,
i18n(
"INDI"),
"kstars_indi");
1183 if (Ekos::Manager::Instance())
1184 Ekos::Manager::Instance()->setOptionsWidget(ekosOption, opsekos);
1189 opsxplanet =
new OpsXplanet(
this);
1190 page = dialog->
addPage(opsxplanet,
i18n(
"Xplanet"),
"kstars_xplanet");
1193 page = dialog->
addPage(opadvanced,
i18n(
"Advanced"),
"kstars_advanced");
1196 page = dialog->
addPage(opsdeveloper,
i18n(
"Developer"),
"kstars_developer");
1203 KStars::Instance()->appHelpActivated();
1212 opterrain->syncOptions();
1214 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
1216 opsImageOverlay->syncOptions();
1218 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
1223 Options::self()->save();
1233 Options::self()->save();
1239void KStars::slotSetTime()
1247 if (Options::useAltAz())
1249 if (
map()->focusObject())
1252 data()->geo()->lat());
1278 if (Options::useAltAz())
1280 if (
map()->focusObject())
1283 data()->geo()->lat());
1301void KStars::slotFind()
1306 (targetObject = FindDialog::Instance()->targetObject()))
1318void KStars::slotOpenFITS()
1321 auto fv = createFITSViewer();
1326void KStars::slotBlink()
1329 auto fv = createFITSViewer();
1334void KStars::slotExportImage()
1343 "Images (*.png *.jpeg *.gif *.bmp *.svg)");
1356 i18n(
"A file named \"%1\" already exists. Overwrite it?", fileURL.
fileName()),
1368 if (!m_ExportImageDialog)
1372 KStarsData::Instance()->imageExporter());
1376 m_ExportImageDialog->setOutputUrl(fileURL.
toLocalFile());
1380 m_ExportImageDialog->
show();
1383void KStars::slotRunScript()
1388 i18nc(
"Filter by file type: KStars Scripts.",
"KStars Scripts (*.kstars)"));
1396 KSNotification::sorry(
i18n(
"Executing remote scripts is not supported."));
1404 QString message =
i18n(
"Could not open file %1", f.fileName());
1405 KSNotification::sorry(message,
i18n(
"Could Not Open File"));
1413 while (!istream.atEnd())
1415 line = istream.readLine();
1416 if (line.
at(0) !=
'#' && line.
left(9) !=
"dbus-send")
1429 "The selected script contains unrecognized elements, "
1430 "indicating that it was not created using the KStars script builder. "
1431 "This script may not function properly, and it may even contain "
1433 "Would you like to execute it anyway?"),
1448 p.
start(f.fileName(), arguments);
1454 qApp->processEvents();
1463void KStars::slotPrint()
1465 bool switchColors(
false);
1468 if (
data()->colorScheme()->colorNamed(
"SkyColor") !=
QColor(255, 255, 255))
1471 i18n(
"You can save printer ink by using the \"Star Chart\" "
1472 "color scheme, which uses a white background. Would you like to "
1473 "temporarily switch to the Star Chart color scheme for printing?");
1476 nullptr, message,
i18n(
"Switch to Star Chart Colors?"),
1482 switchColors =
true;
1488void KStars::slotPrintingWizard()
1490 if (m_PrintingWizard)
1492 delete m_PrintingWizard;
1496 m_PrintingWizard->
show();
1499void KStars::slotToggleTimer()
1501 if (
data()->clock()->isActive())
1508 if (fabs(
data()->clock()->scale()) > Options::slewTimeScale())
1511 if (
data()->clock()->isManualMode())
1516 Options::setRunClock(
data()->clock()->isActive());
1519void KStars::slotRealTimeToogled(
bool checked)
1556void KStars::slotStepForward()
1558 if (
data()->clock()->isActive())
1564void KStars::slotStepBackward()
1566 if (
data()->clock()->isActive())
1573void KStars::slotPointFocus()
1576 map()->stopTracking();
1580 Options::useRefraction());
1593 if (Options::isTracking())
1595 Options::setIsTracking(
false);
1602 if (planet &&
data()->temporaryTrail)
1605 data()->temporaryTrail =
false;
1618 Options::setIsTracking(
true);
1628void KStars::slotManualFocus()
1645 double realAlt(focusDialog->point()->alt().Degrees());
1646 double realDec(focusDialog->point()->dec().Degrees());
1647 if (Options::useAltAz() && realAlt > 89.0)
1649 focusDialog->point()->setAlt(89.0);
1650 focusDialog->point()->HorizontalToEquatorial(
data()->lst(),
1651 data()->geo()->lat());
1653 if (!Options::useAltAz() && realDec > 89.0)
1655 focusDialog->point()->setDec(89.0);
1656 focusDialog->point()->EquatorialToHorizontal(
data()->lst(),
1662 if (Options::isTracking())
1675 if (Options::useAltAz())
1679 focusDialog->point()->az(),
false);
1684 focusDialog->point()->dec());
1688 if (Options::useAltAz() && realAlt > 89.0)
1690 if (!Options::useAltAz() && realDec > 89.0)
1694 if (focusDialog->usedAltAz())
1695 map()->stopTracking();
1710 ki18nc(
"approximate field of view",
"Approximate FOV: %1 degrees");
1715 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcminutes");
1721 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcseconds");
1737 i18nc(
"The user should enter an angle for the field-of-view of the display",
1738 "Enter Desired Field-of-View Angle"),
1739 i18n(
"Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1748void KStars::slotCoordSys()
1750 if (Options::useAltAz())
1752 Options::setUseAltAz(
false);
1753 if (Options::useRefraction())
1755 if (
map()->focusObject())
1762 data()->geo()->lat());
1767 ->
setText(
i18n(
"Switch to Horizontal View (Horizontal &Coordinates)"));
1769 ->
action(
"up_orientation")
1770 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Up"));
1772 ->
action(
"down_orientation")
1773 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Down"));
1774 erectObserverCorrectionGroup->
setEnabled(
false);
1778 Options::setUseAltAz(
true);
1779 if (Options::useRefraction())
1786 ->
setText(
i18n(
"Switch to Star Globe View (Equatorial &Coordinates)"));
1788 ->
action(
"up_orientation")
1789 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Up"));
1791 ->
action(
"down_orientation")
1792 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Down"));
1793 erectObserverCorrectionGroup->
setEnabled(
true);
1799void KStars::slotSkyMapOrientation()
1803 Options::setSkyRotation(0.0);
1807 Options::setSkyRotation(180.0);
1811 Options::setErectObserverCorrection(
1818void KStars::slotMapProjection()
1821 Options::setProjection(Projector::Lambert);
1823 Options::setProjection(Projector::AzimuthalEquidistant);
1825 Options::setProjection(Projector::Orthographic);
1827 Options::setProjection(Projector::Equirectangular);
1829 Options::setProjection(Projector::Stereographic);
1831 Options::setProjection(Projector::Gnomonic);
1834 qCDebug(KSTARS) <<
"Projection system: " << Options::projection();
1840void KStars::slotColorScheme()
1845void KStars::slotTargetSymbol(
bool flag)
1862 Options::setFOVNames(names);
1870void KStars::slotApplySkyMapView(
const QString &viewName)
1876 qCWarning(KSTARS) <<
"View named " << viewName <<
" not found!";
1882 Options::setUseAltAz(!view->useAltAz);
1885 Options::setMirrorSkyMap(view->mirror);
1888 int erectObserverCorrection = 0;
1889 double viewAngle = view->viewAngle;
1890 if (view->erectObserver && view->useAltAz)
1894 erectObserverCorrection = 1;
1899 erectObserverCorrection = 2;
1908 Options::setErectObserverCorrection(erectObserverCorrection);
1910 if (!std::isnan(view->fov))
1914 repopulateOrientation();
1915 qCDebug(KSTARS) <<
"Alt/Az: " << Options::useAltAz()
1916 <<
"Mirror: " << Options::mirrorSkyMap()
1917 <<
"Rotation: " << Options::skyRotation()
1918 <<
"Erect Obs: " << Options::erectObserverCorrection()
1919 <<
"FOV: " << view->fov;
1924void KStars::slotHIPSSource()
1927 Q_ASSERT(selectedAction !=
nullptr);
1929 QString selectedSource = selectedAction->
text().remove(
'&');
1933 if (selectedSource ==
i18n(
"None"))
1934 HIPSManager::Instance()->setCurrentSource(
"None");
1936 HIPSManager::Instance()->setCurrentSource(selectedSource);
1941void KStars::slotEditViews()
1952void KStars::slotFOVEdit()
1963void KStars::slotObsList()
1965 m_KStarsData->observingList()->
show();
1968void KStars::slotEquipmentWriter()
1971 equipmentdlg->loadEquipment();
1972 equipmentdlg->exec();
1973 delete equipmentdlg;
1976void KStars::slotObserverManager()
1979 m_observerAdd->exec();
1980 delete m_observerAdd;
1983void KStars::slotHorizonManager()
1985 if (!m_HorizonManager)
1988 connect(m_SkyMap, SIGNAL(positionClicked(
SkyPoint *)), m_HorizonManager,
1992 m_HorizonManager->
show();
1997 if (!m_EyepieceView)
2002 const FOV *fov =
nullptr;
2003 if (!
data()->getAvailableFOVs().isEmpty())
2009 foreach (f,
data()->getAvailableFOVs())
2011 nameToFovMap.
insert(f->name(), f);
2013 nameToFovMap.
insert(
i18n(
"Attempt to determine from image"),
nullptr);
2015 this,
i18n(
"Eyepiece View: Choose a field-of-view"),
2016 i18n(
"FOV to render eyepiece view for:"), nameToFovMap.
keys(), 0,
false,
2023void KStars::slotExecute()
2025 KStarsData::Instance()->executeSession()->init();
2026 KStarsData::Instance()->executeSession()->show();
2029void KStars::slotPolarisHourAngle()
2036void KStars::slotFullScreen()
2051void KStars::slotTerrain()
2053 Options::setShowTerrain(!Options::showTerrain());
2055 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
2056 opterrain->syncOptions();
2061void KStars::slotImageOverlays()
2063 Options::setShowImageOverlays(!Options::showImageOverlays());
2065 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
2066 opsImageOverlay->syncOptions();
2074 if (
map()->focusObject() &&
map()->focusObject()->isSolarSystem() &&
2075 data()->temporaryTrail)
2086void KStars::slotShowGUIItem(
bool show)
2091 Options::setShowStatusBar(
show);
2097 Options::setShowAltAzField(
show);
2103 Options::setShowRADecField(
show);
2109 Options::setShowJ2000RADecField(
show);
2124 if (actionName.
mid(3) ==
2125 cg.
readEntry(
"ColorSchemeFile",
"moonless-night.colors").
remove(
".colors"))
2132 connect(kta, SIGNAL(toggled(
bool)),
this, SLOT(slotColorScheme()));
2137 qCDebug(KSTARS) <<
"removing " << actionName;
2141void KStars::slotAboutToQuit()
2143 if (m_SkyMap ==
nullptr)
2147 DriverManager::Instance()->disconnectClients();
2158 Options::setWindowWidth(
width());
2159 Options::setWindowHeight(
height());
2170 quit->start(
"killall kdeinit5");
2171 quit->waitForFinished(1000);
2172 quit->start(
"killall klauncher");
2173 quit->waitForFinished(1000);
2174 quit->start(
"killall kioslave");
2175 quit->waitForFinished(1000);
2176 quit->start(
"killall kio_http_cache_cleaner");
2177 quit->waitForFinished(1000);
2184 if (Options::showAltAzField())
2187 if (Options::useAltAz())
2195 if (Options::showRADecField())
2198 lastUpdate.
setDJD(KStarsData::Instance()->updateNum()->getJD());
2207 if (Options::showJ2000RADecField())
2211 p0 = p->
catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2220void KStars::slotUpdateComets(
bool isAutoUpdate)
2222 data()->
skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2226void KStars::slotUpdateAsteroids(
bool isAutoUpdate)
2228 data()->
skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2232void KStars::slotUpdateSupernovae()
2237void KStars::slotUpdateSatellites()
2242void KStars::slotConfigureNotifications()
2244#ifdef HAVE_NOTIFYCONFIG
2250 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.
Renders the view through the eyepiece of various telescope types.
void showEyepieceField(SkyPoint *sp, FOV const *const fov=nullptr, const QString &imagePath=QString())
Show the eyepiece field dialog.
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".
A simple class encapsulating a Field-of-View symbol.
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
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 slotEyepieceView(SkyPoint *sp, const QString &imagePath=QString())
Show the eyepiece view tool.
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)
QString name(StandardAction id)
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
iterator insert(const Key &key, const T &value)
QList< Key > keys() 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