• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 5770622832

pending completion
5770622832

Pull #3348

github

gzotti
Fixed a logic error introduced by previous edit.
Pull Request #3348: Fix: orbit details

58 of 58 new or added lines in 5 files covered. (100.0%)

14813 of 124420 relevant lines covered (11.91%)

27935.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/gui/ViewDialog.cpp
1
/*
2
 * Stellarium
3
 * Copyright (C) 2008 Fabien Chereau
4
 * Copyright (C) 2012 Timothy Reaves
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
19
*/
20

21

22
#include "ViewDialog.hpp"
23
#include "ui_viewDialog.h"
24
#include "AddRemoveLandscapesDialog.hpp"
25
#include "AtmosphereDialog.hpp"
26
#include "SkylightDialog.hpp"
27
#include "TonemappingDialog.hpp"
28
#include "GreatRedSpotDialog.hpp"
29
#include "ConfigureDSOColorsDialog.hpp"
30
#include "ConfigureOrbitColorsDialog.hpp"
31
#include "StelApp.hpp"
32
#include "StelCore.hpp"
33
#include "StelModule.hpp"
34
#include "LandscapeMgr.hpp"
35
#include "StelSkyCultureMgr.hpp"
36
#include "StelFileMgr.hpp"
37
#include "StelProjector.hpp"
38
#include "StelModuleMgr.hpp"
39
#include "SolarSystem.hpp"
40
#include "Planet.hpp"
41
#include "NebulaMgr.hpp"
42
#include "AsterismMgr.hpp"
43
#include "StelStyle.hpp"
44
#include "StelGuiBase.hpp"
45
#include "StelGui.hpp"
46
#include "StelActionMgr.hpp"
47
#include "StelPropertyMgr.hpp"
48
#include "StelHips.hpp"
49
#include "StelMovementMgr.hpp"
50

51
#include <QDebug>
52
#include <QFrame>
53
#include <QFile>
54
#include <QFileInfo>
55
#include <QSettings>
56
#include <QTimer>
57
#include <QDialog>
58
#include <QStringList>
59
#include <QJsonArray>
60

61
ViewDialog::ViewDialog(QObject* parent) : StelDialog("View", parent)
×
62
        , addRemoveLandscapesDialog(nullptr)
×
63
        , atmosphereDialog(nullptr)
×
64
        , skylightDialog(nullptr)
×
65
        , tonemappingDialog(nullptr)
×
66
        , greatRedSpotDialog(nullptr)
×
67
        , configureDSOColorsDialog(nullptr)
×
68
        , configureOrbitColorsDialog(nullptr)
×
69
{
70
        ui = new Ui_viewDialogForm;        
×
71
}
×
72

73
ViewDialog::~ViewDialog()
×
74
{
75
        delete ui;
×
76
        ui=nullptr;
×
77
        delete addRemoveLandscapesDialog;
×
78
        addRemoveLandscapesDialog = nullptr;
×
79
        delete atmosphereDialog;
×
80
        atmosphereDialog = nullptr;
×
81
        delete skylightDialog;
×
82
        skylightDialog = nullptr;
×
83
        delete tonemappingDialog;
×
84
        tonemappingDialog = nullptr;
×
85
        delete greatRedSpotDialog;
×
86
        greatRedSpotDialog = nullptr;
×
87
        delete configureDSOColorsDialog;
×
88
        configureDSOColorsDialog = nullptr;
×
89
        delete configureOrbitColorsDialog;
×
90
        configureOrbitColorsDialog = nullptr;
×
91
}
×
92

93
void ViewDialog::retranslate()
×
94
{
95
        if (dialog)
×
96
        {
97
                ui->retranslateUi(dialog);
×
98
                updateZhrDescription(StelApp::getInstance().getModule("SporadicMeteorMgr")->property("zhr").toInt());
×
99
                populateLists();
×
100
                populateToolTips();
×
101
                populatePlanetMagnitudeAlgorithmsList();
×
102
                populatePlanetMagnitudeAlgorithmDescription();
×
103
                ui->lightPollutionWidget->retranslate();
×
104
                populateHipsGroups();
×
105
                updateHips();
×
106
                //Hack to shrink the tabs to optimal size after language change
107
                //by causing the list items to be laid out again.
108
                updateTabBarListWidgetWidth();
×
109
        }
110
}
×
111

112
void ViewDialog::styleChanged(const QString &style)
×
113
{
114
        StelDialog::styleChanged(style);
×
115
        if (dialog)
×
116
        {
117
                populateLists();
×
118
                populateToolTips();
×
119
                populatePlanetMagnitudeAlgorithmsList();
×
120
                populatePlanetMagnitudeAlgorithmDescription();
×
121
                populateHipsGroups();
×
122
        }
123
}
×
124

125
void ViewDialog::connectGroupBox(QGroupBox* groupBox, const QString& actionId)
×
126
{
127
        StelAction* action = StelApp::getInstance().getStelActionManager()->findAction(actionId);
×
128
        Q_ASSERT(action);
×
129
        groupBox->setChecked(action->isChecked());
×
130
        connect(action, SIGNAL(toggled(bool)), groupBox, SLOT(setChecked(bool)));
×
131
        connect(groupBox, SIGNAL(toggled(bool)), action, SLOT(setChecked(bool)));
×
132
}
×
133

