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

Stellarium / stellarium / 15670918640

16 Jun 2025 02:08AM UTC coverage: 11.775% (-0.2%) from 11.931%
15670918640

push

github

alex-w
Updated data

14700 of 124846 relevant lines covered (11.77%)

18324.52 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 "ConstellationMgr.hpp"
37
#include "StelFileMgr.hpp"
38
#include "StelProjector.hpp"
39
#include "StelModuleMgr.hpp"
40
#include "SolarSystem.hpp"
41
#include "Planet.hpp"
42
#include "NebulaMgr.hpp"
43
#include "AsterismMgr.hpp"
44
#include "StelStyle.hpp"
45
#include "StelGuiBase.hpp"
46
#include "StelGui.hpp"
47
#include "HipsMgr.hpp"
48
#include "StelActionMgr.hpp"
49
#include "StelPropertyMgr.hpp"
50
#include "StelHips.hpp"
51
#include "StelMovementMgr.hpp"
52

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

63
struct Page
64
{
65
        enum
66
        {
67
                Sky,
68
                SSO,
69
                DSO,
70
                Markings,
71
                Landscape,
72
                SkyCulture,
73
                Surveys,
74

75
                COUNT
76
        };
77
};
78

79
ViewDialog::ViewDialog(QObject* parent) : StelDialog("View", parent)
×
80
        , addRemoveLandscapesDialog(nullptr)
×
81
        , atmosphereDialog(nullptr)
×
82
        , skylightDialog(nullptr)
×
83
        , tonemappingDialog(nullptr)
×
84
        , greatRedSpotDialog(nullptr)
×
85
        , configureDSOColorsDialog(nullptr)
×
86
        , configureOrbitColorsDialog(nullptr)
×
87
{
88
        ui = new Ui_viewDialogForm;        
×
89
        // This connection should be made here, rather than in createDialogContent, because otherwise it
90
        // won't be possible to open the dialog for the first time by right-clicking the HiPS button.
91
        const auto hipsmgr = qobject_cast<HipsMgr*>(StelApp::getInstance().getModule("HipsMgr"));
×
92
        connect(qobject_cast<HipsMgr*>(hipsmgr), &HipsMgr::toggleDialog, this, &ViewDialog::toggleHipsDialog);
×
93
}
×
94

95
ViewDialog::~ViewDialog()
×
96
{
97
        delete ui;
×
98
        ui=nullptr;
×
99
        delete addRemoveLandscapesDialog;
×
100
        addRemoveLandscapesDialog = nullptr;
×
101
        delete atmosphereDialog;
×
102
        atmosphereDialog = nullptr;
×
103
        delete skylightDialog;
×
104
        skylightDialog = nullptr;
×
105
        delete tonemappingDialog;
×
106
        tonemappingDialog = nullptr;
×
107
        delete greatRedSpotDialog;
×
108
        greatRedSpotDialog = nullptr;
×
109
        delete configureDSOColorsDialog;
×
110
        configureDSOColorsDialog = nullptr;
×
111
        delete configureOrbitColorsDialog;
×
112
        configureOrbitColorsDialog = nullptr;
×
113
}
×
114

115
void ViewDialog::retranslate()
×
116
{
117
        if (dialog)
×
118
        {
119
                ui->retranslateUi(dialog);
×
120
                updateZhrDescription(StelApp::getInstance().getModule("SporadicMeteorMgr")->property("zhr").toInt());
×
121
                populateLists();
×
122
                populateToolTips();
×
123
                populatePlanetMagnitudeAlgorithmsList();
×
124
                populatePlanetMagnitudeAlgorithmDescription();
×
125
                ui->lightPollutionWidget->retranslate();
×
126
                populateHipsGroups();
×
127
                updateHips();
×
128
                //Hack to shrink the tabs to optimal size after language change
129
                //by causing the list items to be laid out again.
130
                updateTabBarListWidgetWidth();
×
131
        }
132
}
×
133

134
void ViewDialog::styleChanged(const QString &style)
×
135
{
136
        StelDialog::styleChanged(style);
×
137
        if (dialog)
×
138
        {
139
                populateLists();
×
140
                populateToolTips();
×
141
                populatePlanetMagnitudeAlgorithmsList();
×
142
                populatePlanetMagnitudeAlgorithmDescription();
×
143
                populateHipsGroups();
×
144
        }
145
}
×
146

147
void ViewDialog::connectGroupBox(QGroupBox* groupBox, const QString& actionId)
×
148
{
149
        StelAction* action = StelApp::getInstance().getStelActionManager()->findAction(actionId);
×
150
        Q_ASSERT(action);
×
151
        groupBox->setChecked(action->isChecked());
×
152
        connect(action, SIGNAL(toggled(bool)), groupBox, SLOT(setChecked(bool)));
×
153
        connect(groupBox, SIGNAL(toggled(bool)), action, SLOT(setChecked(bool)));
×
154
}
×
155

156
void ViewDialog::createDialogContent()
×
157
{
158
        ui->setupUi(dialog);
×
159
        Q_ASSERT(ui->stackedWidget->count() == Page::COUNT);
×
160
        dialog->installEventFilter(this);
×
161

162
        StelApp *app = &StelApp::getInstance();
×
163
        connect(app, SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
164
        // Set the Sky tab activated by default
165
        ui->stackedWidget->setCurrentIndex(Page::Sky);
×
166
        ui->stackListWidget->setCurrentRow(Page::Sky);
×
167
        connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
×
168
        // Kinetic scrolling
169
        kineticScrollingList << ui->projectionListWidget << ui->culturesListWidget << ui->skyCultureTextBrowser << ui->landscapesListWidget
×
170
                             << ui->landscapeTextBrowser << ui->surveysListWidget << ui->surveysTextBrowser;
×
171
        StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
172
        if (gui)
×
173
        {
174
                enableKineticScrolling(gui->getFlagUseKineticScrolling());
×
175
                connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
176
        }
177
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
178
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
179

180
        populateLists();
×
181
        populateToolTips();
×
182

183
        ui->currentFovSpinBox->setMinimum(app->getCore()->getMovementMgr()->getMinFov(), true);
×
184
        ui->currentFovSpinBox->setMaximum(360.0, true);
×
185
        ui->currentFovSpinBox->setWrapping(false);
×
186
        setDisplayFormatForSpins(app->getFlagShowDecimalDegrees());
×
187

188
        // TODOs after properties merge:
189
        // Jupiter's GRS should become property, and recheck the other "from trunk" entries.
190
        connect(ui->culturesListWidget, SIGNAL(currentTextChanged(const QString&)),&StelApp::getInstance().getSkyCultureMgr(),SLOT(setCurrentSkyCultureNameI18(QString)));
×
191
        connect(&StelApp::getInstance().getSkyCultureMgr(), &StelSkyCultureMgr::currentSkyCultureIDChanged, this, &ViewDialog::skyCultureChanged);
×
192

193
        // Connect and initialize checkboxes and other widgets
194
        SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
×
195
        Q_ASSERT(ssmgr);
×
196
        // Stars section
197
        connectGroupBox(ui->starGroupBox, "actionShow_Stars");
×
198
        connectDoubleProperty(ui->starScaleRadiusDoubleSpinBox,"StelSkyDrawer.absoluteStarScale");
×
199
        connectDoubleProperty(ui->starRelativeScaleDoubleSpinBox, "StelSkyDrawer.relativeStarScale");
×
200
        connectBoolProperty(ui->starTwinkleCheckBox, "StelSkyDrawer.flagStarTwinkle");
×
201
        connectBoolProperty(ui->starTwinkleWithoutAtmosphereCheckBox, "StelSkyDrawer.flagForcedTwinkle");
×
202
        connectDoubleProperty(ui->starTwinkleAmountDoubleSpinBox, "StelSkyDrawer.twinkleAmount");
×
203
        connectBoolProperty(ui->starLimitMagnitudeCheckBox,"StelSkyDrawer.flagStarMagnitudeLimit");
×
204
        connectDoubleProperty(ui->starLimitMagnitudeDoubleSpinBox, "StelSkyDrawer.customStarMagLimit");
×
205
        connectBoolProperty(ui->spikyStarsCheckBox, "StelSkyDrawer.flagStarSpiky");
×
206
        connectCheckBox(ui->starLabelCheckBox, "actionShow_Stars_Labels");
×
207
        connectDoubleProperty(ui->starsLabelsHorizontalSlider,"StarMgr.labelsAmount",0.0,10.0);
×
208
        connectBoolProperty(ui->checkBoxAdditionalNamesStars, "StarMgr.flagAdditionalNamesDisplayed");
×
209
        connectBoolProperty(ui->checkBoxStarDesignationsOnlyUsage, "StarMgr.flagDesignationLabels");
×
210
        connectBoolProperty(ui->dblStarsDesignationsCheckBox, "StarMgr.flagDblStarsDesignation");
×
211
        connectBoolProperty(ui->varStarsDesignationsCheckBox, "StarMgr.flagVarStarsDesignation");
×
212
        connectBoolProperty(ui->hipDesignationsCheckBox, "StarMgr.flagHIPDesignation");
×
213

214
        // Sky section
215
        connectBoolProperty(ui->milkyWayCheckBox, "MilkyWay.flagMilkyWayDisplayed");
×
216
        connectDoubleProperty(ui->milkyWayBrightnessDoubleSpinBox, "MilkyWay.intensity");
×
217
        connectDoubleProperty(ui->milkyWaySaturationDoubleSpinBox, "MilkyWay.saturation");
×
218
        connectBoolProperty(ui->zodiacalLightCheckBox, "ZodiacalLight.flagZodiacalLightDisplayed");
×
219
        connectDoubleProperty(ui->zodiacalLightBrightnessDoubleSpinBox, "ZodiacalLight.intensity");
×
220
        connectBoolProperty(ui->adaptationCheckbox, "StelSkyDrawer.flagLuminanceAdaptation");
×
221
        connectDoubleProperty(ui->twilightAltitudeDoubleSpinBox, "SpecificTimeMgr.twilightAltitude");
×
222

223
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
224
        Q_ASSERT(lmgr);
×
225
        // Light pollution
226
        ui->lightPollutionWidget->setup();
×
227

228
        // atmosphere details
229
        connect(ui->pushButtonAtmosphereDetails, SIGNAL(clicked()), this, SLOT(showAtmosphereDialog()));
×
230
        // This has to be manually enabled by the user
231
        StelPropertyMgr* propMgr = StelApp::getInstance().getStelPropertyManager();
×
232
        if (propMgr->getProperty("Skylight.flagGuiPublic")->getValue().toBool())
×
233
                connect(ui->pushButtonSkylightDetails, SIGNAL(clicked()), this, SLOT(showSkylightDialog()));
×
234
        else
235
                ui->pushButtonSkylightDetails->hide();
×
236
        // tonemapping details
237
        connect(ui->tonemappingPushButton, SIGNAL(clicked()), this, SLOT(showTonemappingDialog()));
×
238

239
        // Planets section
240
        connectGroupBox(ui->planetsGroupBox, "actionShow_Planets");
×
241
        connectCheckBox(ui->planetMarkerCheckBox, "actionShow_Planets_Hints");
×
242
        connectCheckBox(ui->planetOrbitCheckBox, "actionShow_Planets_Orbits");
×
243
        connectBoolProperty(ui->planetIsolatedOrbitCheckBox, "SolarSystem.flagIsolatedOrbits");
×
244
        connectBoolProperty(ui->planetOrbitMajorPlanetsCheckBox, "SolarSystem.flagPlanetsOrbits");
×
245
        connectBoolProperty(ui->planetOrbitOnlyCheckBox, "SolarSystem.flagPlanetsOrbitsOnly");
×
246
        connectBoolProperty(ui->planetOrbitsMoonCheckBox, "SolarSystem.flagOrbitsWithMoons");
×
247
        connectBoolProperty(ui->planetOrbitPermanentCheckBox, "SolarSystem.flagPermanentOrbits");
×
248
        connectIntProperty(ui->planetOrbitsThicknessSpinBox, "SolarSystem.orbitsThickness");
×
249
        connect(ui->pushButtonOrbitColors, SIGNAL(clicked(bool)), this, SLOT(showConfigureOrbitColorsDialog()));
×
250
        populateOrbitsControls(ssmgr->getFlagOrbits());
×
251
        connect(ssmgr,SIGNAL(flagOrbitsChanged(bool)), this, SLOT(populateOrbitsControls(bool)));
×
252
        connectBoolProperty(ui->planetLightSpeedCheckBox, "SolarSystem.flagLightTravelTime");
×
253
        connectBoolProperty(ui->planetUseObjModelsCheckBox, "SolarSystem.flagUseObjModels");
×
254
        connectBoolProperty(ui->planetShowObjSelfShadowsCheckBox, "SolarSystem.flagShowObjSelfShadows");
×
255
        ui->planetShowObjSelfShadowsCheckBox->setEnabled(ssmgr->getFlagUseObjModels());
×
256
        connect(ssmgr,SIGNAL(flagUseObjModelsChanged(bool)),ui->planetShowObjSelfShadowsCheckBox, SLOT(setEnabled(bool)));
×
257
        connectBoolProperty(ui->planetLimitMagnitudeCheckBox,"StelSkyDrawer.flagPlanetMagnitudeLimit");
×
258
        connectDoubleProperty(ui->planetLimitMagnitudeDoubleSpinBox,"StelSkyDrawer.customPlanetMagLimit");
×
259
        connectBoolProperty(ui->planetScaleMoonCheckBox, "SolarSystem.flagMoonScale");
×
260
        connectDoubleProperty(ui->moonScaleFactor,"SolarSystem.moonScale");
×
261
        connectBoolProperty(ui->planetScaleMinorBodyCheckBox, "SolarSystem.flagMinorBodyScale");
×
262
        connectDoubleProperty(ui->minorBodyScaleFactor,"SolarSystem.minorBodyScale");
×
263
        connectBoolProperty(ui->planetScalePlanetsCheckBox, "SolarSystem.flagPlanetScale");
×
264
        connectDoubleProperty(ui->planetScaleFactor,"SolarSystem.planetScale");
×
265
        connectBoolProperty(ui->planetScaleSunCheckBox, "SolarSystem.flagSunScale");
×
266
        connectDoubleProperty(ui->sunScaleFactor,"SolarSystem.sunScale");
×
267
        connectCheckBox(ui->planetLabelCheckBox, "actionShow_Planets_Labels");
×
268
        connectCheckBox(ui->planetNomenclatureCheckBox, "actionShow_Planets_Nomenclature");
×
269
        connectDoubleProperty(ui->planetsLabelsHorizontalSlider, "SolarSystem.labelsAmount",0.0,10.0);        
×
270
        connectCheckBox(ui->planetNomenclatureCheckBox, "actionShow_Planets_Nomenclature");
×
271
        ui->planetNomenclatureColor->setup("NomenclatureMgr.nomenclatureColor", "color/planet_nomenclature_color");
×
272
        connectBoolProperty(ui->outlineCratersCheckBox, "NomenclatureMgr.flagOutlineCraters");
×
273
        ui->planetLabelColor->setup("SolarSystem.labelsColor", "color/planet_names_color");
×
274
        ui->planetTrailsColor->setup("SolarSystem.trailsColor", "color/object_trails_color");
×
275
        connectBoolProperty(ui->planetTrailsCheckBox, "SolarSystem.trailsDisplayed");
×
276
        connectIntProperty(ui->planetTrailsThicknessSpinBox, "SolarSystem.trailsThickness");        
×
277
        connectBoolProperty(ui->planetIsolatedTrailsCheckBox, "SolarSystem.flagIsolatedTrails");
×
278
        connectIntProperty(ui->planetIsolatedTrailsSpinBox, "SolarSystem.numberIsolatedTrails");
×
279
        connectBoolProperty(ui->drawMoonHaloCheckBox, "SolarSystem.flagDrawMoonHalo");
×
280
        connectBoolProperty(ui->minorPlanetMarkersCheckBox, "SolarSystem.flagMarkers");
×
281
        connectDoubleProperty(ui->minorPlanetMarkerMagThresholdSpinBox, "SolarSystem.markerMagThreshold");
×
282
        connectBoolProperty(ui->drawSunGlareCheckBox, "SolarSystem.flagDrawSunHalo");
×
283
        connectBoolProperty(ui->drawSunCoronaCheckBox, "SolarSystem.flagPermanentSolarCorona");
×
284
        connectBoolProperty(ui->shadowEnlargementDanjonCheckBox, "SolarSystem.earthShadowEnlargementDanjon");
×
285
        populateTrailsControls(ssmgr->getFlagTrails());
×
286
        connect(ssmgr,SIGNAL(trailsDisplayedChanged(bool)), this, SLOT(populateTrailsControls(bool)));
×
287

288
        connectBoolProperty(ui->hidePlanetNomenclatureCheckBox, "NomenclatureMgr.flagHideLocalNomenclature");
×
289
        connectBoolProperty(ui->showTerminatorNomenclatureOnlyCheckBox, "NomenclatureMgr.flagShowTerminatorZoneOnly");
×
290
        connectIntProperty(ui->terminatorMinAltSpinbox, "NomenclatureMgr.terminatorMinAltitude");
×
291
        connectIntProperty(ui->terminatorMaxAltSpinbox, "NomenclatureMgr.terminatorMaxAltitude");
×
292
        connectBoolProperty(ui->showSpecialNomenclatureOnlyCheckBox, "NomenclatureMgr.specialNomenclatureOnlyDisplayed");
×
293
        StelModule* mnmgr = StelApp::getInstance().getModule("NomenclatureMgr");
×
294
        populateNomenclatureControls(mnmgr->property("flagShowNomenclature").toBool());
×
295
        connect(mnmgr, SIGNAL(flagShowNomenclatureChanged(bool)), this, SLOT(populateNomenclatureControls(bool)));
×
296

297
        populatePlanetMagnitudeAlgorithmsList();
×
298
        int idx = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::getApparentMagnitudeAlgorithm(), Qt::UserRole, Qt::MatchCaseSensitive);
×
299
        if (idx==-1)
×
300
        {
301
                // Use Mallama&Hilton_2018 as default
302
                idx = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::MallamaHilton_2018, Qt::UserRole, Qt::MatchCaseSensitive);
×
303
        }
