Kstars

kstarsactions.cpp
1/*
2 SPDX-FileCopyrightText: 2002 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7// This file contains function definitions for Actions declared in kstars.h
8
9#include "kstars.h"
10
11#include "imageexporter.h"
12#include "kstarsdata.h"
13#include "kstars_debug.h"
14#include "ksnotification.h"
15#include "kswizard.h"
16#include "Options.h"
17#include "skymap.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"
51#ifdef HAVE_INDI
52#include "skyobjects/mosaictiles.h"
53#include "indi/indidome.h"
54#endif
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"
71#ifdef HAVE_INDI
72#include <basedevice.h>
73//#include "indi/telescopewizardprocess.h"
74#include "indi/opsindi.h"
75#include "indi/drivermanager.h"
76#include "indi/guimanager.h"
77#include "indi/indilistener.h"
78#endif
79
80#ifdef HAVE_CFITSIO
81#include "fitsviewer/fitsviewer.h"
82#include "fitsviewer/opsfits.h"
83#ifdef HAVE_INDI
84#include "ekos/manager.h"
85#include "ekos/scheduler/framingassistantui.h"
86#include "ekos/scheduler/scheduler.h"
87#include "ekos/scheduler/schedulermodulestate.h"
88#include "ekos/opsekos.h"
89#include "ekos/mount/mount.h"
90#include "tools/imagingplanner.h"
91#endif
92#endif
93
94#include "xplanet/opsxplanet.h"
95
96#ifdef HAVE_NOTIFYCONFIG
97#include <KNotifyConfigWidget>
98#endif
99#include <KActionCollection>
100#include <KActionMenu>
101
102#include <KToggleAction>
103
104#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
105#include <KNSWidgets/dialog.h>
106#else
107#include <kns3/downloaddialog.h>
108#endif
109
110#include <QQuickWindow>
111#include <QQuickView>
112
113#ifdef _WIN32
114#include <windows.h>
115#undef interface
116#endif
117#include <sys/stat.h>
118
119/** ViewToolBar Action. All of the viewToolBar buttons are connected to this slot. **/
120
121void KStars::slotViewToolBar()
122{
124 KConfigDialog *kcd = KConfigDialog::exists("settings");
125
126 if (a == actionCollection()->action("show_stars"))
127 {
128 Options::setShowStars(a->isChecked());
129 if (kcd)
130 {
131 opcatalog->kcfg_ShowStars->setChecked(a->isChecked());
132 }
133 }
134 else if (a == actionCollection()->action("show_deepsky"))
135 {
136 Options::setShowDeepSky(a->isChecked());
137 if (kcd)
138 {
139 opcatalog->kcfg_ShowDeepSky->setChecked(a->isChecked());
140 }
141 }
142 else if (a == actionCollection()->action("show_planets"))
143 {
144 Options::setShowSolarSystem(a->isChecked());
145 if (kcd)
146 {
147 opsolsys->kcfg_ShowSolarSystem->setChecked(a->isChecked());
148 }
149 }
150 else if (a == actionCollection()->action("show_clines"))
151 {
152 Options::setShowCLines(a->isChecked());
153 if (kcd)
154 {
155 opguides->kcfg_ShowCLines->setChecked(a->isChecked());
156 }
157 }
158 else if (a == actionCollection()->action("show_cnames"))
159 {
160 Options::setShowCNames(a->isChecked());
161 if (kcd)
162 {
163 opguides->kcfg_ShowCNames->setChecked(a->isChecked());
164 }
165 }
166 else if (a == actionCollection()->action("show_cbounds"))
167 {
168 Options::setShowCBounds(a->isChecked());
169 if (kcd)
170 {
171 opguides->kcfg_ShowCBounds->setChecked(a->isChecked());
172 }
173 }
174 else if (a == actionCollection()->action("show_constellationart"))
175 {
176 Options::setShowConstellationArt(a->isChecked());
177 if (kcd)
178 {
179 opguides->kcfg_ShowConstellationArt->setChecked(a->isChecked());
180 }
181 }
182 else if (a == actionCollection()->action("show_mw"))
183 {
184 Options::setShowMilkyWay(a->isChecked());
185 if (kcd)
186 {
187 opguides->kcfg_ShowMilkyWay->setChecked(a->isChecked());
188 }
189 }
190 else if (a == actionCollection()->action("show_equatorial_grid"))
191 {
192 // if autoSelectGrid is selected and the user clicked the
193 // show_equatorial_grid button, he probably wants us to disable
194 // the autoSelectGrid and display the equatorial grid.
195 Options::setAutoSelectGrid(false);
196 Options::setShowEquatorialGrid(a->isChecked());
197 if (kcd)
198 {
199 opguides->kcfg_ShowEquatorialGrid->setChecked(a->isChecked());
200 opguides->kcfg_AutoSelectGrid->setChecked(false);
201 }
202 }
203 else if (a == actionCollection()->action("show_horizontal_grid"))
204 {
205 Options::setAutoSelectGrid(false);
206 Options::setShowHorizontalGrid(a->isChecked());
207 if (kcd)
208 {
209 opguides->kcfg_ShowHorizontalGrid->setChecked(a->isChecked());
210 opguides->kcfg_AutoSelectGrid->setChecked(false);
211 }
212 }
213 else if (a == actionCollection()->action("show_horizon"))
214 {
215 Options::setShowGround(a->isChecked());
216 if (!a->isChecked() && Options::useRefraction())
217 {
218 QString caption = i18n("Refraction effects disabled");
219 QString message = i18n("When the horizon is switched off, refraction effects "
220 "are temporarily disabled.");
221
222 KMessageBox::information(this, message, caption, "dag_refract_hide_ground");
223 }
224 if (kcd)
225 {
226 opguides->kcfg_ShowGround->setChecked(a->isChecked());
227 }
228 }
229 else if (a == actionCollection()->action("simulate_daytime"))
230 {
231 Options::setSimulateDaytime(a->isChecked());
232 if (kcd)
233 {
234 opguides->kcfg_SimulateDaytime->setChecked(a->isChecked());
235 }
236 }
237 else if (a == actionCollection()->action("show_flags"))
238 {
239 Options::setShowFlags(a->isChecked());
240 if (kcd)
241 {
242 opguides->kcfg_ShowFlags->setChecked(a->isChecked());
243 }
244 }
245 else if (a == actionCollection()->action("show_satellites"))
246 {
247 Options::setShowSatellites(a->isChecked());
248 if (kcd)
249 {
250 opssatellites->kcfg_ShowSatellites->setChecked(a->isChecked());
251 }
252 }
253 else if (a == actionCollection()->action("show_supernovae"))
254 {
255 Options::setShowSupernovae(a->isChecked());
256 if (kcd)
257 {
258 opssupernovae->kcfg_ShowSupernovae->setChecked(a->isChecked());
259 }
260 }
261
262 // update time for all objects because they might be not initialized
263 // it's needed when using horizontal coordinates
265 updateTime();
266
267 map()->forceUpdate();
268}
269
270void KStars::slotINDIToolBar()
271{
272#ifdef HAVE_INDI
274
275 if (a == actionCollection()->action("show_control_panel"))
276 {
277 if (a->isChecked())
278 {
279 GUIManager::Instance()->raise();
280 GUIManager::Instance()->activateWindow();
281 GUIManager::Instance()->showNormal();
282 }
283 else
284 GUIManager::Instance()->hide();
285 }
286 else if (a == actionCollection()->action("show_ekos"))
287 {
288 if (a->isChecked())
289 {
290 Ekos::Manager::Instance()->raise();
291 Ekos::Manager::Instance()->activateWindow();
292 Ekos::Manager::Instance()->showNormal();
293 }
294 else
295 Ekos::Manager::Instance()->hide();
296 }
297 else if (a == actionCollection()->action("lock_telescope"))
298 {
299 for (auto &oneDevice : INDIListener::devices())
300 {
301 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
302 continue;
303
304 if (oneDevice->isConnected() == false)
305 {
306 KSNotification::error(i18n("Mount %1 is offline. Please connect and retry again.", oneDevice->getDeviceName()));
307 return;
308 }
309
310 auto mount = oneDevice->getMount();
311 if (!mount)
312 continue;
313
314 if (a->isChecked())
315 mount->centerLock();
316 else
317 mount->centerUnlock();
318 return;
319 }
320
321 KSNotification::sorry(i18n("No connected mounts found."));
322 return;
323 }
324 else if (a == actionCollection()->action("show_fits_viewer"))
325 {
326 if (m_FITSViewers.isEmpty())
327 {
328 a->setEnabled(false);
329 return;
330 }
331
332 if (a->isChecked())
333 {
334 for (auto &view : m_FITSViewers)
335 {
336 if (view->tabs().empty() == false)
337 {
338 view->raise();
339 view->activateWindow();
340 view->showNormal();
341 }
342 }
343 }
344 else
345 {
346 for (auto &view : m_FITSViewers)
347 {
348 view->hide();
349 }
350 }
351 }
352 else if (a == actionCollection()->action("show_mount_box"))
353 {
354#ifdef HAVE_CFITSIO
355#ifdef HAVE_INDI
356 Ekos::Manager::Instance()->mountModule()->toggleMountToolBox();
357#endif
358#endif
359 }
360 else if (a == actionCollection()->action("show_sensor_fov"))
361 {
362 Options::setShowSensorFOV(a->isChecked());
363 for (auto &oneFOV : data()->getTransientFOVs())
364 {
365 if (oneFOV->objectName() == "sensor_fov")
366 oneFOV->setProperty("visible", a->isChecked());
367 }
368 }
369 else if (a == actionCollection()->action("show_mosaic_panel"))
370 {
371#ifdef HAVE_INDI
372 Options::setShowMosaicPanel(a->isChecked());
373 // TODO
374 // If scheduler is not running, then we should also show the Mosaic Planner dialog.
375 auto scheduler = Ekos::Manager::Instance()->schedulerModule();
376 if (a->isChecked() && scheduler && scheduler->moduleState()->schedulerState() != Ekos::SCHEDULER_RUNNING)
377 {
378 // Only create if we don't have an instance already
379 if (findChild<Ekos::FramingAssistantUI *>("FramingAssistant") == nullptr)
380 {
381 Ekos::FramingAssistantUI *assistant = new Ekos::FramingAssistantUI();
382 assistant->setAttribute(Qt::WA_DeleteOnClose, true);
383 assistant->show();
384 }
385 }
386#endif
387 }
388
389#endif
390}
391
393{
394 telescopeGroup->setEnabled(enable);
395 if (enable == false)
396 {
397 for (auto &a : telescopeGroup->actions())
398 {
399 a->setChecked(false);
400 }
401 }
402}
403
405{
406 domeGroup->setEnabled(enable);
407 if (enable == false)
408 {
409 for (auto &a : domeGroup->actions())
410 {
411 a->setChecked(false);
412 }
413 }
414}
415
416/** Major Dialog Window Actions **/
417
418void KStars::slotCalculator()
419{
420 if (!m_AstroCalc)
421 m_AstroCalc = new AstroCalc(this);
422 m_AstroCalc->show();
423}
424
426{
427 QPointer<KSWizard> wizard = new KSWizard(this);
428 if (wizard->exec() == QDialog::Accepted)
429 {
430 Options::setRunStartupWizard(false); //don't run on startup next time
431 if (wizard->geo())
432 updateLocationFromWizard(*(wizard->geo()));
433 }
434}
435
436void KStars::updateLocationFromWizard(const GeoLocation &geo)
437{
438 data()->setLocation(geo);
439 // adjust local time to keep UT the same.
440 // create new LT without DST offset
441 KStarsDateTime ltime = data()->geo()->UTtoLT(data()->ut());
442
443 // reset timezonerule to compute next dst change
444 data()->geo()->tzrule()->reset_with_ltime(ltime, data()->geo()->TZ0(),
445 data()->isTimeRunningForward());
446
447 // reset next dst change time
448 data()->setNextDSTChange(data()->geo()->tzrule()->nextDSTChange());
449
450 // reset local sideral time
451 data()->syncLST();
452
453 // Make sure Numbers, Moon, planets, and sky objects are updated immediately
455
456 // If the sky is in Horizontal mode and not tracking, reset focus such that
457 // Alt/Az remain constant.
458 if (!Options::isTracking() && Options::useAltAz())
459 {
460 map()->focus()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
461 }
462
463 // recalculate new times and objects
465 updateTime();
466}
467
469{
470 // 2017-07-04: Explicitly load kstars.knsrc from resources file
471#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
472 auto dlg = std::make_unique<KNSWidgets::Dialog>(":/kconfig/kstars.knsrc", this);
473#else
474 auto dlg = std::make_unique<KNS3::DownloadDialog>(":/kconfig/kstars.knsrc", this);
475#endif
476
477 if (!dlg)
478 return;
479
480 dlg->exec();
481
482 // Get the list of all the installed entries.
483 const auto changed_entries = dlg->changedEntries();
484
485 CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
486#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
487 for (const KNSCore::Entry &entry : changed_entries)
488#else
489 for (const KNS3::Entry &entry : changed_entries)
490#endif
491 {
492 if (entry.category() != "dso")
493 continue;
494
495#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
496 const auto id = entry.uniqueId().toInt();
497 if (entry.status() == KNSCore::Entry::Installed)
498#else
499 const auto id = entry.id().toInt();
500 if (entry.status() == KNS3::Entry::Installed)
501#endif
502 for (const QString &name : entry.installedFiles())
503 {
504 if (name.endsWith(CatalogsDB::db_file_extension))
505 {
506 const auto meta{ CatalogsDB::read_catalog_meta_from_file(name) };
507
508 if (!meta.first)
509 {
511 this, i18n("Error"),
512 i18n("The catalog \"%1\" is corrupt.", entry.name()));
513 continue;
514 }
515
516 if (meta.second.id != id)
517 {
519 this, i18n("Error"),
520 i18n("The catalog \"%1\" is corrupt.<br>Expected id=%2 but "
521 "got id=%3",
522 entry.name(), id, meta.second.id));
523 continue;
524 }
525
526 const auto success{ manager.import_catalog(name, true) };
527 if (!success.first)
529 this, i18n("Error"),
530 i18n("Could not import the catalog \"%1\"<br>%2",
531 entry.name(), success.second));
532 }
533 }
534#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
535 if (entry.status() == KNSCore::Entry::Deleted)
536#else
537 if (entry.status() == KNS3::Entry::Deleted)
538#endif
539 {
540 manager.remove_catalog(id);
541 }
542 }
543
545 KStars::Instance()->data()->skyComposite()->reloadDeepSky();
549}
550
551void KStars::slotAVT()
552{
553 if (!m_AltVsTime)
554 m_AltVsTime = new AltVsTime(this);
555 m_AltVsTime->show();
556}
557
558void KStars::slotWUT()
559{
560 if (!m_WUTDialog)
561 m_WUTDialog = new WUTDialog(this);
562 m_WUTDialog->show();
563}
564
565//FIXME Port to QML2
566//#if 0
568{
569 if (!m_WIView)
571 if (m_WIView && !m_wiDock->isVisible())
573
574 if (KConfigDialog::showDialog("wisettings"))
575 {
576 m_WIEquipmentSettings->populateScopeListWidget();
577 return;
578 }
579
580 KConfigDialog *dialog = new KConfigDialog(this, "wisettings", Options::self());
581
582 connect(dialog, SIGNAL(settingsChanged(QString)), this,
584
585 m_WISettings = new WILPSettings(this);
586 m_WIEquipmentSettings = new WIEquipSettings();
587 dialog->addPage(m_WISettings, i18n("Light Pollution Settings"));
588 dialog->addPage(m_WIEquipmentSettings,
589 i18n("Equipment Settings - Equipment Type and Parameters"));
590 dialog->exec();
591 if (m_WIEquipmentSettings)
592 m_WIEquipmentSettings->setAperture(); //Something isn't working with this!
593}
594
596{
597 if (KStars::Closing)
598 return;
599
600 if (!m_WIView)
601 {
602 m_WIView = new WIView(nullptr);
603 m_wiDock = new QDockWidget(this);
604 m_wiDock->setStyleSheet("QDockWidget::title{background-color:black;}");
605 m_wiDock->setObjectName("What's Interesting");
607 QWidget *container = QWidget::createWindowContainer(m_WIView->getWIBaseView());
608 m_wiDock->setWidget(container);
609 m_wiDock->setMinimumWidth(400);
611 connect(m_wiDock, SIGNAL(visibilityChanged(bool)),
612 actionCollection()->action("show_whatsinteresting"),
613 SLOT(setChecked(bool)));
614 m_wiDock->setVisible(true);
615 }
616 else
617 {
618 m_wiDock->setVisible(!m_wiDock->isVisible());
619 }
620}
621
622void KStars::slotCalendar()
623{
624 if (!m_SkyCalendar)
625 m_SkyCalendar = new SkyCalendar(this);
626 m_SkyCalendar->show();
627}
628
629void KStars::slotGlossary()
630{
631 // GlossaryDialog *dlg = new GlossaryDialog( this, true );
632 // QString glossaryfile =data()->stdDirs->findResource( "data", "kstars/glossary.xml" );
633 // QUrl u = glossaryfile;
634 // Glossary *g = new Glossary( u );
635 // g->setName( i18n( "Knowledge" ) );
636 // dlg->addGlossary( g );
637 // dlg->show();
638}
639
640void KStars::slotScriptBuilder()
641{
642 if (!m_ScriptBuilder)
643 m_ScriptBuilder = new ScriptBuilder(this);
644 m_ScriptBuilder->show();
645}
646
647void KStars::slotSolarSystem()
648{
649 if (!m_PlanetViewer)
650 m_PlanetViewer = new PlanetViewer(this);
651 m_PlanetViewer->show();
652}
653
654void KStars::slotJMoonTool()
655{
656 if (!m_JMoonTool)
657 m_JMoonTool = new JMoonTool(this);
658 m_JMoonTool->show();
659}
660
661void KStars::slotMoonPhaseTool()
662{
663 //FIXME Port to KF5
664 //if( ! mpt ) mpt = new MoonPhaseTool( this );
665 //mpt->show();
666}
667
669{
670 if (!m_FlagManager)
671 m_FlagManager = new FlagManager(this);
672 m_FlagManager->show();
673}
674
675#if 0
676void KStars::slotTelescopeWizard()
677{
678#ifdef HAVE_INDI
679#ifndef Q_OS_WIN
680
681 QString indiServerDir = Options::indiServer();
682
683#ifdef Q_OS_MACOS
684 if (Options::indiServerIsInternal())
685 indiServerDir = QCoreApplication::applicationDirPath();
686 else
687 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
688#endif
689
690 QStringList paths;
691 paths << "/usr/bin"
692 << "/usr/local/bin" << indiServerDir;
693
694 if (QStandardPaths::findExecutable("indiserver").isEmpty())
695 {
696 if (QStandardPaths::findExecutable("indiserver", paths).isEmpty())
697 {
698 KSNotification::error(i18n("Unable to find INDI server. Please make sure the package that provides "
699 "the 'indiserver' binary is installed."));
700 return;
701 }
702 }
703#endif
704
705 QPointer<telescopeWizardProcess> twiz = new telescopeWizardProcess(this);
706 twiz->exec();
707 delete twiz;
708#endif
709}
710#endif
711
712void KStars::slotINDIPanel()
713{
714#ifdef HAVE_INDI
715#ifndef Q_OS_WIN
716
717 QString indiServerDir = Options::indiServer();
718
719#ifdef Q_OS_MACOS
720 if (Options::indiServerIsInternal())
721 indiServerDir = QCoreApplication::applicationDirPath();
722 else
723 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
724#endif
725
726 QStringList paths;
727 paths << "/usr/bin"
728 << "/usr/local/bin" << indiServerDir;
729
730 if (QStandardPaths::findExecutable("indiserver").isEmpty())
731 {
732 if (QStandardPaths::findExecutable("indiserver", paths).isEmpty())
733 {
734 KSNotification::error(i18n(
735 "Unable to find INDI server. Please make sure the package that provides "
736 "the 'indiserver' binary is installed."));
737 return;
738 }
739 }
740#endif
741 GUIManager::Instance()->updateStatus(true);
742#endif
743}
744
745void KStars::slotINDIDriver()
746{
747#ifdef HAVE_INDI
748#ifndef Q_OS_WIN
749
751 nullptr,
752 i18n("INDI Device Manager should only be used by advanced technical users. "
753 "It cannot be used with Ekos. Do you still want to open INDI device "
754 "manager?"),
755 i18n("INDI Device Manager"), KStandardGuiItem::cont(),
757 "indi_device_manager_warning") == KMessageBox::Cancel)
758 return;
759
760 QString indiServerDir = Options::indiServer();
761
762#ifdef Q_OS_MACOS
763 if (Options::indiServerIsInternal())
764 indiServerDir = QCoreApplication::applicationDirPath();
765 else
766 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
767#endif
768
769 QStringList paths;
770 paths << "/usr/bin"
771 << "/usr/local/bin" << indiServerDir;
772
773 if (QStandardPaths::findExecutable("indiserver").isEmpty())
774 {
775 if (QStandardPaths::findExecutable("indiserver", paths).isEmpty())
776 {
777 KSNotification::error(i18n(
778 "Unable to find INDI server. Please make sure the package that provides "
779 "the 'indiserver' binary is installed."));
780 return;
781 }
782 }
783#endif
784
785 DriverManager::Instance()->raise();
786 DriverManager::Instance()->activateWindow();
787 DriverManager::Instance()->showNormal();
788
789#endif
790}
791
792void KStars::slotEkos()
793{
794#ifdef HAVE_CFITSIO
795#ifdef HAVE_INDI
796
797#ifndef Q_OS_WIN
798
799 QString indiServerDir = Options::indiServer();
800
801#ifdef Q_OS_MACOS
802 if (Options::indiServerIsInternal())
803 indiServerDir = QCoreApplication::applicationDirPath();
804 else
805 indiServerDir = QFileInfo(Options::indiServer()).dir().path();
806#endif
807
808 QStringList paths;
809 paths << "/usr/bin"
810 << "/usr/local/bin" << indiServerDir;
811
812 if (QStandardPaths::findExecutable("indiserver").isEmpty())
813 {
814 if (QStandardPaths::findExecutable("indiserver", paths).isEmpty())
815 {
816 KSNotification::error(i18n(
817 "Unable to find INDI server. Please make sure the package that provides "
818 "the 'indiserver' binary is installed."));
819 return;
820 }
821 }
822#endif
823
824 if (Ekos::Manager::Instance()->isVisible() &&
825 Ekos::Manager::Instance()->isActiveWindow())
826 {
827 Ekos::Manager::Instance()->hide();
828 }
829 else
830 {
831 Ekos::Manager::Instance()->raise();
832 Ekos::Manager::Instance()->activateWindow();
833 Ekos::Manager::Instance()->showNormal();
834 }
835
836#endif
837#endif
838}
839
840void KStars::slotINDITelescopeTrack()
841{
842#ifdef HAVE_INDI
843 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
844 return;
845
846 for (auto &oneDevice : INDIListener::devices())
847 {
848 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
849 continue;
850
851 auto mount = oneDevice->getMount();
852 if (!mount || mount->isConnected() == false)
853 continue;
854
856
857 if (a != nullptr)
858 {
859 mount->setTrackEnabled(a->isChecked());
860 return;
861 }
862 }
863#endif
864}
865
866void KStars::slotINDITelescopeSlew(bool focused_object)
867{
868#ifdef HAVE_INDI
869 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
870 return;
871
872 for (auto &oneDevice : INDIListener::devices())
873 {
874 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
875 continue;
876
877 auto mount = oneDevice->getMount();
878 if (!mount || mount->isConnected() == false)
879 continue;
880 if (focused_object)
881 {
882 if (m_SkyMap->focusObject() != nullptr)
883 mount->Slew(m_SkyMap->focusObject());
884 }
885 else
886 mount->Slew(m_SkyMap->mousePoint());
887
888 return;
889 }
890#else
891 Q_UNUSED(focused_object)
892#endif
893}
894
895void KStars::slotINDITelescopeSlewMousePointer()
896{
897#ifdef HAVE_INDI
898 slotINDITelescopeSlew(false);
899#endif
900}
901
902void KStars::slotINDITelescopeSync(bool focused_object)
903{
904#ifdef HAVE_INDI
905 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
906 return;
907
908 for (auto &oneDevice : INDIListener::devices())
909 {
910 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
911 continue;
912
913 auto mount = oneDevice->getMount();
914 if (!mount || mount->isConnected() == false)
915 continue;
916
917 if (focused_object)
918 {
919 if (m_SkyMap->focusObject() != nullptr)
920 mount->Sync(m_SkyMap->focusObject());
921 }
922 else
923 mount->Sync(m_SkyMap->mousePoint());
924
925 return;
926 }
927#else
928 Q_UNUSED(focused_object)
929#endif
930}
931
932void KStars::slotINDITelescopeSyncMousePointer()
933{
934#ifdef HAVE_INDI
935 slotINDITelescopeSync(false);
936#endif
937}
938
939void KStars::slotINDITelescopeAbort()
940{
941#ifdef HAVE_INDI
942 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
943 return;
944
945 for (auto &oneDevice : INDIListener::devices())
946 {
947 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
948 continue;
949
950 auto mount = oneDevice->getMount();
951 if (!mount || mount->isConnected() == false)
952 continue;
953
954 mount->abort();
955 return;
956 }
957#endif
958}
959
960void KStars::slotINDITelescopePark()
961{
962#ifdef HAVE_INDI
963 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
964 return;
965
966 for (auto &oneDevice : INDIListener::devices())
967 {
968 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
969 continue;
970
971 auto mount = oneDevice->getMount();
972 if (!mount || mount->isConnected() == false || mount->canPark() == false)
973 continue;
974
975 mount->park();
976 return;
977 }
978#endif
979}
980
981void KStars::slotINDITelescopeUnpark()
982{
983#ifdef HAVE_INDI
984 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
985 return;
986
987 for (auto &oneDevice : INDIListener::devices())
988 {
989 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE))
990 continue;
991
992 auto mount = oneDevice->getMount();
993 if (!mount || mount->isConnected() == false || mount->canPark() == false)
994 continue;
995
996 mount->unpark();
997 return;
998 }
999#endif
1000}
1001
1002void KStars::slotINDIDomePark()
1003{
1004#ifdef HAVE_INDI
1005 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
1006 return;
1007
1008 for (auto &oneDevice : INDIListener::devices())
1009 {
1010 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1011 continue;
1012
1013 auto dome = oneDevice->getDome();
1014 if (!dome || dome->isConnected() == false)
1015 continue;
1016 if (dome->canPark())
1017 {
1018 dome->park();
1019 return;
1020 }
1021 }
1022#endif
1023}
1024
1025void KStars::slotINDIDomeUnpark()
1026{
1027#ifdef HAVE_INDI
1028 if (m_KStarsData == nullptr || INDIListener::Instance() == nullptr)
1029 return;
1030
1031 for (auto &oneDevice : INDIListener::devices())
1032 {
1033 if (!(oneDevice->getDriverInterface() & INDI::BaseDevice::DOME_INTERFACE))
1034 continue;
1035
1036 auto dome = oneDevice->getDome();
1037 if (!dome || dome->isConnected() == false)
1038 continue;
1039 if (dome->canPark())
1040 {
1041 dome->unpark();
1042 return;
1043 }
1044 }
1045#endif
1046}
1047
1049{
1050 QPointer<LocationDialog> locationdialog = new LocationDialog(this);
1051 if (locationdialog->exec() == QDialog::Accepted)
1052 {
1053 GeoLocation *newLocation = locationdialog->selectedCity();
1054 if (newLocation)
1055 {
1056 // set new location in options
1057 data()->setLocation(*newLocation);
1058
1059 // adjust local time to keep UT the same.
1060 // create new LT without DST offset
1061 KStarsDateTime ltime = newLocation->UTtoLT(data()->ut());
1062
1063 // reset timezonerule to compute next dst change
1064 newLocation->tzrule()->reset_with_ltime(ltime, newLocation->TZ0(),
1065 data()->isTimeRunningForward());
1066
1067 // reset next dst change time
1068 data()->setNextDSTChange(newLocation->tzrule()->nextDSTChange());
1069
1070 // reset local sideral time
1071 data()->syncLST();
1072
1073 // Make sure Numbers, Moon, planets, and sky objects are updated immediately
1075
1076 // If the sky is in Horizontal mode and not tracking, reset focus such that
1077 // Alt/Az remain constant.
1078 if (!Options::isTracking() && Options::useAltAz())
1079 {
1080 map()->focus()->HorizontalToEquatorial(data()->lst(),
1081 data()->geo()->lat());
1082 }
1083
1084 // recalculate new times and objects
1086 updateTime();
1087 }
1088 }
1089 delete locationdialog;
1090}
1091
1092void KStars::slotViewOps()
1093{
1094 // An instance of your dialog could be already created and could be cached,
1095 // in which case you want to display the cached dialog instead of creating
1096 // another one
1097 auto ops = prepareOps();
1098 ops->show();
1099 // Bring to the front.
1100 ops->raise(); // for MacOS
1101 ops->activateWindow(); // for Windows
1102}
1103
1104KConfigDialog *KStars::prepareOps()
1105{
1106 KConfigDialog *dialog = KConfigDialog::exists("settings");
1107 if (nullptr != dialog)
1108 return dialog;
1109
1110 // KConfigDialog didn't find an instance of this dialog, so lets create it :
1111 dialog = new KConfigDialog(this, "settings", Options::self());
1112
1113 // For some reason the dialog does not resize to contents
1114 // so we set initial 'resonable' size here. Any better way to do this?
1115 dialog->resize(800, 600);
1116#ifdef Q_OS_MACOS
1118#endif
1119
1120 connect(dialog, SIGNAL(settingsChanged(QString)), this,
1121 SLOT(slotApplyConfigChanges()));
1122
1123 opcatalog = new OpsCatalog();
1124 opguides = new OpsGuides();
1125 opterrain = new OpsTerrain();
1126 opsImageOverlay = new OpsImageOverlay();
1127 opsdeveloper = new OpsDeveloper();
1128 opsolsys = new OpsSolarSystem();
1129 opssatellites = new OpsSatellites();
1130 opssupernovae = new OpsSupernovae();
1131 opcolors = new OpsColors();
1132 opadvanced = new OpsAdvanced();
1133
1134 KPageWidgetItem *page;
1135
1136 page = dialog->addPage(opcatalog, i18n("Catalogs"), "kstars_catalog");
1137 page->setIcon(QIcon::fromTheme("kstars_catalog"));
1138
1139 page = dialog->addPage(opsolsys, i18n("Solar System"), "kstars_solarsystem");
1140 page->setIcon(QIcon::fromTheme("kstars_solarsystem"));
1141
1142 page = dialog->addPage(opssatellites, i18n("Satellites"), "kstars_satellites");
1143 page->setIcon(QIcon::fromTheme("kstars_satellites"));
1144
1145 page = dialog->addPage(opssupernovae, i18n("Supernovae"), "kstars_supernovae");
1146 page->setIcon(QIcon::fromTheme("kstars_supernovae"));
1147
1148 page = dialog->addPage(opguides, i18n("Guides"), "kstars_guides");
1149 page->setIcon(QIcon::fromTheme("kstars_guides"));
1150
1151 page = dialog->addPage(opterrain, i18n("Terrain"), "kstars_terrain");
1152 page->setIcon(QIcon::fromTheme("kstars_terrain", QIcon(":/icons/kstars_terrain.png")));
1153
1154 page = dialog->addPage(opsImageOverlay, i18n("Image Overlays"), "kstars_imageoverlay");
1155 page->setIcon(QIcon::fromTheme("kstars_imageoverlay", QIcon(":/icons/kstars_imageoverlay.png")));
1156 KStarsData::Instance()->skyComposite()->imageOverlay()->setWidgets(
1157 opsImageOverlay->table(), opsImageOverlay->statusDisplay(), opsImageOverlay->solvePushButton(),
1158 opsImageOverlay->tableTitleBox(), opsImageOverlay->solverProfile());
1159
1160 page = dialog->addPage(opcolors, i18n("Colors"), "kstars_colors");
1161 page->setIcon(QIcon::fromTheme("kstars_colors"));
1162
1163#ifdef HAVE_CFITSIO
1164 opsfits = new OpsFITS();
1165 page = dialog->addPage(opsfits, i18n("FITS"), "kstars_fitsviewer");
1166 page->setIcon(QIcon::fromTheme("kstars_fitsviewer"));
1167#endif
1168
1169#ifdef HAVE_INDI
1170 opsindi = new OpsINDI();
1171 page = dialog->addPage(opsindi, i18n("INDI"), "kstars_indi");
1172 page->setIcon(QIcon::fromTheme("kstars_indi"));
1173#ifdef HAVE_CFITSIO
1174 opsekos = new OpsEkos();
1175 KPageWidgetItem *ekosOption = dialog->addPage(opsekos, i18n("Ekos"), "kstars_ekos");
1176 ekosOption->setIcon(QIcon::fromTheme("kstars_ekos"));
1177 if (Ekos::Manager::Instance())
1178 Ekos::Manager::Instance()->setOptionsWidget(ekosOption, opsekos);
1179#endif
1180
1181#endif
1182
1183 opsxplanet = new OpsXplanet(this);
1184 page = dialog->addPage(opsxplanet, i18n("Xplanet"), "kstars_xplanet");
1185 page->setIcon(QIcon::fromTheme("kstars_xplanet"));
1186
1187 page = dialog->addPage(opadvanced, i18n("Advanced"), "kstars_advanced");
1188 page->setIcon(QIcon::fromTheme("kstars_advanced"));
1189
1190 page = dialog->addPage(opsdeveloper, i18n("Developer"), "kstars_developer");
1191 page->setIcon(QIcon::fromTheme("kstars_developer", QIcon(":/icons/kstars_developer.png")));
1192
1193#ifdef Q_OS_MACOS // This is because KHelpClient doesn't seem to be working right on MacOS
1196 {
1197 KStars::Instance()->appHelpActivated();
1198 });
1199#endif
1200
1201 return dialog;
1202}
1203
1205{
1206 opterrain->syncOptions();
1207 actionCollection()->action("toggle_terrain")
1208 ->setText(Options::showTerrain() ? i18n("Hide Terrain") : i18n("Show Terrain"));
1209
1210 opsImageOverlay->syncOptions();
1211 actionCollection()->action("toggle_image_overlays")
1212 ->setText(Options::showImageOverlays() ? i18n("Hide Image Overlays") : i18n("Show Image Overlays"));
1213}
1214
1216{
1217 Options::self()->save();
1218
1219 applyConfig();
1220
1221 //data()->setFullTimeUpdate();
1222 //map()->forceUpdate();
1223}
1224
1226{
1227 Options::self()->save();
1228 applyConfig();
1229 m_WIView->updateObservingConditions();
1230 m_WIView->onReloadIconClicked();
1231}
1232
1233void KStars::slotSetTime()
1234{
1235 QPointer<TimeDialog> timedialog = new TimeDialog(data()->lt(), data()->geo(), this);
1236
1237 if (timedialog->exec() == QDialog::Accepted)
1238 {
1239 data()->changeDateTime(data()->geo()->LTtoUT(timedialog->selectedDateTime()));
1240
1241 if (Options::useAltAz())
1242 {
1243 if (map()->focusObject())
1244 {
1246 data()->geo()->lat());
1247 map()->setFocus(map()->focusObject());
1248 }
1249 else
1250 map()->focus()->HorizontalToEquatorial(data()->lst(),
1251 data()->geo()->lat());
1252 }
1253
1254 map()->forceUpdateNow();
1255
1256 //If focusObject has a Planet Trail, clear it and start anew.
1257 KSPlanetBase *planet = dynamic_cast<KSPlanetBase *>(map()->focusObject());
1258 if (planet && planet->hasTrail())
1259 {
1260 planet->clearTrail();
1261 planet->addToTrail();
1262 }
1263 }
1264 delete timedialog;
1265}
1266
1267//Set Time to CPU clock
1269{
1271
1272 if (Options::useAltAz())
1273 {
1274 if (map()->focusObject())
1275 {
1277 data()->geo()->lat());
1278 map()->setFocus(map()->focusObject());
1279 }
1280 else
1281 map()->focus()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
1282 }
1283
1284 map()->forceUpdateNow();
1285
1286 //If focusObject has a Planet Trail, clear it and start anew.
1287 KSPlanetBase *planet = dynamic_cast<KSPlanetBase *>(map()->focusObject());
1288 if (planet && planet->hasTrail())
1289 {
1290 planet->clearTrail();
1291 planet->addToTrail();
1292 }
1293}
1294
1295void KStars::slotFind()
1296{
1297 //clearCachedFindDialog();
1298 SkyObject *targetObject = nullptr;
1299 if (FindDialog::Instance()->exec() == QDialog::Accepted &&
1300 (targetObject = FindDialog::Instance()->targetObject()))
1301 {
1302 map()->setClickedObject(targetObject);
1303 map()->setClickedPoint(map()->clickedObject());
1304 map()->slotCenter();
1305 }
1306
1307 // check if data has changed while dialog was open
1308 //if (DialogIsObsolete)
1309 // clearCachedFindDialog();
1310}
1311
1312void KStars::slotOpenFITS()
1313{
1314#ifdef HAVE_CFITSIO
1315 auto fv = createFITSViewer();
1316 fv->openFile();
1317#endif
1318}
1319
1320void KStars::slotBlink()
1321{
1322#ifdef HAVE_CFITSIO
1323 auto fv = createFITSViewer();
1324 fv->blink();
1325#endif
1326}
1327
1328void KStars::slotExportImage()
1329{
1330 //TODO Check this
1331 //For remote files, this returns
1332 //QFileInfo::absolutePath: QFileInfo::absolutePath: Constructed with empty filename
1333 //As of 2014-07-19
1334 //QUrl fileURL = KFileDialog::getSaveUrl( QDir::homePath(), "image/png image/jpeg image/gif image/x-portable-pixmap image/bmp image/svg+xml" );
1335 QUrl fileURL =
1336 QFileDialog::getSaveFileUrl(KStars::Instance(), i18nc("@title:window", "Export Image"), QUrl(),
1337 "Images (*.png *.jpeg *.gif *.bmp *.svg)");
1338
1339 //User cancelled file selection dialog - abort image export
1340 if (fileURL.isEmpty())
1341 {
1342 return;
1343 }
1344
1345 //Warn user if file exists!
1346 if (QFile::exists(fileURL.toLocalFile()))
1347 {
1349 parentWidget(),
1350 i18n("A file named \"%1\" already exists. Overwrite it?", fileURL.fileName()),
1351 i18n("Overwrite File?"), KStandardGuiItem::overwrite());
1352 if (r == KMessageBox::Cancel)
1353 return;
1354 }
1355
1356 // execute image export dialog
1357
1358 // Note: We don't let ExportImageDialog create its own ImageExporter because we want legend settings etc to be remembered between UI use and DBus scripting interface use.
1359 //if ( !m_ImageExporter )
1360 //m_ImageExporter = new ImageExporter( this );
1361
1362 if (!m_ExportImageDialog)
1363 {
1364 m_ExportImageDialog = new ExportImageDialog(
1365 fileURL.toLocalFile(), QSize(map()->width(), map()->height()),
1366 KStarsData::Instance()->imageExporter());
1367 }
1368 else
1369 {
1370 m_ExportImageDialog->setOutputUrl(fileURL.toLocalFile());
1371 m_ExportImageDialog->setOutputSize(QSize(map()->width(), map()->height()));
1372 }
1373
1374 m_ExportImageDialog->show();
1375}
1376
1377void KStars::slotRunScript()
1378{
1381 "*.kstars|" +
1382 i18nc("Filter by file type: KStars Scripts.", "KStars Scripts (*.kstars)"));
1383 QFile f;
1384 //QString fname;
1385
1386 if (fileURL.isValid())
1387 {
1388 if (fileURL.isLocalFile() == false)
1389 {
1390 KSNotification::sorry(i18n("Executing remote scripts is not supported."));
1391 return;
1392 }
1393
1394 f.setFileName(fileURL.toLocalFile());
1395
1396 if (!f.open(QIODevice::ReadOnly))
1397 {
1398 QString message = i18n("Could not open file %1", f.fileName());
1399 KSNotification::sorry(message, i18n("Could Not Open File"));
1400 return;
1401 }
1402
1403 QTextStream istream(&f);
1404 QString line;
1405 bool fileOK(true);
1406
1407 while (!istream.atEnd())
1408 {
1409 line = istream.readLine();
1410 if (line.at(0) != '#' && line.left(9) != "dbus-send")
1411 {
1412 fileOK = false;
1413 break;
1414 }
1415 }
1416
1417 if (!fileOK)
1418 {
1419 int answer;
1421 nullptr,
1422 i18n(
1423 "The selected script contains unrecognized elements, "
1424 "indicating that it was not created using the KStars script builder. "
1425 "This script may not function properly, and it may even contain "
1426 "malicious code. "
1427 "Would you like to execute it anyway?"),
1428 i18n("Script Validation Failed"), KGuiItem(i18n("Run Nevertheless")),
1429 KStandardGuiItem::cancel(), "daExecuteScript");
1430 if (answer == KMessageBox::Cancel)
1431 return;
1432 }
1433
1434 //Add statusbar message that script is running
1435 statusBar()->showMessage(i18n("Running script: %1", fileURL.fileName()));
1436
1437 // 2017-09-19: Jasem
1438 // FIXME This is a hack and does not work on non-Linux systems
1439 // The Script Builder should generate files that can run cross-platform
1440 QProcess p;
1441 QStringList arguments;
1442 p.start(f.fileName(), arguments);
1443 if (!p.waitForStarted())
1444 return;
1445
1446 while (!p.waitForFinished(10))
1447 {
1448 qApp->processEvents(); //otherwise tempfile may get deleted before script completes.
1449 if (p.state() != QProcess::Running)
1450 break;
1451 }
1452
1453 statusBar()->showMessage(i18n("Script finished."), 0);
1454 }
1455}
1456
1457void KStars::slotPrint()
1458{
1459 bool switchColors(false);
1460
1461 //Suggest Chart color scheme
1462 if (data()->colorScheme()->colorNamed("SkyColor") != QColor(255, 255, 255))
1463 {
1464 QString message =
1465 i18n("You can save printer ink by using the \"Star Chart\" "
1466 "color scheme, which uses a white background. Would you like to "
1467 "temporarily switch to the Star Chart color scheme for printing?");
1468
1470 nullptr, message, i18n("Switch to Star Chart Colors?"),
1471 KGuiItem(i18n("Switch Color Scheme")), KGuiItem(i18n("Do Not Switch")), "askAgainPrintColors");
1472
1473 if (answer == KMessageBox::Cancel)
1474 return;
1475 if (answer == KMessageBox::Continue)
1476 switchColors = true;
1477 }
1478
1479 printImage(true, switchColors);
1480}
1481
1482void KStars::slotPrintingWizard()
1483{
1484 if (m_PrintingWizard)
1485 {
1486 delete m_PrintingWizard;
1487 }
1488
1489 m_PrintingWizard = new PrintingWizard(this);
1490 m_PrintingWizard->show();
1491}
1492
1493void KStars::slotToggleTimer()
1494{
1495 if (data()->clock()->isActive())
1496 {
1497 data()->clock()->stop();
1498 updateTime();
1499 }
1500 else
1501 {
1502 if (fabs(data()->clock()->scale()) > Options::slewTimeScale())
1503 data()->clock()->setManualMode(true);
1504 data()->clock()->start();
1505 if (data()->clock()->isManualMode())
1506 map()->forceUpdate();
1507 }
1508
1509 // Update clock state in options
1510 Options::setRunClock(data()->clock()->isActive());
1511}
1512
1513void KStars::slotRealTimeToogled(bool checked)
1514{
1515 KToggleAction *ta = static_cast<KToggleAction*>(actionCollection()->action("clock_realtime"));
1516 if (checked)
1517 {
1518 QAction *a = nullptr;
1519 a = actionCollection()->action("clock_startstop");
1520 if (a)a->setDisabled(true);
1521 a = actionCollection()->action("time_step_forward");
1522 if (a)a->setDisabled(true);
1523 a = actionCollection()->action("time_step_backward");
1524 if (a)a->setDisabled(true);
1525 a = actionCollection()->action("time_to_now");
1526 if (a)a->setDisabled(true);
1527 a = actionCollection()->action("time_dialog");
1528 if (a)a->setDisabled(true);
1529 m_TimeStepBox->setDisabled(true);
1530 if (ta)ta->setChecked(true);
1531 }
1532 else
1533 {
1534 QAction *a = nullptr;
1535 a = actionCollection()->action("clock_startstop");
1536 if (a)a->setDisabled(false);
1537 a = actionCollection()->action("time_step_forward");
1538 if (a)a->setDisabled(false);
1539 a = actionCollection()->action("time_step_backward");
1540 if (a)a->setDisabled(false);
1541 a = actionCollection()->action("time_to_now");
1542 if (a)a->setDisabled(false);
1543 a = actionCollection()->action("time_dialog");
1544 if (a)a->setDisabled(false);
1545 m_TimeStepBox->setDisabled(false);
1546 if (ta)ta->setChecked(false);
1547 }
1548}
1549
1550void KStars::slotStepForward()
1551{
1552 if (data()->clock()->isActive())
1553 data()->clock()->stop();
1554 data()->clock()->manualTick(true);
1555 map()->forceUpdate();
1556}
1557
1558void KStars::slotStepBackward()
1559{
1560 if (data()->clock()->isActive())
1561 data()->clock()->stop();
1562 data()->clock()->manualTick(true, true);
1563 map()->forceUpdate();
1564}
1565
1566//Pointing
1567void KStars::slotPointFocus()
1568{
1569 // In the following cases, we set slewing=true in order to disengage tracking
1570 map()->stopTracking();
1571
1572 if (sender() == actionCollection()->action("zenith"))
1573 map()->setDestinationAltAz(dms(90.0), map()->focus()->az(),
1574 Options::useRefraction());
1575 else if (sender() == actionCollection()->action("north"))
1576 map()->setDestinationAltAz(dms(15.0), dms(0.0001), Options::useRefraction());
1577 else if (sender() == actionCollection()->action("east"))
1578 map()->setDestinationAltAz(dms(15.0), dms(90.0), Options::useRefraction());
1579 else if (sender() == actionCollection()->action("south"))
1580 map()->setDestinationAltAz(dms(15.0), dms(180.0), Options::useRefraction());
1581 else if (sender() == actionCollection()->action("west"))
1582 map()->setDestinationAltAz(dms(15.0), dms(270.0), Options::useRefraction());
1583}
1584
1586{
1587 if (Options::isTracking())
1588 {
1589 Options::setIsTracking(false);
1590 actionCollection()->action("track_object")->setText(i18n("Engage &Tracking"));
1592 ->action("track_object")
1593 ->setIcon(QIcon::fromTheme("document-decrypt"));
1594
1595 KSPlanetBase *planet = dynamic_cast<KSPlanetBase *>(map()->focusObject());
1596 if (planet && data()->temporaryTrail)
1597 {
1598 planet->clearTrail();
1599 data()->temporaryTrail = false;
1600 }
1601
1602 map()->setClickedObject(nullptr);
1603 map()->setFocusObject(nullptr); //no longer tracking focusObject
1604 map()->setFocusPoint(nullptr);
1605 }
1606 else
1607 {
1608 map()->setClickedPoint(map()->focus());
1609 map()->setClickedObject(nullptr);
1610 map()->setFocusObject(nullptr); //no longer tracking focusObject
1611 map()->setFocusPoint(map()->clickedPoint());
1612 Options::setIsTracking(true);
1613 actionCollection()->action("track_object")->setText(i18n("Stop &Tracking"));
1615 ->action("track_object")
1616 ->setIcon(QIcon::fromTheme("document-encrypt"));
1617 }
1618
1619 map()->forceUpdate();
1620}
1621
1622void KStars::slotManualFocus()
1623{
1624 QPointer<FocusDialog> focusDialog = new FocusDialog();
1625
1626 // JM 2019-09-04: Should default to RA/DE always
1627 // if (Options::useAltAz())
1628 // focusDialog->activateAzAltPage();
1629
1630 if (focusDialog->exec() == QDialog::Accepted)
1631 {
1632 //If the requested position is very near the pole, we need to point first
1633 //to an intermediate location just below the pole in order to get the longitudinal
1634 //position (RA/Az) right.
1635
1636 // Do not access (RA0, Dec0) of focusDialog->point() as it can be of unknown epoch.
1637 // (RA, Dec) should be synced to JNow
1638 // -- asimha (2020-07-06)
1639 double realAlt(focusDialog->point()->alt().Degrees());
1640 double realDec(focusDialog->point()->dec().Degrees());
1641 if (Options::useAltAz() && realAlt > 89.0)
1642 {
1643 focusDialog->point()->setAlt(89.0);
1644 focusDialog->point()->HorizontalToEquatorial(data()->lst(),
1645 data()->geo()->lat());
1646 }
1647 if (!Options::useAltAz() && realDec > 89.0)
1648 {
1649 focusDialog->point()->setDec(89.0);
1650 focusDialog->point()->EquatorialToHorizontal(data()->lst(),
1651 data()->geo()->lat());
1652 }
1653
1654 map()->setClickedPoint(focusDialog->point());
1655
1656 if (Options::isTracking())
1657 slotTrack();
1658
1659 map()->slotCenter();
1660
1661 //The slew takes some time to complete, and this often causes the final focus point to be slightly
1662 //offset from the user's requested coordinates (because EquatorialToHorizontal() is called
1663 //throughout the process, which depends on the sidereal time). So we now "polish" the final
1664 //position by resetting the final focus to the focusDialog point.
1665 //
1666 //Also, if the requested position was within 1 degree of the coordinate pole, this will
1667 //automatically correct the final pointing from the intermediate offset position to the final position
1669 if (Options::useAltAz())
1670 {
1671 // N.B. We have applied unrefract() in focusDialog
1672 map()->setDestinationAltAz(focusDialog->point()->alt(),
1673 focusDialog->point()->az(), false);
1674 }
1675 else
1676 {
1677 map()->setDestination(focusDialog->point()->ra(),
1678 focusDialog->point()->dec());
1679 }
1680
1681 //Now, if the requested point was near a pole, we need to reset the Alt/Dec of the focus.
1682 if (Options::useAltAz() && realAlt > 89.0)
1683 map()->focus()->setAlt(realAlt);
1684 if (!Options::useAltAz() && realDec > 89.0)
1685 map()->focus()->setDec(realAlt);
1686
1687 //Don't track if we set Alt/Az coordinates. This way, Alt/Az remain constant.
1688 if (focusDialog->usedAltAz())
1689 map()->stopTracking();
1690 }
1691 delete focusDialog;
1692}
1693
1695{
1696 // Enable/disable actions
1697 actionCollection()->action("zoom_out")->setEnabled(Options::zoomFactor() > MINZOOM);
1698 actionCollection()->action("zoom_in")->setEnabled(Options::zoomFactor() < MAXZOOM);
1699 // Update status bar
1700 map()
1701 ->setupProjector(); // this needs to be run redundantly, so that the FOV returned below is up-to-date.
1702 float fov = map()->projector()->fov();
1703 KLocalizedString fovi18nstring =
1704 ki18nc("approximate field of view", "Approximate FOV: %1 degrees");
1705 if (fov < 1.0)
1706 {
1707 fov = fov * 60.0;
1708 fovi18nstring =
1709 ki18nc("approximate field of view", "Approximate FOV: %1 arcminutes");
1710 }
1711 if (fov < 1.0)
1712 {
1713 fov = fov * 60.0;
1714 fovi18nstring =
1715 ki18nc("approximate field of view", "Approximate FOV: %1 arcseconds");
1716 }
1717 QString fovstring = fovi18nstring.subs(QString::number(fov, 'f', 1)).toString();
1718
1719 statusBar()->showMessage(fovstring, 0);
1720}
1721
1723{
1724 bool ok;
1725 double currentAngle = map()->width() / (Options::zoomFactor() * dms::DegToRad);
1726 double minAngle = map()->width() / (MAXZOOM * dms::DegToRad);
1727 double maxAngle = map()->width() / (MINZOOM * dms::DegToRad);
1728
1729 double angSize = QInputDialog::getDouble(
1730 nullptr,
1731 i18nc("The user should enter an angle for the field-of-view of the display",
1732 "Enter Desired Field-of-View Angle"),
1733 i18n("Enter a field-of-view angle in degrees: "), currentAngle, minAngle,
1734 maxAngle, 1, &ok);
1735
1736 if (ok)
1737 {
1738 map()->setZoomFactor(map()->width() / (angSize * dms::DegToRad));
1739 }
1740}
1741
1742void KStars::slotCoordSys()
1743{
1744 if (Options::useAltAz())
1745 {
1746 Options::setUseAltAz(false);
1747 if (Options::useRefraction())
1748 {
1749 if (map()->focusObject()) //simply update focus to focusObject's position
1750 map()->setFocus(map()->focusObject());
1751 else //need to recompute focus for unrefracted position
1752 {
1753 // FIXME: Changed focus()->alt() to be unrefracted by convention; is this still necessary? -- asimha 2020/07/05
1754 map()->setFocusAltAz(map()->focus()->alt(), map()->focus()->az());
1755 map()->focus()->HorizontalToEquatorial(data()->lst(),
1756 data()->geo()->lat());
1757 }
1758 }
1760 ->action("coordsys")
1761 ->setText(i18n("Switch to Horizontal View (Horizontal &Coordinates)"));
1763 ->action("up_orientation")
1764 ->setText(i18nc("Orientation of the sky map", "North &Up"));
1766 ->action("down_orientation")
1767 ->setText(i18nc("Orientation of the sky map", "North &Down"));
1768 erectObserverCorrectionGroup->setEnabled(false);
1769 }
1770 else
1771 {
1772 Options::setUseAltAz(true);
1773 if (Options::useRefraction())
1774 {
1775 // FIXME: Changed focus()->alt() to be unrefracted by convention; is this still necessary? -- asimha 2020/07/05
1776 map()->setFocusAltAz(map()->focus()->alt(), map()->focus()->az());
1777 }
1779 ->action("coordsys")
1780 ->setText(i18n("Switch to Star Globe View (Equatorial &Coordinates)"));
1782 ->action("up_orientation")
1783 ->setText(i18nc("Orientation of the sky map", "Zenith &Up"));
1785 ->action("down_orientation")
1786 ->setText(i18nc("Orientation of the sky map", "Zenith &Down"));
1787 erectObserverCorrectionGroup->setEnabled(true);
1788 }
1789 actionCollection()->action("view:arbitrary")->setChecked(true);
1790 map()->forceUpdate();
1791}
1792
1793void KStars::slotSkyMapOrientation()
1794{
1795 if (sender() == actionCollection()->action("up_orientation"))
1796 {
1797 Options::setSkyRotation(0.0);
1798 }
1799 else if (sender() == actionCollection()->action("down_orientation"))
1800 {
1801 Options::setSkyRotation(180.0);
1802 }
1803
1804 Options::setMirrorSkyMap(actionCollection()->action("mirror_skymap")->isChecked());
1805 Options::setErectObserverCorrection(
1806 actionCollection()->action("erect_observer_correction_off")->isChecked() ? 0 : (
1807 actionCollection()->action("erect_observer_correction_left")->isChecked() ? 1 : 2));
1808 actionCollection()->action("view:arbitrary")->setChecked(true);
1809 map()->forceUpdate();
1810}
1811
1812void KStars::slotMapProjection()
1813{
1814 if (sender() == actionCollection()->action("project_lambert"))
1815 Options::setProjection(Projector::Lambert);
1816 if (sender() == actionCollection()->action("project_azequidistant"))
1817 Options::setProjection(Projector::AzimuthalEquidistant);
1818 if (sender() == actionCollection()->action("project_orthographic"))
1819 Options::setProjection(Projector::Orthographic);
1820 if (sender() == actionCollection()->action("project_equirectangular"))
1821 Options::setProjection(Projector::Equirectangular);
1822 if (sender() == actionCollection()->action("project_stereographic"))
1823 Options::setProjection(Projector::Stereographic);
1824 if (sender() == actionCollection()->action("project_gnomonic"))
1825 Options::setProjection(Projector::Gnomonic);
1826
1827 //DEBUG
1828 qCDebug(KSTARS) << "Projection system: " << Options::projection();
1829
1830 m_SkyMap->forceUpdate();
1831}
1832
1833//Settings Menu:
1834void KStars::slotColorScheme()
1835{
1837}
1838
1839void KStars::slotTargetSymbol(bool flag)
1840{
1841 qDebug() << Q_FUNC_INFO << QString("slotTargetSymbol: %1 %2").arg(sender()->objectName()).arg(flag);
1842
1843 QStringList names = Options::fOVNames();
1844 if (flag)
1845 {
1846 // Add FOV to list
1847 names.append(sender()->objectName());
1848 }
1849 else
1850 {
1851 // Remove FOV from list
1852 int ix = names.indexOf(sender()->objectName());
1853 if (ix >= 0)
1854 names.removeAt(ix);
1855 }
1856 Options::setFOVNames(names);
1857
1858 // Sync visibleFOVs with fovNames
1859 data()->syncFOV();
1860
1861 map()->forceUpdate();
1862}
1863
1864void KStars::slotApplySkyMapView(const QString &viewName)
1865{
1866
1867 auto view = SkyMapViewManager::viewNamed(viewName);
1868 if (!view)
1869 {
1870 qCWarning(KSTARS) << "View named " << viewName << " not found!";
1871 return;
1872 }
1873
1874 // FIXME: Ugly hack to update the menus correctly...
1875 // we set the opposite coordinate system setting and call slotCoordSys to toggle
1876 Options::setUseAltAz(!view->useAltAz);
1877 slotCoordSys();
1878
1879 Options::setMirrorSkyMap(view->mirror);
1880 actionCollection()->action("mirror_skymap")->setChecked(Options::mirrorSkyMap());
1881
1882 int erectObserverCorrection = 0;
1883 double viewAngle = view->viewAngle;
1884 if (view->erectObserver && view->useAltAz)
1885 {
1886 if (viewAngle > 0.)
1887 {
1888 erectObserverCorrection = 1;
1889 viewAngle -= 90.; // FIXME: Check
1890 }
1891 if (viewAngle < 0.)
1892 {
1893 erectObserverCorrection = 2;
1894 viewAngle += 90.; // FIXME: Check
1895 }
1896 }
1897 if (view->inverted)
1898 {
1899 viewAngle += 180.; // FIXME: Check
1900 }
1901
1902 Options::setErectObserverCorrection(erectObserverCorrection);
1903 Options::setSkyRotation(dms::reduce(viewAngle));
1904 if (!std::isnan(view->fov))
1905 {
1906 Options::setZoomFactor(map()->width() / (3 * view->fov * dms::DegToRad));
1907 }
1908 repopulateOrientation(); // Update the menus
1909 qCDebug(KSTARS) << "Alt/Az: " << Options::useAltAz()
1910 << "Mirror: " << Options::mirrorSkyMap()
1911 << "Rotation: " << Options::skyRotation()
1912 << "Erect Obs: " << Options::erectObserverCorrection()
1913 << "FOV: " << view->fov;
1914 actionCollection()->action(QString("view:%1").arg(viewName))->setChecked(true);
1915 map()->forceUpdate();
1916}
1917
1918void KStars::slotHIPSSource()
1919{
1920 QAction *selectedAction = qobject_cast<QAction *>(sender());
1921 Q_ASSERT(selectedAction != nullptr);
1922
1923 QString selectedSource = selectedAction->text().remove('&');
1924
1925 // selectedSource could be translated, while we need to send only Latin "None"
1926 // to Hips manager.
1927 if (selectedSource == i18n("None"))
1928 HIPSManager::Instance()->setCurrentSource("None");
1929 else
1930 HIPSManager::Instance()->setCurrentSource(selectedSource);
1931
1932 map()->forceUpdate();
1933}
1934
1935void KStars::slotEditViews()
1936{
1937 QPointer<ViewsDialog> viewsDialog = new ViewsDialog(this);
1938 if (viewsDialog->exec() == QDialog::Accepted)
1939 {
1942 }
1943 delete viewsDialog;
1944}
1945
1946void KStars::slotFOVEdit()
1947{
1948 QPointer<FOVDialog> fovdlg = new FOVDialog(this);
1949 if (fovdlg->exec() == QDialog::Accepted)
1950 {
1952 repopulateFOV();
1953 }
1954 delete fovdlg;
1955}
1956
1957void KStars::slotObsList()
1958{
1959 m_KStarsData->observingList()->show();
1960}
1961
1962void KStars::slotImagingPlanner()
1963{
1964#ifdef HAVE_INDI
1965 m_KStarsData->imagingPlanner()->show();
1966#endif
1967}
1968
1969void KStars::slotEquipmentWriter()
1970{
1971 QPointer<EquipmentWriter> equipmentdlg = new EquipmentWriter();
1972 equipmentdlg->loadEquipment();
1973 equipmentdlg->exec();
1974 delete equipmentdlg;
1975}
1976
1977void KStars::slotObserverManager()
1978{
1979 QPointer<ObserverAdd> m_observerAdd = new ObserverAdd();
1980 m_observerAdd->exec();
1981 delete m_observerAdd;
1982}
1983
1984void KStars::slotHorizonManager()
1985{
1986 if (!m_HorizonManager)
1987 {
1988 m_HorizonManager = new HorizonManager(this);
1989 connect(m_SkyMap, SIGNAL(positionClicked(SkyPoint *)), m_HorizonManager,
1990 SLOT(addSkyPoint(SkyPoint *)));
1991 }
1992
1993 m_HorizonManager->show();
1994}
1995
1996void KStars::slotExecute()
1997{
1998 KStarsData::Instance()->executeSession()->init();
1999 KStarsData::Instance()->executeSession()->show();
2000}
2001
2002void KStars::slotPolarisHourAngle()
2003{
2004 QPointer<PolarisHourAngle> pHourAngle = new PolarisHourAngle(this);
2005 pHourAngle->exec();
2006}
2007
2008// Toggle to and from full screen mode
2009void KStars::slotFullScreen()
2010{
2012 {
2014 ~Qt::WindowFullScreen); // reset
2015 }
2016 else
2017 {
2019 Qt::WindowFullScreen); // set
2020 }
2021}
2022
2023// Toggle showing terrain on the SkyMap.
2024void KStars::slotTerrain()
2025{
2026 Options::setShowTerrain(!Options::showTerrain());
2027 actionCollection()->action("toggle_terrain")
2028 ->setText(Options::showTerrain() ? i18n("Hide Terrain") : i18n("Show Terrain"));
2029 opterrain->syncOptions();
2031}
2032
2033// Toggle showing image overlays on the SkyMap.
2034void KStars::slotImageOverlays()
2035{
2036 Options::setShowImageOverlays(!Options::showImageOverlays());
2037 actionCollection()->action("toggle_image_overlays")
2038 ->setText(Options::showImageOverlays() ? i18n("Hide Image Overlays") : i18n("Show Image Overlays"));
2039 opsImageOverlay->syncOptions();
2041}
2042
2044{
2045 //Exclude object with temporary trail
2046 SkyObject *exOb(nullptr);
2047 if (map()->focusObject() && map()->focusObject()->isSolarSystem() &&
2048 data()->temporaryTrail)
2049 {
2050 exOb = map()->focusObject();
2051 }
2052
2054
2055 map()->forceUpdate();
2056}
2057
2058//toggle display of GUI Items on/off
2059void KStars::slotShowGUIItem(bool show)
2060{
2061 //Toolbars
2062 if (sender() == actionCollection()->action("show_statusBar"))
2063 {
2064 Options::setShowStatusBar(show);
2066 }
2067
2068 if (sender() == actionCollection()->action("show_sbAzAlt"))
2069 {
2070 Options::setShowAltAzField(show);
2071 AltAzField.setHidden(!show);
2072 }
2073
2074 if (sender() == actionCollection()->action("show_sbRADec"))
2075 {
2076 Options::setShowRADecField(show);
2077 RADecField.setHidden(!show);
2078 }
2079
2080 if (sender() == actionCollection()->action("show_sbJ2000RADec"))
2081 {
2082 Options::setShowJ2000RADecField(show);
2083 J2000RADecField.setHidden(!show);
2084 }
2085}
2086void KStars::addColorMenuItem(QString name, const QString &actionName)
2087{
2088 KToggleAction *kta = actionCollection()->add<KToggleAction>(actionName);
2089 const QString filename = QString(actionName).mid(3) + ".colors";
2090 kta->setText(name);
2091 kta->setObjectName(filename);
2092 kta->setActionGroup(cschemeGroup);
2093
2094 colorActionMenu->addAction(kta);
2095
2097 if (actionName.mid(3) ==
2098 cg.readEntry("ColorSchemeFile", "moonless-night.colors").remove(".colors"))
2099 {
2100 kta->setChecked(true);
2101 }
2102
2103 //use mid(3) to exclude the leading "cs_" prefix from the action name
2104 data()->add_color_scheme(filename, name.replace("&", ""));
2105 connect(kta, SIGNAL(toggled(bool)), this, SLOT(slotColorScheme()));
2106}
2107
2109{
2110 qCDebug(KSTARS) << "removing " << actionName;
2111 colorActionMenu->removeAction(actionCollection()->action(actionName));
2112}
2113
2114void KStars::slotAboutToQuit()
2115{
2116 if (m_SkyMap == nullptr)
2117 return;
2118
2119#ifdef HAVE_INDI
2120 DriverManager::Instance()->disconnectClients();
2121 INDIListener::Instance()->disconnect();
2122 GUIManager::Instance()->disconnect();
2123#endif
2124
2125 // Delete skymap. This required to run destructors and save
2126 // current state in the option.
2127 delete m_SkyMap;
2128 m_SkyMap = nullptr;
2129
2130 //Store Window geometry in Options object
2131 Options::setWindowWidth(width());
2132 Options::setWindowHeight(height());
2133
2134 //explicitly save the colorscheme data to the config file
2136
2137 //synch the config file with the Config object
2138 writeConfig();
2139
2140 //Terminate Child Processes if on OS X
2141#ifdef Q_OS_MACOS
2142 QProcess *quit = new QProcess(this);
2143 quit->start("killall kdeinit5");
2144 quit->waitForFinished(1000);
2145 quit->start("killall klauncher");
2146 quit->waitForFinished(1000);
2147 quit->start("killall kioslave");
2148 quit->waitForFinished(1000);
2149 quit->start("killall kio_http_cache_cleaner");
2150 quit->waitForFinished(1000);
2151 delete quit;
2152#endif
2153}
2154
2156{
2157 if (Options::showAltAzField())
2158 {
2159 dms a = p->alt();
2160 if (Options::useAltAz())
2161 a = p->altRefracted();
2162 QString s =
2163 QString("%1, %2").arg(p->az().toDMSString(true), //true: force +/- symbol
2164 a.toDMSString(true)); //true: force +/- symbol
2165 //statusBar()->changeItem( s, 1 );
2166 AltAzField.setText(s);
2167 }
2168 if (Options::showRADecField())
2169 {
2170 KStarsDateTime lastUpdate;
2171 lastUpdate.setDJD(KStarsData::Instance()->updateNum()->getJD());
2172 QString sEpoch = QString::number(lastUpdate.epoch(), 'f', 1);
2173 QString s = QString("%1, %2 (J%3)")
2174 .arg(p->ra().toHMSString(), p->dec().toDMSString(true),
2175 sEpoch); //true: force +/- symbol
2176 //statusBar()->changeItem( s, 2 );
2177 RADecField.setText(s);
2178 }
2179
2180 if (Options::showJ2000RADecField())
2181 {
2182 // catalogCoord would modify p
2183 SkyPoint pOrig = *p;
2184 SkyPoint p0;
2185 //p0 = p->deprecess(KStarsData::Instance()->updateNum()); // deprecess to update RA0/Dec0 from RA/Dec
2186 p0 = pOrig.catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
2187 QString s = QString("%1, %2 (J2000)")
2188 .arg(p0.ra().toHMSString(),
2189 p0.dec().toDMSString(true)); //true: force +/- symbol
2190 //statusBar()->changeItem( s, 2 );
2191 J2000RADecField.setText(s);
2192 }
2193}
2194
2195void KStars::slotUpdateComets(bool isAutoUpdate)
2196{
2197 data()->skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile(
2198 isAutoUpdate);
2199}
2200
2201void KStars::slotUpdateAsteroids(bool isAutoUpdate)
2202{
2203 data()->skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile(
2204 isAutoUpdate);
2205}
2206
2207void KStars::slotUpdateSupernovae()
2208{
2209 data()->skyComposite()->supernovaeComponent()->slotTriggerDataFileUpdate();
2210}
2211
2212void KStars::slotUpdateSatellites()
2213{
2214 data()->skyComposite()->satellites()->updateTLEs();
2215}
2216
2217void KStars::slotConfigureNotifications()
2218{
2219#ifdef HAVE_NOTIFYCONFIG
2221#endif
2222}
2224{
2225 auto *ui = new CatalogsDBUI{ this, CatalogsDB::dso_db_path() };
2226 ui->show();
2227 connect(ui, &QDialog::finished, this, [&](const auto)
2228 {
2229 KStars::Instance()->data()->skyComposite()->catalogsComponent()->dropCache();
2230 });
2231}
the Altitude vs.
Definition altvstime.h:41
This is the base class for the KStars astronomical calculator.
Definition astrocalc.h:26
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...
Definition catalogsdb.h:183
void saveToConfig()
Save color-scheme data to the Config object.
Export sky image dialog.
FOVDialog is dialog to select a Field-of-View indicator (or create a new one)
Definition fovdialog.h:38
static bool save()
Write list of FOVs to "fov.dat".
Definition fov.cpp:49
Flag manager Dialog box to add and remove flags.
Definition flagmanager.h:36
A small dialog for setting the focus coordinates manually.
Definition focusdialog.h:33
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
double TZ0() const
TimeZoneRule * tzrule()
Manages adding/removing and editing regions and points associated with user-customized artificial hor...
Display the positions of Jupiter's moons as a function of time.
Definition jmoontool.h:24
Q_INVOKABLE QAction * action(const QString &name) const
ActionType * add(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
void addAction(QAction *action)
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
QString toString() const
KLocalizedString subs(const KLocalizedString &a, int fieldWidth=0, QChar fillChar=QLatin1Char(' ')) const
static KNotifyConfigWidget * configure(QWidget *parent=nullptr, const QString &appname=QString())
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.
Definition kswizard.h:77
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.
Definition kstarsdata.h:112
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()
Definition kstarsdata.h:174
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()
Definition kstarsdata.h:220
GeoLocation * geo()
Definition kstarsdata.h:232
void add_color_scheme(const QString &filename, const QString &name)
Register a color scheme with filename and name.
Definition kstarsdata.h:207
SkyMapComposite * skyComposite()
Definition kstarsdata.h:168
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition kstarsdata.h:285
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.
SkyMap * map() const
Definition kstars.h:139
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
Definition kstars.cpp:311
void slotDownload()
action slot: open KNewStuff window to download extra data.
static KStars * Instance()
Definition kstars.h:121
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
Definition kstars.h:133
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.
Definition kstars.cpp:592
static bool Closing
Set to true when the application is being closed.
Definition kstars.h:857
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.
Definition observeradd.h:19
The Advanced Tab of the Options window.
Definition opsadvanced.h:27
The Catalog page for the Options window.
Definition opscatalog.h:28
The Colors page allows the user to adjust all of the colors used to display the night sky.
Definition opscolors.h:32
The Developer Tab of the Options window.
Enables the user to set remote connection devices and options in addition to online and offline astro...
Definition opsekos.h:22
The FITS Tab of the Options window.
Definition opsfits.h:32
The guide page enables to user to select to turn on and off guide overlays such as constellation line...
Definition opsguides.h:19
Enables the user to change several INDI options including default ports for common devices,...
Definition opsindi.h:23
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.
Definition opsterrain.h:20
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.
Definition projector.cpp:88
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.
Definition simclock.cpp:66
Q_SCRIPTABLE Q_NOREPLY void start()
DBUS function to start the SimClock.
Definition simclock.cpp:155
Q_SCRIPTABLE Q_NOREPLY void stop()
DBUS function to stop the SimClock.
Definition simclock.cpp:136
void manualTick(bool force=false, bool backward=false)
Equivalent of tick() for manual mode.
Definition simclock.cpp:112
Draws Rise/Set/Transit curves for major solar system planets for any calendar year.
Definition skycalendar.h:30
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.
Definition skymap.cpp:1176
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition skymap.h:123
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1255
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition skymap.cpp:1021
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition skymap.cpp:366
const Projector * projector() const
Get the current projector.
Definition skymap.h:300
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1186
SkyPoint * mousePoint()
Retrieve the mouse pointer position.
Definition skymap.h:227
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:981
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition skymap.cpp:993
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition skymap.h:378
void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
sets the destination point of the sky map, using its alt/az coordinates.
Definition skymap.cpp:1005
void setFocus(SkyPoint *f)
sets the central focus point of the sky map.
Definition skymap.cpp:967
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition skymap.cpp:371
void slotCenter()
Center the display at the point ClickedPoint.
Definition skymap.cpp:380
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition skymap.h:204
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition skymap.h:262
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
The sky coordinates of a point in the sky.
Definition skypoint.h:45
const CachingDms & dec() const
Definition skypoint.h:269
void setDec(dms d)
Sets Dec, the current Declination.
Definition skypoint.h:169
const CachingDms & ra() const
Definition skypoint.h:263
dms altRefracted() const
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition skypoint.cpp:77
const dms & az() const
Definition skypoint.h:275
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition skypoint.h:194
const dms & alt() const
Definition skypoint.h:281
void HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates,...
Definition skypoint.cpp:143
SkyPoint catalogueCoord(long double jdf)
Computes the J2000.0 catalogue coordinates for this SkyPoint using the epoch removing aberration,...
Definition skypoint.cpp:710
void slotTriggerDataFileUpdate()
This initiates updating of the data file.
static void discoverTextureDirs()
Clear the cache and discover the directories to load textures from.
A class for adjusting the Time and Date.
Definition timedialog.h:38
KStarsDateTime nextDSTChange() const
void reset_with_ltime(KStarsDateTime &ltime, 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 ...
bool hasTrail() const
Definition trailobject.h:36
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)
Definition viewsdialog.h:49
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.
Definition wiview.h:33
void onReloadIconClicked()
public slot - Reload list of visible sky-objects.
Definition wiview.cpp:393
void updateObservingConditions()
Definition wiview.cpp:215
What's up tonight dialog is a window which lists all sky objects that will be visible during the next...
Definition wutdialog.h:40
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
const dms reduce() const
return the equivalent angle between 0 and 360 degrees.
Definition dms.cpp:251
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:287
const QString toHMSString(const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:378
static constexpr double DegToRad
DegToRad is a const static member equal to the number of radians in one degree (dms::PI/180....
Definition dms.h:390
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)
KGuiItem overwrite()
KGuiItem cont()
KGuiItem cancel()
void clicked(bool checked)
bool isChecked() const const
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setActionGroup(QActionGroup *group)
void setDisabled(bool b)
void setText(const QString &text)
QList< QAction * > actions() const const
void setEnabled(bool)
QString applicationDirPath()
virtual int exec()
void finished(int result)
QString homePath()
QString path() const const
void setAllowedAreas(Qt::DockWidgetAreas areas)
void setWidget(QWidget *widget)
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)
QDir dir() const const
QIcon fromTheme(const QString &name)
double getDouble(QWidget *parent, const QString &title, const QString &label, double value, double min, double max, int decimals, bool *ok, Qt::WindowFlags flags, double step)
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
RightDockWidgetArea
WA_DeleteOnClose
WindowFullScreen
QString fileName(ComponentFormattingOptions options) const const
bool isEmpty() const const
bool isLocalFile() const const
bool isValid() const const
QString toLocalFile() const const
QWidget * topLevelWidget() const const
void activateWindow()
QWidget * createWindowContainer(QWindow *window, QWidget *parent, Qt::WindowFlags flags)
bool isFullScreen() const const
void hide()
void setMinimumWidth(int minw)
QWidget * parentWidget() const const
void raise()
void setAttribute(Qt::WidgetAttribute attribute, bool on)
void setDisabled(bool disable)
void setHidden(bool hidden)
void setWindowState(Qt::WindowStates windowState)
void show()
void showNormal()
void resize(const QSize &)
void setStyleSheet(const QString &styleSheet)
bool isVisible() const const
void setWindowFlags(Qt::WindowFlags type)
Qt::WindowStates windowState() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.