134
void ViewDialog::createDialogContent()
×
135
{
136
        ui->setupUi(dialog);
×
137
        dialog->installEventFilter(this);
×
138

139
        StelApp *app = &StelApp::getInstance();
×
140
        connect(app, SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
141
        // Set the Sky tab activated by default
142
        ui->stackedWidget->setCurrentIndex(0);
×
143
        ui->stackListWidget->setCurrentRow(0);
×
144
        connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
×
145
        // Kinetic scrolling
146
        kineticScrollingList << ui->projectionListWidget << ui->culturesListWidget << ui->skyCultureTextBrowser << ui->landscapesListWidget
×
147
                             << ui->landscapeTextBrowser << ui->surveysListWidget << ui->surveysTextBrowser;
×
148
        StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
149
        if (gui)
×
150
        {
151
                enableKineticScrolling(gui->getFlagUseKineticScrolling());
×
152
                connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
153
        }
154
        connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
×
155
        connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
156

157
        populateLists();
×
158
        populateToolTips();
×
159
        // fixed size for buttons
160
        QSize bs = QSize(24, 24);
×
161
        ui->pushButtonAtmosphereDetails->setFixedSize(bs);
×
162
        ui->pushButtonSkylightDetails->setFixedSize(bs);
×
163
        ui->tonemappingPushButton->setFixedSize(bs);
×
164
        ui->pushButtonOrbitColors->setFixedSize(bs);        
×
165

166
        ui->currentFovSpinBox->setMinimum(app->getCore()->getMovementMgr()->getMinFov(), true);
×
167
        ui->currentFovSpinBox->setMaximum(360.0, true);
×
168
        ui->currentFovSpinBox->setWrapping(false);
×
169
        setDisplayFormatForSpins(app->getFlagShowDecimalDegrees());
×
170

171
        // TODOs after properties merge:
172
        // Jupiter's GRS should become property, and recheck the other "from trunk" entries.
173
        connect(ui->culturesListWidget, SIGNAL(currentTextChanged(const QString&)),&StelApp::getInstance().getSkyCultureMgr(),SLOT(setCurrentSkyCultureNameI18(QString)));
×
174
        connect(&StelApp::getInstance().getSkyCultureMgr(), SIGNAL(currentSkyCultureChanged(QString)), this, SLOT(skyCultureChanged()));
×
175

176
        // Connect and initialize checkboxes and other widgets
177
        SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
×
178
        Q_ASSERT(ssmgr);
×
179
        // Stars section
180
        connectGroupBox(ui->starGroupBox, "actionShow_Stars");
×
181
        connectDoubleProperty(ui->starScaleRadiusDoubleSpinBox,"StelSkyDrawer.absoluteStarScale");
×
182
        connectDoubleProperty(ui->starRelativeScaleDoubleSpinBox, "StelSkyDrawer.relativeStarScale");
×
183
        connectBoolProperty(ui->starTwinkleCheckBox, "StelSkyDrawer.flagStarTwinkle");
×
184
        connectDoubleProperty(ui->starTwinkleAmountDoubleSpinBox, "StelSkyDrawer.twinkleAmount");
×
185
        connectBoolProperty(ui->starLimitMagnitudeCheckBox,"StelSkyDrawer.flagStarMagnitudeLimit");
×
186
        connectDoubleProperty(ui->starLimitMagnitudeDoubleSpinBox, "StelSkyDrawer.customStarMagLimit");
×
187
        connectBoolProperty(ui->spikyStarsCheckBox, "StelSkyDrawer.flagStarSpiky");
×
188
        connectCheckBox(ui->starLabelCheckBox, "actionShow_Stars_Labels");
×
189
        connectDoubleProperty(ui->starsLabelsHorizontalSlider,"StarMgr.labelsAmount",0.0,10.0);
×
190
        connectBoolProperty(ui->checkBoxAdditionalNamesStars, "StarMgr.flagAdditionalNamesDisplayed");
×
191
        connectBoolProperty(ui->checkBoxStarDesignationsOnlyUsage, "StarMgr.flagDesignationLabels");
×
192
        connectBoolProperty(ui->dblStarsDesignationsCheckBox, "StarMgr.flagDblStarsDesignation");
×
193
        connectBoolProperty(ui->varStarsDesignationsCheckBox, "StarMgr.flagVarStarsDesignation");
×
194
        connectBoolProperty(ui->hipDesignationsCheckBox, "StarMgr.flagHIPDesignation");
×
195

196
        // Sky section
197
        connectBoolProperty(ui->milkyWayCheckBox, "MilkyWay.flagMilkyWayDisplayed");
×
198
        connectDoubleProperty(ui->milkyWayBrightnessDoubleSpinBox, "MilkyWay.intensity");
×
199
        connectDoubleProperty(ui->milkyWaySaturationDoubleSpinBox, "MilkyWay.saturation");
×
200
        connectBoolProperty(ui->zodiacalLightCheckBox, "ZodiacalLight.flagZodiacalLightDisplayed");
×
201
        connectDoubleProperty(ui->zodiacalLightBrightnessDoubleSpinBox, "ZodiacalLight.intensity");
×
202
        connectBoolProperty(ui->adaptationCheckbox, "StelSkyDrawer.flagLuminanceAdaptation");
×
203
        connectDoubleProperty(ui->twilightAltitudeDoubleSpinBox, "SpecificTimeMgr.twilightAltitude");
×
204

205
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
206
        Q_ASSERT(lmgr);
×
207
        // Light pollution
208
        ui->lightPollutionWidget->setup();
×
209

210
        // atmosphere details
211
        connect(ui->pushButtonAtmosphereDetails, SIGNAL(clicked()), this, SLOT(showAtmosphereDialog()));
×
212
        // This has to be manually enabled by the user
213
        StelPropertyMgr* propMgr = StelApp::getInstance().getStelPropertyManager();
×
214
        if (propMgr->getProperty("Skylight.flagGuiPublic")->getValue().toBool())
×
215
                connect(ui->pushButtonSkylightDetails, SIGNAL(clicked()), this, SLOT(showSkylightDialog()));
×
216
        else
217
                ui->pushButtonSkylightDetails->hide();
×
218
        // tonemapping details
219
        connect(ui->tonemappingPushButton, SIGNAL(clicked()), this, SLOT(showTonemappingDialog()));
×
220

221
        // Planets section
222
        connectGroupBox(ui->planetsGroupBox, "actionShow_Planets");
×
223
        connectCheckBox(ui->planetMarkerCheckBox, "actionShow_Planets_Hints");
×
224
        connectCheckBox(ui->planetOrbitCheckBox, "actionShow_Planets_Orbits");
×
225
        connectBoolProperty(ui->planetIsolatedOrbitCheckBox, "SolarSystem.flagIsolatedOrbits");
×
226
        connectBoolProperty(ui->planetOrbitOnlyCheckBox, "SolarSystem.flagPlanetsOrbitsOnly");
×
227
        connectBoolProperty(ui->planetOrbitsMoonCheckBox, "SolarSystem.flagOrbitsWithMoons");
×
228
        connectBoolProperty(ui->planetOrbitPermanentCheckBox, "SolarSystem.flagPermanentOrbits");
×
229
        connectIntProperty(ui->planetOrbitsThicknessSpinBox, "SolarSystem.orbitsThickness");
×
230
        connect(ui->pushButtonOrbitColors, SIGNAL(clicked(bool)), this, SLOT(showConfigureOrbitColorsDialog()));
×
231
        populateOrbitsControls(ssmgr->getFlagOrbits());
×
232
        connect(ssmgr,SIGNAL(flagOrbitsChanged(bool)), this, SLOT(populateOrbitsControls(bool)));
×
233
        connectBoolProperty(ui->planetLightSpeedCheckBox, "SolarSystem.flagLightTravelTime");
×
234
        connectBoolProperty(ui->planetUseObjModelsCheckBox, "SolarSystem.flagUseObjModels");
×
235
        connectBoolProperty(ui->planetShowObjSelfShadowsCheckBox, "SolarSystem.flagShowObjSelfShadows");
×
236
        ui->planetShowObjSelfShadowsCheckBox->setEnabled(ssmgr->getFlagUseObjModels());
×
237
        connect(ssmgr,SIGNAL(flagUseObjModelsChanged(bool)),ui->planetShowObjSelfShadowsCheckBox, SLOT(setEnabled(bool)));
×
238
        connectBoolProperty(ui->planetLimitMagnitudeCheckBox,"StelSkyDrawer.flagPlanetMagnitudeLimit");
×
239
        connectDoubleProperty(ui->planetLimitMagnitudeDoubleSpinBox,"StelSkyDrawer.customPlanetMagLimit");
×
240
        connectBoolProperty(ui->planetScaleMoonCheckBox, "SolarSystem.flagMoonScale");
×
241
        connectDoubleProperty(ui->moonScaleFactor,"SolarSystem.moonScale");
×
242
        connectBoolProperty(ui->planetScaleMinorBodyCheckBox, "SolarSystem.flagMinorBodyScale");
×
243
        connectDoubleProperty(ui->minorBodyScaleFactor,"SolarSystem.minorBodyScale");
×
244
        connectBoolProperty(ui->planetScalePlanetsCheckBox, "SolarSystem.flagPlanetScale");
×
245
        connectDoubleProperty(ui->planetScaleFactor,"SolarSystem.planetScale");
×
246
        connectBoolProperty(ui->planetScaleSunCheckBox, "SolarSystem.flagSunScale");
×
247
        connectDoubleProperty(ui->sunScaleFactor,"SolarSystem.sunScale");
×
248
        connectCheckBox(ui->planetLabelCheckBox, "actionShow_Planets_Labels");
×
249
        connectCheckBox(ui->planetNomenclatureCheckBox, "actionShow_Planets_Nomenclature");
×
250
        connectDoubleProperty(ui->planetsLabelsHorizontalSlider, "SolarSystem.labelsAmount",0.0,10.0);        
×
251
        connectCheckBox(ui->planetNomenclatureCheckBox, "actionShow_Planets_Nomenclature");
×
252
        connectColorButton(ui->planetNomenclatureColor, "NomenclatureMgr.nomenclatureColor", "color/planet_nomenclature_color");
×
253
        connectColorButton(ui->planetLabelColor, "SolarSystem.labelsColor", "color/planet_names_color");
×
254
        connectColorButton(ui->planetTrailsColor, "SolarSystem.trailsColor", "color/object_trails_color");
×
255
        connectBoolProperty(ui->planetTrailsCheckBox, "SolarSystem.trailsDisplayed");
×
256
        connectIntProperty(ui->planetTrailsThicknessSpinBox, "SolarSystem.trailsThickness");        
×
257
        connectBoolProperty(ui->planetIsolatedTrailsCheckBox, "SolarSystem.flagIsolatedTrails");
×
258
        connectIntProperty(ui->planetIsolatedTrailsSpinBox, "SolarSystem.numberIsolatedTrails");
×
259
        connectBoolProperty(ui->drawMoonHaloCheckBox, "SolarSystem.flagDrawMoonHalo");
×
260
        connectBoolProperty(ui->drawSunGlareCheckBox, "SolarSystem.flagDrawSunHalo");
×
261
        connectBoolProperty(ui->drawSunCoronaCheckBox, "SolarSystem.flagPermanentSolarCorona");
×
262
        connectBoolProperty(ui->shadowEnlargementDanjonCheckBox, "SolarSystem.earthShadowEnlargementDanjon");
×
263
        populateTrailsControls(ssmgr->getFlagTrails());
×
264
        connect(ssmgr,SIGNAL(trailsDisplayedChanged(bool)), this, SLOT(populateTrailsControls(bool)));
×
265

266
        connectBoolProperty(ui->hidePlanetNomenclatureCheckBox, "NomenclatureMgr.flagHideLocalNomenclature");
×
267
        connectBoolProperty(ui->showTerminatorNomenclatureOnlyCheckBox, "NomenclatureMgr.flagShowTerminatorZoneOnly");
×
268
        connectIntProperty(ui->terminatorMinAltSpinbox, "NomenclatureMgr.terminatorMinAltitude");
×
269
        connectIntProperty(ui->terminatorMaxAltSpinbox, "NomenclatureMgr.terminatorMaxAltitude");
×
270
        connectBoolProperty(ui->showSpecialNomenclatureOnlyCheckBox, "NomenclatureMgr.specialNomenclatureOnlyDisplayed");
×
271
        StelModule* mnmgr = StelApp::getInstance().getModule("NomenclatureMgr");
×
272
        populateNomenclatureControls(mnmgr->property("flagShowNomenclature").toBool());
×
273
        connect(mnmgr, SIGNAL(flagShowNomenclatureChanged(bool)), this, SLOT(populateNomenclatureControls(bool)));
×
274

275
        populatePlanetMagnitudeAlgorithmsList();
×
276
        int idx = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::getApparentMagnitudeAlgorithm(), Qt::UserRole, Qt::MatchCaseSensitive);
×
277
        if (idx==-1)
×
278
        {
279
                // Use Mallama&Hilton_2018 as default
280
                idx = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::MallamaHilton_2018, Qt::UserRole, Qt::MatchCaseSensitive);
×
281
        }
282
        ui->planetMagnitudeAlgorithmComboBox->setCurrentIndex(idx);
×
283
        connect(ui->planetMagnitudeAlgorithmComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setPlanetMagnitudeAlgorithm(int)));
×
284
        populatePlanetMagnitudeAlgorithmDescription();
×
285

286
        // GreatRedSpot (Jupiter)
287
        connect(ui->pushButtonGrsDetails, SIGNAL(clicked()), this, SLOT(showGreatRedSpotDialog()));
×
288

289
        // Link Solar System Editor button if available...
290
        StelModule *sse=StelApp::getInstance().getModuleMgr().getModule("SolarSystemEditor", true);
×
291
        if (sse)
×
292
                connect(ui->pushButtonSSE, &QPushButton::clicked, sse, [=]{sse->configureGui(true);});
×
293
        else
294
                ui->pushButtonSSE->hide();
×
295

296
        // Shooting stars section
297
        StelModule* mmgr = StelApp::getInstance().getModule("SporadicMeteorMgr");
×
298
        Q_ASSERT(mmgr);
×
299
        connectIntProperty(ui->zhrSpinBox, "SporadicMeteorMgr.zhr");
×
300
        connectIntProperty(ui->zhrSlider, "SporadicMeteorMgr.zhr", ui->zhrSlider->minimum(), ui->zhrSlider->maximum());
×
301
        updateZhrDescription(mmgr->property("zhr").toInt());
×
302
        connect(mmgr, SIGNAL(zhrChanged(int)), this, SLOT(updateZhrDescription(int)));
×
303

304
        // DSO tab contents
305
        NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
×
306
        updateSelectedCatalogsCheckBoxes();
×
307
        connect(nmgr, SIGNAL(catalogFiltersChanged(int)), this, SLOT(updateSelectedCatalogsCheckBoxes()));
×
308
        connect(ui->selectAllCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectAllCatalogs()));
×
309
        connect(ui->selectStandardCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectStandardCatalogs()));
×
310
        connect(ui->selectPreferredCatalogs, SIGNAL(clicked()), nmgr, SLOT(loadCatalogFilters()));
×
311
        connect(ui->storePreferredCatalogs, SIGNAL(clicked()), nmgr, SLOT(storeCatalogFilters()));
×
312
        connect(ui->selectNoneCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectNoneCatalogs()));
×
313
        connect(ui->buttonGroupDisplayedDSOCatalogs, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(setSelectedCatalogsFromCheckBoxes()));
×
314
        updateSelectedTypesCheckBoxes();
×
315
        connect(nmgr, SIGNAL(typeFiltersChanged(int)), this, SLOT(updateSelectedTypesCheckBoxes()));
×
316
        connect(ui->buttonGroupDisplayedDSOTypes, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(setSelectedTypesFromCheckBoxes()));
×
317
        connectGroupBox(ui->groupBoxDSOTypeFilters,"actionSet_Nebula_TypeFilterUsage");
×
318
        // DSO Labels section
319
        connectGroupBox(ui->groupBoxDSOLabelsAndMarkers, "actionShow_Nebulas");
×
320
        connectDoubleProperty(ui->nebulasLabelsHorizontalSlider, "NebulaMgr.labelsAmount",0.0,10.0);
×
321
        connectDoubleProperty(ui->nebulasHintsHorizontalSlider, "NebulaMgr.hintsAmount",0.0,10.0);
×
322
        connectBoolProperty(ui->checkBoxDesignationsOnlyUsage, "NebulaMgr.flagDesignationLabels");
×
323
        connectBoolProperty(ui->checkBoxProportionalHints, "NebulaMgr.hintsProportional");
×
324
        connectBoolProperty(ui->checkBoxOutlines, "NebulaMgr.flagOutlinesDisplayed");
×
325
        connectBoolProperty(ui->checkBoxSurfaceBrightnessUsage, "NebulaMgr.flagSurfaceBrightnessUsage");
×
326
        connectBoolProperty(ui->nebulaLimitMagnitudeCheckBox,"StelSkyDrawer.flagNebulaMagnitudeLimit");
×
327
        connectBoolProperty(ui->checkBoxAdditionalNamesDSO, "NebulaMgr.flagAdditionalNamesDisplayed");
×
328
        connectDoubleProperty(ui->nebulaLimitMagnitudeDoubleSpinBox,"StelSkyDrawer.customNebulaMagLimit");
×
329
        connectBoolProperty(ui->nebulaLimitSizeCheckBox, "NebulaMgr.flagUseSizeLimits");
×
330
        connectDoubleProperty(ui->nebulaLimitSizeMinDoubleSpinBox, "NebulaMgr.minSizeLimit");
×
331
        connectDoubleProperty(ui->nebulaLimitSizeMaxDoubleSpinBox, "NebulaMgr.maxSizeLimit");