304
        ui->planetMagnitudeAlgorithmComboBox->setCurrentIndex(idx);
×
305
        connect(ui->planetMagnitudeAlgorithmComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setPlanetMagnitudeAlgorithm(int)));
×
306
        populatePlanetMagnitudeAlgorithmDescription();
×
307

308
        // GreatRedSpot (Jupiter)
309
        connect(ui->pushButtonGrsDetails, SIGNAL(clicked()), this, SLOT(showGreatRedSpotDialog()));
×
310

311
        // Link Solar System Editor button if available...
312
        StelModule *sse=StelApp::getInstance().getModuleMgr().getModule("SolarSystemEditor", true);
×
313
        if (sse)
×
314
                connect(ui->pushButtonSSE, &QPushButton::clicked, sse, [=]{sse->configureGui(true);});
×
315
        else
316
                ui->pushButtonSSE->hide();
×
317

318
        // Shooting stars section
319
        StelModule* mmgr = StelApp::getInstance().getModule("SporadicMeteorMgr");
×
320
        Q_ASSERT(mmgr);
×
321
        connectIntProperty(ui->zhrSpinBox, "SporadicMeteorMgr.zhr");
×
322
        connectIntProperty(ui->zhrSlider, "SporadicMeteorMgr.zhr", ui->zhrSlider->minimum(), ui->zhrSlider->maximum());
×
323
        updateZhrDescription(mmgr->property("zhr").toInt());
×
324
        connect(mmgr, SIGNAL(zhrChanged(int)), this, SLOT(updateZhrDescription(int)));
×
325

326
        // DSO tab contents
327
        NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
×
328
        updateSelectedCatalogsCheckBoxes();
×
329
        connect(nmgr, SIGNAL(catalogFiltersChanged(int)), this, SLOT(updateSelectedCatalogsCheckBoxes()));
×
330
        connect(ui->selectAllCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectAllCatalogs()));
×
331
        connect(ui->selectStandardCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectStandardCatalogs()));
×
332
        connect(ui->selectPreferredCatalogs, SIGNAL(clicked()), nmgr, SLOT(loadCatalogFilters()));
×
333
        connect(ui->storePreferredCatalogs, SIGNAL(clicked()), nmgr, SLOT(storeCatalogFilters()));
×
334
        connect(ui->selectNoneCatalogs, SIGNAL(clicked()), nmgr, SLOT(selectNoneCatalogs()));
×
335
        connect(ui->buttonGroupDisplayedDSOCatalogs, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(setSelectedCatalogsFromCheckBoxes()));
×
336
        updateSelectedTypesCheckBoxes();
×
337
        connect(nmgr, SIGNAL(typeFiltersChanged(int)), this, SLOT(updateSelectedTypesCheckBoxes()));
×
338
        connect(ui->buttonGroupDisplayedDSOTypes, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(setSelectedTypesFromCheckBoxes()));
×
339
        connectGroupBox(ui->groupBoxDSOTypeFilters,"actionSet_Nebula_TypeFilterUsage");
×
340
        // DSO Labels section
341
        connectGroupBox(ui->groupBoxDSOLabelsAndMarkers, "actionShow_Nebulas");
×
342
        connectDoubleProperty(ui->nebulasLabelsHorizontalSlider, "NebulaMgr.labelsAmount",0.0,10.0);
×
343
        connectDoubleProperty(ui->nebulasHintsHorizontalSlider, "NebulaMgr.hintsAmount",0.0,10.0);
×
344
        connectDoubleProperty(ui->hintsBrightnessDoubleSpinBox, "NebulaMgr.hintsBrightness");
×
345
        connectDoubleProperty(ui->labelsBrightnessDoubleSpinBox, "NebulaMgr.labelsBrightness");
×
346
        connectBoolProperty(ui->checkBoxDesignationsOnlyUsage, "NebulaMgr.flagDesignationLabels");
×
347
        connectBoolProperty(ui->checkBoxProportionalHints, "NebulaMgr.hintsProportional");
×
348
        connectBoolProperty(ui->checkBoxOutlines, "NebulaMgr.flagOutlinesDisplayed");
×
349
        connectBoolProperty(ui->checkBoxSurfaceBrightnessUsage, "NebulaMgr.flagSurfaceBrightnessUsage");
×
350
        connectBoolProperty(ui->nebulaLimitMagnitudeCheckBox,"StelSkyDrawer.flagNebulaMagnitudeLimit");
×
351
        connectBoolProperty(ui->checkBoxAdditionalNamesDSO, "NebulaMgr.flagAdditionalNamesDisplayed");
×
352
        connectBoolProperty(ui->checkBoxShowOnlyNamedDSO, "NebulaMgr.flagShowOnlyNamedDSO");
×
353
        connectDoubleProperty(ui->nebulaLimitMagnitudeDoubleSpinBox,"StelSkyDrawer.customNebulaMagLimit");
×
354
        connectBoolProperty(ui->nebulaLimitSizeCheckBox, "NebulaMgr.flagUseSizeLimits");
×
355
        connectDoubleProperty(ui->nebulaLimitSizeMinDoubleSpinBox, "NebulaMgr.minSizeLimit");
