Kstars

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

KDE's Doxygen guidelines are available online.