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

KDE's Doxygen guidelines are available online.