×
356
        connectDoubleProperty(ui->nebulaLimitSizeMaxDoubleSpinBox, "NebulaMgr.maxSizeLimit");
×
357
        connect(ui->pushButtonConfigureDSOColors, SIGNAL(clicked()), this, SLOT(showConfigureDSOColorsDialog()));
×
358

359
        // Landscape section
360
        connectCheckBox(ui->showGroundCheckBox, "actionShow_Ground");
×
361
        connectCheckBox(ui->showFogCheckBox, "actionShow_Fog");
×
362
        connectCheckBox(ui->atmosphereCheckBox, "actionShow_Atmosphere");
×
363
        connectCheckBox(ui->landscapeIlluminationCheckBox, "actionShow_LandscapeIllumination");
×
364
        connectCheckBox(ui->landscapeLabelsCheckBox, "actionShow_LandscapeLabels");
×
365

366
        connectBoolProperty(ui->landscapeLocationCheckBox, "LandscapeMgr.flagLandscapeSetsLocation");
×
367
        ui->labelsColorButton->setup("LandscapeMgr.labelColor", "landscape/label_color");
×
368
        ui->polygonColorButton->setup("LandscapeMgr.polyLineColor", "landscape/polyline_color");
×
369
        connectIntProperty(ui->landscapeLabelsFontSizeSpinBox, "LandscapeMgr.labelFontSize");
×
370
        connectIntProperty(ui->landscapeLabelsAngleSpinBox, "LandscapeMgr.labelAngle");
×
371

372
        connectBoolProperty(ui->landscapeBrightnessCheckBox,"LandscapeMgr.flagLandscapeUseMinimalBrightness");
×
373
        connect(lmgr,SIGNAL(flagLandscapeUseMinimalBrightnessChanged(bool)),ui->localLandscapeBrightnessCheckBox,SLOT(setEnabled(bool)));
×
374
        connect(lmgr,SIGNAL(flagLandscapeUseMinimalBrightnessChanged(bool)),ui->landscapeBrightnessSpinBox,SLOT(setEnabled(bool)));
×
375
        ui->localLandscapeBrightnessCheckBox->setEnabled(lmgr->property("flagLandscapeUseMinimalBrightness").toBool());
×
376
        ui->landscapeBrightnessSpinBox->setEnabled(lmgr->property("flagLandscapeUseMinimalBrightness").toBool());
×
377
        connectDoubleProperty(ui->landscapeBrightnessSpinBox,"LandscapeMgr.defaultMinimalBrightness");
×
378
        connectBoolProperty(ui->landscapeTransparencyCheckBox,"LandscapeMgr.flagLandscapeUseTransparency");
×
379
        connectDoubleProperty(ui->landscapeTransparencySpinBox,"LandscapeMgr.landscapeTransparency");
×
380
        connectBoolProperty(ui->localLandscapeBrightnessCheckBox,"LandscapeMgr.flagLandscapeSetsMinimalBrightness");
×
381
        connectBoolProperty(ui->landscapePolylineCheckBox, "LandscapeMgr.flagPolyLineDisplayedOnly");
×
382
        connectIntProperty(ui->landscapePolylineThicknessSpinBox, "LandscapeMgr.polyLineThickness");
×
383
        connect(ui->landscapesListWidget, &QListWidget::currentItemChanged, this, [=](QListWidgetItem *newItem, QListWidgetItem *oldItem){
×
384
                Q_UNUSED(oldItem)
385
                GETSTELMODULE(LandscapeMgr)->setCurrentLandscapeName(newItem->data(Qt::UserRole).toString());
×
386
        });
×
387
        connect(lmgr, SIGNAL(currentLandscapeChanged(QString,QString)), this, SLOT(landscapeChanged(QString,QString)));
×
388
        connect(ui->useAsDefaultLandscapeCheckBox, SIGNAL(clicked()), this, SLOT(setCurrentLandscapeAsDefault()));
×
389
        connect(lmgr,SIGNAL(defaultLandscapeChanged(QString)),this,SLOT(updateDefaultLandscape()));
×
390
        updateDefaultLandscape();
×
391
        connect(lmgr, SIGNAL(landscapesChanged()), this, SLOT(populateLists()));
×
392
        connect(ui->pushButtonAddRemoveLandscapes, SIGNAL(clicked()), this, SLOT(showAddRemoveLandscapesDialog()));
×
393

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

486
        ui->colorEclipticGridJ2000       ->setup("GridLinesMgr.eclipticJ2000GridColor",         "color/ecliptical_J2000_color");
×
487
        ui->colorEclipticGridOfDate      ->setup("GridLinesMgr.eclipticGridColor",              "color/ecliptical_color");
×
488
        ui->colorEquatorialJ2000Grid     ->setup("GridLinesMgr.equatorJ2000GridColor",          "color/equatorial_J2000_color");
×
489
        ui->colorEquatorialGrid          ->setup("GridLinesMgr.equatorGridColor",               "color/equatorial_color");
×
490
        ui->colorFixedEquatorialGrid     ->setup("GridLinesMgr.fixedEquatorGridColor",          "color/fixed_equatorial_color");
×
491
        ui->colorGalacticGrid            ->setup("GridLinesMgr.galacticGridColor",              "color/galactic_color");
×
492
        ui->colorSupergalacticGrid       ->setup("GridLinesMgr.supergalacticGridColor",         "color/supergalactic_color");
×
493
        ui->colorAzimuthalGrid           ->setup("GridLinesMgr.azimuthalGridColor",             "color/azimuthal_color");
×
494
        ui->colorEclipticLineJ2000       ->setup("GridLinesMgr.eclipticJ2000LineColor",         "color/ecliptic_J2000_color");
×
495
        ui->colorEclipticLineOfDate      ->setup("GridLinesMgr.eclipticLineColor",              "color/ecliptic_color");
×
496
        ui->colorInvariablePlane         ->setup("GridLinesMgr.invariablePlaneLineColor",       "color/invariable_plane_color");
×
497
        ui->colorSolarEquatorLine        ->setup("GridLinesMgr.solarEquatorLineColor",          "color/solar_equator_color");
×
498
        ui->colorEquatorJ2000Line        ->setup("GridLinesMgr.equatorJ2000LineColor",          "color/equator_J2000_color");
×
499
        ui->colorEquatorLine             ->setup("GridLinesMgr.equatorLineColor",               "color/equator_color");
×
500
        ui->colorFixedEquatorLine        ->setup("GridLinesMgr.fixedEquatorLineColor",          "color/fixed_equator_color");
×
501
        ui->colorGalacticEquatorLine     ->setup("GridLinesMgr.galacticEquatorLineColor",       "color/galactic_equator_color");
×
502
        ui->colorSupergalacticEquatorLine->setup("GridLinesMgr.supergalacticEquatorLineColor",  "color/supergalactic_equator_color");
×
503
        ui->colorHorizonLine             ->setup("GridLinesMgr.horizonLineColor",               "color/horizon_color");
×
504
        ui->colorLongitudeLine           ->setup("GridLinesMgr.longitudeLineColor",             "color/oc_longitude_color");
×
505
        ui->colorQuadratureLine          ->setup("GridLinesMgr.quadratureLineColor",            "color/quadrature_color");
×
506
        ui->colorColuresLine             ->setup("GridLinesMgr.colureLinesColor",               "color/colures_color");
×
507
        ui->colorCircumpolarCircles      ->setup("GridLinesMgr.circumpolarCirclesColor",        "color/circumpolar_circles_color");
×
508
        ui->colorUmbraCircle             ->setup("GridLinesMgr.umbraCircleColor",               "color/umbra_circle_color");
×
509
        ui->colorPenumbraCircle          ->setup("GridLinesMgr.penumbraCircleColor",            "color/penumbra_circle_color");
×
510
        ui->colorPrecessionCircles       ->setup("GridLinesMgr.precessionCirclesColor",         "color/precession_circles_color");
×
511
        ui->colorPrimeVerticalLine       ->setup("GridLinesMgr.primeVerticalLineColor",         "color/prime_vertical_color");
×
512
        ui->colorCurrentVerticalLine     ->setup("GridLinesMgr.currentVerticalLineColor",       "color/current_vertical_color");
×
513
        ui->colorMeridianLine            ->setup("GridLinesMgr.meridianLineColor",              "color/meridian_color");
×
514
        ui->colorCelestialJ2000Poles     ->setup("GridLinesMgr.celestialJ2000PolesColor",       "color/celestial_J2000_poles_color");
×
515
        ui->colorCelestialPoles          ->setup("GridLinesMgr.celestialPolesColor",            "color/celestial_poles_color");
×
516
        ui->colorZenithNadir             ->setup("GridLinesMgr.zenithNadirColor",               "color/zenith_nadir_color");
×
517
        ui->colorEclipticJ2000Poles      ->setup("GridLinesMgr.eclipticJ2000PolesColor",        "color/ecliptic_J2000_poles_color");
×
518
        ui->colorEclipticPoles           ->setup("GridLinesMgr.eclipticPolesColor",             "color/ecliptic_poles_color");
×
519
        ui->colorGalacticPoles           ->setup("GridLinesMgr.galacticPolesColor",             "color/galactic_poles_color");
×
520
        ui->colorGalacticCenter          ->setup("GridLinesMgr.galacticCenterColor",            "color/galactic_center_color");
×
521
        ui->colorSupergalacticPoles      ->setup("GridLinesMgr.supergalacticPolesColor",        "color/supergalactic_poles_color");
×
522
        ui->colorEquinoxJ2000Points      ->setup("GridLinesMgr.equinoxJ2000PointsColor",        "color/equinox_J2000_points_color");
×
523
        ui->colorEquinoxPoints           ->setup("GridLinesMgr.equinoxPointsColor",             "color/equinox_points_color");
×
524
        ui->colorSolsticeJ2000Points     ->setup("GridLinesMgr.solsticeJ2000PointsColor",       "color/solstice_J2000_points_color");
×
525
        ui->colorSolsticePoints          ->setup("GridLinesMgr.solsticePointsColor",            "color/solstice_points_color");
×
526
        ui->colorAntisolarPoint          ->setup("GridLinesMgr.antisolarPointColor",            "color/antisolar_point_color");
×
527
        ui->colorApexPoints              ->setup("GridLinesMgr.apexPointsColor",                "color/apex_points_color");
×
528
        ui->colorFOVCenterMarker         ->setup("SpecialMarkersMgr.fovCenterMarkerColor",      "color/fov_center_marker_color");
×
529
        ui->colorFOVCircularMarker       ->setup("SpecialMarkersMgr.fovCircularMarkerColor",    "color/fov_circular_marker_color");
×
530
        ui->colorFOVRectangularMarker    ->setup("SpecialMarkersMgr.fovRectangularMarkerColor", "color/fov_rectangular_marker_color");
×
531
        ui->colorCardinalPoints          ->setup("LandscapeMgr.cardinalPointsColor",            "color/cardinal_color");
×
532
        ui->colorCompassMarks            ->setup("SpecialMarkersMgr.compassMarksColor",         "color/compass_marks_color");
×
533