×
332
        connect(ui->pushButtonConfigureDSOColors, SIGNAL(clicked()), this, SLOT(showConfigureDSOColorsDialog()));
×
333

334
        // Landscape section
335
        connectCheckBox(ui->showGroundCheckBox, "actionShow_Ground");
×
336
        connectCheckBox(ui->showFogCheckBox, "actionShow_Fog");
×
337
        connectCheckBox(ui->atmosphereCheckBox, "actionShow_Atmosphere");
×
338
        connectCheckBox(ui->landscapeIlluminationCheckBox, "actionShow_LandscapeIllumination");
×
339
        connectCheckBox(ui->landscapeLabelsCheckBox, "actionShow_LandscapeLabels");
×
340

341
        connectBoolProperty(ui->landscapePositionCheckBox, "LandscapeMgr.flagLandscapeSetsLocation");
×
342
        connectColorButton(ui->labelsColorButton, "LandscapeMgr.labelColor", "landscape/label_color");
×
343
        connectIntProperty(ui->labelsFontSizeSpinBox, "LandscapeMgr.labelFontSize");
×
344

345
        connectBoolProperty(ui->landscapeBrightnessCheckBox,"LandscapeMgr.flagLandscapeUseMinimalBrightness");
×
346
        connect(lmgr,SIGNAL(flagLandscapeUseMinimalBrightnessChanged(bool)),ui->localLandscapeBrightnessCheckBox,SLOT(setEnabled(bool)));
×
347
        connect(lmgr,SIGNAL(flagLandscapeUseMinimalBrightnessChanged(bool)),ui->landscapeBrightnessSpinBox,SLOT(setEnabled(bool)));
×
348
        ui->localLandscapeBrightnessCheckBox->setEnabled(lmgr->property("flagLandscapeUseMinimalBrightness").toBool());
×
349
        ui->landscapeBrightnessSpinBox->setEnabled(lmgr->property("flagLandscapeUseMinimalBrightness").toBool());
×
350
        connectDoubleProperty(ui->landscapeBrightnessSpinBox,"LandscapeMgr.defaultMinimalBrightness");
×
351
        connectBoolProperty(ui->landscapeTransparencyCheckBox,"LandscapeMgr.flagLandscapeUseTransparency");
×
352
        connectDoubleProperty(ui->landscapeTransparencySpinBox,"LandscapeMgr.landscapeTransparency");
×
353
        connectBoolProperty(ui->localLandscapeBrightnessCheckBox,"LandscapeMgr.flagLandscapeSetsMinimalBrightness");
×
354
        connectBoolProperty(ui->landscapePolylineCheckBox, "LandscapeMgr.flagPolyLineDisplayedOnly");
×
355
        connectIntProperty(ui->landscapePolylineThicknessSpinBox, "LandscapeMgr.polyLineThickness");
×
356
        connect(ui->landscapesListWidget, &QListWidget::currentItemChanged, this, [=](QListWidgetItem *newItem, QListWidgetItem *oldItem){
×
357
                Q_UNUSED(oldItem)
358
                GETSTELMODULE(LandscapeMgr)->setCurrentLandscapeName(newItem->data(Qt::UserRole).toString());
×
359
        });
×
360
        connect(lmgr, SIGNAL(currentLandscapeChanged(QString,QString)), this, SLOT(landscapeChanged(QString,QString)));
×
361
        connect(ui->useAsDefaultLandscapeCheckBox, SIGNAL(clicked()), this, SLOT(setCurrentLandscapeAsDefault()));
×
362
        connect(lmgr,SIGNAL(defaultLandscapeChanged(QString)),this,SLOT(updateDefaultLandscape()));
×
363
        updateDefaultLandscape();
×
364
        connect(lmgr, SIGNAL(landscapesChanged()), this, SLOT(populateLists()));
×
365
        connect(ui->pushButtonAddRemoveLandscapes, SIGNAL(clicked()), this, SLOT(showAddRemoveLandscapesDialog()));
×
366

367
        // Grid and lines
368
        connectGroupBox(ui->celestialSphereGroupBox,              "actionShow_Gridlines");
×
369
        connectCheckBox(ui->showEquatorLineCheckBox,              "actionShow_Equator_Line");
×
370
        connectCheckBox(ui->showEquatorJ2000LineCheckBox,         "actionShow_Equator_J2000_Line");
×
371
        connectCheckBox(ui->showFixedEquatorLineCheckBox,         "actionShow_Fixed_Equator_Line");
×
372
        connectCheckBox(ui->showEclipticLineJ2000CheckBox,        "actionShow_Ecliptic_J2000_Line");
×
373
        connectCheckBox(ui->showEclipticLineOfDateCheckBox,       "actionShow_Ecliptic_Line");
×
374
        connectCheckBox(ui->showInvariablePlaneCheckBox,          "actionShow_Invariable_Plane_Line");
×
375
        connectCheckBox(ui->showSolarEquatorCheckBox,             "actionShow_Solar_Equator_Line");
×
376
        connectCheckBox(ui->showMeridianLineCheckBox,             "actionShow_Meridian_Line");
×
377
        connectCheckBox(ui->showLongitudeLineCheckBox,            "actionShow_Longitude_Line");
×
378
        connectCheckBox(ui->showQuadratureLineCheckBox,           "actionShow_Quadrature_Line");
×
379
        connectCheckBox(ui->showHorizonLineCheckBox,              "actionShow_Horizon_Line");
×
380
        connectCheckBox(ui->showEquatorialGridCheckBox,                  "actionShow_Equatorial_Grid");
×
381
        connectCheckBox(ui->showFixedEquatorialGridCheckBox,      "actionShow_Fixed_Equatorial_Grid");
×
382
        connectCheckBox(ui->showGalacticGridCheckBox,             "actionShow_Galactic_Grid");
×
383
        connectCheckBox(ui->showGalacticEquatorLineCheckBox,      "actionShow_Galactic_Equator_Line");
×
384
        connectCheckBox(ui->showSupergalacticGridCheckBox,        "actionShow_Supergalactic_Grid");
×
385
        connectCheckBox(ui->showSupergalacticEquatorLineCheckBox, "actionShow_Supergalactic_Equator_Line");
×
386
        connectCheckBox(ui->showAzimuthalGridCheckBox,            "actionShow_Azimuthal_Grid");
×
387
        connectCheckBox(ui->showEquatorialJ2000GridCheckBox,      "actionShow_Equatorial_J2000_Grid");
×
388
        connectCheckBox(ui->showEclipticGridJ2000CheckBox,        "actionShow_Ecliptic_J2000_Grid");
×
389
        connectCheckBox(ui->showEclipticGridOfDateCheckBox,       "actionShow_Ecliptic_Grid");
×
390
        connectCheckBox(ui->showCardinalPointsCheckBox,           "actionShow_Cardinal_Points");
×
391
        connectCheckBox(ui->showOrdinal8WRPointsCheckBox,         "actionShow_Intercardinal_Points");
×
392
        connectCheckBox(ui->showOrdinal16WRPointsCheckBox,        "actionShow_Secondary_Intercardinal_Points");
×
393
        connectCheckBox(ui->showOrdinal32WRPointsCheckBox,        "actionShow_Tertiary_Intercardinal_Points");
×
394
        connectCheckBox(ui->showCompassMarksCheckBox,             "actionShow_Compass_Marks");
×
395
        connectCheckBox(ui->showPrecessionCirclesCheckBox,        "actionShow_Precession_Circles");
×
396
        connectCheckBox(ui->showPrimeVerticalLineCheckBox,        "actionShow_Prime_Vertical_Line");
×
397
        connectCheckBox(ui->showCurrentVerticalLineCheckBox,      "actionShow_Current_Vertical_Line");
×
398
        connectCheckBox(ui->showColuresLineCheckBox,              "actionShow_Colure_Lines");
×
399
        connectCheckBox(ui->showCircumpolarCirclesCheckBox,       "actionShow_Circumpolar_Circles");
×
400
        connectCheckBox(ui->showUmbraCheckBox,                    "actionShow_Umbra_Circle");
×
401
        connectCheckBox(ui->showUmbraCenterCheckBox,              "actionShow_Umbra_Center_Point");
×
402
        connectCheckBox(ui->showPenumbraCheckBox,                 "actionShow_Penumbra_Circle");
×
403
        connectCheckBox(ui->showCelestialJ2000PolesCheckBox,      "actionShow_Celestial_J2000_Poles");
×
404
        connectCheckBox(ui->showCelestialPolesCheckBox,           "actionShow_Celestial_Poles");
×
405
        connectCheckBox(ui->showZenithNadirCheckBox,              "actionShow_Zenith_Nadir");
×
406
        connectCheckBox(ui->showEclipticJ2000PolesCheckBox,       "actionShow_Ecliptic_J2000_Poles");
×
407
        connectCheckBox(ui->showEclipticPolesCheckBox,            "actionShow_Ecliptic_Poles");
×
408
        connectCheckBox(ui->showGalacticPolesCheckBox,            "actionShow_Galactic_Poles");
×
409
        connectCheckBox(ui->showGalacticCenterCheckBox,           "actionShow_Galactic_Center");
×
410
        connectCheckBox(ui->showSupergalacticPolesCheckBox,       "actionShow_Supergalactic_Poles");
×
411
        connectCheckBox(ui->showEquinoxJ2000PointsCheckBox,       "actionShow_Equinox_J2000_Points");
×
412
        connectCheckBox(ui->showEquinoxPointsCheckBox,            "actionShow_Equinox_Points");
×
413
        connectCheckBox(ui->showSolsticeJ2000PointsCheckBox,      "actionShow_Solstice_J2000_Points");
×
414
        connectCheckBox(ui->showSolsticePointsCheckBox,           "actionShow_Solstice_Points");
×
415
        connectCheckBox(ui->showAntisolarPointCheckBox,           "actionShow_Antisolar_Point");
×
416
        connectCheckBox(ui->showApexPointsCheckBox,               "actionShow_Apex_Points");
×
417
        connectCheckBox(ui->showFOVCenterMarkerCheckBox,          "actionShow_FOV_Center_Marker");
×
418
        connectCheckBox(ui->showFOVCircularMarkerCheckBox,        "actionShow_FOV_Circular_Marker");
×
419
        connectCheckBox(ui->showFOVRectangularMarkerCheckBox,     "actionShow_FOV_Rectangular_Marker");
×
420
        connectDoubleProperty(ui->fovCircularMarkerSizeDoubleSpinBox,             "SpecialMarkersMgr.fovCircularMarkerSize");
×
421
        connectDoubleProperty(ui->fovRectangularMarkerWidthDoubleSpinBox,         "SpecialMarkersMgr.fovRectangularMarkerWidth");
×
422
        connectDoubleProperty(ui->fovRectangularMarkerHeightDoubleSpinBox,        "SpecialMarkersMgr.fovRectangularMarkerHeight");
×
423
        connectDoubleProperty(ui->fovRectangularMarkerRotationAngleDoubleSpinBox, "SpecialMarkersMgr.fovRectangularMarkerRotationAngle");
×
424
        // The thickness of lines
425
        connectIntProperty(ui->lineThicknessSpinBox,                "GridLinesMgr.lineThickness");
×
426
        connectIntProperty(ui->partThicknessSpinBox,                "GridLinesMgr.partThickness");
×
427
        connectBoolProperty(ui->equatorPartsCheckBox,               "GridLinesMgr.equatorPartsDisplayed");
×
428
        connectBoolProperty(ui->equatorJ2000PartsCheckBox,          "GridLinesMgr.equatorJ2000PartsDisplayed");
