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

KDE's Doxygen guidelines are available online.