534
#if (QT_VERSION<QT_VERSION_CHECK(6,7,0))
535
        connect(ui->showCardinalPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
536
        connect(ui->showOrdinal8WRPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
537
        connect(ui->showOrdinal16WRPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectedCardinalCheckBoxes()));
×
538
#else
539
        connect(ui->showCardinalPointsCheckBox, SIGNAL(checkStateChanged(Qt::CheckState)), this, SLOT(setSelectedCardinalCheckBoxes()));
540
        connect(ui->showOrdinal8WRPointsCheckBox, SIGNAL(checkStateChanged(Qt::CheckState)), this, SLOT(setSelectedCardinalCheckBoxes()));
541
        connect(ui->showOrdinal16WRPointsCheckBox, SIGNAL(checkStateChanged(Qt::CheckState)), this, SLOT(setSelectedCardinalCheckBoxes()));
542
#endif
543
        setSelectedCardinalCheckBoxes();
×
544

545
        // Projection
546
        connect(ui->projectionListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(changeProjection(const QString&)));
×
547
        connect(StelApp::getInstance().getCore(), SIGNAL(currentProjectionTypeChanged(StelCore::ProjectionType)),this,SLOT(projectionChanged()));
×
548
        connect(app, SIGNAL(flagShowDecimalDegreesChanged(bool)), this, SLOT(setDisplayFormatForSpins(bool)));
×
549
        connectDoubleProperty(ui->viewportOffsetSpinBox, "StelMovementMgr.viewportVerticalOffsetTarget");
×
550
        connectDoubleProperty(ui->userMaxFovSpinBox, "StelMovementMgr.userMaxFov");
×
551
        connectDoubleProperty(ui->currentFovSpinBox, "StelMovementMgr.currentFov");
×
552

553
        // Sky Culture
554
        connect(ui->useAsDefaultSkyCultureCheckBox, SIGNAL(clicked()), this, SLOT(setCurrentCultureAsDefault()));
×
555
        connect(&StelApp::getInstance().getSkyCultureMgr(), &StelSkyCultureMgr::defaultSkyCultureIDChanged,
×
556
                this, &ViewDialog::updateDefaultSkyCulture);
557
        updateDefaultSkyCulture();
×
558

559
        configureSkyCultureCheckboxes();
×
560
        StelSkyCultureMgr *scMgr=GETSTELMODULE(StelSkyCultureMgr);
×
561
        connect(scMgr, &StelSkyCultureMgr::screenLabelStyleChanged, this, &ViewDialog::configureSkyCultureCheckboxes);
×
562
        connect(scMgr, &StelSkyCultureMgr::infoLabelStyleChanged, this, &ViewDialog::configureSkyCultureCheckboxes);
×
563

564
        connect(ui->infoLabelNativeCheckBox           , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
565
        connect(ui->infoLabelPronounceCheckBox        , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
566
        connect(ui->infoLabelTransliterationCheckBox  , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
567
        connect(ui->infoLabelTranslationCheckBox      , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
568
        connect(ui->infoLabelIPACheckBox              , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
569
        connect(ui->infoLabelModernCheckBox           , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureInfoStyleFromCheckboxes);
×
570

571
        connect(ui->screenLabelNativeCheckBox         , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
572
        connect(ui->screenLabelPronounceCheckBox      , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
573
        connect(ui->screenLabelTransliterationCheckBox, &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
574
        connect(ui->screenLabelTranslationCheckBox    , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
575
        connect(ui->screenLabelIPACheckBox            , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
576
        connect(ui->screenLabelModernCheckBox         , &QCheckBox::clicked, this, &ViewDialog::updateSkyCultureScreenStyleFromCheckboxes);
×
577

578
        connectBoolProperty(ui->abbreviatedNamesCheckBox,               "StelSkyCultureMgr.flagUseAbbreviatedNames");
×
579
        connectCheckBox(ui->showConstellationLinesCheckBox,             "actionShow_Constellation_Lines");
×
580
        connectIntProperty(ui->constellationLineThicknessSpinBox,       "ConstellationMgr.constellationLineThickness");
×
581
        connectCheckBox(ui->showConstellationLabelsCheckBox,            "actionShow_Constellation_Labels");
×
582
        connectCheckBox(ui->showConstellationBoundariesCheckBox,        "actionShow_Constellation_Boundaries");
×
583
        connectIntProperty(ui->constellationBoundariesThicknessSpinBox,        "ConstellationMgr.boundariesThickness");
×
584
        connectCheckBox(ui->showConstellationArtCheckBox,               "actionShow_Constellation_Art");
×
585
        connectDoubleProperty(ui->constellationArtBrightnessSpinBox,    "ConstellationMgr.artIntensity");
×
586

587
        // fade duration
588
        connectDoubleProperty(ui->artFadeDurationDoubleSpinBox,           "ConstellationMgr.artFadeDuration");
×
589
        connectDoubleProperty(ui->boundariesFadeDurationDoubleSpinBox,    "ConstellationMgr.boundariesFadeDuration");
×
590
        connectDoubleProperty(ui->linesFadeDurationDoubleSpinBox,         "ConstellationMgr.linesFadeDuration");
×
591
        connectDoubleProperty(ui->namesFadeDurationDoubleSpinBox,         "ConstellationMgr.namesFadeDuration");
×
592
        connectDoubleProperty(ui->asterismNamesFadeDurationDoubleSpinBox, "AsterismMgr.namesFadeDuration");
×
593
        connectDoubleProperty(ui->asterismLinesFadeDurationDoubleSpinBox, "AsterismMgr.linesFadeDuration");
×
594
        connectDoubleProperty(ui->rayHelpersFadeDurationDoubleSpinBox,    "AsterismMgr.rayHelpersFadeDuration");
×
595

596
        ui->colorConstellationBoundaries->setup("ConstellationMgr.boundariesColor", "color/const_boundary_color");
×
597
        ui->colorConstellationLabels    ->setup("ConstellationMgr.namesColor",      "color/const_names_color");
×
598
        ui->colorConstellationLines     ->setup("ConstellationMgr.linesColor",      "color/const_lines_color");
×
599

600
        connectCheckBox(ui->showAsterismLinesCheckBox,          "actionShow_Asterism_Lines");
×
601
        connectIntProperty(ui->asterismLineThicknessSpinBox,    "AsterismMgr.asterismLineThickness");
×
602
        connectCheckBox(ui->showAsterismLabelsCheckBox,         "actionShow_Asterism_Labels");
×
603
        connectCheckBox(ui->showRayHelpersCheckBox,             "actionShow_Ray_Helpers");
×
604
        connectIntProperty(ui->rayHelperThicknessSpinBox,       "AsterismMgr.rayHelperThickness");
×
605

606
        connectBoolProperty(ui->selectSingleConstellationCheckBox, "ConstellationMgr.isolateSelected");
×
607
        connectBoolProperty(ui->constellationPickCheckBox,         "ConstellationMgr.flagConstellationPick");
×
608

609
        ui->colorAsterismLabels->setup("AsterismMgr.namesColor",      "color/asterism_names_color");
×
610
        ui->colorAsterismLines ->setup("AsterismMgr.linesColor",      "color/asterism_lines_color");
×
611
        ui->colorRayHelpers    ->setup("AsterismMgr.rayHelpersColor", "color/rayhelper_lines_color");
×
612

613
        QSettings *conf=StelApp::getInstance().getSettings();
×
614
        if (conf->value("gui/skyculture_enable_hulls", "false").toBool())
×
615
        {
616
                connectCheckBox(ui->constellationHullsCheckBox,                          "actionShow_Constellation_Hulls");
×
617
                ui->constellationHullsColorButton                               ->setup("ConstellationMgr.hullsColor",  "color/const_hulls_color");
×
618
                connectIntProperty(ui->constellationHullsThicknessSpinBox,              "ConstellationMgr.hullsThickness");
×
619
                connectDoubleProperty(ui->constellationHullsFadeDurationDoubleSpinBox,  "ConstellationMgr.hullsFadeDuration");
×
620
        }
621
        else
622
        {
623
                ui->constellationHullsCheckBox->hide();
×
624
                ui->constellationHullsColorButton->hide();
×
625
                ui->constellationHullsThicknessSpinBox->hide();
×
626
                ui->constellationHullsFadeDurationDoubleSpinBox->hide();
×
627
        }
628

629
        connectBoolProperty(ui->zodiacCheckBox, "ConstellationMgr.zodiacDisplayed");
×
630
        connectBoolProperty(ui->lunarSystemCheckBox, "ConstellationMgr.lunarSystemDisplayed");
×
631
        ui->zodiacColorButton->setup("ConstellationMgr.zodiacColor", "color/sc_zodiac_color");
×
632
        ui->lunarSystemColorButton->setup("ConstellationMgr.lunarSystemColor", "color/sc_lunarsystem_color");
×
633

634
        connectIntProperty(ui->zodiacThicknessSpinBox,                        "ConstellationMgr.zodiacThickness");
×
635
        connectIntProperty(ui->lunarSystemThicknessSpinBox,                "ConstellationMgr.lunarSystemThickness");
×
636
        connectDoubleProperty(ui->zodiacFadeDurationDoubleSpinBox,      "ConstellationMgr.zodiacFadeDuration");
×
637
        connectDoubleProperty(ui->lunarSystemFadeDurationDoubleSpinBox, "ConstellationMgr.lunarSystemFadeDuration");
×
638

639

640
        // Font selection
641
        connectIntProperty(ui->constellationsFontSizeSpinBox, "ConstellationMgr.fontSize");
×
642
        connectIntProperty(ui->asterismsFontSizeSpinBox,      "AsterismMgr.fontSize");
×
643

644
        // Hips mgr.
645
        populateHipsGroups();
×
646
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");        
×
647
        // HiPS updates may be very frequent when we are getting a list of
648
        // surveys, we don't want to update the widget on each of them, so the
649
        // timer is used to delay the update a bit.
650
        hipsUpdateTimer.setInterval(50);
×
651
        hipsUpdateTimer.setSingleShot(true);
×
652
        connect(&hipsUpdateTimer, &QTimer::timeout, this, &ViewDialog::updateHips);
×
653
        connect(qobject_cast<HipsMgr*>(hipsmgr), &HipsMgr::surveysChanged, this,
×
654
                [this]{ if(!hipsUpdateTimer.isActive()) hipsUpdateTimer.start(); });
×
655

656
        connect(ui->surveyTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateHips()));
×
657
        connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(updateHips()));
×
658
        connect(ui->surveysListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(updateHips()), Qt::QueuedConnection);
×
659
        connect(ui->surveysListWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(hipsListItemChanged(QListWidgetItem*)));
×
660
        connect(ui->surveysFilter, &QLineEdit::textChanged, this, &ViewDialog::filterSurveys);
×
661
        updateHips();
×
662

663
        updateTabBarListWidgetWidth();
×
664

665
        connect((dynamic_cast<StelGui*>(StelApp::getInstance().getGui())), &StelGui::htmlStyleChanged, this, [=](const QString &style){
×
666
                ui->surveysTextBrowser->document()->setDefaultStyleSheet(style);
×
667
                ui->projectionTextBrowser->document()->setDefaultStyleSheet(style);
×
668
                ui->landscapeTextBrowser->document()->setDefaultStyleSheet(style);
×
669
                ui->skyCultureTextBrowser->document()->setDefaultStyleSheet(style);
×
670
        });
×
671
}
×
672

673
bool ViewDialog::eventFilter(QObject* object, QEvent* event)
×
674
{
675
        if (object != dialog || event->type() != QEvent::KeyPress)
×
676
                return false;
×
677
        const auto keyEvent = static_cast<QKeyEvent*>(event);
×
678
        if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)
×
679
                return true; // Prevent these keys pressing buttons when focus is not on the buttons
×
680
        return false;
×
681
}
682

683
void ViewDialog::setDisplayFormatForSpins(bool flagDecimalDegrees)
×
684
{
685
        int places = 0;
×
686
        AngleSpinBox::DisplayFormat format = AngleSpinBox::DMSSymbols;
×
687
        if (flagDecimalDegrees)
×
688
        {
689
                places = 5;
×
690
                format = AngleSpinBox::DecimalDeg;
×
691
        }
692
        ui->currentFovSpinBox->setDecimals(places);
×
693
        ui->currentFovSpinBox->setDisplayFormat(format);
×
694
}
×
695

696
void ViewDialog::populateOrbitsControls(bool flag)
×
697
{
698
        ui->planetIsolatedOrbitCheckBox->setEnabled(flag);
×
699
        ui->planetOrbitMajorPlanetsCheckBox->setEnabled(flag);
×
700
        ui->planetOrbitOnlyCheckBox->setEnabled(flag);
×
701
        ui->planetOrbitsMoonCheckBox->setEnabled(flag);
×
702
        ui->planetOrbitPermanentCheckBox->setEnabled(flag);
×
703
        ui->planetOrbitsThicknessSpinBox->setEnabled(flag);
×
704
        ui->pushButtonOrbitColors->setEnabled(flag);
×
705
}
×
706

707
void ViewDialog::populateTrailsControls(bool flag)
×
708
{
709
        ui->planetIsolatedTrailsCheckBox->setEnabled(flag);
×
710
        ui->planetIsolatedTrailsSpinBox->setEnabled(flag);
×
711
        ui->planetTrailsThicknessSpinBox->setEnabled(flag);
×
712
}
×
713

714
void ViewDialog::populateNomenclatureControls(bool flag)
×
715
{
716
        ui->hidePlanetNomenclatureCheckBox->setEnabled(flag);
×
717
        ui->showSpecialNomenclatureOnlyCheckBox->setEnabled(flag);
×
718
        ui->outlineCratersCheckBox->setEnabled(flag);
×
719
        ui->showTerminatorNomenclatureOnlyCheckBox->setEnabled(flag);
×
720
        ui->terminatorMinAltSpinbox->setEnabled(flag);
×
721
        ui->terminatorMaxAltSpinbox->setEnabled(flag);
×
722
        ui->labelTerminator->setEnabled(flag);
×
723
}
×
724

725
// Heuristic function to decide in which group to put a survey.
726
static QString getHipsType(const HipsSurveyP hips)
×
727
{
728
        QJsonObject properties = hips->property("properties").toJsonObject();
×
729
        if (!hips->isPlanetarySurvey())
×
730
                return "dss";
×
731
        if (properties["type"].toString() == "planet") // TODO: switch to use hips->isPlanetarySurvey() and multiple surveys for Solar system bodies
×
732
                return "sol";
×
733
        return "other";
×
734
}
×
735

736
void ViewDialog::updateHips()
×
737
{
738
        if (!ui->page_surveys->isVisible()) return;
×
739
        StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
740
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");
×
741
        QMetaObject::invokeMethod(hipsmgr, "loadSources");
×
742

743
        QComboBox* typeComboBox = ui->surveyTypeComboBox;
×
744
        QVariant selectedType = typeComboBox->itemData(typeComboBox->currentIndex());
×
745
        if (selectedType.isNull())
×
746
                selectedType = "dss";
×
747

748
        // Update survey list.
749
        QListWidget* l = ui->surveysListWidget;
×
750

751
        if (!hipsmgr->property("loaded").toBool())
×
752
        {
753
                l->clear();
×
754
                new QListWidgetItem(q_("Loading..."), l);
×
755
                return;
×
756
        }
757

758
        QString currentSurvey = l->currentItem() ? l->currentItem()->data(Qt::UserRole).toString() : "";
×
759
        QListWidgetItem* currentItem = nullptr;
×
760
        HipsSurveyP currentHips;
×
761

762
        l->blockSignals(true);
×
763
        l->clear();
×
764
        const QList<HipsSurveyP> hipslist = hipsmgr->property("surveys").value<QList<HipsSurveyP>>();
×
765

766
        for (auto &hips: hipslist)
×
767
        {
768
                if (getHipsType(hips) != selectedType)
×
769
                        continue;
×
770
                QString url = hips->property("url").toString();
×
771
                QJsonObject properties = hips->property("properties").toJsonObject();
×
772
                QString title = properties["obs_title"].toString();
×
773
                if (title.isEmpty())
×
774
                        continue;
×
775
                QListWidgetItem* item = new QListWidgetItem(title, l);
×
776
                item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
×
777
                item->setCheckState(hips->property("visible").toBool() ? Qt::Checked : Qt::Unchecked);
×
778
                item->setData(Qt::UserRole, url);
×
779
                if (url == currentSurvey)
×
780
                {
781
                        currentItem = item;
×
782
                        currentHips = hips;
×
783
                }
784
                disconnect(hips.data(), nullptr, this, nullptr);
×
785
                connect(hips.data(), SIGNAL(statusChanged()), this, SLOT(updateHips()));
×
786
        }
×
787
        l->sortItems(Qt::AscendingOrder);
×
788
        l->setCurrentItem(currentItem);
×
789
        l->scrollToItem(currentItem);
×
790
        l->blockSignals(false);
×
791

792
        if (!currentHips)
×
793
        {
794
                ui->surveysTextBrowser->setText("");
×
795
        }
796
        else
797
        {
798
                QJsonObject props = currentHips->property("properties").toJsonObject();
×
799
                QString html = QString("<h1>%1</h1>\n").arg(props["obs_title"].toString());
×
800
                if (props.contains("obs_copyright") && props.contains("obs_copyright_url"))
×
801
                {
802
                        html += QString("<p>Copyright <a href='%2'>%1</a></p>\n")
×
803
                                        .arg(props["obs_copyright"].toString(), props["obs_copyright_url"].toString());
×
804
                }
805
                html += QString("<p>%1</p>\n").arg(props["obs_description"].toString());
×
806
                html += "<h2>" + q_("properties") + "</h2>\n<ul>\n";
×
807
                for (auto iter = props.constBegin(); iter != props.constEnd(); iter++)
×
808
                {
809
                        html += QString("<li><b>%1</b> %2</li>\n").arg(iter.key(), iter.value().toString());
×
810
                }
811
                html += "</ul>\n";
×
812
                if (gui)
×
813
                        ui->surveysTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
814
                ui->surveysTextBrowser->setHtml(html);
×
815
        }
×
816
        filterSurveys();
×
817
}
×
818

819
void ViewDialog::populateHipsGroups()
×
820
{
821
        // Update the groups combobox.
822
        QComboBox* typeComboBox = ui->surveyTypeComboBox;
×
823
        int index = typeComboBox->currentIndex();
×
824
        QVariant selectedType = typeComboBox->itemData(index);
×
825
        if (selectedType.isNull())
×
826
                selectedType = "dss";
×
827
        typeComboBox->clear();
×
828
        typeComboBox->addItem(q_("Deep Sky"), "dss");
×
829
        typeComboBox->addItem(q_("Solar System"), "sol");
×
830
        index = typeComboBox->findData(selectedType, Qt::UserRole, Qt::MatchCaseSensitive);
×
831
        typeComboBox->setCurrentIndex(index);
×
832
}
×
833

834
void ViewDialog::toggleHipsDialog()
×
835
{
836
        if (visible())
×
837
        {
838
                if (ui->stackListWidget->currentRow() == Page::Surveys)
×
839
                {
840
                        setVisible(false);
×
841
                }
842
                else
843
                {
844
                        ui->stackListWidget->setCurrentRow(Page::Surveys);
×
845
                        // Force it to become active and bring it to the top
846
                        setVisible(false);
×
847
                        setVisible(true);
×
848
                }
849
        }
850
        else
851
        {
852
                setVisible(true);
×
853
                ui->stackListWidget->setCurrentRow(Page::Surveys);
×
854
        }
855
}
×
856

857
void ViewDialog::filterSurveys()
×
858
{
859
        const QString pattern = ui->surveysFilter->text().simplified();
×
860
        const auto& list = *ui->surveysListWidget;
×
861
        for (int row = 0; row < list.count(); ++row)
×
862
        {
863
                auto& item = *list.item(row);
×
864
                const QString text = item.text().simplified();
×
865
                const bool show = pattern.isEmpty() || text.contains(pattern, Qt::CaseInsensitive);
×
866
                item.setHidden(!show);
×
867
        }
×
868
}
×
869

870
void ViewDialog::hipsListItemChanged(QListWidgetItem* item)
×
871
{
872
        QListWidget* l = item->listWidget();
×
873
        l->blockSignals(true);
×
874
        StelModule *hipsmgr = StelApp::getInstance().getModule("HipsMgr");
×
875
        QString url = item->data(Qt::UserRole).toString();
×
876
        HipsSurveyP hips;
×
877
        QMetaObject::invokeMethod(hipsmgr, "getSurveyByUrl", Qt::DirectConnection,
×
878
                        Q_RETURN_ARG(HipsSurveyP, hips), Q_ARG(QString, url));
×
879
        Q_ASSERT(hips);
×
880
        if (item->checkState() == Qt::Checked)
×
881
        {
882
                l->setCurrentItem(item);
×
883
                hips->setProperty("visible", true);
×
884
        }
885
        else
886
        {
887
                hips->setProperty("visible", false);
×
888
        }
889
        l->blockSignals(false);
×
890
}
×
891

892
void ViewDialog::updateTabBarListWidgetWidth()
×
893
{
894
        ui->stackListWidget->setWrapping(false);
×
895
        // Update list item sizes after translation
896
        ui->stackListWidget->adjustSize();
×
897
        QAbstractItemModel* model = ui->stackListWidget->model();
×
898
        if (!model)
×
899
                return;
×
900

901
        // stackListWidget->font() does not work properly!
902
        // It has a incorrect fontSize in the first loading, which produces the bug#995107.
903
        QFont font;
×
904
        font.setPixelSize(14);
×
905
        font.setWeight(QFont::Bold);
×
906
        QFontMetrics fontMetrics(font);
×
907
        int iconSize = ui->stackListWidget->iconSize().width();
×
908
        int width = 0;
×
909
        for (int row = 0; row < model->rowCount(); row++)
×
910
        {
911
                int textWidth = fontMetrics.boundingRect(ui->stackListWidget->item(row)->text()).width();
×
912
                width += iconSize > textWidth ? iconSize : textWidth; // use the wider one
×
913
                width += 24; // margin - 12px left and 12px right
×
914
        }
915
        // Hack to force the window to be resized...
916
        ui->stackListWidget->setMinimumWidth(width);
×
917
        ui->stackListWidget->updateGeometry();
×
918
}
×
919

920
void ViewDialog::setSelectedCardinalCheckBoxes()
×
921
{
922
        StelPropertyMgr* propMgr = StelApp::getInstance().getStelPropertyManager();
×
923
        bool cardinals = propMgr->getProperty("LandscapeMgr.cardinalPointsDisplayed")->getValue().toBool();
×
924
        bool ordinals = propMgr->getProperty("LandscapeMgr.ordinalPointsDisplayed")->getValue().toBool();
×
925
        bool secondary = propMgr->getProperty("LandscapeMgr.ordinal16WRPointsDisplayed")->getValue().toBool();
×
926
        ui->showOrdinal8WRPointsCheckBox->setEnabled(cardinals);
×
927
        ui->showOrdinal16WRPointsCheckBox->setEnabled(cardinals && ordinals);
×
928
        ui->showOrdinal32WRPointsCheckBox->setEnabled(cardinals && ordinals && secondary);
×
929
}
×
930

931
void ViewDialog::setSelectedCatalogsFromCheckBoxes()
×
932
{
933
        Nebula::CatalogGroup flags(Nebula::CatNone);
×
934
        if (ui->checkBoxNGC->isChecked())
×
935
                flags |= Nebula::CatNGC;
×
936
        if (ui->checkBoxIC->isChecked())
×
937
                flags |= Nebula::CatIC;
×
938
        if (ui->checkBoxM->isChecked())
×
939
                flags |= Nebula::CatM;
×
940
        if (ui->checkBoxC->isChecked())
×
941
                flags |= Nebula::CatC;
×
942
        if (ui->checkBoxB->isChecked())
×
943
                flags |= Nebula::CatB;
×
944
        if (ui->checkBoxSh2->isChecked())
×
945
                flags |= Nebula::CatSh2;
×
946
        if (ui->checkBoxVdB->isChecked())
×
947
                flags |= Nebula::CatVdB;
×
948
        if (ui->checkBoxRCW->isChecked())
×
949
                flags |= Nebula::CatRCW;
×
950
        if (ui->checkBoxLBN->isChecked())
×
951
                flags |= Nebula::CatLBN;
×
952
        if (ui->checkBoxLDN->isChecked())
×
953
                flags |= Nebula::CatLDN;
×
954
        if (ui->checkBoxCr->isChecked())
×
955
                flags |= Nebula::CatCr;
×
956
        if (ui->checkBoxMel->isChecked())
×
957
                flags |= Nebula::CatMel;
×
958
        if (ui->checkBoxCed->isChecked())
×
959
                flags |= Nebula::CatCed;
×
960
        if (ui->checkBoxPGC->isChecked())
×
961
                flags |= Nebula::CatPGC;
×
962
        if (ui->checkBoxUGC->isChecked())
×
963
                flags |= Nebula::CatUGC;
×
964
        if (ui->checkBoxArp->isChecked())
×
965
                flags |= Nebula::CatArp;
×
966
        if (ui->checkBoxVV->isChecked())
×
967
                flags |= Nebula::CatVV;
×
968
        if (ui->checkBoxPK->isChecked())
×
969
                flags |= Nebula::CatPK;
×
970
        if (ui->checkBoxPNG->isChecked())
×
971
                flags |= Nebula::CatPNG;
×
972
        if (ui->checkBoxSNRG->isChecked())
×
973
                flags |= Nebula::CatSNRG;
×
974
        if (ui->checkBoxACO->isChecked())
×
975
                flags |= Nebula::CatACO;
×
976
        if (ui->checkBoxHCG->isChecked())
×
977
                flags |= Nebula::CatHCG;        
×
978
        if (ui->checkBoxESO->isChecked())
×
979
                flags |= Nebula::CatESO;
×
980
        if (ui->checkBoxVdBH->isChecked())
×
981
                flags |= Nebula::CatVdBH;
×
982
        if (ui->checkBoxDWB->isChecked())
×
983
                flags |= Nebula::CatDWB;
×
984
        if (ui->checkBoxTr->isChecked())
×
985
                flags |= Nebula::CatTr;
×
986
        if (ui->checkBoxSt->isChecked())
×
987
                flags |= Nebula::CatSt;
×
988
        if (ui->checkBoxRu->isChecked())
×
989
                flags |= Nebula::CatRu;
×
990
        if (ui->checkBoxVdBHa->isChecked())
×
991
                flags |= Nebula::CatVdBHa;
×
992
        if (ui->checkBoxOther->isChecked())
×
993
                flags |= Nebula::CatOther;
×
994

995
        GETSTELMODULE(NebulaMgr)->setCatalogFilters(flags);
×
996
}
×
997

998
void ViewDialog::setSelectedTypesFromCheckBoxes()
×
999
{
1000
        Nebula::TypeGroup flags(Nebula::TypeNone);
×
1001
        if (ui->checkBoxGalaxiesType->isChecked())
×
1002
                flags |= Nebula::TypeGalaxies;
×
1003
        if (ui->checkBoxActiveGalaxiesType->isChecked())
×
1004
                flags |= Nebula::TypeActiveGalaxies;
×
1005
        if (ui->checkBoxInteractingGalaxiesType->isChecked())
×
1006
                flags |= Nebula::TypeInteractingGalaxies;
×
1007
        if (ui->checkBoxOpenStarClustersType->isChecked())
×
1008
                flags |= Nebula::TypeOpenStarClusters;
×
1009
        if (ui->checkBoxGlobularStarClustersType->isChecked())
×
1010
                flags |= Nebula::TypeGlobularStarClusters;
×
1011
        if (ui->checkBoxBrightNebulaeType->isChecked())
×
1012
                flags |= Nebula::TypeBrightNebulae;
×
1013
        if (ui->checkBoxDarkNebulaeType->isChecked())
×
1014
                flags |= Nebula::TypeDarkNebulae;
×
1015
        if (ui->checkBoxPlanetaryNebulaeType->isChecked())
×
1016
                flags |= Nebula::TypePlanetaryNebulae;
×
1017
        if (ui->checkBoxHydrogenRegionsType->isChecked())
×
1018
                flags |= Nebula::TypeHydrogenRegions;
×
1019
        if (ui->checkBoxSupernovaRemnantsType->isChecked())
×
1020
                flags |= Nebula::TypeSupernovaRemnants;
×
1021
        if (ui->checkBoxGalaxyClustersType->isChecked())
×
1022
                flags |= Nebula::TypeGalaxyClusters;
×
1023
        if (ui->checkBoxOtherType->isChecked())
×
1024
                flags |= Nebula::TypeOther;
×
1025

1026
        GETSTELMODULE(NebulaMgr)->setTypeFilters(flags);
×
1027

1028
        StelApp::immediateSave("dso_type_filters/flag_show_galaxies",             flags.testFlag(Nebula::TypeGalaxies));
×
1029
        StelApp::immediateSave("dso_type_filters/flag_show_active_galaxies",      flags.testFlag(Nebula::TypeActiveGalaxies));
×
1030
        StelApp::immediateSave("dso_type_filters/flag_show_interacting_galaxies", flags.testFlag(Nebula::TypeInteractingGalaxies));
×
1031
        StelApp::immediateSave("dso_type_filters/flag_show_open_clusters",        flags.testFlag(Nebula::TypeOpenStarClusters));
×
1032
        StelApp::immediateSave("dso_type_filters/flag_show_globular_clusters",    flags.testFlag(Nebula::TypeGlobularStarClusters));
×
1033
        StelApp::immediateSave("dso_type_filters/flag_show_bright_nebulae",       flags.testFlag(Nebula::TypeBrightNebulae));
×
1034
        StelApp::immediateSave("dso_type_filters/flag_show_dark_nebulae",         flags.testFlag(Nebula::TypeDarkNebulae));
×
1035
        StelApp::immediateSave("dso_type_filters/flag_show_planetary_nebulae",    flags.testFlag(Nebula::TypePlanetaryNebulae));
×
1036
        StelApp::immediateSave("dso_type_filters/flag_show_hydrogen_regions",     flags.testFlag(Nebula::TypeHydrogenRegions));
×
1037
        StelApp::immediateSave("dso_type_filters/flag_show_supernova_remnants",   flags.testFlag(Nebula::TypeSupernovaRemnants));
×
1038
        StelApp::immediateSave("dso_type_filters/flag_show_galaxy_clusters",      flags.testFlag(Nebula::TypeGalaxyClusters));
×
1039
        StelApp::immediateSave("dso_type_filters/flag_show_other",                flags.testFlag(Nebula::TypeOther));
×
1040
}
×
1041

1042
void ViewDialog::updateSelectedCatalogsCheckBoxes()
×
1043
{
1044
        const Nebula::CatalogGroup flags = static_cast<Nebula::CatalogGroup>(GETSTELMODULE(NebulaMgr)->getCatalogFilters());
×
1045
        ui->checkBoxNGC->setChecked(flags & Nebula::CatNGC);
×
1046
        ui->checkBoxIC->setChecked(flags & Nebula::CatIC);
×
1047
        ui->checkBoxM->setChecked(flags & Nebula::CatM);
×
1048
        ui->checkBoxC->setChecked(flags & Nebula::CatC);
×
1049
        ui->checkBoxB->setChecked(flags & Nebula::CatB);
×
1050
        ui->checkBoxSh2->setChecked(flags & Nebula::CatSh2);
×
1051
        ui->checkBoxVdB->setChecked(flags & Nebula::CatVdB);
×
1052
        ui->checkBoxRCW->setChecked(flags & Nebula::CatRCW);
×
1053
        ui->checkBoxLDN->setChecked(flags & Nebula::CatLDN);
×
1054
        ui->checkBoxLBN->setChecked(flags & Nebula::CatLBN);
×
1055
        ui->checkBoxCr->setChecked(flags & Nebula::CatCr);
×
1056
        ui->checkBoxMel->setChecked(flags & Nebula::CatMel);
×
1057
        ui->checkBoxCed->setChecked(flags & Nebula::CatCed);
×
1058
        ui->checkBoxPGC->setChecked(flags & Nebula::CatPGC);
×
1059
        ui->checkBoxUGC->setChecked(flags & Nebula::CatUGC);
×
1060
        ui->checkBoxArp->setChecked(flags & Nebula::CatArp);
×
1061
        ui->checkBoxVV->setChecked(flags & Nebula::CatVV);
×
1062
        ui->checkBoxPK->setChecked(flags & Nebula::CatPK);
×
1063
        ui->checkBoxPNG->setChecked(flags & Nebula::CatPNG);
×
1064
        ui->checkBoxSNRG->setChecked(flags & Nebula::CatSNRG);
×
1065
        ui->checkBoxACO->setChecked(flags & Nebula::CatACO);
×
1066
        ui->checkBoxHCG->setChecked(flags & Nebula::CatHCG);        
×
1067
        ui->checkBoxESO->setChecked(flags & Nebula::CatESO);
×
1068
        ui->checkBoxVdBH->setChecked(flags & Nebula::CatVdBH);
×
1069
        ui->checkBoxDWB->setChecked(flags & Nebula::CatDWB);
×
1070
        ui->checkBoxTr->setChecked(flags & Nebula::CatTr);
×
1071
        ui->checkBoxSt->setChecked(flags & Nebula::CatSt);
×
1072
        ui->checkBoxRu->setChecked(flags & Nebula::CatRu);
×
1073
        ui->checkBoxVdBHa->setChecked(flags & Nebula::CatVdBHa);
×
1074
        ui->checkBoxOther->setChecked(flags & Nebula::CatOther);        
×
1075
}
×
1076

1077
void ViewDialog::updateSelectedTypesCheckBoxes()
×
1078
{
1079
        const Nebula::TypeGroup flags = static_cast<Nebula::TypeGroup>(GETSTELMODULE(NebulaMgr)->getTypeFilters());
×
1080
        ui->checkBoxGalaxiesType->setChecked(flags & Nebula::TypeGalaxies);
×
1081
        ui->checkBoxActiveGalaxiesType->setChecked(flags & Nebula::TypeActiveGalaxies);
×
1082
        ui->checkBoxInteractingGalaxiesType->setChecked(flags & Nebula::TypeInteractingGalaxies);
×
1083
        ui->checkBoxOpenStarClustersType->setChecked(flags & Nebula::TypeOpenStarClusters);
×
1084
        ui->checkBoxGlobularStarClustersType->setChecked(flags & Nebula::TypeGlobularStarClusters);
×
1085
        ui->checkBoxBrightNebulaeType->setChecked(flags & Nebula::TypeBrightNebulae);
×
1086
        ui->checkBoxDarkNebulaeType->setChecked(flags & Nebula::TypeDarkNebulae);
×
1087
        ui->checkBoxPlanetaryNebulaeType->setChecked(flags & Nebula::TypePlanetaryNebulae);
×
1088
        ui->checkBoxHydrogenRegionsType->setChecked(flags & Nebula::TypeHydrogenRegions);
×
1089
        ui->checkBoxSupernovaRemnantsType->setChecked(flags & Nebula::TypeSupernovaRemnants);
×
1090
        ui->checkBoxGalaxyClustersType->setChecked(flags & Nebula::TypeGalaxyClusters);
×
1091
        ui->checkBoxOtherType->setChecked(flags & Nebula::TypeOther);
×
1092
}
×
1093

1094
void ViewDialog::populateToolTips()
×
1095
{
1096
        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")));
×
1097
        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.")));
×
1098

1099
        QString degree = QChar(0x00B0);
×
1100
        ui->fovCircularMarkerSizeDoubleSpinBox->setSuffix(degree);
×
1101
        ui->fovRectangularMarkerHeightDoubleSpinBox->setSuffix(degree);
×
1102
        ui->fovRectangularMarkerWidthDoubleSpinBox->setSuffix(degree);
×
1103
        ui->fovRectangularMarkerRotationAngleDoubleSpinBox->setSuffix(degree);
×
1104

1105
        // TRANSLATORS: duration in seconds
1106
        QString seconds = qc_("s", "duration, suffix");
×
1107
        ui->artFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1108
        ui->linesFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1109
        ui->namesFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1110
        ui->boundariesFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1111
        ui->constellationHullsFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1112
        ui->asterismLinesFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1113
        ui->asterismNamesFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1114
        ui->rayHelpersFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1115
        ui->zodiacFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1116
        ui->lunarSystemFadeDurationDoubleSpinBox->setSuffix(seconds);
×
1117
}
×
1118

1119
void ViewDialog::populateLists()
×
1120
{
1121
        // Fill the culture list widget from the available list
1122
        StelApp& app = StelApp::getInstance();
×
1123
        QListWidget* l = ui->culturesListWidget;
×
1124
        l->blockSignals(true);
×
1125
        l->clear();
×
1126
        const QStringList &skycultures = app.getSkyCultureMgr().getSkyCultureListI18();
×
1127
        for ( const auto& s : skycultures  )
×
1128
        {
1129
                l->addItem(s);
×
1130
                l->findItems(s, Qt::MatchExactly).at(0)->setToolTip(s);
×
1131
        }
1132
        l->setCurrentItem(l->findItems(app.getSkyCultureMgr().getCurrentSkyCultureNameI18(), Qt::MatchExactly).at(0));
×
1133
        l->blockSignals(false);
×
1134
        updateSkyCultureText();
×
1135

1136
        const StelCore* core = app.getCore();
×
1137
        StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
×
1138

1139
        // Fill the projection list
1140
        l = ui->projectionListWidget;
×
1141
        l->blockSignals(true);
×
1142
        l->clear();        
×
1143
        const QStringList mappings = core->getAllProjectionTypeKeys();
×
1144
        for (const auto& s : mappings)
×
1145
        {
1146
                l->addItem(core->projectionTypeKeyToNameI18n(s));
×
1147
        }
1148
        l->setCurrentItem(l->findItems(core->getCurrentProjectionNameI18n(), Qt::MatchExactly).at(0));
×
1149
        l->blockSignals(false);
×
1150
        if (gui)
×
1151
                ui->projectionTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1152
        ui->projectionTextBrowser->setHtml(core->getProjection(StelCore::FrameJ2000)->getHtmlSummary());        
×
1153

1154
        // Fill the landscape list
1155
        l = ui->landscapesListWidget;
×
1156
        l->blockSignals(true);
×
1157
        l->clear();
×
1158
        StelModule* lmgr = app.getModule("LandscapeMgr");
×
1159
        QStringList landscapeList = lmgr->property("allLandscapeNames").toStringList();
×
1160
        for (const auto& landscapeName : std::as_const(landscapeList))
×
1161
        {
1162
                QString label = q_(landscapeName);
×
1163
                QListWidgetItem* item = new QListWidgetItem(label);
×
1164
                item->setData(Qt::UserRole, landscapeName);
×
1165
                l->addItem(item);
×
1166
        }
×
1167
        l->sortItems(); // they may have been translated!
×
1168
        QString selectedLandscapeName = lmgr->property("currentLandscapeName").toString();
×
1169
        for (int i = 0; i < l->count(); i++)
×
1170
        {
1171
                if (l->item(i)->data(Qt::UserRole).toString() == selectedLandscapeName)
×
1172
                {
1173
                        l->setCurrentRow(i);
×
1174
                        break;
×
1175
                }
1176
        }
1177
        l->blockSignals(false);        
×
1178
        QStringList searchPaths;
×
1179
        searchPaths << StelFileMgr::findFile("landscapes/" + lmgr->property("currentLandscapeID").toString());
×
1180

1181
        ui->landscapeTextBrowser->setSearchPaths(searchPaths);
×
1182
        if (gui)
×
1183
                ui->landscapeTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));        
×
1184
        ui->landscapeTextBrowser->setHtml(lmgr->property("currentLandscapeHtmlDescription").toString());        
×
1185
        updateDefaultLandscape();
×
1186
}
×
1187

1188
void ViewDialog::configureSkyCultureCheckboxes()
×
1189
{
1190
        static StelSkyCultureMgr *scMgr     = GETSTELMODULE(StelSkyCultureMgr);
×
1191
        StelObject::CulturalDisplayStyle infoStyle   = scMgr->getInfoLabelStyle();
×
1192
        StelObject::CulturalDisplayStyle screenStyle = scMgr->getScreenLabelStyle();
×
1193
        static ConstellationMgr *cMgr       = GETSTELMODULE(ConstellationMgr);
×
1194
        const bool hasZodiac=cMgr->hasZodiac();
×
1195
        const bool hasLunarSystem=cMgr->hasLunarSystem();
×
1196

1197
        ui->infoLabelNativeCheckBox           ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::Native));
×
1198
        ui->infoLabelPronounceCheckBox        ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::Pronounce));
×
1199
        ui->infoLabelTransliterationCheckBox  ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::Translit));