×
429
        connectBoolProperty(ui->fixedEquatorPartsCheckBox,          "GridLinesMgr.fixedEquatorPartsDisplayed");
×
430
        connectBoolProperty(ui->eclipticPartsCheckBox,              "GridLinesMgr.eclipticPartsDisplayed");
×
431
        connectBoolProperty(ui->eclipticJ2000PartsCheckBox,         "GridLinesMgr.eclipticJ2000PartsDisplayed");
×
432
        connectBoolProperty(ui->solarEquatorPartsCheckBox,          "GridLinesMgr.solarEquatorPartsDisplayed");
×
433
        connectBoolProperty(ui->longitudePartsCheckBox,             "GridLinesMgr.longitudePartsDisplayed");
×
434
        connectBoolProperty(ui->horizonPartsCheckBox,               "GridLinesMgr.horizonPartsDisplayed");
×
435
        connectBoolProperty(ui->meridianPartsCheckBox,              "GridLinesMgr.meridianPartsDisplayed");
×
436
        connectBoolProperty(ui->primeVerticalPartsCheckBox,         "GridLinesMgr.primeVerticalPartsDisplayed");
×
437
        connectBoolProperty(ui->currentVerticalPartsCheckBox,       "GridLinesMgr.currentVerticalPartsDisplayed");
×
438
        connectBoolProperty(ui->colurePartsCheckBox,                "GridLinesMgr.colurePartsDisplayed");
×
439
        connectBoolProperty(ui->precessionPartsCheckBox,            "GridLinesMgr.precessionPartsDisplayed");
×
440
        connectBoolProperty(ui->galacticEquatorPartsCheckBox,       "GridLinesMgr.galacticEquatorPartsDisplayed");
×
441
        connectBoolProperty(ui->supergalacticEquatorPartsCheckBox,  "GridLinesMgr.supergalacticEquatorPartsDisplayed");
×
442
        connectBoolProperty(ui->equatorLabelsCheckBox,              "GridLinesMgr.equatorPartsLabeled");
×
443
        connectBoolProperty(ui->equatorJ2000LabelsCheckBox,         "GridLinesMgr.equatorJ2000PartsLabeled");
×
444
        connectBoolProperty(ui->fixedEquatorLabelsCheckBox,         "GridLinesMgr.fixedEquatorPartsLabeled");
×
445
        connectBoolProperty(ui->eclipticLabelsCheckBox,             "GridLinesMgr.eclipticPartsLabeled");
×
446
        connectBoolProperty(ui->withSolarTicksCheckbox,             "GridLinesMgr.eclipticDatesLabeled");
×
447
        connectBoolProperty(ui->eclipticJ2000LabelsCheckBox,        "GridLinesMgr.eclipticJ2000PartsLabeled");
×
448
        connectBoolProperty(ui->solarEquatorLabelsCheckBox,         "GridLinesMgr.solarEquatorPartsLabeled");
×
449
        connectBoolProperty(ui->longitudeLabelsCheckBox,            "GridLinesMgr.longitudePartsLabeled");
×
450
        connectBoolProperty(ui->horizonLabelsCheckBox,              "GridLinesMgr.horizonPartsLabeled");
×
451
        connectBoolProperty(ui->meridianLabelsCheckBox,             "GridLinesMgr.meridianPartsLabeled");
×
452
        connectBoolProperty(ui->primeVerticalLabelsCheckBox,        "GridLinesMgr.primeVerticalPartsLabeled");
×
453
        connectBoolProperty(ui->currentVerticalLabelsCheckBox,      "GridLinesMgr.currentVerticalPartsLabeled");
×
454
        connectBoolProperty(ui->colureLabelsCheckBox,               "GridLinesMgr.colurePartsLabeled");
×
455
        connectBoolProperty(ui->precessionLabelsCheckBox,           "GridLinesMgr.precessionPartsLabeled");
×
456
        connectBoolProperty(ui->galacticEquatorLabelsCheckBox,      "GridLinesMgr.galacticEquatorPartsLabeled");
×
457
        connectBoolProperty(ui->supergalacticEquatorLabelsCheckBox, "GridLinesMgr.supergalacticEquatorPartsLabeled");
×
458

459
        connectColorButton(ui->colorEclipticGridJ2000,        "GridLinesMgr.eclipticJ2000GridColor",         "color/ecliptical_J2000_color");
×
460
        connectColorButton(ui->colorEclipticGridOfDate,       "GridLinesMgr.eclipticGridColor",              "color/ecliptical_color");
×
461
        connectColorButton(ui->colorEquatorialJ2000Grid,      "GridLinesMgr.equatorJ2000GridColor",          "color/equatorial_J2000_color");
×
462
        connectColorButton(ui->colorEquatorialGrid,           "GridLinesMgr.equatorGridColor",               "color/equatorial_color");
×
463
        connectColorButton(ui->colorFixedEquatorialGrid,      "GridLinesMgr.fixedEquatorGridColor",          "color/fixed_equatorial_color");
×
464
        connectColorButton(ui->colorGalacticGrid,             "GridLinesMgr.galacticGridColor",              "color/galactic_color");
×
465
        connectColorButton(ui->colorSupergalacticGrid,        "GridLinesMgr.supergalacticGridColor",         "color/supergalactic_color");
×
466
        connectColorButton(ui->colorAzimuthalGrid,            "GridLinesMgr.azimuthalGridColor",             "color/azimuthal_color");
×
467
        connectColorButton(ui->colorEclipticLineJ2000,        "GridLinesMgr.eclipticJ2000LineColor",         "color/ecliptic_J2000_color");
×
468
        connectColorButton(ui->colorEclipticLineOfDate,       "GridLinesMgr.eclipticLineColor",              "color/ecliptic_color");
×
469
        connectColorButton(ui->colorInvariablePlane,          "GridLinesMgr.invariablePlaneLineColor",       "color/invariable_plane_color");
×
470
        connectColorButton(ui->colorSolarEquatorLine,         "GridLinesMgr.solarEquatorLineColor",          "color/solar_equator_color");
×
471
        connectColorButton(ui->colorEquatorJ2000Line,         "GridLinesMgr.equatorJ2000LineColor",          "color/equator_J2000_color");
×
472
        connectColorButton(ui->colorEquatorLine,              "GridLinesMgr.equatorLineColor",               "color/equator_color");
×
473
        connectColorButton(ui->colorFixedEquatorLine,         "GridLinesMgr.fixedEquatorLineColor",          "color/fixed_equator_color");
×
474
        connectColorButton(ui->colorGalacticEquatorLine,      "GridLinesMgr.galacticEquatorLineColor",       "color/galactic_equator_color");
×
475
        connectColorButton(ui->colorSupergalacticEquatorLine, "GridLinesMgr.supergalacticEquatorLineColor",  "color/supergalactic_equator_color");
×
476
        connectColorButton(ui->colorHorizonLine,              "GridLinesMgr.horizonLineColor",               "color/horizon_color");
×
477
        connectColorButton(ui->colorLongitudeLine,            "GridLinesMgr.longitudeLineColor",             "color/oc_longitude_color");
×
478
        connectColorButton(ui->colorQuadratureLine,           "GridLinesMgr.quadratureLineColor",            "color/quadrature_color");
×
479
        connectColorButton(ui->colorColuresLine,              "GridLinesMgr.colureLinesColor",               "color/colures_color");
×
480
        connectColorButton(ui->colorCircumpolarCircles,       "GridLinesMgr.circumpolarCirclesColor",        "color/circumpolar_circles_color");
×
481
        connectColorButton(ui->colorUmbraCircle,              "GridLinesMgr.umbraCircleColor",               "color/umbra_circle_color");
×
482
        connectColorButton(ui->colorPenumbraCircle,           "GridLinesMgr.penumbraCircleColor",            "color/penumbra_circle_color");
×
483
        connectColorButton(ui->colorPrecessionCircles,        "GridLinesMgr.precessionCirclesColor",         "color/precession_circles_color");
×
484
        connectColorButton(ui->colorPrimeVerticalLine,        "GridLinesMgr.primeVerticalLineColor",         "color/prime_vertical_color");
×
485
        connectColorButton(ui->colorCurrentVerticalLine,      "GridLinesMgr.currentVerticalLineColor",       "color/current_vertical_color");
×
486
        connectColorButton(ui->colorMeridianLine,             "GridLinesMgr.meridianLineColor",              "color/meridian_color");
×
487
        connectColorButton(ui->colorCelestialJ2000Poles,      "GridLinesMgr.celestialJ2000PolesColor",       "color/celestial_J2000_poles_color");
×
488
        connectColorButton(ui->colorCelestialPoles,           "GridLinesMgr.celestialPolesColor",            "color/celestial_poles_color");
×
489
        connectColorButton(ui->colorZenithNadir,              "GridLinesMgr.zenithNadirColor",               "color/zenith_nadir_color");
×
490
        connectColorButton(ui->colorEclipticJ2000Poles,       "GridLinesMgr.eclipticJ2000PolesColor",        "color/ecliptic_J2000_poles_color");
×
491
        connectColorButton(ui->colorEclipticPoles,            "GridLinesMgr.eclipticPolesColor",             "color/ecliptic_poles_color");
×
492
        connectColorButton(ui->colorGalacticPoles,            "GridLinesMgr.galacticPolesColor",             "color/galactic_poles_color");
×
493
        connectColorButton(ui->colorGalacticCenter,           "GridLinesMgr.galacticCenterColor",            "color/galactic_center_color");
×
494
        connectColorButton(ui->colorSupergalacticPoles,       "GridLinesMgr.supergalacticPolesColor",        "color/supergalactic_poles_color");
×
495
        connectColorButton(ui->colorEquinoxJ2000Points,       "GridLinesMgr.equinoxJ2000PointsColor",        "color/equinox_J2000_points_color");
×
496
        connectColorButton(ui->colorEquinoxPoints,            "GridLinesMgr.equinoxPointsColor",             "color/equinox_points_color");
×
497
        connectColorButton(ui->colorSolsticeJ2000Points,      "GridLinesMgr.solsticeJ2000PointsColor",       "color/solstice_J2000_points_color");
×
498
        connectColorButton(ui->colorSolsticePoints,           "GridLinesMgr.solsticePointsColor",            "color/solstice_points_color");
×
499
        connectColorButton(ui->colorAntisolarPoint,           "GridLinesMgr.antisolarPointColor",            "color/antisolar_point_color");
×
500
        connectColorButton(ui->colorApexPoints,               "GridLinesMgr.apexPointsColor",                "color/apex_points_color");
×
501
        connectColorButton(ui->colorFOVCenterMarker,          "SpecialMarkersMgr.fovCenterMarkerColor",      "color/fov_center_marker_color");
×
502
        connectColorButton(ui->colorFOVCircularMarker,        "SpecialMarkersMgr.fovCircularMarkerColor",    "color/fov_circular_marker_color");
×
503
        connectColorButton(ui->colorFOVRectangularMarker,     "SpecialMarkersMgr.fovRectangularMarkerColor", "color/fov_rectangular_marker_color");
×
504
        connectColorButton(ui->colorCardinalPoints,           "LandscapeMgr.cardinalPointsColor",            "color/cardinal_color");
×
505
        connectColorButton(ui->colorCompassMarks,             "SpecialMarkersMgr.compassMarksColor",         "color/compass_marks_color");
×
506

