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>
103#include <kns3/downloaddialog.h>
105#include <QQuickWindow>
116void KStars::slotViewToolBar()
126 opcatalog->kcfg_ShowStars->setChecked(a->
isChecked());
134 opcatalog->kcfg_ShowDeepSky->setChecked(a->
isChecked());
139 Options::setShowSolarSystem(a->
isChecked());
142 opsolsys->kcfg_ShowSolarSystem->setChecked(a->
isChecked());
150 opguides->kcfg_ShowCLines->setChecked(a->
isChecked());
158 opguides->kcfg_ShowCNames->setChecked(a->
isChecked());
166 opguides->kcfg_ShowCBounds->setChecked(a->
isChecked());
171 Options::setShowConstellationArt(a->
isChecked());
174 opguides->kcfg_ShowConstellationArt->setChecked(a->
isChecked());
179 Options::setShowMilkyWay(a->
isChecked());
182 opguides->kcfg_ShowMilkyWay->setChecked(a->
isChecked());
190 Options::setAutoSelectGrid(
false);
191 Options::setShowEquatorialGrid(a->
isChecked());
194 opguides->kcfg_ShowEquatorialGrid->setChecked(a->
isChecked());
195 opguides->kcfg_AutoSelectGrid->setChecked(
false);
200 Options::setAutoSelectGrid(
false);
201 Options::setShowHorizontalGrid(a->
isChecked());
204 opguides->kcfg_ShowHorizontalGrid->setChecked(a->
isChecked());
205 opguides->kcfg_AutoSelectGrid->setChecked(
false);
211 if (!a->
isChecked() && Options::useRefraction())
213 QString caption =
i18n(
"Refraction effects disabled");
214 QString message =
i18n(
"When the horizon is switched off, refraction effects "
215 "are temporarily disabled.");
221 opguides->kcfg_ShowGround->setChecked(a->
isChecked());
226 Options::setSimulateDaytime(a->
isChecked());
229 opguides->kcfg_SimulateDaytime->setChecked(a->
isChecked());
237 opguides->kcfg_ShowFlags->setChecked(a->
isChecked());
242 Options::setShowSatellites(a->
isChecked());
245 opssatellites->kcfg_ShowSatellites->setChecked(a->
isChecked());
250 Options::setShowSupernovae(a->
isChecked());
253 opssupernovae->kcfg_ShowSupernovae->setChecked(a->
isChecked());
265void KStars::slotINDIToolBar()
274 GUIManager::Instance()->
raise();
279 GUIManager::Instance()->
hide();
285 Ekos::Manager::Instance()->
raise();
290 Ekos::Manager::Instance()->
hide();
294 for (
auto &oneDevice : INDIListener::devices())
296 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
299 if (oneDevice->isConnected() ==
false)
301 KSNotification::error(
i18n(
"Mount %1 is offline. Please connect and retry again.", oneDevice->getDeviceName()));
305 auto mount = oneDevice->getMount();
312 mount->centerUnlock();
316 KSNotification::sorry(
i18n(
"No connected mounts found."));
321 if (m_FITSViewers.isEmpty())
329 for (
auto &view : m_FITSViewers)
331 if (view->tabs().empty() ==
false)
334 view->activateWindow();
341 for (
auto &view : m_FITSViewers)
351 Ekos::Manager::Instance()->mountModule()->toggleMountToolBox();
357 Options::setShowSensorFOV(a->
isChecked());
358 for (
auto &oneFOV :
data()->getTransientFOVs())
360 if (oneFOV->objectName() ==
"sensor_fov")
361 oneFOV->setProperty(
"visible", a->
isChecked());
367 Options::setShowMosaicPanel(a->
isChecked());
370 auto scheduler = Ekos::Manager::Instance()->schedulerModule();
371 if (a->
isChecked() && scheduler && scheduler->moduleState()->schedulerState() != Ekos::SCHEDULER_RUNNING)
376 Ekos::FramingAssistantUI *assistant =
new Ekos::FramingAssistantUI();
392 for (
auto &a : telescopeGroup->
actions())
404 for (
auto &a : domeGroup->
actions())
413void KStars::slotCalculator()
425 Options::setRunStartupWizard(
false);
427 updateLocationFromWizard(*(wizard->geo()));
431void KStars::updateLocationFromWizard(
const GeoLocation &geo)
440 data()->isTimeRunningForward());
453 if (!Options::isTracking() && Options::useAltAz())
463void KStars::slotDownload()
465 KSNotification::event(
467 i18n(
"Due to a known issue in the kde frameworks, "
468 "updating already downloaded items is currently not possible. <br> "
469 "Please uninstall and reinstall them to update."));
472 auto dlg = std::make_unique<KNS3::DownloadDialog>(
":/kconfig/kstars.knsrc",
this);
480 const auto changed_entries = dlg->changedEntries();
483 for (
const KNS3::Entry &entry : changed_entries)
485 if (entry.category() !=
"dso")
487 const auto id = entry.id().toInt();
489 if (entry.status() == KNS3::Entry::Installed)
490 for (
const QString &name : entry.installedFiles())
494 const auto meta{ CatalogsDB::read_catalog_meta_from_file(name) };
500 i18n(
"The catalog \"%1\" is corrupt.", entry.name()));
504 if (meta.second.id !=
id)
508 i18n(
"The catalog \"%1\" is corrupt.<br>Expected id=%2 but "
510 entry.name(),
id, meta.second.id));
514 const auto success{ manager.import_catalog(name,
true) };
518 i18n(
"Could not import the catalog \"%1\"<br>%2",
519 entry.name(), success.second));
523 if (entry.status() == KNS3::Entry::Deleted)
525 manager.remove_catalog(
id);
536void KStars::slotAVT()
543void KStars::slotWUT()
572 dialog->
addPage(m_WISettings,
i18n(
"Light Pollution Settings"));
573 dialog->
addPage(m_WIEquipmentSettings,
574 i18n(
"Equipment Settings - Equipment Type and Parameters"));
576 if (m_WIEquipmentSettings)
587 m_WIView =
new WIView(
nullptr);
589 m_wiDock->
setStyleSheet(
"QDockWidget::title{background-color:black;}");
596 connect(m_wiDock, SIGNAL(visibilityChanged(
bool)),
598 SLOT(setChecked(
bool)));
607void KStars::slotCalendar()
611 m_SkyCalendar->
show();
614void KStars::slotGlossary()
625void KStars::slotScriptBuilder()
627 if (!m_ScriptBuilder)
629 m_ScriptBuilder->
show();
632void KStars::slotSolarSystem()
636 m_PlanetViewer->
show();
639void KStars::slotJMoonTool()
646void KStars::slotMoonPhaseTool()
657 m_FlagManager->
show();
661void KStars::slotTelescopeWizard()
666 QString indiServerDir = Options::indiServer();
669 if (Options::indiServerIsInternal())
677 <<
"/usr/local/bin" << indiServerDir;
683 KSNotification::error(
i18n(
"Unable to find INDI server. Please make sure the package that provides "
684 "the 'indiserver' binary is installed."));
697void KStars::slotINDIPanel()
702 QString indiServerDir = Options::indiServer();
705 if (Options::indiServerIsInternal())
713 <<
"/usr/local/bin" << indiServerDir;
719 KSNotification::error(
i18n(
720 "Unable to find INDI server. Please make sure the package that provides "
721 "the 'indiserver' binary is installed."));
726 GUIManager::Instance()->updateStatus(
true);
730void KStars::slotINDIDriver()
737 i18n(
"INDI Device Manager should only be used by advanced technical users. "
738 "It cannot be used with Ekos. Do you still want to open INDI device "
745 QString indiServerDir = Options::indiServer();
748 if (Options::indiServerIsInternal())
756 <<
"/usr/local/bin" << indiServerDir;
762 KSNotification::error(
i18n(
763 "Unable to find INDI server. Please make sure the package that provides "
764 "the 'indiserver' binary is installed."));
770 DriverManager::Instance()->
raise();
777void KStars::slotEkos()
784 QString indiServerDir = Options::indiServer();
787 if (Options::indiServerIsInternal())
795 <<
"/usr/local/bin" << indiServerDir;
801 KSNotification::error(
i18n(
802 "Unable to find INDI server. Please make sure the package that provides "
803 "the 'indiserver' binary is installed."));
809 if (Ekos::Manager::Instance()->
isVisible() &&
812 Ekos::Manager::Instance()->
hide();
816 Ekos::Manager::Instance()->
raise();
825void KStars::slotINDITelescopeTrack()
828 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
831 for (
auto &oneDevice : INDIListener::devices())
833 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
836 auto mount = oneDevice->getMount();
837 if (!mount ||
mount->isConnected() ==
false)
851void KStars::slotINDITelescopeSlew(
bool focused_object)
854 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
857 for (
auto &oneDevice : INDIListener::devices())
859 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
862 auto mount = oneDevice->getMount();
863 if (!mount ||
mount->isConnected() ==
false)
876 Q_UNUSED(focused_object)
880void KStars::slotINDITelescopeSlewMousePointer()
883 slotINDITelescopeSlew(
false);
887void KStars::slotINDITelescopeSync(
bool focused_object)
890 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
893 for (
auto &oneDevice : INDIListener::devices())
895 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
898 auto mount = oneDevice->getMount();
899 if (!mount ||
mount->isConnected() ==
false)
913 Q_UNUSED(focused_object)
917void KStars::slotINDITelescopeSyncMousePointer()
920 slotINDITelescopeSync(
false);
924void KStars::slotINDITelescopeAbort()
927 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
930 for (
auto &oneDevice : INDIListener::devices())
932 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
935 auto mount = oneDevice->getMount();
936 if (!mount ||
mount->isConnected() ==
false)
945void KStars::slotINDITelescopePark()
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 ||
mount->canPark() ==
false)
966void KStars::slotINDITelescopeUnpark()
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::slotINDIDomePark()
990 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
993 for (
auto &oneDevice : INDIListener::devices())
995 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
998 auto dome = oneDevice->getDome();
999 if (!dome || dome->isConnected() ==
false)
1001 if (dome->canPark())
1010void KStars::slotINDIDomeUnpark()
1013 if (m_KStarsData ==
nullptr || INDIListener::Instance() ==
nullptr)
1016 for (
auto &oneDevice : INDIListener::devices())
1018 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1021 auto dome = oneDevice->getDome();
1022 if (!dome || dome->isConnected() ==
false)
1024 if (dome->canPark())
1038 GeoLocation *newLocation = locationdialog->selectedCity();
1050 data()->isTimeRunningForward());
1063 if (!Options::isTracking() && Options::useAltAz())
1066 data()->geo()->lat());
1074 delete locationdialog;
1077void KStars::slotViewOps()
1082 auto ops = prepareOps();
1086 ops->activateWindow();
1092 if (
nullptr != dialog)
1096 dialog =
new KConfigDialog(
this,
"settings", Options::self());
1100 dialog->resize(800, 600);
1121 page = dialog->
addPage(opcatalog,
i18n(
"Catalogs"),
"kstars_catalog");
1124 page = dialog->
addPage(opsolsys,
i18n(
"Solar System"),
"kstars_solarsystem");
1127 page = dialog->
addPage(opssatellites,
i18n(
"Satellites"),
"kstars_satellites");
1130 page = dialog->
addPage(opssupernovae,
i18n(
"Supernovae"),
"kstars_supernovae");
1133 page = dialog->
addPage(opguides,
i18n(
"Guides"),
"kstars_guides");
1136 page = dialog->
addPage(opterrain,
i18n(
"Terrain"),
"kstars_terrain");
1139 page = dialog->
addPage(opsImageOverlay,
i18n(
"Image Overlays"),
"kstars_imageoverlay");
1141 KStarsData::Instance()->
skyComposite()->imageOverlay()->setWidgets(
1142 opsImageOverlay->table(), opsImageOverlay->statusDisplay(), opsImageOverlay->solvePushButton(),
1143 opsImageOverlay->tableTitleBox(), opsImageOverlay->solverProfile());
1145 page = dialog->
addPage(opcolors,
i18n(
"Colors"),
"kstars_colors");
1150 page = dialog->
addPage(opsfits,
i18n(
"FITS"),
"kstars_fitsviewer");
1156 page = dialog->
addPage(opsindi,
i18n(
"INDI"),
"kstars_indi");
1162 if (Ekos::Manager::Instance())
1163 Ekos::Manager::Instance()->setOptionsWidget(ekosOption, opsekos);
1168 opsxplanet =
new OpsXplanet(
this);
1169 page = dialog->
addPage(opsxplanet,
i18n(
"Xplanet"),
"kstars_xplanet");
1172 page = dialog->
addPage(opadvanced,
i18n(
"Advanced"),
"kstars_advanced");
1175 page = dialog->
addPage(opsdeveloper,
i18n(
"Developer"),
"kstars_developer");
1182 KStars::Instance()->appHelpActivated();
1191 opterrain->syncOptions();
1193 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
1195 opsImageOverlay->syncOptions();
1197 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
1202 Options::self()->save();
1212 Options::self()->save();
1218void KStars::slotSetTime()
1226 if (Options::useAltAz())
1228 if (
map()->focusObject())
1231 data()->geo()->lat());
1257 if (Options::useAltAz())
1259 if (
map()->focusObject())
1262 data()->geo()->lat());
1280void KStars::slotFind()
1285 (targetObject = FindDialog::Instance()->targetObject()))
1297void KStars::slotOpenFITS()
1300 auto fv = createFITSViewer();
1305void KStars::slotBlink()
1308 auto fv = createFITSViewer();
1313void KStars::slotExportImage()
1322 "Images (*.png *.jpeg *.gif *.bmp *.svg)");
1335 i18n(
"A file named \"%1\" already exists. Overwrite it?", fileURL.
fileName()),
1347 if (!m_ExportImageDialog)
1351 KStarsData::Instance()->imageExporter());
1355 m_ExportImageDialog->setOutputUrl(fileURL.
toLocalFile());
1359 m_ExportImageDialog->
show();
1362void KStars::slotRunScript()
1367 i18nc(
"Filter by file type: KStars Scripts.",
"KStars Scripts (*.kstars)"));
1375 KSNotification::sorry(
i18n(
"Executing remote scripts is not supported."));
1383 QString message =
i18n(
"Could not open file %1", f.fileName());
1384 KSNotification::sorry(message,
i18n(
"Could Not Open File"));
1392 while (!istream.atEnd())
1394 line = istream.readLine();
1395 if (line.
at(0) !=
'#' && line.
left(9) !=
"dbus-send")
1408 "The selected script contains unrecognized elements, "
1409 "indicating that it was not created using the KStars script builder. "
1410 "This script may not function properly, and it may even contain "
1412 "Would you like to execute it anyway?"),
1427 p.
start(f.fileName(), arguments);
1433 qApp->processEvents();
1442void KStars::slotPrint()
1444 bool switchColors(
false);
1447 if (
data()->colorScheme()->colorNamed(
"SkyColor") !=
QColor(255, 255, 255))
1450 i18n(
"You can save printer ink by using the \"Star Chart\" "
1451 "color scheme, which uses a white background. Would you like to "
1452 "temporarily switch to the Star Chart color scheme for printing?");
1454 int answer = KMessageBox::questionYesNoCancel(
1455 nullptr, message,
i18n(
"Switch to Star Chart Colors?"),
1461 if (answer == KMessageBox::Yes)
1462 switchColors =
true;
1468void KStars::slotPrintingWizard()
1470 if (m_PrintingWizard)
1472 delete m_PrintingWizard;
1476 m_PrintingWizard->
show();
1479void KStars::slotToggleTimer()
1481 if (
data()->clock()->isActive())
1488 if (fabs(
data()->clock()->scale()) > Options::slewTimeScale())
1491 if (
data()->clock()->isManualMode())
1496 Options::setRunClock(
data()->clock()->isActive());
1499void KStars::slotRealTimeToogled(
bool checked)
1526void KStars::slotStepForward()
1528 if (
data()->clock()->isActive())
1534void KStars::slotStepBackward()
1536 if (
data()->clock()->isActive())
1543void KStars::slotPointFocus()
1546 map()->stopTracking();
1550 Options::useRefraction());
1563 if (Options::isTracking())
1565 Options::setIsTracking(
false);
1572 if (planet &&
data()->temporaryTrail)
1575 data()->temporaryTrail =
false;
1588 Options::setIsTracking(
true);
1598void KStars::slotManualFocus()
1615 double realAlt(focusDialog->point()->alt().Degrees());
1616 double realDec(focusDialog->point()->dec().Degrees());
1617 if (Options::useAltAz() && realAlt > 89.0)
1619 focusDialog->point()->setAlt(89.0);
1620 focusDialog->point()->HorizontalToEquatorial(
data()->lst(),
1621 data()->geo()->lat());
1623 if (!Options::useAltAz() && realDec > 89.0)
1625 focusDialog->point()->setDec(89.0);
1626 focusDialog->point()->EquatorialToHorizontal(
data()->lst(),
1632 if (Options::isTracking())
1645 if (Options::useAltAz())
1649 focusDialog->point()->az(),
false);
1654 focusDialog->point()->dec());
1658 if (Options::useAltAz() && realAlt > 89.0)
1660 if (!Options::useAltAz() && realDec > 89.0)
1664 if (focusDialog->usedAltAz())
1665 map()->stopTracking();
1680 ki18nc(
"approximate field of view",
"Approximate FOV: %1 degrees");
1685 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcminutes");
1691 ki18nc(
"approximate field of view",
"Approximate FOV: %1 arcseconds");
1707 i18nc(
"The user should enter an angle for the field-of-view of the display",
1708 "Enter Desired Field-of-View Angle"),
1709 i18n(
"Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1718void KStars::slotCoordSys()
1720 if (Options::useAltAz())
1722 Options::setUseAltAz(
false);
1723 if (Options::useRefraction())
1725 if (
map()->focusObject())
1732 data()->geo()->lat());
1737 ->
setText(
i18n(
"Switch to Horizontal View (Horizontal &Coordinates)"));
1739 ->
action(
"up_orientation")
1740 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Up"));
1742 ->
action(
"down_orientation")
1743 ->
setText(
i18nc(
"Orientation of the sky map",
"North &Down"));
1744 erectObserverCorrectionGroup->
setEnabled(
false);
1748 Options::setUseAltAz(
true);
1749 if (Options::useRefraction())
1756 ->
setText(
i18n(
"Switch to Star Globe View (Equatorial &Coordinates)"));
1758 ->
action(
"up_orientation")
1759 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Up"));
1761 ->
action(
"down_orientation")
1762 ->
setText(
i18nc(
"Orientation of the sky map",
"Zenith &Down"));
1763 erectObserverCorrectionGroup->
setEnabled(
true);
1769void KStars::slotSkyMapOrientation()
1773 Options::setSkyRotation(0.0);
1777 Options::setSkyRotation(180.0);
1781 Options::setErectObserverCorrection(
1788void KStars::slotMapProjection()
1791 Options::setProjection(Projector::Lambert);
1793 Options::setProjection(Projector::AzimuthalEquidistant);
1795 Options::setProjection(Projector::Orthographic);
1797 Options::setProjection(Projector::Equirectangular);
1799 Options::setProjection(Projector::Stereographic);
1801 Options::setProjection(Projector::Gnomonic);
1804 qCDebug(KSTARS) <<
"Projection system: " << Options::projection();
1810void KStars::slotColorScheme()
1815void KStars::slotTargetSymbol(
bool flag)
1832 Options::setFOVNames(names);
1840void KStars::slotApplySkyMapView(
const QString &viewName)
1846 qCWarning(KSTARS) <<
"View named " << viewName <<
" not found!";
1852 Options::setUseAltAz(!view->useAltAz);
1855 Options::setMirrorSkyMap(view->mirror);
1858 int erectObserverCorrection = 0;
1859 double viewAngle = view->viewAngle;
1860 if (view->erectObserver && view->useAltAz)
1864 erectObserverCorrection = 1;
1869 erectObserverCorrection = 2;
1878 Options::setErectObserverCorrection(erectObserverCorrection);
1880 if (!std::isnan(view->fov))
1884 repopulateOrientation();
1885 qCDebug(KSTARS) <<
"Alt/Az: " << Options::useAltAz()
1886 <<
"Mirror: " << Options::mirrorSkyMap()
1887 <<
"Rotation: " << Options::skyRotation()
1888 <<
"Erect Obs: " << Options::erectObserverCorrection()
1889 <<
"FOV: " << view->fov;
1894void KStars::slotHIPSSource()
1897 Q_ASSERT(selectedAction !=
nullptr);
1899 QString selectedSource = selectedAction->
text().remove(
'&');
1903 if (selectedSource ==
i18n(
"None"))
1904 HIPSManager::Instance()->setCurrentSource(
"None");
1906 HIPSManager::Instance()->setCurrentSource(selectedSource);
1911void KStars::slotEditViews()
1922void KStars::slotFOVEdit()
1933void KStars::slotObsList()
1935 m_KStarsData->observingList()->
show();
1938void KStars::slotEquipmentWriter()
1941 equipmentdlg->loadEquipment();
1942 equipmentdlg->exec();
1943 delete equipmentdlg;
1946void KStars::slotObserverManager()
1949 m_observerAdd->exec();
1950 delete m_observerAdd;
1953void KStars::slotHorizonManager()
1955 if (!m_HorizonManager)
1958 connect(m_SkyMap, SIGNAL(positionClicked(
SkyPoint *)), m_HorizonManager,
1962 m_HorizonManager->
show();
1967 if (!m_EyepieceView)
1972 const FOV *fov =
nullptr;
1973 if (!
data()->getAvailableFOVs().isEmpty())
1979 foreach (f,
data()->getAvailableFOVs())
1981 nameToFovMap.
insert(f->name(), f);
1983 nameToFovMap.
insert(
i18n(
"Attempt to determine from image"),
nullptr);
1985 this,
i18n(
"Eyepiece View: Choose a field-of-view"),
1986 i18n(
"FOV to render eyepiece view for:"), nameToFovMap.
keys(), 0,
false,
1993void KStars::slotExecute()
1995 KStarsData::Instance()->executeSession()->init();
1996 KStarsData::Instance()->executeSession()->show();
1999void KStars::slotPolarisHourAngle()
2006void KStars::slotTipOfDay()
2008 KTipDialog::showTip(
this,
"kstars/tips",
true);
2012void KStars::slotFullScreen()
2027void KStars::slotTerrain()
2029 Options::setShowTerrain(!Options::showTerrain());
2031 ->
setText(Options::showTerrain() ?
i18n(
"Hide Terrain") :
i18n(
"Show Terrain"));
2032 opterrain->syncOptions();
2037void KStars::slotImageOverlays()
2039 Options::setShowImageOverlays(!Options::showImageOverlays());
2041 ->
setText(Options::showImageOverlays() ?
i18n(
"Hide Image Overlays") :
i18n(
"Show Image Overlays"));
2042 opsImageOverlay->syncOptions();
2050 if (
map()->focusObject() &&
map()->focusObject()->isSolarSystem() &&
2051 data()->temporaryTrail)
2062void KStars::slotShowGUIItem(
bool show)
2067 Options::setShowStatusBar(
show);
2073 Options::setShowAltAzField(
show);
2079 Options::setShowRADecField(
show);
2085 Options::setShowJ2000RADecField(
show);
2100 if (actionName.
mid(3) ==
2101 cg.
readEntry(
"ColorSchemeFile",
"moonless-night.colors").
remove(
".colors"))
2108 connect(kta, SIGNAL(toggled(
bool)),
this, SLOT(slotColorScheme()));
2113 qCDebug(KSTARS) <<
"removing " << actionName;
2117void KStars::slotAboutToQuit()
2119 if (m_SkyMap ==
nullptr)
2123 DriverManager::Instance()->disconnectClients();
2134 Options::setWindowWidth(
width());
2135 Options::setWindowHeight(
height());
2146 quit->start(
"killall kdeinit5");
2147 quit->waitForFinished(1000);
2148 quit->start(
"killall klauncher");
2149 quit->waitForFinished(1000);
2150 quit->start(
"killall kioslave");
2151 quit->waitForFinished(1000);
2152 quit->start(
"killall kio_http_cache_cleaner");
2153 quit->waitForFinished(1000);
2160 if (Options::showAltAzField())
2163 if (Options::useAltAz())
2171 if (Options::showRADecField())
2174 lastUpdate.
setDJD(KStarsData::Instance()->updateNum()->getJD());
2183 if (Options::showJ2000RADecField())
2187 p0 = p->
catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2196void KStars::slotUpdateComets(
bool isAutoUpdate)
2198 data()->
skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2202void KStars::slotUpdateAsteroids(
bool isAutoUpdate)
2204 data()->
skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2208void KStars::slotUpdateSupernovae()
2213void KStars::slotUpdateSatellites()
2218void KStars::slotConfigureNotifications()
2220#ifdef HAVE_NOTIFYCONFIG
2226 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