×
1200
        ui->infoLabelTranslationCheckBox      ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::Translated));
×
1201
        ui->infoLabelIPACheckBox              ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::IPA));
×
1202
        ui->infoLabelModernCheckBox           ->setChecked(int(infoStyle)   & int(StelObject::CulturalDisplayStyle::Modern));
×
1203
        ui->screenLabelNativeCheckBox         ->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::Native));
×
1204
        ui->screenLabelPronounceCheckBox      ->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::Pronounce));
×
1205
        ui->screenLabelTransliterationCheckBox->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::Translit));
×
1206
        ui->screenLabelTranslationCheckBox    ->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::Translated));
×
1207
        ui->screenLabelIPACheckBox            ->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::IPA));
×
1208
        ui->screenLabelModernCheckBox         ->setChecked(int(screenStyle) & int(StelObject::CulturalDisplayStyle::Modern));
×
1209

1210
        ui->zodiacCheckBox->setEnabled(hasZodiac);
×
1211
        ui->zodiacColorButton->setEnabled(hasZodiac);
×
1212
        ui->zodiacFadeDurationDoubleSpinBox->setEnabled(hasZodiac);
×
1213
        ui->zodiacThicknessSpinBox->setEnabled(hasZodiac);
×
1214
        ui->lunarSystemCheckBox->setEnabled(hasLunarSystem);