507
        connect(ui->showCardinalPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
508
        connect(ui->showOrdinal8WRPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
509
        connect(ui->showOrdinal16WRPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
510
        setSelectedCardinalCheckBoxes();
×
511

512
        // Projection
513
        connect(ui->projectionListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(changeProjection(const QString&)));
×
514
        connect(StelApp::getInstance().getCore(), SIGNAL(currentProjectionTypeChanged(StelCore::ProjectionType)),this,SLOT(projectionChanged()));
×
515
        connect(app, SIGNAL(flagShowDecimalDegreesChanged(bool)), this, SLOT(setDisplayFormatForSpins(bool)));
×
516
        connectDoubleProperty(ui->viewportOffsetSpinBox, "StelMovementMgr.viewportVerticalOffsetTarget");
×
517
        connectDoubleProperty(ui->userMaxFovSpinBox, "StelMovementMgr.userMaxFov");
×
518
        connectDoubleProperty(ui->currentFovSpinBox, "StelMovementMgr.currentFov");
×
519

520
        // Sky Culture
521
        connect(ui->useAsDefaultSkyCultureCheckBox, SIGNAL(clicked()), this, SLOT(setCurrentCultureAsDefault()));
×
522
        connect(&StelApp::getInstance().getSkyCultureMgr(), SIGNAL(defaultSkyCultureChanged(QString)),this,SLOT(updateDefaultSkyCulture()));
×
523
        updateDefaultSkyCulture();
×
524

525
        // allow to display short names and inhibit translation.
526
        connectIntProperty(ui->skyCultureNamesStyleComboBox,            "ConstellationMgr.constellationDisplayStyle");
×
527
        connectCheckBox(ui->nativePlanetNamesCheckBox,                  "actionShow_Skyculture_NativePlanetNames");
×
528
        connectCheckBox(ui->showConstellationLinesCheckBox,             "actionShow_Constellation_Lines");
×
529
        connectIntProperty(ui->constellationLineThicknessSpinBox,       "ConstellationMgr.constellationLineThickness");
×
530
        connectCheckBox(ui->showConstellationLabelsCheckBox,                "actionShow_Constellation_Labels");
×
531
        connectCheckBox(ui->showConstellationBoundariesCheckBox,        "actionShow_Constellation_Boundaries");
×
532
        connectIntProperty(ui->constellationBoundariesThicknessSpinBox, "ConstellationMgr.constellationBoundariesThickness");
×
533
        connectCheckBox(ui->showConstellationArtCheckBox,               "actionShow_Constellation_Art");
×
534
        connectDoubleProperty(ui->constellationArtBrightnessSpinBox,    "ConstellationMgr.artIntensity");
×
535

536
        connectColorButton(ui->colorConstellationBoundaries, "ConstellationMgr.boundariesColor", "color/const_boundary_color");
×
537
        connectColorButton(ui->colorConstellationLabels,     "ConstellationMgr.namesColor",      "color/const_names_color");
×
538
        connectColorButton(ui->colorConstellationLines,      "ConstellationMgr.linesColor",      "color/const_lines_color");
×
539

540
        connectCheckBox(ui->showAsterismLinesCheckBox,       "actionShow_Asterism_Lines");
×
541
        connectIntProperty(ui->asterismLineThicknessSpinBox, "AsterismMgr.asterismLineThickness");
×
542
        connectCheckBox(ui->showAsterismLabelsCheckBox,      "actionShow_Asterism_Labels");
×
543
        connectCheckBox(ui->showRayHelpersCheckBox,          "actionShow_Ray_Helpers");
×
544
        connectIntProperty(ui->rayHelperThicknessSpinBox,    "AsterismMgr.rayHelperThickness");
×
545

546
        connectColorButton(ui->colorAsterismLabels, "AsterismMgr.namesColor",      "color/asterism_names_color");
×
547
        connectColorButton(ui->colorAsterismLines,  "AsterismMgr.linesColor",      "color/asterism_lines_color");
×
548
        connectColorButton(ui->colorRayHelpers,     "AsterismMgr.rayHelpersColor", "color/rayhelper_lines_color");
×
549

550
        // Font selection
551
        connectIntProperty(ui->constellationsFontSizeSpinBox, "ConstellationMgr.fontSize");
×
552
        connectIntProperty(ui->asterismsFontSizeSpinBox,      "AsterismMgr.fontSize");
×
553

554
        // Hips mgr.
555
        populateHipsGroups();
×
556
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");        
×
557
        connect(hipsmgr, SIGNAL(surveysChanged()), this, SLOT(updateHips()));
×
558
        connect(ui->surveyTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateHips()));
×
559
        connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(updateHips()));
×
560
        connect(ui->surveysListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(updateHips()), Qt::QueuedConnection);
×
561
        connect(ui->surveysListWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(hipsListItemChanged(QListWidgetItem*)));
×
562
        updateHips();
×
563

564
        updateTabBarListWidgetWidth();
×
565

566
        connect((dynamic_cast<StelGui*>(StelApp::getInstance().getGui())), &StelGui::htmlStyleChanged, this, [=](const QString &style){
×
567
                ui->surveysTextBrowser->document()->setDefaultStyleSheet(style);
×
568
                ui->projectionTextBrowser->document()->setDefaultStyleSheet(style);
×
569
                ui->landscapeTextBrowser->document()->setDefaultStyleSheet(style);
×
570
                ui->skyCultureTextBrowser->document()->setDefaultStyleSheet(style);
×
571
        });
×
572
}
×
573

574
bool ViewDialog::eventFilter(QObject* object, QEvent* event)
×
575
{
576
        if (object != dialog || event->type() != QEvent::KeyPress)
×
577
                return false;
×
578
        const auto keyEvent = static_cast<QKeyEvent*>(event);
×
579
        if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)
×
580
                return true; // Prevent these keys pressing buttons when focus is not on the buttons
×
581
        return false;
×
582
}
583

584
void ViewDialog::setDisplayFormatForSpins(bool flagDecimalDegrees)
×
585
{
586
        int places = 0;
×
587
        AngleSpinBox::DisplayFormat format = AngleSpinBox::DMSSymbols;
×
588
        if (flagDecimalDegrees)
×
589
        {
590
                places = 5;
×
591
                format = AngleSpinBox::DecimalDeg;
×
592
        }
593
        ui->currentFovSpinBox->setDecimals(places);
×
594
        ui->currentFovSpinBox->setDisplayFormat(format);
×
595
}
×
596

597
void ViewDialog::populateOrbitsControls(bool flag)
×
598
{
599
        ui->planetIsolatedOrbitCheckBox->setEnabled(flag);
×
600
        ui->planetOrbitOnlyCheckBox->setEnabled(flag);
×
601
        ui->planetOrbitPermanentCheckBox->setEnabled(flag);
×
602
        ui->planetOrbitsThicknessSpinBox->setEnabled(flag);
×
603
        ui->pushButtonOrbitColors->setEnabled(flag);
×
604
}
×
605

606
void ViewDialog::populateTrailsControls(bool flag)
×
607
{
608
        ui->planetIsolatedTrailsCheckBox->setEnabled(flag);
×
609
        ui->planetIsolatedTrailsSpinBox->setEnabled(flag);
×
610
        ui->planetTrailsThicknessSpinBox->setEnabled(flag);
×
611
}
×
612

613
void ViewDialog::populateNomenclatureControls(bool flag)
×
614
{
615
        ui->hidePlanetNomenclatureCheckBox->setEnabled(flag);
×
616
        ui->showSpecialNomenclatureOnlyCheckBox->setEnabled(flag);
×
617
        ui->showTerminatorNomenclatureOnlyCheckBox->setEnabled(flag);
×
618
        ui->terminatorMinAltSpinbox->setEnabled(flag);
×
619
        ui->terminatorMaxAltSpinbox->setEnabled(flag);
×
620
        ui->labelTerminator->setEnabled(flag);
×
621
}
×
622

623
// Heuristic function to decide in which group to put a survey.
624
static QString getHipsType(const HipsSurveyP hips)
×
625
{
626
        QJsonObject properties = hips->property("properties").toJsonObject();
×
627
        if (!hips->isPlanetarySurvey())
×
628
                return "dss";
×
629
        if (properties["type"].toString() == "planet") // TODO: switch to use hips->isPlanetarySurvey() and multiple surveys for Solar system bodies
×
630
                return "sol";
×
631
        return "other";
×
632
}
×
633

634
void ViewDialog::updateHips()
×
635
{
636
        if (!ui->page_surveys->isVisible()) return;
×
637
        StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
638
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");
×
639
        QMetaObject::invokeMethod(hipsmgr, "loadSources");
×
640

641
        QComboBox* typeComboBox = ui->surveyTypeComboBox;
×
642
        QVariant selectedType = typeComboBox->itemData(typeComboBox->currentIndex());
×
643
        if (selectedType.isNull())
×
644
                selectedType = "dss";
×
645

646
        // Update survey list.
647
        QListWidget* l = ui->surveysListWidget;
×
648

649
        if (!hipsmgr->property("loaded").toBool())
×
650
        {
651
                l->clear();
×
652
                new QListWidgetItem(q_("Loading..."), l);
×
653
                return;
×
654
        }
655

656
        QJsonObject currentInfo;
×
657
        QString currentSurvey = l->currentItem() ? l->currentItem()->data(Qt::UserRole).toString() : "";
×
658
        QListWidgetItem* currentItem = nullptr;
×
659
        HipsSurveyP currentHips;
×
660

661
        l->blockSignals(true);
×
662
        l->clear();
×
663
        const QList<HipsSurveyP> hipslist = hipsmgr->property("surveys").value<QList<HipsSurveyP>>();
×
664

665
        for (auto &hips: hipslist)
×
666
        {
667
                if (getHipsType(hips) != selectedType)
×
668
                        continue;
×
669
                QString url = hips->property("url").toString();
×
670
                QJsonObject properties = hips->property("properties").toJsonObject();
×
671
                QString title = properties["obs_title"].toString();
×
672
                if (title.isEmpty())
×
673
                        continue;
×
674
                QListWidgetItem* item = new QListWidgetItem(title, l);
×
675
                item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
×
676
                item->setCheckState(hips->property("visible").toBool() ? Qt::Checked : Qt::Unchecked);
×
677
                item->setData(Qt::UserRole, url);
×
678
                if (url == currentSurvey)
×
679
                {
680
                        currentItem = item;
×
681
                        currentHips = hips;
×
682
                }
683
                disconnect(hips.data(), nullptr, this, nullptr);
×
684
                connect(hips.data(), SIGNAL(statusChanged()), this, SLOT(updateHips()));
×
685
        }
×
686
        l->sortItems(Qt::AscendingOrder);
×
687
        l->setCurrentItem(currentItem);
×
688
        l->scrollToItem(currentItem);
×
689
        l->blockSignals(false);
×
690

691
        if (!currentHips)
×
692
        {
693
                ui->surveysTextBrowser->setText("");
×
694
        }
695
        else
696
        {
697
                QJsonObject props = currentHips->property("properties").toJsonObject();
×
698
                QString html = QString("<h1>%1</h1>\n").arg(props["obs_title"].toString());
×
699
                if (props.contains("obs_copyright") && props.contains("obs_copyright_url"))
×
700
                {
701
                        html += QString("<p>Copyright <a href='%2'>%1</a></p>\n")
×
702
                                        .arg(props["obs_copyright"].toString(), props["obs_copyright_url"].toString());
×
703
                }
704
                html += QString("<p>%1</p>\n").arg(props["obs_description"].toString());
×
705
                html += "<h2>" + q_("properties") + "</h2>\n<ul>\n";
×
706
                for (auto iter = props.constBegin(); iter != props.constEnd(); iter++)
×
707
                {
708
                        html += QString("<li><b>%1</b> %2</li>\n").arg(iter.key(), iter.value().toString());
×
709
                }
710
                html += "</ul>\n";
×
711
                if (gui)
×
712
                        ui->surveysTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
713
                ui->surveysTextBrowser->setHtml(html);
×
714
        }
×
715
}
×
716

