Kstars

opssolarsystem.cpp
1/*
2 SPDX-FileCopyrightText: 2004 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "opssolarsystem.h"
8
9#include "kstars.h"
10#include "kstarsdata.h"
11#include "skymap.h"
12
13#include <KActionCollection>
14#include <KConfigDialog>
15
16OpsSolarSystem::OpsSolarSystem() : QFrame(KStars::Instance())
17{
18 setupUi(this);
19
20 connect(kcfg_ShowSolarSystem, SIGNAL(toggled(bool)), SLOT(slotAllWidgets(bool)));
21 connect(kcfg_ShowAsteroids, SIGNAL(toggled(bool)), SLOT(slotAsteroidWidgets(bool)));
22 connect(kcfg_MagLimitAsteroidDownload, SIGNAL(valueChanged(double)), this, SLOT(slotChangeMagDownload(double)));
23 connect(kcfg_ShowComets, SIGNAL(toggled(bool)), SLOT(slotCometWidgets(bool)));
24
25 connect(ClearAllTrails, SIGNAL(clicked()), KStars::Instance(), SLOT(slotClearAllTrails()));
26 connect(showAllPlanets, SIGNAL(clicked()), this, SLOT(slotSelectPlanets()));
27 connect(showNonePlanets, SIGNAL(clicked()), this, SLOT(slotSelectPlanets()));
28
29 MagLimitAsteroidDownloadWarning->setVisible(false);
30
31 kcfg_MagLimitAsteroid->setMinimum(0.0);
32 kcfg_MagLimitAsteroid->setMaximum(30.0);
33 kcfg_MaxRadCometName->setMaximum(100.0);
34 kcfg_MagLimitAsteroidDownload->setMinimum(0.0);
35 kcfg_MagLimitAsteroidDownload->setMaximum(30.0);
36
37 slotAsteroidWidgets(kcfg_ShowAsteroids->isChecked());
38 slotCometWidgets(kcfg_ShowComets->isChecked());
39
40 //Get a pointer to the KConfigDialog
41 m_ConfigDialog = KConfigDialog::exists("settings");
42
43 connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply()));
44 connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply()));
45 //connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(slotCancel()) );
46
47 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
48 connect(solarButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonPressed), this,
49 [&]() { isDirty = true; });
50 #else
51 connect(solarButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idPressed), this,
52 [&]() { isDirty = true; });
53 #endif
54}
55
56void OpsSolarSystem::slotChangeMagDownload(double mag)
57{
58 if (mag > 12)
59 MagLimitAsteroidDownloadWarning->setVisible(true);
60 else
61 MagLimitAsteroidDownloadWarning->setVisible(false);
62}
63
64void OpsSolarSystem::slotAllWidgets(bool on)
65{
66 MajorBodiesBox->setEnabled(on);
67 MinorBodiesBox->setEnabled(on);
68 TrailsBox->setEnabled(on);
69}
70
71void OpsSolarSystem::slotAsteroidWidgets(bool on)
72{
73 kcfg_MagLimitAsteroid->setEnabled(on);
74 kcfg_ShowAsteroidNames->setEnabled(on);
75 kcfg_AsteroidLabelDensity->setEnabled(on);
76 textLabel3->setEnabled(on);
77 textLabel6->setEnabled(on);
78 LabelDensity->setEnabled(on);
79}
80
81void OpsSolarSystem::slotCometWidgets(bool on)
82{
83 kcfg_ShowCometNames->setEnabled(on);
84 kcfg_MaxRadCometName->setEnabled(on);
85 textLabel4->setEnabled(on);
86 kcfg_ShowCometComas->setEnabled(on);
87}
88
89void OpsSolarSystem::slotSelectPlanets()
90{
91 bool b = true;
92 if (QString(sender()->objectName()) == "showNonePlanets")
93 b = false;
94
95 kcfg_ShowSun->setChecked(b);
96 kcfg_ShowMoon->setChecked(b);
97 kcfg_ShowMercury->setChecked(b);
98 kcfg_ShowVenus->setChecked(b);
99 kcfg_ShowMars->setChecked(b);
100 kcfg_ShowJupiter->setChecked(b);
101 kcfg_ShowSaturn->setChecked(b);
102 kcfg_ShowUranus->setChecked(b);
103 kcfg_ShowNeptune->setChecked(b);
104 //kcfg_ShowPluto->setChecked( b );
105}
106
107void OpsSolarSystem::slotApply()
108{
109 if (isDirty == false)
110 return;
111
112 isDirty = false;
113
114 // update time for all objects because they might be not initialized
115 // it's needed when using horizontal coordinates
119}
static KConfigDialog * exists(const QString &name)
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
This is the main window for KStars.
Definition kstars.h:89
SkyMap * map() const
Definition kstars.h:139
static KStars * Instance()
Definition kstars.h:121
KStarsData * data() const
Definition kstars.h:133
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition kstars.cpp:592
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1173
void buttonPressed(QAbstractButton *button)
void idPressed(int id)
QObject * sender() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
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.