×
1215
        ui->lunarSystemColorButton->setEnabled(hasLunarSystem);
×
1216
        ui->lunarSystemFadeDurationDoubleSpinBox->setEnabled(hasLunarSystem);
×
1217
        ui->lunarSystemThicknessSpinBox->setEnabled(hasLunarSystem);
×
1218
}
×
1219

1220
void ViewDialog::updateSkyCultureInfoStyleFromCheckboxes()
×
1221
{
1222
        static StelSkyCultureMgr *scMgr       = GETSTELMODULE(StelSkyCultureMgr);
×
1223

1224
        scMgr->setInfoLabelStyle(static_cast<StelObject::CulturalDisplayStyle>(
×
1225
                                int(ui->infoLabelNativeCheckBox         ->isChecked()) << 5 |
×
1226
                                int(ui->infoLabelPronounceCheckBox      ->isChecked()) << 4 |
×
1227
                                int(ui->infoLabelTransliterationCheckBox->isChecked()) << 3 |
×
1228
                                int(ui->infoLabelTranslationCheckBox    ->isChecked()) << 2 |
×
1229
                                int(ui->infoLabelIPACheckBox            ->isChecked()) << 1 |
×
1230
                                int(ui->infoLabelModernCheckBox         ->isChecked())
×
1231
                                ));
1232
}
×
1233