717
void ViewDialog::populateHipsGroups()
×
718
{
719
        // Update the groups combobox.
720
        QComboBox* typeComboBox = ui->surveyTypeComboBox;
×
721
        int index = typeComboBox->currentIndex();
×
722
        QVariant selectedType = typeComboBox->itemData(index);
×
723
        if (selectedType.isNull())
×
724
                selectedType = "dss";
×
725
        typeComboBox->clear();
×
726
        typeComboBox->addItem(q_("Deep Sky"), "dss");
×
727
        typeComboBox->addItem(q_("Solar System"), "sol");
×
728
        index = typeComboBox->findData(selectedType, Qt::UserRole, Qt::MatchCaseSensitive);
×
729
        typeComboBox->setCurrentIndex(index);
×
730
}
×
731

732
void ViewDialog::hipsListItemChanged(QListWidgetItem* item)
×
733
{
734
        QListWidget* l = item->listWidget();
×
735
        l->blockSignals(true);
×
736
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");
×
737
        QString url = item->data(Qt::UserRole).toString();
×
738
        HipsSurveyP hips;
×
739
        QMetaObject::invokeMethod(hipsmgr, "getSurveyByUrl", Qt::DirectConnection,
×
740
                        Q_RETURN_ARG(HipsSurveyP, hips), Q_ARG(QString, url));
×
741
        Q_ASSERT(hips);
×
742
        if (item->checkState() == Qt::Checked)
×
743
        {
744
                l->setCurrentItem(item);
×
745
                hips->setProperty("visible", true);
×
746
        }
747
        else
748
        {
749
                hips->setProperty("visible", false);
×
750
        }
751
        l->blockSignals(false);
×
752
}
×
753

754
void ViewDialog::updateTabBarListWidgetWidth()
×
755
{
756
        ui->stackListWidget->setWrapping(false);
×
757
        // Update list item sizes after translation
758
        ui->stackListWidget->adjustSize();
×
759
        QAbstractItemModel* model = ui->stackListWidget->model();
×
760
        if (!model)
×
761
                return;
×
762

763
        // stackListWidget->font() does not work properly!
764
        // It has a incorrect fontSize in the first loading, which produces the bug#995107.
765
        QFont font;
×
766
        font.setPixelSize(14);
×
767
        font.setWeight(QFont::Bold);
×
768
        QFontMetrics fontMetrics(font);
×
769
        int iconSize = ui->stackListWidget->iconSize().width();
×
770
        int width = 0;
×
771
        for (int row = 0; row < model->rowCount(); row++)
×
772
        {
773
                int textWidth = fontMetrics.boundingRect(ui->stackListWidget->item(row)->text()).width();
×
774
                width += iconSize > textWidth ? iconSize : textWidth; // use the wider one
×
775
                width += 24; // margin - 12px left and 12px right
×
776
        }
777
        // Hack to force the window to be resized...
778
        ui->stackListWidget->setMinimumWidth(width);
×
779
        ui->stackListWidget->updateGeometry();
×
780
}
×
781

782
void ViewDialog::setSelectedCardinalCheckBoxes()
×
783
{
784
        StelPropertyMgr* propMgr = StelApp::getInstance().getStelPropertyManager();
×
785
        bool cardinals = propMgr->getProperty("LandscapeMgr.cardinalPointsDisplayed")->getValue().toBool();
×
786
        bool ordinals = propMgr->getProperty("LandscapeMgr.ordinalPointsDisplayed")->getValue().toBool();
×
787
        bool secondary = propMgr->getProperty("LandscapeMgr.ordinal16WRPointsDisplayed")->getValue().toBool();
×
788
        ui->showOrdinal8WRPointsCheckBox->setEnabled(cardinals);
×
789
        ui->showOrdinal16WRPointsCheckBox->setEnabled(cardinals && ordinals);
×
790
        ui->showOrdinal32WRPointsCheckBox->setEnabled(cardinals && ordinals && secondary);
×
791
}
×
792

793
void ViewDialog::setSelectedCatalogsFromCheckBoxes()
×
794
{
795
        Nebula::CatalogGroup flags(Nebula::CatNone);
×
796
        if (ui->checkBoxNGC->isChecked())
×
797
                flags |= Nebula::CatNGC;
×
798
        if (ui->checkBoxIC->isChecked())
×
799
                flags |= Nebula::CatIC;
×
800
        if (ui->checkBoxM->isChecked())
×
801
                flags |= Nebula::CatM;
×
802
        if (ui->checkBoxC->isChecked())
×
803
                flags |= Nebula::CatC;
×
804
        if (ui->checkBoxB->isChecked())
×
805
                flags |= Nebula::CatB;
×
806
        if (ui->checkBoxSh2->isChecked())
×
807
                flags |= Nebula::CatSh2;
×
808
        if (ui->checkBoxVdB->isChecked())
×
809
                flags |= Nebula::CatVdB;
×
810
        if (ui->checkBoxRCW->isChecked())
×
811
                flags |= Nebula::CatRCW;
×
812
        if (ui->checkBoxLBN->isChecked())
×
813
                flags |= Nebula::CatLBN;
×
814
        if (ui->checkBoxLDN->isChecked())
×
815
                flags |= Nebula::CatLDN;
×
816
        if (ui->checkBoxCr->isChecked())
×
817
                flags |= Nebula::CatCr;
×
818
        if (ui->checkBoxMel->isChecked())
×
819
                flags |= Nebula::CatMel;
×
820
        if (ui->checkBoxCed->isChecked())
×
821
                flags |= Nebula::CatCed;
×
822
        if (ui->checkBoxPGC->isChecked())
×
823
                flags |= Nebula::CatPGC;
×
824
        if (ui->checkBoxUGC->isChecked())
×
825
                flags |= Nebula::CatUGC;
×
826
        if (ui->checkBoxArp->isChecked())
×
827
                flags |= Nebula::CatArp;
×
828
        if (ui->checkBoxVV->isChecked())
×
829
                flags |= Nebula::CatVV;
×
830
        if (ui->checkBoxPK->isChecked())
×
831
                flags |= Nebula::CatPK;
×
832
        if (ui->checkBoxPNG->isChecked())
×
833
                flags |= Nebula::CatPNG;
×
834
        if (ui->checkBoxSNRG->isChecked())
×
835
                flags |= Nebula::CatSNRG;
×
836
        if (ui->checkBoxACO->isChecked())
×
837
                flags |= Nebula::CatACO;
×
838
        if (ui->checkBoxHCG->isChecked())
×
839
                flags |= Nebula::CatHCG;        
×
840
        if (ui->checkBoxESO->isChecked())
×
841
                flags |= Nebula::CatESO;
×
842
        if (ui->checkBoxVdBH->isChecked())
×
843
                flags |= Nebula::CatVdBH;
×
844
        if (ui->checkBoxDWB->isChecked())
×
845
                flags |= Nebula::CatDWB;
×
846
        if (ui->checkBoxTr->isChecked())
×
847
                flags |= Nebula::CatTr;
×
848
        if (ui->checkBoxSt->isChecked())
×
849
                flags |= Nebula::CatSt;
×
850
        if (ui->checkBoxRu->isChecked())
×
851
                flags |= Nebula::CatRu;
×
852
        if (ui->checkBoxVdBHa->isChecked())
×
853
                flags |= Nebula::CatVdBHa;
×
854
        if (ui->checkBoxOther->isChecked())
×
855
                flags |= Nebula::CatOther;
×
856

857
        GETSTELMODULE(NebulaMgr)->setCatalogFilters(flags);
×
858
}
×
859

860
void ViewDialog::setSelectedTypesFromCheckBoxes()
×
861
{
862
        Nebula::TypeGroup flags(Nebula::TypeNone);
×
863
        if (ui->checkBoxGalaxiesType->isChecked())
×
864
                flags |= Nebula::TypeGalaxies;
×
865
        if (ui->checkBoxActiveGalaxiesType->isChecked())
×
866
                flags |= Nebula::TypeActiveGalaxies;
×
867
        if (ui->checkBoxInteractingGalaxiesType->isChecked())
×
868
                flags |= Nebula::TypeInteractingGalaxies;
×
869
        if (ui->checkBoxOpenStarClustersType->isChecked())
×
870
                flags |= Nebula::TypeOpenStarClusters;
×
871
        if (ui->checkBoxGlobularStarClustersType->isChecked())
×
872
                flags |= Nebula::TypeGlobularStarClusters;
×
873
        if (ui->checkBoxBrightNebulaeType->isChecked())
×
874
                flags |= Nebula::TypeBrightNebulae;
×
875
        if (ui->checkBoxDarkNebulaeType->isChecked())
×
876
                flags |= Nebula::TypeDarkNebulae;
×
877
        if (ui->checkBoxPlanetaryNebulaeType->isChecked())
×
878
                flags |= Nebula::TypePlanetaryNebulae;
×
879
        if (ui->checkBoxHydrogenRegionsType->isChecked())
×
880
                flags |= Nebula::TypeHydrogenRegions;
×
881
        if (ui->checkBoxSupernovaRemnantsType->isChecked())
×
882
                flags |= Nebula::TypeSupernovaRemnants;
×
883
        if (ui->checkBoxGalaxyClustersType->isChecked())
×
884
                flags |= Nebula::TypeGalaxyClusters;
×
885
        if (ui->checkBoxOtherType->isChecked())
×
886
                flags |= Nebula::TypeOther;
×
887

888
        GETSTELMODULE(NebulaMgr)->setTypeFilters(flags);
×
889
}
×
890

891

892
void ViewDialog::updateSelectedCatalogsCheckBoxes()
×
893
{
894
        const Nebula::CatalogGroup flags = static_cast<Nebula::CatalogGroup>(GETSTELMODULE(NebulaMgr)->getCatalogFilters());
×
895
        ui->checkBoxNGC->setChecked(flags & Nebula::CatNGC);
×
896
        ui->checkBoxIC->setChecked(flags & Nebula::CatIC);
×
897
        ui->checkBoxM->setChecked(flags & Nebula::CatM);
×
898
        ui->checkBoxC->setChecked(flags & Nebula::CatC);
×
899
        ui->checkBoxB->setChecked(flags & Nebula::CatB);
×
900
        ui->checkBoxSh2->setChecked(flags & Nebula::CatSh2);
×
901
        ui->checkBoxVdB->setChecked(flags & Nebula::CatVdB);
×
902
        ui->checkBoxRCW->setChecked(flags & Nebula::CatRCW);
×
903
        ui->checkBoxLDN->setChecked(flags & Nebula::CatLDN);
×
904
        ui->checkBoxLBN->setChecked(flags & Nebula::CatLBN);
×
905
        ui->checkBoxCr->setChecked(flags & Nebula::CatCr);
×
906
        ui->checkBoxMel->setChecked(flags & Nebula::CatMel);
×
907
        ui->checkBoxCed->setChecked(flags & Nebula::CatCed);
×
908
        ui->checkBoxPGC->setChecked(flags & Nebula::CatPGC);
×
909
        ui->checkBoxUGC->setChecked(flags & Nebula::CatUGC);
×
910
        ui->checkBoxArp->setChecked(flags & Nebula::CatArp);
×
911
        ui->checkBoxVV->setChecked(flags & Nebula::CatVV);
×
912
        ui->checkBoxPK->setChecked(flags & Nebula::CatPK);
×
913
        ui->checkBoxPNG->setChecked(flags & Nebula::CatPNG);
×
914
        ui->checkBoxSNRG->setChecked(flags & Nebula::CatSNRG);
×
915
        ui->checkBoxACO->setChecked(flags & Nebula::CatACO);
×
916
        ui->checkBoxHCG->setChecked(flags & Nebula::CatHCG);        
×
917
        ui->checkBoxESO->setChecked(flags & Nebula::CatESO);
×
918
        ui->checkBoxVdBH->setChecked(flags & Nebula::CatVdBH);
×
919
        ui->checkBoxDWB->setChecked(flags & Nebula::CatDWB);
×
920
        ui->checkBoxTr->setChecked(flags & Nebula::CatTr);
×
921
        ui->checkBoxSt->setChecked(flags & Nebula::CatSt);
×
922
        ui->checkBoxRu->setChecked(flags & Nebula::CatRu);
×
923
        ui->checkBoxVdBHa->setChecked(flags & Nebula::CatVdBHa);
×
924
        ui->checkBoxOther->setChecked(flags & Nebula::CatOther);        
×
925
}
×
926