1234
void ViewDialog::updateSkyCultureScreenStyleFromCheckboxes()
×
1235
{
1236
        static StelSkyCultureMgr *scMgr       = GETSTELMODULE(StelSkyCultureMgr);
×
1237

1238
        scMgr->setScreenLabelStyle(static_cast<StelObject::CulturalDisplayStyle>(
×
1239
                                int(ui->screenLabelNativeCheckBox         ->isChecked()) << 5 |
×
1240
                                int(ui->screenLabelPronounceCheckBox      ->isChecked()) << 4 |
×
1241
                                int(ui->screenLabelTransliterationCheckBox->isChecked()) << 3 |
×
1242
                                int(ui->screenLabelTranslationCheckBox    ->isChecked()) << 2 |
×
1243
                                int(ui->screenLabelIPACheckBox            ->isChecked()) << 1 |
×
1244
                                int(ui->screenLabelModernCheckBox         ->isChecked())
×
1245
                                ));
1246
}
×
1247

1248
void ViewDialog::skyCultureChanged()
×
1249
{
1250
        QListWidget* l = ui->culturesListWidget;
×
1251
        l->setCurrentItem(l->findItems(StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureNameI18(), Qt::MatchExactly).at(0));
×
1252
        updateSkyCultureText();
×
1253
        updateDefaultSkyCulture();
×
1254
        configureSkyCultureCheckboxes();
×
1255
}
×
1256

1257
// fill the description text window, not the names in the sky.
1258
void ViewDialog::updateSkyCultureText()
×
1259
{
1260
        StelApp& app = StelApp::getInstance();
×
1261
        QString skyCultureId = app.getSkyCultureMgr().getCurrentSkyCultureID();
×
1262
        QString html = app.getSkyCultureMgr().getCurrentSkyCultureHtmlDescription();
×
1263

1264
        QStringList searchPaths;
×
1265
        searchPaths << StelFileMgr::findFile("skycultures/" + skyCultureId);
×
1266

1267
        ui->skyCultureTextBrowser->setSearchPaths(searchPaths);
×
1268
        StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
×
1269
        if (gui)
×
1270
                ui->skyCultureTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1271
        ui->skyCultureTextBrowser->setHtml(html);        
×
1272
}
×
1273

1274
void ViewDialog::changeProjection(const QString& projectionNameI18n)
×
1275
{
1276
        StelCore* core = StelApp::getInstance().getCore();
×
1277
        core->setCurrentProjectionTypeKey(core->projectionNameI18nToTypeKey(projectionNameI18n));
×
1278
}
×
1279

1280
void ViewDialog::projectionChanged()
×
1281
{
1282
        StelCore* core = StelApp::getInstance().getCore();
×
1283
        QListWidget* l = ui->projectionListWidget;
×
1284
        l->setCurrentItem(l->findItems(core->getCurrentProjectionNameI18n(), Qt::MatchExactly).at(0),QItemSelectionModel::SelectCurrent);
×
1285
        ui->projectionTextBrowser->setHtml(core->getProjection(StelCore::FrameJ2000)->getHtmlSummary());
×
1286
        ui->currentFovSpinBox->setMaximum(core->getProjection(StelCore::FrameJ2000)->getMaxFov(), true);
×
1287
}
×
1288

1289
void ViewDialog::landscapeChanged(QString id, QString name)
×
1290
{
1291
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1292
        for (int i = 0; i < ui->landscapesListWidget->count(); i++)
×
1293
        {
1294
                if (ui->landscapesListWidget->item(i)->data(Qt::UserRole).toString() == name)
×
1295
                {
1296
                        ui->landscapesListWidget->setCurrentRow(i, QItemSelectionModel::SelectCurrent);
×
1297
                        break;
×
1298
                }
1299
        }
1300

1301
        QStringList searchPaths;
×
1302
        searchPaths << StelFileMgr::findFile("landscapes/" + id);
×
1303

1304
        ui->landscapeTextBrowser->setSearchPaths(searchPaths);
×
1305
        ui->landscapeTextBrowser->setHtml(lmgr->property("currentLandscapeHtmlDescription").toString());
×
1306
        updateDefaultLandscape();
×
1307
        // Reset values that might have changed.
1308
        ui->showFogCheckBox->setChecked(lmgr->property("fogDisplayed").toBool());
×
1309
}
×
1310

1311
void ViewDialog::showAddRemoveLandscapesDialog()
×
1312
{
1313
        if(addRemoveLandscapesDialog == nullptr)
×
1314
                addRemoveLandscapesDialog = new AddRemoveLandscapesDialog();
×
1315

1316
        addRemoveLandscapesDialog->setVisible(true);
×
1317
}
×
1318

1319
void ViewDialog::showAtmosphereDialog()
×
1320
{
1321
        if(atmosphereDialog == nullptr)
×
1322
                atmosphereDialog = new AtmosphereDialog();
×
1323

1324
        atmosphereDialog->setVisible(true);
×
1325
}
×
1326

1327
void ViewDialog::showSkylightDialog()
×
1328
{
1329
    if(skylightDialog == nullptr)
×
1330
        skylightDialog = new SkylightDialog();
×
1331

1332
    skylightDialog->setVisible(true);
×
1333
}
×
1334

1335
void ViewDialog::showTonemappingDialog()
×
1336
{
1337
    if(tonemappingDialog == nullptr)
×
1338
        tonemappingDialog = new TonemappingDialog();
×
1339

1340
    tonemappingDialog->setVisible(true);
×
1341
}
×
1342

1343
void ViewDialog::showGreatRedSpotDialog()
×
1344
{
1345
        if(greatRedSpotDialog == nullptr)
×
1346
                greatRedSpotDialog = new GreatRedSpotDialog();
×
1347

1348
        greatRedSpotDialog->setVisible(true);
×
1349
}
×
1350

1351
void ViewDialog::showConfigureDSOColorsDialog()
×
1352
{
1353
        if(configureDSOColorsDialog == nullptr)
×
1354
                configureDSOColorsDialog = new ConfigureDSOColorsDialog();
×
1355

1356
        configureDSOColorsDialog->setVisible(true);
×
1357
}
×
1358

1359
void ViewDialog::showConfigureOrbitColorsDialog()
×
1360
{
1361
        if(configureOrbitColorsDialog == nullptr)
×
1362
                configureOrbitColorsDialog = new ConfigureOrbitColorsDialog();
×
1363

1364
        configureOrbitColorsDialog->setVisible(true);
×
1365
}
×
1366

1367
void ViewDialog::updateZhrDescription(int zhr)
×
1368
{
1369
        // GZ changed to small regions instead of hard "case" to better see a manual setting.
1370
        if (zhr==0)
×
1371
                ui->zhrLabel->setText("<small><i>"+q_("No shooting stars")+"</i></small>");
×
1372
        else if (zhr<=10)
×
1373
                ui->zhrLabel->setText("<small><i>"+q_("Normal rate")+"</i></small>");
×
1374
        else if ((zhr>=20) && (zhr<=30)) // was 25
×
1375
                ui->zhrLabel->setText("<small><i>"+q_("Standard Orionids rate")+"</i></small>");
×
1376
        else if ((zhr>=90) && (zhr<=110)) // was 100
×
1377
                ui->zhrLabel->setText("<small><i>"+q_("Standard Perseids rate")+"</i></small>");
×
1378
        else if ((zhr>=111) && (zhr<=132)) // was 120
×
1379
                ui->zhrLabel->setText("<small><i>"+q_("Standard Geminids rate")+"</i></small>");
×
1380
        else if ((zhr>=180) && (zhr<=220)) // was 200
×
1381
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Perseid rate")+"</i></small>");
×
1382
        else if ((zhr>=900) && (zhr<=1100)) // was 1000
×
1383
                ui->zhrLabel->setText("<small><i>"+q_("Meteor storm rate")+"</i></small>");
×
1384
        else if ((zhr>=5400) && (zhr<=6600)) // was 6000
×
1385
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Draconid rate")+"</i></small>");
×
1386
        else if ((zhr>=9000) && (zhr<=11000)) // was 10000
×
1387
                ui->zhrLabel->setText("<small><i>"+q_("Exceptional Leonid rate")+"</i></small>");
×
1388
        else if ((zhr>=130000) && (zhr<=160000)) // was 144000
×
1389
                ui->zhrLabel->setText("<small><i>"+q_("Very high rate (1966 Leonids)")+"</i></small>");
×
1390
        else if (zhr>=230000) // was 240000
×
1391
                ui->zhrLabel->setText("<small><i>"+q_("Highest rate ever (1833 Leonids)")+"</i></small>");
×
1392
        else
1393
                ui->zhrLabel->setText("");
×
1394
}
×
1395

1396
void ViewDialog::setCurrentLandscapeAsDefault(void)
×
1397
{
1398
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1399
        Q_ASSERT(lmgr);
×
1400
        lmgr->setProperty("defaultLandscapeID", lmgr->property("currentLandscapeID"));
×
1401
}
×
1402

1403
void ViewDialog::setCurrentCultureAsDefault(void)
×
1404
{
1405
        StelApp::getInstance().getSkyCultureMgr().setDefaultSkyCultureID(StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureID());
×
1406
}
×
1407

1408
void ViewDialog::updateDefaultSkyCulture()
×
1409
{
1410
        // Check that the useAsDefaultSkyCultureCheckBox needs to be updated
1411
        bool b = StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureID()==StelApp::getInstance().getSkyCultureMgr().getDefaultSkyCultureID();
×
1412
        ui->useAsDefaultSkyCultureCheckBox->setChecked(b);
×
1413
        ui->useAsDefaultSkyCultureCheckBox->setEnabled(!b);
×
1414
        // Check that ray helpers and asterism lines are defined
1415
        b = GETSTELMODULE(AsterismMgr)->isLinesDefined();
×
1416
        ui->showAsterismLinesCheckBox->setEnabled(b);
×
1417
        ui->showAsterismLabelsCheckBox->setEnabled(b);
×
1418
        ui->asterismLineThicknessSpinBox->setEnabled(b);
×
1419
        ui->colorAsterismLines->setEnabled(b);
×
1420
        ui->colorAsterismLabels->setEnabled(b);
×
1421
        ui->showRayHelpersCheckBox->setEnabled(b);
×
1422
        ui->rayHelperThicknessSpinBox->setEnabled(b);
×
1423
        ui->colorRayHelpers->setEnabled(b);
×
1424
        ui->asterismsFontSizeSpinBox->setEnabled(b);
×
1425
        ui->constellationPickCheckBox->setEnabled(b);
×
1426
}
×
1427

1428
void ViewDialog::updateDefaultLandscape()
×
1429
{
1430
        StelModule* lmgr = StelApp::getInstance().getModule("LandscapeMgr");
×
1431
        Q_ASSERT(lmgr);
×
1432
        bool isDefault = lmgr->property("currentLandscapeID") == lmgr->property("defaultLandscapeID");
×
1433
        ui->useAsDefaultLandscapeCheckBox->setChecked(isDefault);
×
1434
        ui->useAsDefaultLandscapeCheckBox->setEnabled(!isDefault);
×
1435
}
×
1436

1437
void ViewDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
×
1438
{
1439
        if (!current)
×
1440
                current = previous;
×
1441
        ui->stackedWidget->setCurrentIndex(ui->stackListWidget->row(current));
×
1442
}
×
1443

1444
void ViewDialog::populatePlanetMagnitudeAlgorithmsList()
×
1445
{
1446
        Q_ASSERT(ui->planetMagnitudeAlgorithmComboBox);
×
1447
        QComboBox* algorithms = ui->planetMagnitudeAlgorithmComboBox;
×
1448
        //Save the current selection to be restored later
1449
        algorithms->blockSignals(true);
×
1450
        int index = algorithms->currentIndex();
×
1451
        QVariant selectedAlgorithmId = algorithms->itemData(index);
×
1452
        algorithms->clear();
×
1453
        //For each algorithm, display the localized name and store the key as user data.
1454
        algorithms->addItem(qc_("G. Müller (1893)",              "magnitude algorithm"), Planet::Mueller_1893);
×
1455
        algorithms->addItem(qc_("Astronomical Almanac (1984)",   "magnitude algorithm"), Planet::AstronomicalAlmanac_1984);
×
1456
        algorithms->addItem(qc_("Explanatory Supplement (1992)", "magnitude algorithm"), Planet::ExplanatorySupplement_1992);
×
1457
        algorithms->addItem(qc_("Explanatory Supplement (2013)", "magnitude algorithm"), Planet::ExplanatorySupplement_2013);
×
1458
        algorithms->addItem(qc_("Mallama & Hilton (2018)",       "magnitude algorithm"), Planet::MallamaHilton_2018);
×
1459
        algorithms->addItem(qc_("Generic",                       "magnitude algorithm"), Planet::Generic);
×
1460
        //Restore the selection
1461
        index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::MatchCaseSensitive);
×
1462
        algorithms->setCurrentIndex(index);
×
1463
        //algorithms->model()->sort(0);
1464
        algorithms->blockSignals(false);
×
1465
}
×
1466

1467
void ViewDialog::setPlanetMagnitudeAlgorithm(int algorithmID)
×
1468
{
1469
        Planet::ApparentMagnitudeAlgorithm newAlgorithm = static_cast<Planet::ApparentMagnitudeAlgorithm>(ui->planetMagnitudeAlgorithmComboBox->itemData(algorithmID).toInt());
×
1470

1471
        GETSTELMODULE(SolarSystem)->setApparentMagnitudeAlgorithmOnEarth(newAlgorithm);
×
1472
        populatePlanetMagnitudeAlgorithmDescription();
×
1473
}
×
1474

1475
void ViewDialog::populatePlanetMagnitudeAlgorithmDescription()
×
1476
{
1477
        int currentAlgorithm = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::getApparentMagnitudeAlgorithm(), Qt::UserRole, Qt::MatchCaseSensitive);
×
1478
        if (currentAlgorithm==-1) // Use Mallama&Hilton 2018 as default
×
1479
                currentAlgorithm = ui->planetMagnitudeAlgorithmComboBox->findData(Planet::MallamaHilton_2018, Qt::UserRole, Qt::MatchCaseSensitive);
×
1480

1481
        const QMap<int, QString>planetMagnitudeAlgorithmMap = {
1482
                { 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).") },
×
1483
                { 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).") },
×
1484
                { Planet::ExplanatorySupplement_1992, q_("The algorithm was published in the 2nd edition of the <em>Explanatory Supplement to the Astronomical Almanac</em> (1992).") },
×
1485
                { Planet::ExplanatorySupplement_2013, q_("The algorithm was published in the 3rd edition of the <em>Explanatory Supplement to the Astronomical Almanac</em> (2013).") },
×
1486
                { 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.") }
×
1487
        };
×
1488

1489
        QString info = planetMagnitudeAlgorithmMap.value(currentAlgorithm, q_("Visual magnitude based on phase angle and albedo."));
×
1490
        ui->planetMagnitudeAlgorithmDescription->setText(QString("<small>%1</small>").arg(info));
×
1491
}
×
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