927
void ViewDialog::updateSelectedTypesCheckBoxes()
×
928
{
929
        const Nebula::TypeGroup flags = static_cast<Nebula::TypeGroup>(GETSTELMODULE(NebulaMgr)->getTypeFilters());
×
930
        ui->checkBoxGalaxiesType->setChecked(flags & Nebula::TypeGalaxies);
×
931
        ui->checkBoxActiveGalaxiesType->setChecked(flags & Nebula::TypeActiveGalaxies);
×
932
        ui->checkBoxInteractingGalaxiesType->setChecked(flags & Nebula::TypeInteractingGalaxies);
×
933
        ui->checkBoxOpenStarClustersType->setChecked(flags & Nebula::TypeOpenStarClusters);
×
934
        ui->checkBoxGlobularStarClustersType->setChecked(flags & Nebula::TypeGlobularStarClusters);
×
935
        ui->checkBoxBrightNebulaeType->setChecked(flags & Nebula::TypeBrightNebulae);
×
936
        ui->checkBoxDarkNebulaeType->setChecked(flags & Nebula::TypeDarkNebulae);
×
937
        ui->checkBoxPlanetaryNebulaeType->setChecked(flags & Nebula::TypePlanetaryNebulae);
×
938
        ui->checkBoxHydrogenRegionsType->setChecked(flags & Nebula::TypeHydrogenRegions);
×
939
        ui->checkBoxSupernovaRemnantsType->setChecked(flags & Nebula::TypeSupernovaRemnants);
×
940
        ui->checkBoxGalaxyClustersType->setChecked(flags & Nebula::TypeGalaxyClusters);
×
941
        ui->checkBoxOtherType->setChecked(flags & Nebula::TypeOther);
×
942
}
×
943

944
void ViewDialog::populateToolTips()
×
945
{
946
        ui->planetUseObjModelsCheckBox->setToolTip(QString("<p>%1</p>").arg(q_("Uses a polygonal 3D model for some selected subplanetary objects (small moons, asteroids, comets) instead of a spherical approximation")));
×
947
        ui->planetShowObjSelfShadowsCheckBox->setToolTip(QString("<p>%1</p>").arg(q_("Use a &quot;shadow map&quot; to simulate self-shadows of non-convex solar system objects. May reduce shadow penumbra quality on some objects.")));
×
948

949
        QString degree = QChar(0x00B0);
×
950
        ui->fovCircularMarkerSizeDoubleSpinBox->setSuffix(degree);
×
951
        ui->fovRectangularMarkerHeightDoubleSpinBox->setSuffix(degree);
×
952
        ui->fovRectangularMarkerWidthDoubleSpinBox->setSuffix(degree);
×
953
        ui->fovRectangularMarkerRotationAngleDoubleSpinBox->setSuffix(degree);
×
954
}
×
955

956
void ViewDialog::populateLists()
×
957
{
958
        // Fill the culture list widget from the available list
959
        StelApp& app = StelApp::getInstance();
×
960
        QListWidget* l = ui->culturesListWidget;
×
961
        l->blockSignals(true);
×
962
        l->clear();
×
963
        QStringList starlore = app.getSkyCultureMgr().getSkyCultureListI18();
×
964
        for ( const auto& s : starlore  )
×
965
        {
966
                l->addItem(s);
×
967
                l->findItems(s, Qt::MatchExactly).at(0)->setToolTip(s);
×
968
        }
969
        l->setCurrentItem(l->findItems(app.getSkyCultureMgr().getCurrentSkyCultureNameI18(), Qt::MatchExactly).at(0));
×
970
        l->blockSignals(false);
×
971
        updateSkyCultureText();
×
972

973
        // populate language printing combo. (taken from DeltaT combo)
974
        StelModule* cmgr = app.getModule("ConstellationMgr");
×
975
        Q_ASSERT(cmgr);
×
976
        Q_ASSERT(ui->skyCultureNamesStyleComboBox);
×
977
        QComboBox* cultureNamesStyleComboBox = ui->skyCultureNamesStyleComboBox;
×
978

979
        cultureNamesStyleComboBox->blockSignals(true);
×
980
        cultureNamesStyleComboBox->clear();
×
981
        QMetaEnum enumerator = cmgr->metaObject()->property(cmgr->metaObject()->indexOfProperty("constellationDisplayStyle")).enumerator();
×
982
        cultureNamesStyleComboBox->addItem(q_("Abbreviated"), enumerator.keyToValue("constellationsAbbreviated"));
×
983
        cultureNamesStyleComboBox->addItem(q_("Native"), enumerator.keyToValue("constellationsNative"));  // Please make this always a transcript into European letters!
×
984
        cultureNamesStyleComboBox->addItem(q_("Translated"), enumerator.keyToValue("constellationsTranslated"));
×
985
        //cultureNamesStyleComboBox->addItem(q_("English"),    ConstellationMgr::constellationsEnglish); // This is not useful.
986
        //Restore the selection
987
        int index = cultureNamesStyleComboBox->findData(cmgr->property("constellationDisplayStyle").toInt(), Qt::UserRole, Qt::MatchCaseSensitive);
×
988
        if (index==-1) index=2; // Default: Translated
×
989
        cultureNamesStyleComboBox->setCurrentIndex(index);
×
990
        cultureNamesStyleComboBox->blockSignals(false);
×
991

992
        const StelCore* core = app.getCore();
×
993
        StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
×
994

995
        // Fill the projection list
996
        l = ui->projectionListWidget;
×
997
        l->blockSignals(true);
×
998
        l->clear();        
×
999
        const QStringList mappings = core->getAllProjectionTypeKeys();
×
1000
        for (const auto& s : mappings)
×
1001
        {
1002
                l->addItem(core->projectionTypeKeyToNameI18n(s));
×
1003
        }
1004
        l->setCurrentItem(l->findItems(core->getCurrentProjectionNameI18n(), Qt::MatchExactly).at(0));
×
1005
        l->blockSignals(false);
×
1006
        if (gui)
×
1007
                ui->projectionTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1008
        ui->projectionTextBrowser->setHtml(core->getProjection(StelCore::FrameJ2000)->getHtmlSummary());        
×
1009

1010
        // Fill the landscape list
1011
        l = ui->landscapesListWidget;
×
1012
        l->blockSignals(true);
×
1013
        l->clear();
×
1014
        StelModule* lmgr = app.getModule("LandscapeMgr");
×
1015
        QStringList landscapeList = lmgr->property("allLandscapeNames").toStringList();
×
1016
        for (const auto& landscapeName : qAsConst(landscapeList))
×
1017
        {
1018
                QString label = q_(landscapeName);
×
1019
                QListWidgetItem* item = new QListWidgetItem(label);
×
1020
                item->setData(Qt::UserRole, landscapeName);
×
1021
                l->addItem(item);
×
1022
        }
×
1023
        l->sortItems(); // they may have been translated!
×
1024
        QString selectedLandscapeName = lmgr->property("currentLandscapeName").toString();
×
1025
        for (int i = 0; i < l->count(); i++)
×
1026
        {
1027
                if (l->item(i)->data(Qt::UserRole).toString() == selectedLandscapeName)
×
1028
                {
1029
                        l->setCurrentRow(i);
×
1030
                        break;
×
1031
                }
1032
        }
1033
        l->blockSignals(false);        
×
1034
        QStringList searchPaths;
×
1035
        searchPaths << StelFileMgr::findFile("landscapes/" + lmgr->property("currentLandscapeID").toString());
×
1036

1037
        ui->landscapeTextBrowser->setSearchPaths(searchPaths);
×
1038
        if (gui)
×
1039
                ui->landscapeTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));        
×
1040
        ui->landscapeTextBrowser->setHtml(lmgr->property("currentLandscapeHtmlDescription").toString());        
×
1041
        updateDefaultLandscape();
×
1042
}
×
1043

1044
void ViewDialog::skyCultureChanged()
×
1045
{
1046
        QListWidget* l = ui->culturesListWidget;
×
1047
        l->setCurrentItem(l->findItems(StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureNameI18(), Qt::MatchExactly).at(0));
×
1048
        updateSkyCultureText();
×
1049
        updateDefaultSkyCulture();
×
1050
}
×
1051

1052
// fill the description text window, not the names in the sky.
1053
void ViewDialog::updateSkyCultureText()
×
1054
{
1055
        StelApp& app = StelApp::getInstance();
×
1056
        QString skyCultureId = app.getSkyCultureMgr().getCurrentSkyCultureID();
×
1057
        QString html = app.getSkyCultureMgr().getCurrentSkyCultureHtmlDescription();
×
1058

1059
        QStringList searchPaths;
×
1060
        searchPaths << StelFileMgr::findFile("skycultures/" + skyCultureId);
×
1061

1062
        ui->skyCultureTextBrowser->setSearchPaths(searchPaths);
×
1063
        StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
×
1064
        if (gui)
×
1065
                ui->skyCultureTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1066
        ui->skyCultureTextBrowser->setHtml(html);        
×
1067
}
×
1068

1069
void ViewDialog::changeProjection(const QString& projectionNameI18n)
×
1070
{
1071
        StelCore* core = StelApp::getInstance().getCore();
×
1072
        core->setCurrentProjectionTypeKey(core->projectionNameI18nToTypeKey(projectionNameI18n));
×
1073
}
×
1074

1075
void ViewDialog::projectionChanged()
×
1076
{
1077
        StelCore* core = StelApp::getInstance().getCore();
×
1078
        QListWidget* l = ui->projectionListWidget;
×
1079
        l->setCurrentItem(l->findItems(core->getCurrentProjectionNameI18n(), Qt::MatchExactly).at(0),QItemSelectionModel::SelectCurrent);
×
1080
        ui->projectionTextBrowser->setHtml(core->getProjection(StelCore::FrameJ2000)->getHtmlSummary());
×
1081
        ui->currentFovSpinBox->setMaximum(core->getProjection(StelCore::FrameJ2000)->getMaxFov(), true);
×
1082
}
×
1083

1084
void ViewDialog::landscapeChanged(QString id, QString name)
×
1085
{
1086
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1087
        for (int i = 0; i < ui->landscapesListWidget->count(); i++)
×
1088
        {
1089
                if (ui->landscapesListWidget->item(i)->data(Qt::UserRole).toString() == name)
×
1090
                {
1091
                        ui->landscapesListWidget->setCurrentRow(i, QItemSelectionModel::SelectCurrent);
×
1092
                        break;
×
1093
                }
1094
        }
1095

1096
        QStringList searchPaths;
×
1097
        searchPaths << StelFileMgr::findFile("landscapes/" + id);
×
1098

1099
        ui->landscapeTextBrowser->setSearchPaths(searchPaths);
×
1100
        ui->landscapeTextBrowser->setHtml(lmgr->property("currentLandscapeHtmlDescription").toString());
×
1101
        updateDefaultLandscape();
×
1102
        // Reset values that might have changed.
1103
        ui->showFogCheckBox->setChecked(lmgr->property("fogDisplayed").toBool());
×
1104
}
×
1105

1106
void ViewDialog::showAddRemoveLandscapesDialog()
×
1107
{
1108
        if(addRemoveLandscapesDialog == nullptr)
×
1109
                addRemoveLandscapesDialog = new AddRemoveLandscapesDialog();
×
1110

1111
        addRemoveLandscapesDialog->setVisible(true);
×
1112
}
×
1113

1114
void ViewDialog::showAtmosphereDialog()
×
1115
{
1116
        if(atmosphereDialog == nullptr)
×
1117
                atmosphereDialog = new AtmosphereDialog();
×
1118

1119
        atmosphereDialog->setVisible(true);
×
1120
}
×
1121

1122
void ViewDialog::showSkylightDialog()
×
1123
{
1124
    if(skylightDialog == nullptr)
×
1125
        skylightDialog = new SkylightDialog();
×
1126

1127
    skylightDialog->setVisible(true);
×
1128
}
×
1129

1130
void ViewDialog::showTonemappingDialog()
×
1131
{
1132
    if(tonemappingDialog == nullptr)
×
1133
        tonemappingDialog = new TonemappingDialog();
×
1134

1135
    tonemappingDialog->setVisible(true);
×
1136
}
×
1137

1138
void ViewDialog::showGreatRedSpotDialog()
×
1139
{
1140
        if(greatRedSpotDialog == nullptr)
×
1141
                greatRedSpotDialog = new GreatRedSpotDialog();
×
1142

1143
        greatRedSpotDialog->setVisible(true);
×
1144
}
×
1145

1146
void ViewDialog::showConfigureDSOColorsDialog()
×
1147
{
1148
        if(configureDSOColorsDialog == nullptr)
×
1149
                configureDSOColorsDialog = new ConfigureDSOColorsDialog();
×
1150

1151
        configureDSOColorsDialog->setVisible(true);
×
1152
}
×
1153

1154
void ViewDialog::showConfigureOrbitColorsDialog()
×
1155
{
1156
        if(configureOrbitColorsDialog == nullptr)
×
1157
                configureOrbitColorsDialog = new ConfigureOrbitColorsDialog();
×
1158

1159
        configureOrbitColorsDialog->setVisible(true);
×
1160
}
×
1161

1162
void ViewDialog::updateZhrDescription(int zhr)
×
1163
{
1164
        // GZ changed to small regions instead of hard "case" to better see a manual setting.
1165
        if (zhr==0)
×
1166
                ui->zhrLabel->setText("<small><i>"+q_("No shooting stars")+"</i></small>");
×
1167
        else if (zhr<=10)
×
1168
                ui->zhrLabel->setText("<small><i>"+q_("Normal rate")+"</i></small>");
×
1169
        else if ((zhr>=20) && (zhr<=30)) // was 25
×
1170
                ui->zhrLabel->setText("<small><i>"+q_("Standard Orionids rate")+"</i></small>");
×
1171
        else if ((zhr>=90) && (zhr<=110)) // was 100
×
1172
                ui->zhrLabel->setText("<small><i>"+q_("Standard Perseids rate")+"</i></small>");
×
1173
        else if ((zhr>=111) && (zhr<=132)) // was 120
×
1174
                ui->zhrLabel->setText("<small><i>"+q_("Standard Geminids rate")+"</i></small>");
×
1175
        else if ((zhr>=180) && (zhr<=220)) // was 200
×
1176
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Perseid rate")+"</i></small>");
×
1177
        else if ((zhr>=900) && (zhr<=1100)) // was 1000
×
1178
                ui->zhrLabel->setText("<small><i>"+q_("Meteor storm rate")+"</i></small>");
×
1179
        else if ((zhr>=5400) && (zhr<=6600)) // was 6000
×
1180
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Draconid rate")+"</i></small>");
×
1181
        else if ((zhr>=9000) && (zhr<=11000)) // was 10000
×
1182
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Leonid rate")+"</i></small>");
×
1183
        else if ((zhr>=130000) && (zhr<=160000)) // was 144000
×
1184
                ui->zhrLabel->setText("<small><i>"+q_("Very high rate (1966 Leonids)")+"</i></small>");
×
1185
        else if (zhr>=230000) // was 240000
×
1186
                ui->zhrLabel->setText("<small><i>"+q_("Highest rate ever (1833 Leonids)")+"</i></small>");
×
1187
        else
1188
                ui->zhrLabel->setText("");
×
1189
}
×
1190

1191
void ViewDialog::setCurrentLandscapeAsDefault(void)
×
1192
{
1193
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1194
        Q_ASSERT(lmgr);
×
1195
        lmgr->setProperty("defaultLandscapeID", lmgr->property("currentLandscapeID"));
×
1196
}
×
1197

1198
void ViewDialog::setCurrentCultureAsDefault(void)
×
1199
{
1200
        StelApp::getInstance().getSkyCultureMgr().setDefaultSkyCultureID(StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureID());
×
1201
}
×
1202

1203
void ViewDialog::updateDefaultSkyCulture()
×
1204
{
1205
        // Check that the useAsDefaultSkyCultureCheckBox needs to be updated
1206
        bool b = StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureID()==StelApp::getInstance().getSkyCultureMgr().getDefaultSkyCultureID();
×
1207
        ui->useAsDefaultSkyCultureCheckBox->setChecked(b);
×
1208
        ui->useAsDefaultSkyCultureCheckBox->setEnabled(!b);
×
1209
        // Check that ray helpers and asterism lines are defined
1210
        b = GETSTELMODULE(AsterismMgr)->isLinesDefined();
×
1211
        ui->showAsterismLinesCheckBox->setEnabled(b);
×
1212
        ui->showAsterismLabelsCheckBox->setEnabled(b);
×
1213
        ui->asterismLineThicknessSpinBox->setEnabled(b);
×
1214
        ui->colorAsterismLines->setEnabled(b);
×
1215
        ui->colorAsterismLabels->setEnabled(b);
×
1216
        ui->showRayHelpersCheckBox->setEnabled(b);
×
1217
        ui->rayHelperThicknessSpinBox->setEnabled(b);
×
1218
        ui->colorRayHelpers->setEnabled(b);
×
1219
        ui->asterismsFontSizeSpinBox->setEnabled(b);
×
1220
        ui->labelAsterismsFontSize->setEnabled(b);
×
1221
}
×
1222

1223
void ViewDialog::updateDefaultLandscape()
×
1224
{
1225
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1226
        Q_ASSERT(lmgr);
×
1227
        bool isDefault = lmgr->property("currentLandscapeID") == lmgr->property("defaultLandscapeID");
×
1228
        ui->useAsDefaultLandscapeCheckBox->setChecked(isDefault);
×
1229
        ui->useAsDefaultLandscapeCheckBox->setEnabled(!isDefault);
×
1230
}
×
1231

1232
void ViewDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
×
1233
{
1234
        if (!current)
×
1235
                current = previous;
×
1236
        ui->stackedWidget->setCurrentIndex(ui->stackListWidget->row(current));
×
1237
}
×
1238

1239
void ViewDialog::populatePlanetMagnitudeAlgorithmsList()
×
1240
{
1241
        Q_ASSERT(ui->planetMagnitudeAlgorithmComboBox);
×
1242
        QComboBox* algorithms = ui->planetMagnitudeAlgorithmComboBox;
×
1243
        //Save the current selection to be restored later
1244
        algorithms->blockSignals(true);
×
1245
        int index = algorithms->currentIndex();
×
1246
        QVariant selectedAlgorithmId = algorithms->itemData(index);
×
1247
        algorithms->clear();
×
1248
        //For each algorithm, display the localized name and store the key as user data.
1249
        algorithms->addItem(qc_("G. Müller (1893)",              "magnitude algorithm"), Planet::Mueller_1893);
×
1250
        algorithms->addItem(qc_("Astronomical Almanac (1984)",   "magnitude algorithm"), Planet::AstronomicalAlmanac_1984);
×
1251
        algorithms->addItem(qc_("Explanatory Supplement (1992)", "magnitude algorithm"), Planet::ExplanatorySupplement_1992);
×
1252
        algorithms->addItem(qc_("Explanatory Supplement (2013)", "magnitude algorithm"), Planet::ExplanatorySupplement_2013);
×
1253
        algorithms->addItem(qc_("Mallama & Hilton (2018)",       "magnitude algorithm"), Planet::MallamaHilton_2018);
×
1254
        algorithms->addItem(qc_("Generic",                       "magnitude algorithm"), Planet::Generic);
×
1255
        //Restore the selection
1256
        index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::MatchCaseSensitive);
×
1257
        algorithms->setCurrentIndex(index);
×
1258
        //algorithms->model()->sort(0);
1259
        algorithms->blockSignals(false);
×
1260
}
×
1261

1262
void ViewDialog::setPlanetMagnitudeAlgorithm(int algorithmID)
×
1263
{
1264
        Planet::ApparentMagnitudeAlgorithm currentAlgorithm = static_cast<Planet::ApparentMagnitudeAlgorithm>(ui->planetMagnitudeAlgorithmComboBox->itemData(algorithmID).toInt());
×
1265
        Planet::setApparentMagnitudeAlgorithm(currentAlgorithm);
×
1266
        populatePlanetMagnitudeAlgorithmDescription();
×
1267
}
×
1268

1269
void ViewDialog::populatePlanetMagnitudeAlgorithmDescription()
×
1270
{
1271
        int currentAlgorithm = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::getApparentMagnitudeAlgorithm(), Qt::UserRole, Qt::MatchCaseSensitive);
×
1272
        if (currentAlgorithm==-1) // Use Mallama&Hilton 2018 as default
×
1273
                currentAlgorithm = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::MallamaHilton_2018, Qt::UserRole, Qt::MatchCaseSensitive);
×
1274

1275
        const QMap<int, QString>planetMagnitudeAlgorithmMap = {
1276
                { Planet::AstronomicalAlmanac_1984, q_("The algorithm was used in the <em>Astronomical Almanac</em> (1984 and later) and gives V (instrumental) magnitudes (allegedly from D.L. Harris).") },
×
1277
                { Planet::Mueller_1893, q_("The algorithm is based on visual observations 1877-1891 by G. Müller and was still republished in the <em>Explanatory Supplement to the Astronomical Ephemeris</em> (1961).") },
×
1278
                { Planet::ExplanatorySupplement_1992, q_("The algorithm was published in the 2nd edition of the <em>Explanatory Supplement to the Astronomical Almanac</em> (1992).") },
×
1279
                { Planet::ExplanatorySupplement_2013, q_("The algorithm was published in the 3rd edition of the <em>Explanatory Supplement to the Astronomical Almanac</em> (2013).") },
×
1280
                { Planet::MallamaHilton_2018, q_("The algorithm was published by A. Mallama & J. L. Hilton: <em>Computing apparent planetary magnitudes for the Astronomical Almanac.</em> Astronomy&Computing 25 (2018) 10-24.") }
×
1281
        };
×
1282

1283
        QString info = planetMagnitudeAlgorithmMap.value(currentAlgorithm, q_("Visual magnitude based on phase angle and albedo."));
×
1284
        ui->planetMagnitudeAlgorithmDescription->setText(QString("<small>%1</small>").arg(info));
×
1285
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc