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

Stellarium / stellarium / 17068063291

19 Aug 2025 11:22AM UTC coverage: 11.766%. Remained the same
17068063291

push

github

alex-w
Reformatting

14706 of 124990 relevant lines covered (11.77%)

18303.49 hits per line

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

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

22
#include "Dialog.hpp"
23
#include "ConfigurationDialog.hpp"
24
#include "CustomDeltaTEquationDialog.hpp"
25
#include "ConfigureScreenshotsDialog.hpp"
26
#include "StelMainView.hpp"
27
#include "ui_configurationDialog.h"
28
#include "StelApp.hpp"
29
#include "StelFileMgr.hpp"
30
#include "StelCore.hpp"
31
#include "StelLocaleMgr.hpp"
32
#include "StelProjector.hpp"
33
#include "StelActionMgr.hpp"
34
#include "StelProgressController.hpp"
35

36
#include "StelUtils.hpp"
37
#include "StelCore.hpp"
38
#include "StelMovementMgr.hpp"
39
#include "StelModuleMgr.hpp"
40
#include "StelGui.hpp"
41
#include "StelGuiItems.hpp"
42
#include "StelLocation.hpp"
43
#include "ConstellationMgr.hpp"
44
#include "StarMgr.hpp"
45
#include "NebulaMgr.hpp"
46
#ifdef ENABLE_SCRIPTING
47
#include "StelScriptMgr.hpp"
48
#endif
49
#include "StelTranslator.hpp"
50

51
#include <QSettings>
52
#include <QDebug>
53
#include <QFile>
54
#include <QFileDialog>
55
#include <QFontDialog>
56
#include <QComboBox>
57
#include <QDir>
58
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
59
#include <QWindow>
60
#else
61
#include <QDesktopWidget>
62
#endif
63
#include <QImageWriter>
64
#include <QScreen>
65
#include <QThreadPool>
66

67
//! Simple helper extension class which can guarantee int inputs in a useful range.
68
class MinMaxIntValidator: public QIntValidator
69
{
70
public:
71
        MinMaxIntValidator(int min, int max, QObject *parent=Q_NULLPTR):
×
72
                QIntValidator(min, max, parent){}
×
73

74
        void fixup(QString &input) const override
×
75
        {
76
                int allowed=qBound(bottom(), input.toInt(), top());
×
77
                input.setNum(allowed);
×
78
        }
×
79
};
80

81
ConfigurationDialog::ConfigurationDialog(StelGui* agui, QObject* parent)
×
82
        : StelDialog("Configuration", parent)
83
        , isDownloadingStarCatalog(false)
×
84
        , nextStarCatalogToDownloadIndex(0)
×
85
        , starCatalogsCount(0)
×
86
        , hasDownloadedStarCatalog(false)
×
87
        , starCatalogDownloadReply(Q_NULLPTR)
×
88
        , currentDownloadFile(Q_NULLPTR)
×
89
        , progressBar(Q_NULLPTR)
×
90
        , gui(agui)
×
91
        , customDeltaTEquationDialog(Q_NULLPTR)
×
92
        , configureScreenshotsDialog(Q_NULLPTR)
×
93
        , savedProjectionType(StelApp::getInstance().getCore()->getCurrentProjectionType())
×
94
{
95
        ui = new Ui_configurationDialogForm;
×
96
}
×
97

98
ConfigurationDialog::~ConfigurationDialog()
×
99
{
100
        delete ui;
×
101
        ui = Q_NULLPTR;
×
102
        delete customDeltaTEquationDialog;
×
103
        customDeltaTEquationDialog = Q_NULLPTR;
×
104
        delete configureScreenshotsDialog;
×
105
        configureScreenshotsDialog = Q_NULLPTR;
×
106
        delete currentDownloadFile;
×
107
        currentDownloadFile = Q_NULLPTR;
×
108
}
×
109

110
void ConfigurationDialog::retranslate()
×
111
{
112
        if (dialog)
×
113
        {
114
                ui->retranslateUi(dialog);
×
115

116
                //Initial FOV and direction on the "Main" page
117
                updateConfigLabels();
×
118
                
119
                //Star catalog download button and info
120
                updateStarCatalogControlsText();
×
121

122
                //Script information
123
                //(trigger re-displaying the description of the current item)
124
                #ifdef ENABLE_SCRIPTING
125
                scriptSelectionChanged(ui->scriptListWidget->currentItem()->text());
×
126
                #else
127
                // we had hidden and re-sorted the tabs, and must now manually re-set the label.
128
                ui->stackListWidget->item(5)->setText(QCoreApplication::translate("configurationDialogForm", "Plugins", nullptr));
129
                #endif
130

131
                populateDitherList();
×
132

133
                //Plug-in information
134
                populatePluginsList();
×
135

136
                populateDeltaTAlgorithmsList();
×
137
                populateDateFormatsList();
×
138
                populateTimeFormatsList();
×
139

140
                populateTooltips();
×
141

142
                //Hack to shrink the tabs to optimal size after language change
143
                //by causing the list items to be laid out again.
144
                updateTabBarListWidgetWidth();
×
145
        }
146
}
×
147

148
void ConfigurationDialog::createDialogContent()
×
149
{
150
        StelCore* core = StelApp::getInstance().getCore();
×
151
        const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000);
×
152

153
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
154

155
        ui->setupUi(dialog);
×
156
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
157

158
        // Set the main tab activated by default
159
        ui->configurationStackedWidget->setCurrentIndex(0);
×
160
        ui->stackListWidget->setCurrentRow(0);
×
161

162
        // Kinetic scrolling
163
        kineticScrollingList << ui->pluginsListWidget << ui->scriptListWidget;
×
164
        StelGui* appGui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
165
        if (appGui)
×
166
        {
167
                enableKineticScrolling(appGui->getFlagUseKineticScrolling());
×
168
                connect(appGui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
169
        }
170

171
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
172
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
173

174
        // Main tab
175
        #ifdef ENABLE_NLS
176
        // Fill the language list widget from the available list
177
        QComboBox* cb = ui->programLanguageComboBox;
178
        cb->clear();
179
        cb->addItems(StelTranslator::globalTranslator->getAvailableLanguagesNamesNative(StelFileMgr::getLocaleDir()));
180
        cb->model()->sort(0);
181
        updateCurrentLanguage();
182
        connect(cb->lineEdit(), SIGNAL(editingFinished()), this, SLOT(updateCurrentLanguage()));
183
        connect(cb, SIGNAL(currentIndexChanged(const int)), this, SLOT(selectLanguage(const int)));
184
        // Language properties are potentially delicate. Accidentally immediate storing may cause obvious problems.
185
        connect(ui->languageSaveToolButton, SIGNAL(clicked()), this, SLOT(storeLanguageSettings()));
186
        #else
187
        ui->groupBox_LanguageSettings->hide();
×
188
        #endif
189

190
        connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadStars()));
×
191
        connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
×
192
        connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downloadStars()));
×
193
        resetStarCatalogControls();
×
194

195
        connect(ui->de430checkBox, SIGNAL(clicked()), this, SLOT(de430ButtonClicked()));
×
196
        connect(ui->de431checkBox, SIGNAL(clicked()), this, SLOT(de431ButtonClicked()));
×
197
        connect(ui->de440checkBox, SIGNAL(clicked()), this, SLOT(de440ButtonClicked()));
×
198
        connect(ui->de441checkBox, SIGNAL(clicked()), this, SLOT(de441ButtonClicked()));
×
199
        resetEphemControls();
×
200

201
        connectBoolProperty(ui->nutationCheckBox, "StelCore.flagUseNutation");
×
202
        connectBoolProperty(ui->aberrationCheckBox, "StelCore.flagUseAberration");
×
203
        connectDoubleProperty(ui->aberrationSpinBox, "StelCore.aberrationFactor");
×
204
        connectBoolProperty(ui->parallaxCheckBox, "StelCore.flagUseParallax");
×
205
        connectDoubleProperty(ui->parallaxSpinBox, "StelCore.parallaxFactor");
×
206
        connectBoolProperty(ui->topocentricCheckBox, "StelCore.flagUseTopocentricCoordinates");
×
207
        // We cannot link flag setting to immediate storing. (GH #4112)
208
        // The immediate-store is now triggered by this click
209
        connect(ui->topocentricCheckBox, &QCheckBox::released, this, [=](){
×
210
                StelApp::immediateSave("astro/flag_topocentric_coordinates",
×
211
                                       StelApp::getInstance().getStelPropertyManager()->getStelPropertyValue("StelCore.flagUseTopocentricCoordinates"));
×
212
        });
×
213

214
        // Additional settings for selected object info
215
        connectBoolProperty(ui->checkBoxUMSurfaceBrightness, "NebulaMgr.flagSurfaceBrightnessArcsecUsage");
×
216
        connectBoolProperty(ui->checkBoxUMShortNotationSurfaceBrightness, "NebulaMgr.flagSurfaceBrightnessShortNotationUsage");
×
217
        connectBoolProperty(ui->checkBoxUseFormattingOutput, "StelApp.flagUseFormattingOutput");
×
218
        connectBoolProperty(ui->checkBoxUseCCSDesignations,  "StelApp.flagUseCCSDesignation");
×
219
        connectBoolProperty(ui->overwriteTextColorCheckBox,  "StelApp.flagOverwriteInfoColor");
×
220

221
        // Selected object info
222
        updateSelectedInfoGui();
×
223
        connect(ui->noSelectedInfoRadio, SIGNAL(released()), this, SLOT(setNoSelectedInfo()));
×
224
        connect(ui->allSelectedInfoRadio, SIGNAL(released()), this, SLOT(setAllSelectedInfo()));
×
225
        connect(ui->defaultSelectedInfoRadio, SIGNAL(released()), this, SLOT(setDefaultSelectedInfo()));
×
226
        connect(ui->briefSelectedInfoRadio, SIGNAL(released()), this, SLOT(setBriefSelectedInfo()));
×
227
        connect(ui->customSelectedInfoRadio, SIGNAL(released()), this, SLOT(setCustomSelectedInfo()));
×
228
        connect(ui->buttonGroupDisplayedFields, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(setSelectedInfoFromCheckBoxes()));
×
229
        if (appGui)
×
230
                connect(appGui, SIGNAL(infoStringChanged()), this, SLOT(updateSelectedInfoGui()));
×
231
        
232
        // Navigation tab
233
        // Startup time
234
        if (core->getStartupTimeMode()=="actual")
×
235
                ui->systemTimeRadio->setChecked(true);
×
236
        else if (core->getStartupTimeMode()=="today")
×
237
                ui->todayRadio->setChecked(true);
×
238
        else
239
                ui->fixedTimeRadio->setChecked(true);
×
240
        connect(ui->systemTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setStartupTimeMode()));
×
241
        connect(ui->todayRadio, SIGNAL(clicked(bool)), this, SLOT(setStartupTimeMode()));
×
242
        connect(ui->fixedTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setStartupTimeMode()));
×
243

244
        ui->todayTimeSpinBox->setTime(core->getInitTodayTime());
×
245
        connect(ui->todayTimeSpinBox, SIGNAL(timeChanged(QTime)), core, SLOT(setInitTodayTime(QTime)));
×
246
        ui->fixedDateTimeEdit->setMinimumDate(QDate(100,1,1));
×
247
        ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(core->getPresetSkyTime(), Qt::LocalTime));
×
248
        ui->fixedDateTimeEdit->setDisplayFormat("dd.MM.yyyy HH:mm");
×
249
        connect(ui->fixedDateTimeEdit, SIGNAL(dateTimeChanged(QDateTime)), core, SLOT(setPresetSkyTime(QDateTime)));
×
250

251
        bool state = (mvmgr->getFlagEnableMoveKeys() || mvmgr->getFlagEnableZoomKeys());
×
252
        ui->enableKeysNavigationCheckBox->setChecked(state);
×
253
        ui->editShortcutsPushButton->setEnabled(state);
×
254
        connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), this, SLOT(setKeyNavigationState(bool)));
×
255
        connectBoolProperty(ui->enableMouseNavigationCheckBox,  "StelMovementMgr.flagEnableMouseNavigation");
×
256
        connectBoolProperty(ui->enableMouseZoomingCheckBox,  "StelMovementMgr.flagEnableMouseZooming");
×
257

258
        connect(ui->fixedDateTimeCurrentButton, SIGNAL(clicked()), this, SLOT(setFixedDateTimeToCurrent()));
×
259
        connect(ui->editShortcutsPushButton, SIGNAL(clicked()), this, SLOT(showShortcutsWindow()));
×
260

261
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
262
        // Display formats of date
263
        populateDateFormatsList();
×
264
        int idx = ui->dateFormatsComboBox->findData(localeManager.getDateFormatStr(), Qt::UserRole, Qt::MatchCaseSensitive);
×
265
        if (idx==-1)
×
266
        {
267
                // Use system_default as default
268
                idx = ui->dateFormatsComboBox->findData(QVariant("system_default"), Qt::UserRole, Qt::MatchCaseSensitive);
×
269
        }
270
        ui->dateFormatsComboBox->setCurrentIndex(idx);
×
271
        connect(ui->dateFormatsComboBox, SIGNAL(currentIndexChanged(const int)), this, SLOT(setDateFormat()));
×
272
        connectBoolProperty(ui->startupTimeStopCheckBox, "StelCore.startupTimeStop");
×
273

274
        // Display formats of time
275
        populateTimeFormatsList();
×
276
        idx = ui->timeFormatsComboBox->findData(localeManager.getTimeFormatStr(), Qt::UserRole, Qt::MatchCaseSensitive);
×
277
        if (idx==-1)
×
278
        {
279
                // Use system_default as default
280
                idx = ui->timeFormatsComboBox->findData(QVariant("system_default"), Qt::UserRole, Qt::MatchCaseSensitive);
×
281
        }
282
        ui->timeFormatsComboBox->setCurrentIndex(idx);
×
283
        connect(ui->timeFormatsComboBox, SIGNAL(currentIndexChanged(const int)), this, SLOT(setTimeFormat()));
×
284
        if (StelApp::getInstance().getSettings()->value("gui/flag_time_jd", false).toBool())
×
285
                ui->jdRadioButton->setChecked(true);
×
286
        else
287
                ui->dtRadioButton->setChecked(true);
×
288
        connect(ui->jdRadioButton, SIGNAL(clicked(bool)), this, SLOT(setButtonBarDTFormat()));
×
289
        connect(ui->dtRadioButton, SIGNAL(clicked(bool)), this, SLOT(setButtonBarDTFormat()));
×
290

291
        // Delta-T
292
        populateDeltaTAlgorithmsList();        
×
293
        idx = ui->deltaTAlgorithmComboBox->findData(core->getCurrentDeltaTAlgorithmKey(), Qt::UserRole, Qt::MatchCaseSensitive);
×
294
        if (idx==-1)
×
295
        {
296
                // Use Modified Espenak & Meeus (2006) as default
297
                idx = ui->deltaTAlgorithmComboBox->findData(QVariant("EspenakMeeusModified"), Qt::UserRole, Qt::MatchCaseSensitive);
×
298
        }
299
        ui->deltaTAlgorithmComboBox->setCurrentIndex(idx);
×
300
        connect(ui->deltaTAlgorithmComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setDeltaTAlgorithm(int)));
×
301
        connect(ui->pushButtonCustomDeltaTEquationDialog, SIGNAL(clicked()), this, SLOT(showCustomDeltaTEquationDialog()));
×
302
        if (core->getCurrentDeltaTAlgorithm()==StelCore::Custom)
×
303
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(true);
×
304

305
        // Tools tab
306
        ui->sphericMirrorCheckbox->setChecked(StelApp::getInstance().getViewportEffect() == "sphericMirrorDistorter");
×
307
        connect(ui->sphericMirrorCheckbox, SIGNAL(toggled(bool)), this, SLOT(setSphericMirror(bool)));
×
308
        connectBoolProperty(ui->gravityLabelCheckbox, "StelCore.flagGravityLabels");
×
309

310
        ui->diskViewportCheckbox->setChecked(proj->getMaskType() == StelProjector::MaskDisk);
×
311
        connect(ui->diskViewportCheckbox, SIGNAL(toggled(bool)), this, SLOT(setDiskViewport(bool)));
×
312
        connectBoolProperty(ui->autoZoomResetsDirectionCheckbox, "StelMovementMgr.flagAutoZoomOutResetsDirection");
×
313

314
        connectBoolProperty(ui->showQuitButtonCheckBox,                                "StelGui.flagShowQuitButton");
×
315
        connectBoolProperty(ui->showFlipButtonsCheckbox,                                "StelGui.flagShowFlipButtons");
×
316
        connectBoolProperty(ui->showNebulaBgButtonCheckbox,                        "StelGui.flagShowNebulaBackgroundButton");
×
317
        
318
        connectBoolProperty(ui->showObsListButtonCheckBox,        "StelGui.flagShowObsListButton");
×
319
        
320
        connectBoolProperty(ui->showICRSGridButtonCheckBox,                        "StelGui.flagShowICRSGridButton");
×
321
        connectBoolProperty(ui->showGalacticGridButtonCheckBox,                "StelGui.flagShowGalacticGridButton");
×
322
        connectBoolProperty(ui->showEclipticGridButtonCheckBox,                "StelGui.flagShowEclipticGridButton");
×
323
        connectBoolProperty(ui->showHipsButtonCheckBox,                                "StelGui.flagShowHiPSButton");
×
324
        connectBoolProperty(ui->showDSSButtonCheckbox,                                "StelGui.flagShowDSSButton");
×
325
        connectBoolProperty(ui->showGotoSelectedButtonCheckBox,                "StelGui.flagShowGotoSelectedObjectButton");
×
326
        connectBoolProperty(ui->showNightmodeButtonCheckBox,                "StelGui.flagShowNightmodeButton");
×
327
        connectBoolProperty(ui->showFullscreenButtonCheckBox,                        "StelGui.flagShowFullscreenButton");
×
328
        connectBoolProperty(ui->showCardinalButtonCheckBox,                        "StelGui.flagShowCardinalButton");
×
329
        connectBoolProperty(ui->showCompassButtonCheckBox,                        "StelGui.flagShowCompassButton");
×
330

331
        connectBoolProperty(ui->showConstellationBoundariesButtonCheckBox, "StelGui.flagShowConstellationBoundariesButton");
×
332
        connectBoolProperty(ui->showConstellationArtsButtonCheckBox, "StelGui.flagShowConstellationArtsButton");
×
333
        connectBoolProperty(ui->showAsterismLinesButtonCheckBox,                "StelGui.flagShowAsterismLinesButton");
×
334
        connectBoolProperty(ui->showAsterismLabelsButtonCheckBox,        "StelGui.flagShowAsterismLabelsButton");
×
335

336
        connectBoolProperty(ui->decimalDegreeCheckBox,                                "StelApp.flagShowDecimalDegrees");
×
337
        connectBoolProperty(ui->azimuthFromSouthcheckBox,                        "StelApp.flagUseAzimuthFromSouth");
×
338

339
        connectBoolProperty(ui->mouseTimeoutCheckbox,                                "MainView.flagCursorTimeout");
×
340
        connectDoubleProperty(ui->mouseTimeoutSpinBox,                                "MainView.cursorTimeout");
×
341
        connectIntProperty(ui->minFpsSpinBox,                                   "MainView.minFps");
×
342
        connectIntProperty(ui->maxFpsSpinBox,                                   "MainView.maxFps");
×
343
        connectBoolProperty(ui->useButtonsBackgroundCheckBox,                "StelGui.flagUseButtonsBackground");
×
344
        connectBoolProperty(ui->indicationMountModeCheckBox,                        "StelMovementMgr.flagIndicationMountMode");
×
345
        connectBoolProperty(ui->kineticScrollingCheckBox,                                "StelGui.flagUseKineticScrolling");
×
346
        connectBoolProperty(ui->focusOnDaySpinnerCheckBox,                        "StelGui.flagEnableFocusOnDaySpinner");
×
347
        ui->overwriteTextColorButton->setup("StelApp.overwriteInfoColor", "color/info_text_color");
×
348
        ui->daylightTextColorButton ->setup("StelApp.daylightInfoColor",  "color/daylight_text_color");
×
349
        connectIntProperty(ui->solarSystemThreadNumberSpinBox, "SolarSystem.extraThreads");
×
350
        ui->solarSystemThreadNumberSpinBox->setMaximum(QThreadPool::globalInstance()->maxThreadCount()-1);
×
351

352
        // Font selection. We use a hidden, but documented entry in config.ini to optionally show a font selection option.
353
        connectIntProperty(ui->screenFontSizeSpinBox, "StelApp.screenFontSize");
×
354
        connectIntProperty(ui->guiFontSizeSpinBox, "StelApp.guiFontSize");
×
355
        connectDoubleProperty(ui->screenButtonScaleSpinBox, "StelApp.screenButtonScale");
×
356
        if (StelApp::getInstance().getSettings()->value("gui/flag_font_selection", true).toBool())
×
357
        {
358
                populateFontWritingSystemCombo();
×
359
                connect(ui->fontWritingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleFontBoxWritingSystem(int)));
×
360

361
                ui->fontComboBox->setWritingSystem(QFontDatabase::Any);
×
362
                ui->fontComboBox->setFontFilters(QFontComboBox::ScalableFonts | QFontComboBox::ProportionalFonts);
×
363
                ui->fontComboBox->setCurrentFont(QGuiApplication::font());
×
364
                connect(ui->fontComboBox, SIGNAL(currentFontChanged(QFont)), &StelApp::getInstance(), SLOT(setAppFont(QFont)));
×
365
        }
366
        else
367
        {
368
                ui->fontWritingSystemComboBox->hide();
×
369
                ui->fontComboBox->hide();
×
370
        }
371
        // Font properties are potentially delicate. Immediate storing may cause problems with other script systems etc.
372
        connect(ui->fontSaveToolButton, SIGNAL(clicked()), this, SLOT(storeFontSettings()));
×
373

374
        // Dithering
375
        populateDitherList();
×
376
        connect(ui->ditheringComboBox, SIGNAL(currentIndexChanged(const int)), this, SLOT(setDitherFormat()));
×
377

378
        // General Option Save
379
        connect(ui->saveViewDirAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveCurrentViewDirSettings()));
×
380
        connect(ui->saveSettingsAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveAllSettings()));
×
381
        connectBoolProperty(ui->immediateSaveCheckBox, "StelApp.flagImmediateSave");
×
382
        // Disable "save settings" button in case of immediate-store mode
383
        if (StelApp::getInstance().getFlagImmediateSave())
×
384
                ui->saveSettingsAsDefaultPushButton->setDisabled(true);
×
385
        connect(ui->saveSettingsAsDefaultPushButton, &QPushButton::clicked, this, [=](){
×
386
                if (ui->immediateSaveCheckBox->isChecked())
×
387
                        ui->saveSettingsAsDefaultPushButton->setDisabled(true);
×
388
        });
×
389
        connect(ui->immediateSaveCheckBox, &QCheckBox::clicked, this, [=](){
×
390
                if (!ui->immediateSaveCheckBox->isChecked())
×
391
                        ui->saveSettingsAsDefaultPushButton->setDisabled(false);
×
392
        });
×
393

394
        connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(setDefaultViewOptions()));
×
395

396
        // Screenshots
397
        populateScreenshotFileformatsCombo();
×
398
        connect(ui->pushButtonConfigureScreenshotsDialog, SIGNAL(clicked()), this, SLOT(showConfigureScreenshotsDialog()));
×
399
        connectStringProperty(ui->screenshotFileFormatComboBox, "MainView.screenShotFormat");
×
400
        ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir());
×
401
        connect(ui->screenshotDirEdit, SIGNAL(editingFinished()), this, SLOT(selectScreenshotDir()));
×
402
        connect(ui->screenshotBrowseButton, SIGNAL(clicked()), this, SLOT(browseForScreenshotDir()));
×
403
        connectBoolProperty(ui->invertScreenShotColorsCheckBox, "MainView.flagInvertScreenShotColors");
×
404
        connectBoolProperty(ui->useCustomScreenshotSizeCheckBox, "MainView.flagUseCustomScreenshotSize");
×
405
        ui->customScreenshotWidthLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
406
        ui->customScreenshotHeightLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
407
        connectIntProperty(ui->customScreenshotWidthLineEdit, "MainView.customScreenshotWidth");
×
408
        connectIntProperty(ui->customScreenshotHeightLineEdit, "MainView.customScreenshotHeight");
×
409
        connectIntProperty(ui->dpiSpinBox, "MainView.screenshotDpi");
×
410
        StelMainView *mainView=static_cast<StelMainView *>(StelApp::getInstance().parent());
×
411
        connect(mainView, SIGNAL(screenshotDpiChanged(int)), this, SLOT(updateDpiTooltip()));
×
412
        connect(mainView, SIGNAL(flagUseCustomScreenshotSizeChanged(bool)), this, SLOT(updateDpiTooltip()));
×
413
        connect(mainView, SIGNAL(customScreenshotWidthChanged(int)), this, SLOT(updateDpiTooltip()));
×
414
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
415
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
416
        connect(mainView, SIGNAL(sizeChanged(const QSize&)), this, SLOT(updateDpiTooltip()));
×
417
        updateDpiTooltip();
×
418

419
        // script tab controls
420
        #ifdef ENABLE_SCRIPTING
421
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
×
422
        connect(ui->scriptListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(scriptSelectionChanged(const QString&)));
×
423
        connect(ui->runScriptButton, SIGNAL(clicked()), this, SLOT(runScriptClicked()));
×
424
        connect(ui->stopScriptButton, SIGNAL(clicked()), this, SLOT(stopScriptClicked()));
×
425
        if (scriptMgr.scriptIsRunning())
×
426
                aScriptIsRunning();
×
427
        else
428
                aScriptHasStopped();
×
429
        connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(aScriptIsRunning()));
×
430
        connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(aScriptHasStopped()));
×
431
        ui->scriptListWidget->setSortingEnabled(true);
×
432
        populateScriptsList();
×
433
        connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScriptsList()));
×
434
        #else
435
        ui->configurationStackedWidget->removeWidget(ui->page_Scripts); // only hide, no delete!
436
        QListWidgetItem *item = ui->stackListWidget->takeItem(5); // take out from its place.
437
        ui->stackListWidget->addItem(item); // We must add it back to the end of the tabs, as...
438
        ui->stackListWidget->item(6)->setHidden(true); // deleting would cause a crash during retranslation. (GH#2544)
439
        #endif
440

441
        // plugins control
442
        connect(ui->pluginsListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(pluginsSelectionChanged(QListWidgetItem*, QListWidgetItem*)));
×
443
#if (QT_VERSION<QT_VERSION_CHECK(6,7,0))
444
        connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int)));
×
445
#else
446
        connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(checkStateChanged(Qt::CheckState)), this, SLOT(loadAtStartupChanged(Qt::CheckState)));
447
#endif
448
        connect(ui->pluginsListWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(pluginConfigureCurrentSelection()));
×
449
        connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(pluginConfigureCurrentSelection()));
×
450
        populatePluginsList();
×
451

452
        updateConfigLabels();
×
453
        populateTooltips();
×
454
        updateTabBarListWidgetWidth();
×
455

456
        connect((dynamic_cast<StelGui*>(StelApp::getInstance().getGui())), &StelGui::htmlStyleChanged, this, [=](const QString &style){
×
457
                ui->pluginsInfoBrowser->document()->setDefaultStyleSheet(style);
×
458
                ui->scriptInfoBrowser->document()->setDefaultStyleSheet(style);
×
459
                ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(style);
×
460
        });
×
461
}
×
462

463
void ConfigurationDialog::setKeyNavigationState(bool state)
×
464
{
465
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
466
        mvmgr->setFlagEnableMoveKeys(state);
×
467
        mvmgr->setFlagEnableZoomKeys(state);
×
468
        ui->editShortcutsPushButton->setEnabled(state);
×
469
}
×
470

471
void ConfigurationDialog::updateCurrentLanguage()
×
472
{
473
        QComboBox* cb = ui->programLanguageComboBox;
×
474
        QString appLang = StelApp::getInstance().getLocaleMgr().getAppLanguage();
×
475
        QString l2 = StelTranslator::iso639_1CodeToNativeName(appLang);
×
476

477
        if (cb->currentText() == l2)
×
478
                return;
×
479

480
        int lt = cb->findText(l2, Qt::MatchExactly);
×
481
        if (lt == -1 && appLang.contains('_'))
×
482
        {
483
                l2 = appLang.left(appLang.indexOf('_'));
×
484
                l2=StelTranslator::iso639_1CodeToNativeName(l2);
×
485
                lt = cb->findText(l2, Qt::MatchExactly);
×
486
        }
487
        if (lt!=-1)
×
488
                cb->setCurrentIndex(lt);
×
489
}
×
490

491
void ConfigurationDialog::selectLanguage(const int id)
×
492
{
493
        const QString &langName=static_cast<QComboBox*>(sender())->itemText(id);
×
494
        QString code = StelTranslator::nativeNameToIso639_1Code(langName);
×
495
        StelApp::getInstance().getLocaleMgr().setAppLanguage(code);
×
496
        StelMainView::getInstance().initTitleI18n();
×
497
}
×
498

499
void ConfigurationDialog::setStartupTimeMode()
×
500
{
501
        StelCore *core=StelApp::getInstance().getCore();
×
502
        if (ui->systemTimeRadio->isChecked())
×
503
                core->setStartupTimeMode("actual");
×
504
        else if (ui->todayRadio->isChecked())
×
505
                core->setStartupTimeMode("today");
×
506
        else
507
                core->setStartupTimeMode("preset");
×
508

509
        core->setInitTodayTime(ui->todayTimeSpinBox->time());
×
510
        core->setPresetSkyTime(ui->fixedDateTimeEdit->dateTime());
×
511
}
×
512

513
void ConfigurationDialog::setButtonBarDTFormat()
×
514
{
515
        if (ui->jdRadioButton->isChecked())
×
516
                gui->getButtonBar()->setFlagTimeJd(true);
×
517
        else
518
                gui->getButtonBar()->setFlagTimeJd(false);
×
519
        StelApp::immediateSave("gui/flag_time_jd", ui->jdRadioButton->isChecked());
×
520
}
×
521

522
void ConfigurationDialog::showShortcutsWindow()
×
523
{
524
        StelAction* action = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Shortcuts_Window_Global");
×
525
        if (action)
×
526
                action->setChecked(true);
×
527
}
×
528

529
void ConfigurationDialog::setDiskViewport(bool b)
×
530
{
531
        if (b)
×
532
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskDisk);
×
533
        else
534
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskNone);
×
535
        StelApp::immediateSave("projection/viewport", StelProjector::maskTypeToString(StelApp::getInstance().getCore()->getCurrentStelProjectorParams().maskType));
×
536
}
×
537

538
void ConfigurationDialog::setSphericMirror(bool b)
×
539
{
540
        StelCore* core = StelApp::getInstance().getCore();
×
541
        if (b)
×
542
        {
543
                savedProjectionType = core->getCurrentProjectionType();
×
544
                core->setCurrentProjectionType(StelCore::ProjectionFisheye);
×
545
                StelApp::getInstance().setViewportEffect("sphericMirrorDistorter");
×
546
        }
547
        else
548
        {
549
                core->setCurrentProjectionType(static_cast<StelCore::ProjectionType>(savedProjectionType));
×
550
                StelApp::getInstance().setViewportEffect("none");
×
551
        }
552
}
×
553

554
void ConfigurationDialog::updateSelectedInfoGui()
×
555
{
556
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
557
        // Selected object info
558
        if (flags == StelObject::InfoStringGroup(StelObject::None))
×
559
        {
560
                ui->noSelectedInfoRadio->setChecked(true);
×
561
        }
562
        else if (flags == StelObject::InfoStringGroup(StelObject::DefaultInfo))
×
563
        {
564
                ui->defaultSelectedInfoRadio->setChecked(true);
×
565
        }
566
        else if (flags == StelObject::InfoStringGroup(StelObject::ShortInfo))
×
567
        {
568
                ui->briefSelectedInfoRadio->setChecked(true);
×
569
        }
570
        else if (flags == StelObject::InfoStringGroup(StelObject::AllInfo))
×
571
        {
572
                ui->allSelectedInfoRadio->setChecked(true);
×
573
        }
574
        else
575
        {
576
                ui->customSelectedInfoRadio->setChecked(true);
×
577
        }
578
        updateSelectedInfoCheckBoxes();
×
579
}
×
580

581
void ConfigurationDialog::setNoSelectedInfo()
×
582
{
583
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::None));
×
584
        StelApp::immediateSave("gui/selected_object_info", "none");
×
585
        updateSelectedInfoCheckBoxes();
×
586
}
×
587

588
void ConfigurationDialog::setAllSelectedInfo()
×
589
{
590
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::AllInfo));
×
591
        StelApp::immediateSave("gui/selected_object_info", "all");
×
592
        updateSelectedInfoCheckBoxes();
×
593
}
×
594

595
void ConfigurationDialog::setBriefSelectedInfo()
×
596
{
597
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::ShortInfo));
×
598
        StelApp::immediateSave("gui/selected_object_info", "short");
×
599
        updateSelectedInfoCheckBoxes();
×
600
}
×
601

602
void ConfigurationDialog::setDefaultSelectedInfo()
×
603
{
604
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::DefaultInfo));
×
605
        StelApp::immediateSave("gui/selected_object_info", "default");
×
606
        updateSelectedInfoCheckBoxes();
×
607
}
×
608

609
void ConfigurationDialog::setSelectedInfoFromCheckBoxes()
×
610
{
611
        // As this signal will be called when a checkbox is toggled,
612
        // change the general mode to Custom.
613
        if (!ui->customSelectedInfoRadio->isChecked())
×
614
        {
615
                ui->customSelectedInfoRadio->setChecked(true);
×
616
                StelApp::immediateSave("gui/selected_object_info", "custom");
×
617
        }
618

619
        StelObject::InfoStringGroup flags(StelObject::None);
×
620

621
        if (ui->checkBoxName->isChecked())
×
622
                flags |= StelObject::Name;
×
623
        if (ui->checkBoxCatalogNumbers->isChecked())
×
624
                flags |= StelObject::CatalogNumber;
×
625
        if (ui->checkBoxVisualMag->isChecked())
×
626
                flags |= StelObject::Magnitude;
×
627
        if (ui->checkBoxAbsoluteMag->isChecked())
×
628
                flags |= StelObject::AbsoluteMagnitude;
×
629
        if (ui->checkBoxRaDecJ2000->isChecked())
×
630
                flags |= StelObject::RaDecJ2000;
×
631
        if (ui->checkBoxRaDecOfDate->isChecked())
×
632
                flags |= StelObject::RaDecOfDate;
×
633
        if (ui->checkBoxHourAngle->isChecked())
×
634
                flags |= StelObject::HourAngle;
×
635
        if (ui->checkBoxAltAz->isChecked())
×
636
                flags |= StelObject::AltAzi;
×
637
        if (ui->checkBoxDistance->isChecked())
×
638
                flags |= StelObject::Distance;
×
639
        if (ui->checkBoxVelocity->isChecked())
×
640
                flags |= StelObject::Velocity;
×
641
        if (ui->checkBoxProperMotion->isChecked())
×
642
                flags |= StelObject::ProperMotion;
×
643
        if (ui->checkBoxSize->isChecked())
×
644
                flags |= StelObject::Size;
×
645
        if (ui->checkBoxExtra->isChecked())
×
646
                flags |= StelObject::Extra;
×
647
        if (ui->checkBoxGalacticCoordinates->isChecked())
×
648
                flags |= StelObject::GalacticCoord;
×
649
        if (ui->checkBoxSupergalacticCoordinates->isChecked())
×
650
                flags |= StelObject::SupergalacticCoord;
×
651
        if (ui->checkBoxOtherCoords->isChecked())
×
652
                flags |= StelObject::OtherCoord;
×
653
        if (ui->checkBoxElongation->isChecked())
×
654
                flags |= StelObject::Elongation;
×
655
        if (ui->checkBoxType->isChecked())
×
656
                flags |= StelObject::ObjectType;
×
657
        if (ui->checkBoxEclipticCoordsJ2000->isChecked())
×
658
                flags |= StelObject::EclipticCoordJ2000;
×
659
        if (ui->checkBoxEclipticCoordsOfDate->isChecked())
×
660
                flags |= StelObject::EclipticCoordOfDate;
×
661
        if (ui->checkBoxConstellation->isChecked())
×
662
                flags |= StelObject::IAUConstellation;
×
663
        if (ui->checkBoxSiderealTime->isChecked())
×
664
                flags |= StelObject::SiderealTime;
×
665
        if (ui->checkBoxRTSTime->isChecked())
×
666
                flags |= StelObject::RTSTime;
×
667
        if (ui->checkBoxSolarLunarPosition->isChecked())
×
668
                flags |= StelObject::SolarLunarPosition;
×
669

670
        gui->setInfoTextFilters(flags);
×
671
        // overwrite custom selected info settings
672
        saveCustomSelectedInfo();
×
673
}
×
674

675
void ConfigurationDialog::setCustomSelectedInfo()
×
676
{
677
        StelObject::InfoStringGroup flags(StelObject::None);
×
678
        QSettings* conf = StelApp::getInstance().getSettings();
×
679
        Q_ASSERT(conf);
×
680

681
        if (conf->value("custom_selected_info/flag_show_name", false).toBool())
×
682
                flags |= StelObject::Name;
×
683
        if (conf->value("custom_selected_info/flag_show_catalognumber", false).toBool())
×
684
                flags |= StelObject::CatalogNumber;
×
685
        if (conf->value("custom_selected_info/flag_show_magnitude", false).toBool())
×
686
                flags |= StelObject::Magnitude;
×
687
        if (conf->value("custom_selected_info/flag_show_absolutemagnitude", false).toBool())
×
688
                flags |= StelObject::AbsoluteMagnitude;
×
689
        if (conf->value("custom_selected_info/flag_show_radecj2000", false).toBool())
×
690
                flags |= StelObject::RaDecJ2000;
×
691
        if (conf->value("custom_selected_info/flag_show_radecofdate", false).toBool())
×
692
                flags |= StelObject::RaDecOfDate;
×
693
        if (conf->value("custom_selected_info/flag_show_hourangle", false).toBool())
×
694
                flags |= StelObject::HourAngle;
×
695
        if (conf->value("custom_selected_info/flag_show_altaz", false).toBool())
×
696
                flags |= StelObject::AltAzi;
×
697
        if (conf->value("custom_selected_info/flag_show_elongation", false).toBool())
×
698
                flags |= StelObject::Elongation;
×
699
        if (conf->value("custom_selected_info/flag_show_distance", false).toBool())
×
700
                flags |= StelObject::Distance;
×
701
        if (conf->value("custom_selected_info/flag_show_velocity", false).toBool())
×
702
                flags |= StelObject::Velocity;
×
703
        if (conf->value("custom_selected_info/flag_show_propermotion", false).toBool())
×
704
                flags |= StelObject::ProperMotion;
×
705
        if (conf->value("custom_selected_info/flag_show_size", false).toBool())
×
706
                flags |= StelObject::Size;
×
707
        if (conf->value("custom_selected_info/flag_show_extra", false).toBool())
×
708
                flags |= StelObject::Extra;
×
709
        if (conf->value("custom_selected_info/flag_show_galcoord", false).toBool())
×
710
                flags |= StelObject::GalacticCoord;
×
711
        if (conf->value("custom_selected_info/flag_show_supergalcoord", false).toBool())
×
712
                flags |= StelObject::SupergalacticCoord;
×
713
        if (conf->value("custom_selected_info/flag_show_othercoord", false).toBool())
×
714
                flags |= StelObject::OtherCoord;
×
715
        if (conf->value("custom_selected_info/flag_show_type", false).toBool())
×
716
                flags |= StelObject::ObjectType;
×
717
        if (conf->value("custom_selected_info/flag_show_eclcoordofdate", false).toBool())
×
718
                flags |= StelObject::EclipticCoordOfDate;
×
719
        if (conf->value("custom_selected_info/flag_show_eclcoordj2000", false).toBool())
×
720
                flags |= StelObject::EclipticCoordJ2000;
×
721
        if (conf->value("custom_selected_info/flag_show_constellation", false).toBool())
×
722
                flags |= StelObject::IAUConstellation;
×
723
        if (conf->value("custom_selected_info/flag_show_sidereal_time", false).toBool())
×
724
                flags |= StelObject::SiderealTime;
×
725
        if (conf->value("custom_selected_info/flag_show_rts_time", false).toBool())
×
726
                flags |= StelObject::RTSTime;
×
727
        if (conf->value("custom_selected_info/flag_show_solar_lunar", false).toBool())
×
728
                flags |= StelObject::SolarLunarPosition;
×
729

730
        gui->setInfoTextFilters(flags);
×
731
        updateSelectedInfoCheckBoxes();
×
732
}
×
733

734
void ConfigurationDialog::saveCustomSelectedInfo()
×
735
{
736
        // configuration dialog / selected object info tab
737
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
738
        QSettings* conf = StelApp::getInstance().getSettings();
×
739
        Q_ASSERT(conf);
×
740

741
        conf->beginGroup("custom_selected_info");
×
742
        conf->setValue("flag_show_name",                        static_cast<bool>(flags & StelObject::Name));
×
743
        conf->setValue("flag_show_catalognumber",                static_cast<bool>(flags & StelObject::CatalogNumber));
×
744
        conf->setValue("flag_show_magnitude",                        static_cast<bool>(flags & StelObject::Magnitude));
×
745
        conf->setValue("flag_show_absolutemagnitude",                static_cast<bool>(flags & StelObject::AbsoluteMagnitude));
×
746
        conf->setValue("flag_show_radecj2000",                        static_cast<bool>(flags & StelObject::RaDecJ2000));
×
747
        conf->setValue("flag_show_radecofdate",                        static_cast<bool>(flags & StelObject::RaDecOfDate));
×
748
        conf->setValue("flag_show_hourangle",                        static_cast<bool>(flags & StelObject::HourAngle));
×
749
        conf->setValue("flag_show_altaz",                        static_cast<bool>(flags & StelObject::AltAzi));
×
750
        conf->setValue("flag_show_elongation",                        static_cast<bool>(flags & StelObject::Elongation));
×
751
        conf->setValue("flag_show_distance",                        static_cast<bool>(flags & StelObject::Distance));
×
752
        conf->setValue("flag_show_velocity",                        static_cast<bool>(flags & StelObject::Velocity));
×
753
        conf->setValue("flag_show_propermotion",                static_cast<bool>(flags & StelObject::ProperMotion));
×
754
        conf->setValue("flag_show_size",                        static_cast<bool>(flags & StelObject::Size));
×
755
        conf->setValue("flag_show_extra",                        static_cast<bool>(flags & StelObject::Extra));
×
756
        conf->setValue("flag_show_galcoord",                        static_cast<bool>(flags & StelObject::GalacticCoord));
×
757
        conf->setValue("flag_show_supergalcoord",                static_cast<bool>(flags & StelObject::SupergalacticCoord));
×
758
        conf->setValue("flag_show_othercoord",                        static_cast<bool>(flags & StelObject::OtherCoord));
×
759
        conf->setValue("flag_show_type",                        static_cast<bool>(flags & StelObject::ObjectType));
×
760
        conf->setValue("flag_show_eclcoordofdate",                static_cast<bool>(flags & StelObject::EclipticCoordOfDate));
×
761
        conf->setValue("flag_show_eclcoordj2000",                static_cast<bool>(flags & StelObject::EclipticCoordJ2000));
×
762
        conf->setValue("flag_show_constellation",                static_cast<bool>(flags & StelObject::IAUConstellation));
×
763
        conf->setValue("flag_show_sidereal_time",                static_cast<bool>(flags & StelObject::SiderealTime));
×
764
        conf->setValue("flag_show_rts_time",                        static_cast<bool>(flags & StelObject::RTSTime));
×
765
        conf->setValue("flag_show_solar_lunar",                        static_cast<bool>(flags & StelObject::SolarLunarPosition));
×
766
        conf->endGroup();
×
767
}
×
768

769
void ConfigurationDialog::browseForScreenshotDir()
×
770
{
771
        const QString &oldScreenshotDir = StelFileMgr::getScreenshotDir();
×
772
        QString newScreenshotDir = QFileDialog::getExistingDirectory(&StelMainView::getInstance(), q_("Select screenshot directory"), oldScreenshotDir, QFileDialog::ShowDirsOnly);
×
773

774
        if (!newScreenshotDir.isEmpty()) {
×
775
                // remove trailing slash
776
                if (newScreenshotDir.right(1) == "/")
×
777
                        newScreenshotDir = newScreenshotDir.left(newScreenshotDir.length()-1);
×
778

779
                ui->screenshotDirEdit->setText(newScreenshotDir);
×
780
                selectScreenshotDir();
×
781
        }
782
}
×
783

784
void ConfigurationDialog::selectScreenshotDir()
×
785
{
786
        QString dir = ui->screenshotDirEdit->text();
×
787
        try
788
        {
789
                StelFileMgr::setScreenshotDir(dir);
×
790
        }
791
        catch (std::runtime_error& e)
×
792
        {
793
                Q_UNUSED(e)
794
                // nop
795
                // this will happen when people are only half way through typing dirs
796
        }
×
797
}
×
798

799
void ConfigurationDialog::updateDpiTooltip()
×
800
{
801
        StelMainView *mainView=static_cast<StelMainView *>(StelApp::getInstance().parent());
×
802
        const QString qMM=qc_("mm", "millimeters");
×
803
        const int dpi=mainView->getScreenshotDpi();
×
804
        double mmX, mmY;
805
        if (mainView->getFlagUseCustomScreenshotSize())
×
806
        {
807
                mmX=mainView->getCustomScreenshotWidth()*25.4/dpi;
×
808
                mmY=mainView->getCustomScreenshotHeight()*25.4/dpi;
×
809
        }
810
        else
811
        {
812
                mmX=mainView->window()->width()*25.4/dpi;
×
813
                mmY=mainView->window()->height()*25.4/dpi;
×
814
        }
815

816
        ui->dpiSpinBox->setToolTip("<html><head/><body><p>" +
×
817
                                   q_("Dots per Inch (for image metadata).") + "</p><p>" +
×
818
                                   q_("Current designated print size") +
×
819
                                   QString(": %1&times;%2 %3").arg(QString::number(mmX, 'f', 1), QString::number(mmY, 'f', 1), qMM) +
×
820
                                   + "</p></body></html>");
821
}
×
822

823
// Store FOV and viewing dir.
824
void ConfigurationDialog::saveCurrentViewDirSettings()
×
825
{
826
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
827
        Q_ASSERT(mvmgr);
×
828

829
        mvmgr->setInitFov(mvmgr->getCurrentFov());
×
830
        mvmgr->setInitViewDirectionToCurrent();
×
831
}
×
832

833

834
// Save the current viewing options including sky culture
835
// This doesn't include the current viewing direction, landscape, time and FOV since those have specific controls
836
void ConfigurationDialog::saveAllSettings()
×
837
{
838
        QSettings* conf = StelApp::getInstance().getSettings();
×
839
        Q_ASSERT(conf);
×
840

841
        // TBD: store more properties directly, avoid to query all modules.
842
        StelPropertyMgr* propMgr=StelApp::getInstance().getStelPropertyManager();
×
843
        Q_ASSERT(propMgr);
×
844

845
        NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
×
846
        Q_ASSERT(nmgr);
×
847
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
848
        Q_ASSERT(mvmgr);
×
849

850
        StelCore* core = StelApp::getInstance().getCore();
×
851
        const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000);
×
852
        Q_ASSERT(proj);
×
853

854
        conf->setValue("gui/immediate_save_details",                    StelApp::getInstance().getFlagImmediateSave());
×
855
        conf->setValue("gui/flag_enable_kinetic_scrolling",                propMgr->getStelPropertyValue("StelGui.flagUseKineticScrolling").toBool());
×
856

857
        // view dialog / sky tab settings
858
        conf->setValue("stars/absolute_scale",                                QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.absoluteStarScale").toDouble(), 'f', 2));
×
859
        conf->setValue("stars/relative_scale",                                QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.relativeStarScale").toDouble(), 'f', 2));
×
860
        conf->setValue("stars/flag_star_twinkle",                        propMgr->getStelPropertyValue("StelSkyDrawer.flagStarTwinkle").toBool());
×
861
        conf->setValue("stars/star_twinkle_amount",                        QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.twinkleAmount").toDouble(), 'f', 2));
×
862
        conf->setValue("stars/flag_star_spiky",                                propMgr->getStelPropertyValue("StelSkyDrawer.flagStarSpiky").toBool());
×
863
        conf->setValue("astro/twilight_altitude",                        propMgr->getStelPropertyValue("SpecificTimeMgr.twilightAltitude").toDouble());
×
864
        conf->setValue("astro/flag_star_magnitude_limit",                propMgr->getStelPropertyValue("StelSkyDrawer.flagStarMagnitudeLimit").toBool());
×
865
        conf->setValue("astro/star_magnitude_limit",                        QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.customStarMagLimit").toDouble(), 'f', 2));
×
866
        conf->setValue("astro/flag_planet_magnitude_limit",                propMgr->getStelPropertyValue("StelSkyDrawer.flagPlanetMagnitudeLimit").toBool());
×
867
        conf->setValue("astro/planet_magnitude_limit",                        QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.customPlanetMagLimit").toDouble(), 'f', 2));
×
868
        conf->setValue("astro/flag_nebula_magnitude_limit",                propMgr->getStelPropertyValue("StelSkyDrawer.flagNebulaMagnitudeLimit").toBool());
×
869
        conf->setValue("astro/nebula_magnitude_limit",                        QString::number(propMgr->getStelPropertyValue("StelSkyDrawer.customNebulaMagLimit").toDouble(), 'f', 2));
×
870
        conf->setValue("viewing/use_luminance_adaptation",                propMgr->getStelPropertyValue("StelSkyDrawer.flagLuminanceAdaptation").toBool());
×
871
        conf->setValue("astro/flag_planets",                                propMgr->getStelPropertyValue("SolarSystem.planetsDisplayed").toBool());
×
872
        conf->setValue("astro/flag_planets_hints",                        propMgr->getStelPropertyValue("SolarSystem.flagHints").toBool());
×
873
        conf->setValue("astro/flag_planets_markers",                        propMgr->getStelPropertyValue("SolarSystem.flagMarkers").toBool());
×
874
        conf->setValue("astro/planet_markers_mag_threshold",                propMgr->getStelPropertyValue("SolarSystem.markerMagThreshold").toDouble());
×
875
        conf->setValue("astro/flag_planets_orbits",                        propMgr->getStelPropertyValue("SolarSystem.flagOrbits").toBool());
×
876
        conf->setValue("astro/flag_permanent_orbits",                        propMgr->getStelPropertyValue("SolarSystem.flagPermanentOrbits").toBool());
×
877
        conf->setValue("astro/object_orbits_thickness",                        propMgr->getStelPropertyValue("SolarSystem.orbitsThickness").toInt());
×
878
        conf->setValue("astro/object_trails_thickness",                        propMgr->getStelPropertyValue("SolarSystem.trailsThickness").toInt());
×
879
        conf->setValue("viewing/flag_isolated_trails",                        propMgr->getStelPropertyValue("SolarSystem.flagIsolatedTrails").toBool());
×
880
        conf->setValue("viewing/number_isolated_trails",                propMgr->getStelPropertyValue("SolarSystem.numberIsolatedTrails").toInt());
×
881
        conf->setValue("viewing/max_trail_points",                        propMgr->getStelPropertyValue("SolarSystem.maxTrailPoints").toInt());
×
882
        conf->setValue("viewing/max_trail_time_extent",                        propMgr->getStelPropertyValue("SolarSystem.maxTrailTimeExtent").toInt());
×
883
        conf->setValue("viewing/flag_isolated_orbits",                        propMgr->getStelPropertyValue("SolarSystem.flagIsolatedOrbits").toBool());
×
884
        conf->setValue("viewing/flag_planets_orbits",                        propMgr->getStelPropertyValue("SolarSystem.flagPlanetsOrbits").toBool());
×
885
        conf->setValue("viewing/flag_planets_orbits_only",                propMgr->getStelPropertyValue("SolarSystem.flagPlanetsOrbitsOnly").toBool());
×
886
        conf->setValue("viewing/flag_orbits_with_moons",                propMgr->getStelPropertyValue("SolarSystem.flagOrbitsWithMoons").toBool());
×
887
        conf->setValue("astro/flag_light_travel_time",                        propMgr->getStelPropertyValue("SolarSystem.flagLightTravelTime").toBool());
×
888
        conf->setValue("viewing/flag_draw_moon_halo",                        propMgr->getStelPropertyValue("SolarSystem.flagDrawMoonHalo").toBool());
×
889
        conf->setValue("viewing/flag_draw_sun_halo",                        propMgr->getStelPropertyValue("SolarSystem.flagDrawSunHalo").toBool());
×
890
        conf->setValue("viewing/flag_draw_sun_corona",                        propMgr->getStelPropertyValue("SolarSystem.flagPermanentSolarCorona").toBool());
×
891
        conf->setValue("viewing/flag_moon_scaled",                        propMgr->getStelPropertyValue("SolarSystem.flagMoonScale").toBool());
×
892
        conf->setValue("viewing/moon_scale",                                QString::number(propMgr->getStelPropertyValue("SolarSystem.moonScale").toDouble(), 'f', 2));
×
893
        conf->setValue("viewing/flag_minorbodies_scaled",                propMgr->getStelPropertyValue("SolarSystem.flagMinorBodyScale").toBool());
×
894
        conf->setValue("viewing/minorbodies_scale",                        QString::number(propMgr->getStelPropertyValue("SolarSystem.minorBodyScale").toDouble(), 'f', 2));
×
895
        conf->setValue("viewing/flag_planets_scaled",                        propMgr->getStelPropertyValue("SolarSystem.flagPlanetScale").toBool());
×
896
        conf->setValue("viewing/planets_scale",                                QString::number(propMgr->getStelPropertyValue("SolarSystem.planetScale").toDouble(), 'f', 2));
×
897
        conf->setValue("viewing/flag_sun_scaled",                        propMgr->getStelPropertyValue("SolarSystem.flagSunScale").toBool());
×
898
        conf->setValue("viewing/sun_scale",                                QString::number(propMgr->getStelPropertyValue("SolarSystem.sunScale").toDouble(), 'f', 2));
×
899
        conf->setValue("astro/meteor_zhr",                                propMgr->getStelPropertyValue("SporadicMeteorMgr.zhr").toInt());
×
900
        conf->setValue("astro/flag_milky_way",                                propMgr->getStelPropertyValue("MilkyWay.flagMilkyWayDisplayed").toBool());
×
901
        conf->setValue("astro/milky_way_intensity",                        QString::number(propMgr->getStelPropertyValue("MilkyWay.intensity").toDouble(), 'f', 2));
×
902
        conf->setValue("astro/milky_way_saturation",                        QString::number(propMgr->getStelPropertyValue("MilkyWay.saturation").toDouble(), 'f', 2));
×
903
        conf->setValue("astro/flag_zodiacal_light",                        propMgr->getStelPropertyValue("ZodiacalLight.flagZodiacalLightDisplayed").toBool());
×
904
        conf->setValue("astro/zodiacal_light_intensity",                QString::number(propMgr->getStelPropertyValue("ZodiacalLight.intensity").toDouble(), 'f', 2));
×
905
        conf->setValue("astro/grs_longitude",                                propMgr->getStelPropertyValue("SolarSystem.grsLongitude").toInt());
×
906
        conf->setValue("astro/grs_drift",                                propMgr->getStelPropertyValue("SolarSystem.grsDrift").toDouble());
×
907
        conf->setValue("astro/grs_jd",                                        propMgr->getStelPropertyValue("SolarSystem.grsJD").toDouble());
×
908
        conf->setValue("astro/shadow_enlargement_danjon",                propMgr->getStelPropertyValue("SolarSystem.earthShadowEnlargementDanjon").toBool());
×
909
        conf->setValue("astro/flag_planets_labels",                        propMgr->getStelPropertyValue("SolarSystem.labelsDisplayed").toBool());
×
910
        conf->setValue("astro/labels_amount",                                propMgr->getStelPropertyValue("SolarSystem.labelsAmount").toDouble());        
×
911
        conf->setValue("astro/flag_use_obj_models",                        propMgr->getStelPropertyValue("SolarSystem.flagUseObjModels").toBool());
×
912
        conf->setValue("astro/flag_show_obj_self_shadows",                propMgr->getStelPropertyValue("SolarSystem.flagShowObjSelfShadows").toBool());
×
913
        conf->setValue("astro/apparent_magnitude_algorithm",                propMgr->getStelPropertyValue("SolarSystem.apparentMagnitudeAlgorithmOnEarth").toString());
×
914
        conf->setValue("astro/flag_planets_nomenclature",                propMgr->getStelPropertyValue("NomenclatureMgr.flagShowNomenclature").toBool());
×
915
        conf->setValue("astro/flag_planets_nomenclature_outline_craters",propMgr->getStelPropertyValue("NomenclatureMgr.flagOutlineCraters").toBool());
×
916
        conf->setValue("astro/flag_hide_local_nomenclature",                propMgr->getStelPropertyValue("NomenclatureMgr.flagHideLocalNomenclature").toBool());
×
917
        conf->setValue("astro/flag_special_nomenclature_only",                propMgr->getStelPropertyValue("NomenclatureMgr.specialNomenclatureOnlyDisplayed").toBool());
×
918
        conf->setValue("astro/flag_planets_nomenclature_terminator_only",propMgr->getStelPropertyValue("NomenclatureMgr.flagShowTerminatorZoneOnly").toBool());
×
919
        conf->setValue("astro/planet_nomenclature_solar_altitude_min",        propMgr->getStelPropertyValue("NomenclatureMgr.terminatorMinAltitude").toInt());
×
920
        conf->setValue("astro/planet_nomenclature_solar_altitude_max",        propMgr->getStelPropertyValue("NomenclatureMgr.terminatorMaxAltitude").toInt());
×
921
        conf->setValue("astro/planet_markers_mag_threshold",                propMgr->getStelPropertyValue("SolarSystem.markerMagThreshold").toDouble());
×
922

923
        // view dialog / markings tab settings
924
        conf->setValue("viewing/flag_gridlines",                        propMgr->getStelPropertyValue("GridLinesMgr.gridlinesDisplayed").toBool());
×
925
        conf->setValue("viewing/flag_azimuthal_grid",                        propMgr->getStelPropertyValue("GridLinesMgr.azimuthalGridDisplayed").toBool());
×
926
        conf->setValue("viewing/flag_equatorial_grid",                        propMgr->getStelPropertyValue("GridLinesMgr.equatorGridDisplayed").toBool());
×
927
        conf->setValue("viewing/flag_equatorial_J2000_grid",                propMgr->getStelPropertyValue("GridLinesMgr.equatorJ2000GridDisplayed").toBool());
×
928
        conf->setValue("viewing/flag_fixed_equatorial_grid",                propMgr->getStelPropertyValue("GridLinesMgr.fixedEquatorGridDisplayed").toBool());
×
929
        conf->setValue("viewing/flag_equator_line",                        propMgr->getStelPropertyValue("GridLinesMgr.equatorLineDisplayed").toBool());
×
930
        conf->setValue("viewing/flag_equator_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.equatorPartsDisplayed").toBool());
×
931
        conf->setValue("viewing/flag_equator_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.equatorPartsLabeled").toBool());
×
932
        conf->setValue("viewing/flag_equator_J2000_line",                propMgr->getStelPropertyValue("GridLinesMgr.equatorJ2000LineDisplayed").toBool());
×
933
        conf->setValue("viewing/flag_equator_J2000_parts",                propMgr->getStelPropertyValue("GridLinesMgr.equatorJ2000PartsDisplayed").toBool());
×
934
        conf->setValue("viewing/flag_equator_J2000_labels",                propMgr->getStelPropertyValue("GridLinesMgr.equatorJ2000PartsLabeled").toBool());
×
935
        conf->setValue("viewing/flag_fixed_equator_line",                propMgr->getStelPropertyValue("GridLinesMgr.fixedEquatorLineDisplayed").toBool());
×
936
        conf->setValue("viewing/flag_fixed_equator_parts",                propMgr->getStelPropertyValue("GridLinesMgr.fixedEquatorPartsDisplayed").toBool());
×
937
        conf->setValue("viewing/flag_fixed_equator_labels",                propMgr->getStelPropertyValue("GridLinesMgr.fixedEquatorPartsLabeled").toBool());
×
938
        conf->setValue("viewing/flag_ecliptic_line",                        propMgr->getStelPropertyValue("GridLinesMgr.eclipticLineDisplayed").toBool());
×
939
        conf->setValue("viewing/flag_ecliptic_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.eclipticPartsDisplayed").toBool());
×
940
        conf->setValue("viewing/flag_ecliptic_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.eclipticPartsLabeled").toBool());
×
941
        conf->setValue("viewing/flag_ecliptic_dates_labels",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticDatesLabeled").toBool());
×
942
        conf->setValue("viewing/flag_ecliptic_J2000_line",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticJ2000LineDisplayed").toBool());
×
943
        conf->setValue("viewing/flag_ecliptic_J2000_parts",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticJ2000PartsDisplayed").toBool());
×
944
        conf->setValue("viewing/flag_ecliptic_J2000_labels",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticJ2000PartsLabeled").toBool());
×
945
        conf->setValue("viewing/flag_invariable_plane_line",                propMgr->getStelPropertyValue("GridLinesMgr.invariablePlaneLineDisplayed").toBool());
×
946
        conf->setValue("viewing/flag_solar_equator_line",                propMgr->getStelPropertyValue("GridLinesMgr.solarEquatorLineDisplayed").toBool());
×
947
        conf->setValue("viewing/flag_solar_equator_parts",                propMgr->getStelPropertyValue("GridLinesMgr.solarEquatorPartsDisplayed").toBool());
×
948
        conf->setValue("viewing/flag_solar_equator_labels",                propMgr->getStelPropertyValue("GridLinesMgr.solarEquatorPartsLabeled").toBool());
×
949
        conf->setValue("viewing/flag_ecliptic_grid",                        propMgr->getStelPropertyValue("GridLinesMgr.eclipticGridDisplayed").toBool());
×
950
        conf->setValue("viewing/flag_ecliptic_J2000_grid",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticJ2000GridDisplayed").toBool());
×
951
        conf->setValue("viewing/flag_meridian_line",                        propMgr->getStelPropertyValue("GridLinesMgr.meridianLineDisplayed").toBool());
×
952
        conf->setValue("viewing/flag_meridian_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.meridianPartsDisplayed").toBool());
×
953
        conf->setValue("viewing/flag_meridian_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.meridianPartsLabeled").toBool());
×
954
        conf->setValue("viewing/flag_longitude_line",                        propMgr->getStelPropertyValue("GridLinesMgr.longitudeLineDisplayed").toBool());
×
955
        conf->setValue("viewing/flag_longitude_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.longitudePartsDisplayed").toBool());
×
956
        conf->setValue("viewing/flag_longitude_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.longitudePartsLabeled").toBool());
×
957
        conf->setValue("viewing/flag_horizon_line",                        propMgr->getStelPropertyValue("GridLinesMgr.horizonLineDisplayed").toBool());
×
958
        conf->setValue("viewing/flag_horizon_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.horizonPartsDisplayed").toBool());
×
959
        conf->setValue("viewing/flag_horizon_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.horizonPartsLabeled").toBool());
×
960
        conf->setValue("viewing/flag_galactic_grid",                        propMgr->getStelPropertyValue("GridLinesMgr.galacticGridDisplayed").toBool());
×
961
        conf->setValue("viewing/flag_galactic_equator_line",                propMgr->getStelPropertyValue("GridLinesMgr.galacticEquatorLineDisplayed").toBool());
×
962
        conf->setValue("viewing/flag_galactic_equator_parts",                propMgr->getStelPropertyValue("GridLinesMgr.galacticEquatorPartsDisplayed").toBool());
×
963
        conf->setValue("viewing/flag_galactic_equator_labels",                propMgr->getStelPropertyValue("GridLinesMgr.galacticEquatorPartsLabeled").toBool());
×
964
        conf->setValue("viewing/flag_cardinal_points",                        propMgr->getStelPropertyValue("LandscapeMgr.cardinalPointsDisplayed").toBool());
×
965
        conf->setValue("viewing/flag_ordinal_points",                        propMgr->getStelPropertyValue("LandscapeMgr.ordinalPointsDisplayed").toBool());
×
966
        conf->setValue("viewing/flag_16wcr_points",                        propMgr->getStelPropertyValue("LandscapeMgr.ordinal16WRPointsDisplayed").toBool());
×
967
        conf->setValue("viewing/flag_32wcr_points",                        propMgr->getStelPropertyValue("LandscapeMgr.ordinal32WRPointsDisplayed").toBool());
×
968
        conf->setValue("viewing/flag_compass_marks",                        propMgr->getStelPropertyValue("SpecialMarkersMgr.compassMarksDisplayed").toBool());
×
969
        conf->setValue("viewing/flag_prime_vertical_line",                propMgr->getStelPropertyValue("GridLinesMgr.primeVerticalLineDisplayed").toBool());
×
970
        conf->setValue("viewing/flag_prime_vertical_parts",                propMgr->getStelPropertyValue("GridLinesMgr.primeVerticalPartsDisplayed").toBool());
×
971
        conf->setValue("viewing/flag_prime_vertical_labels",                propMgr->getStelPropertyValue("GridLinesMgr.primeVerticalPartsLabeled").toBool());
×
972
        conf->setValue("viewing/flag_current_vertical_line",                propMgr->getStelPropertyValue("GridLinesMgr.currentVerticalLineDisplayed").toBool());
×
973
        conf->setValue("viewing/flag_current_vertical_parts",                propMgr->getStelPropertyValue("GridLinesMgr.currentVerticalPartsDisplayed").toBool());
×
974
        conf->setValue("viewing/flag_current_vertical_labels",                propMgr->getStelPropertyValue("GridLinesMgr.currentVerticalPartsLabeled").toBool());
×
975
        conf->setValue("viewing/flag_colure_lines",                        propMgr->getStelPropertyValue("GridLinesMgr.colureLinesDisplayed").toBool());
×
976
        conf->setValue("viewing/flag_colure_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.colurePartsDisplayed").toBool());
×
977
        conf->setValue("viewing/flag_colure_labels",                        propMgr->getStelPropertyValue("GridLinesMgr.colurePartsLabeled").toBool());
×
978
        conf->setValue("viewing/flag_precession_circles",                propMgr->getStelPropertyValue("GridLinesMgr.precessionCirclesDisplayed").toBool());
×
979
        conf->setValue("viewing/flag_precession_parts",                        propMgr->getStelPropertyValue("GridLinesMgr.precessionPartsDisplayed").toBool());
×
980
        conf->setValue("viewing/flag_precession_labels",                propMgr->getStelPropertyValue("GridLinesMgr.precessionPartsLabeled").toBool());
×
981
        conf->setValue("viewing/flag_circumpolar_circles",                propMgr->getStelPropertyValue("GridLinesMgr.circumpolarCirclesDisplayed").toBool());
×
982
        conf->setValue("viewing/flag_umbra_circle",                        propMgr->getStelPropertyValue("GridLinesMgr.umbraCircleDisplayed").toBool());
×
983
        conf->setValue("viewing/flag_umbra_center_point",                propMgr->getStelPropertyValue("GridLinesMgr.umbraCenterPointDisplayed").toBool());
×
984
        conf->setValue("viewing/flag_penumbra_circle",                        propMgr->getStelPropertyValue("GridLinesMgr.penumbraCircleDisplayed").toBool());
×
985
        conf->setValue("viewing/flag_supergalactic_grid",                propMgr->getStelPropertyValue("GridLinesMgr.supergalacticGridDisplayed").toBool());
×
986
        conf->setValue("viewing/flag_supergalactic_equator_line",        propMgr->getStelPropertyValue("GridLinesMgr.supergalacticEquatorLineDisplayed").toBool());
×
987
        conf->setValue("viewing/flag_supergalactic_equator_parts",        propMgr->getStelPropertyValue("GridLinesMgr.supergalacticEquatorPartsDisplayed").toBool());
×
988
        conf->setValue("viewing/flag_supergalactic_equator_labels",        propMgr->getStelPropertyValue("GridLinesMgr.supergalacticEquatorPartsLabeled").toBool());
×
989
        conf->setValue("viewing/flag_celestial_J2000_poles",                propMgr->getStelPropertyValue("GridLinesMgr.celestialJ2000PolesDisplayed").toBool());
×
990
        conf->setValue("viewing/flag_celestial_poles",                        propMgr->getStelPropertyValue("GridLinesMgr.celestialPolesDisplayed").toBool());
×
991
        conf->setValue("viewing/flag_zenith_nadir",                        propMgr->getStelPropertyValue("GridLinesMgr.zenithNadirDisplayed").toBool());
×
992
        conf->setValue("viewing/flag_ecliptic_J2000_poles",                propMgr->getStelPropertyValue("GridLinesMgr.eclipticJ2000PolesDisplayed").toBool());
×
993
        conf->setValue("viewing/flag_ecliptic_poles",                        propMgr->getStelPropertyValue("GridLinesMgr.eclipticPolesDisplayed").toBool());
×
994
        conf->setValue("viewing/flag_galactic_poles",                        propMgr->getStelPropertyValue("GridLinesMgr.galacticPolesDisplayed").toBool());
×
995
        conf->setValue("viewing/flag_galactic_center",                        propMgr->getStelPropertyValue("GridLinesMgr.galacticCenterDisplayed").toBool());
×
996
        conf->setValue("viewing/flag_supergalactic_poles",                propMgr->getStelPropertyValue("GridLinesMgr.supergalacticPolesDisplayed").toBool());
×
997
        conf->setValue("viewing/flag_equinox_J2000_points",                propMgr->getStelPropertyValue("GridLinesMgr.equinoxJ2000PointsDisplayed").toBool());
×
998
        conf->setValue("viewing/flag_equinox_points",                        propMgr->getStelPropertyValue("GridLinesMgr.equinoxPointsDisplayed").toBool());
×
999
        conf->setValue("viewing/flag_solstice_J2000_points",                propMgr->getStelPropertyValue("GridLinesMgr.solsticeJ2000PointsDisplayed").toBool());
×
1000
        conf->setValue("viewing/flag_solstice_points",                        propMgr->getStelPropertyValue("GridLinesMgr.solsticePointsDisplayed").toBool());
×
1001
        conf->setValue("viewing/flag_antisolar_point",                        propMgr->getStelPropertyValue("GridLinesMgr.antisolarPointDisplayed").toBool());
×
1002
        conf->setValue("viewing/flag_apex_points",                        propMgr->getStelPropertyValue("GridLinesMgr.apexPointsDisplayed").toBool());
×
1003
        conf->setValue("viewing/flag_fov_center_marker",                propMgr->getStelPropertyValue("SpecialMarkersMgr.fovCenterMarkerDisplayed").toBool());
×
1004
        conf->setValue("viewing/flag_fov_circular_marker",                propMgr->getStelPropertyValue("SpecialMarkersMgr.fovCircularMarkerDisplayed").toBool());
×
1005
        conf->setValue("viewing/size_fov_circular_marker",                QString::number(propMgr->getStelPropertyValue("SpecialMarkersMgr.fovCircularMarkerSize").toDouble(), 'f', 2));
×
1006
        conf->setValue("viewing/flag_fov_rectangular_marker",                propMgr->getStelPropertyValue("SpecialMarkersMgr.fovRectangularMarkerDisplayed").toBool());
×
1007
        conf->setValue("viewing/width_fov_rectangular_marker",        QString::number(propMgr->getStelPropertyValue("SpecialMarkersMgr.fovRectangularMarkerWidth").toDouble(), 'f', 2));
×
1008
        conf->setValue("viewing/height_fov_rectangular_marker",        QString::number(propMgr->getStelPropertyValue("SpecialMarkersMgr.fovRectangularMarkerHeight").toDouble(), 'f', 2));
×
1009
        conf->setValue("viewing/rot_fov_rectangular_marker",                QString::number(propMgr->getStelPropertyValue("SpecialMarkersMgr.fovRectangularMarkerRotationAngle").toDouble(), 'f', 2));
×
1010
        conf->setValue("viewing/line_thickness",                        propMgr->getStelPropertyValue("GridLinesMgr.lineThickness").toInt());
×
1011
        conf->setValue("viewing/part_thickness",                        propMgr->getStelPropertyValue("GridLinesMgr.partThickness").toInt());
×
1012

1013
        conf->setValue("viewing/constellation_font_size",                propMgr->getStelPropertyValue("ConstellationMgr.fontSize").toInt());
×
1014
        conf->setValue("viewing/flag_constellation_drawing",                propMgr->getStelPropertyValue("ConstellationMgr.linesDisplayed").toBool());
×
1015
        conf->setValue("viewing/flag_constellation_name",                propMgr->getStelPropertyValue("ConstellationMgr.namesDisplayed").toBool());
×
1016
        conf->setValue("viewing/flag_constellation_boundaries",        propMgr->getStelPropertyValue("ConstellationMgr.boundariesDisplayed").toBool());
×
1017
        conf->setValue("viewing/flag_constellation_hulls",        propMgr->getStelPropertyValue("ConstellationMgr.hullsDisplayed").toBool());
×
1018
        conf->setValue("viewing/flag_constellation_art",                propMgr->getStelPropertyValue("ConstellationMgr.artDisplayed").toBool());
×
1019
        conf->setValue("viewing/flag_constellation_isolate_selected",        propMgr->getStelPropertyValue("ConstellationMgr.isolateSelected").toBool());
×
1020
        conf->setValue("viewing/flag_constellation_pick",                propMgr->getStelPropertyValue("ConstellationMgr.flagConstellationPick").toBool());
×
1021
        conf->setValue("viewing/flag_asterism_isolate_selected",        propMgr->getStelPropertyValue("AsterismMgr.isolateAsterismSelected").toBool());
×
1022
        conf->setValue("viewing/flag_landscape_autoselection",                propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeAutoSelection").toBool());
×
1023
        conf->setValue("viewing/flag_light_pollution_database",                propMgr->getStelPropertyValue("LandscapeMgr.flagUseLightPollutionFromDatabase").toBool());
×
1024
        conf->setValue("viewing/flag_environment_auto_enable",        propMgr->getStelPropertyValue("LandscapeMgr.flagEnvironmentAutoEnabling").toBool());
×
1025
        conf->setValue("viewing/constellation_art_intensity",                propMgr->getStelPropertyValue("ConstellationMgr.artIntensity").toFloat());
×
1026
        conf->setValue("viewing/constellation_line_thickness",                propMgr->getStelPropertyValue("ConstellationMgr.constellationLineThickness").toInt());
×
1027
        conf->setValue("viewing/constellation_boundaries_thickness",        propMgr->getStelPropertyValue("ConstellationMgr.boundariesThickness").toInt());
×
1028
        conf->setValue("viewing/constellation_hulls_thickness",                propMgr->getStelPropertyValue("ConstellationMgr.hullsThickness").toInt());
×
1029
        conf->setValue("viewing/constellation_art_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.artFadeDuration").toDouble(), 'f', 1));
×
1030
        conf->setValue("viewing/constellation_boundaries_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.boundariesFadeDuration").toDouble(), 'f', 1));
×
1031
        conf->setValue("viewing/constellation_hulls_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.hullsFadeDuration").toDouble(), 'f', 1));
×
1032
        conf->setValue("viewing/constellation_lines_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.linesFadeDuration").toDouble(), 'f', 1));
×
1033
        conf->setValue("viewing/constellation_labels_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.namesFadeDuration").toDouble(), 'f', 1));
×
1034

1035
        conf->setValue("viewing/flag_skyculture_zodiac",                        propMgr->getStelPropertyValue("ConstellationMgr.zodiacDisplayed").toBool());
×
1036
        conf->setValue("viewing/skyculture_zodiac_thickness",                QString::number(propMgr->getStelPropertyValue("ConstellationMgr.zodiacThickness").toDouble(), 'f', 1));
×
1037
        conf->setValue("viewing/skyculture_zodiac_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.zodiacFadeDuration").toDouble(), 'f', 1));
×
1038
        conf->setValue("viewing/flag_skyculture_lunarsystem",                propMgr->getStelPropertyValue("ConstellationMgr.lunarSystemDisplayed").toBool());
×
1039
        conf->setValue("viewing/skyculture_lunarsystem_thickness",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.lunarSystemThickness").toDouble(), 'f', 1));
×
1040
        conf->setValue("viewing/skyculture_lunarsystem_fade_duration",        QString::number(propMgr->getStelPropertyValue("ConstellationMgr.lunarSystemFadeDuration").toDouble(), 'f', 1));
×
1041

1042
        conf->setValue("viewing/asterism_font_size",                        propMgr->getStelPropertyValue("AsterismMgr.fontSize").toInt());
×
1043
        conf->setValue("viewing/flag_asterism_drawing",                propMgr->getStelPropertyValue("AsterismMgr.linesDisplayed").toBool());
×
1044
        conf->setValue("viewing/flag_asterism_name",                        propMgr->getStelPropertyValue("AsterismMgr.namesDisplayed").toBool());
×
1045
        conf->setValue("viewing/asterism_line_thickness",                propMgr->getStelPropertyValue("AsterismMgr.asterismLineThickness").toInt());
×
1046
        conf->setValue("viewing/flag_rayhelper_drawing",                propMgr->getStelPropertyValue("AsterismMgr.rayHelpersDisplayed").toBool());
×
1047
        conf->setValue("viewing/rayhelper_line_thickness",                propMgr->getStelPropertyValue("AsterismMgr.rayHelperThickness").toInt());
×
1048
        conf->setValue("viewing/asterism_lines_fade_duration",                QString::number(propMgr->getStelPropertyValue("AsterismMgr.linesFadeDuration").toDouble(), 'f', 1));
×
1049
        conf->setValue("viewing/asterism_labels_fade_duration",        QString::number(propMgr->getStelPropertyValue("AsterismMgr.namesFadeDuration").toDouble(), 'f', 1));
×
1050
        conf->setValue("viewing/rayhelper_lines_fade_duration",        QString::number(propMgr->getStelPropertyValue("AsterismMgr.rayHelpersFadeDuration").toDouble(), 'f', 1));
×
1051
        conf->setValue("viewing/sky_brightness_label_threshold",        propMgr->getStelPropertyValue("StelSkyDrawer.daylightLabelThreshold").toFloat());
×
1052
        conf->setValue("viewing/flag_night",                                StelApp::getInstance().getVisionModeNight());
×
1053
        conf->setValue("astro/flag_stars",                                propMgr->getStelPropertyValue("StarMgr.flagStarsDisplayed").toBool());
×
1054
        conf->setValue("astro/flag_star_name",                        propMgr->getStelPropertyValue("StarMgr.flagLabelsDisplayed").toBool());
×
1055
        conf->setValue("astro/flag_star_additional_names",                propMgr->getStelPropertyValue("StarMgr.flagAdditionalNamesDisplayed").toBool());
×
1056
        conf->setValue("astro/flag_star_designation_usage",                propMgr->getStelPropertyValue("StarMgr.flagDesignationLabels").toBool());
×
1057
        conf->setValue("astro/flag_star_designation_dbl",                propMgr->getStelPropertyValue("StarMgr.flagDblStarsDesignation").toBool());
×
1058
        conf->setValue("astro/flag_star_designation_var",                propMgr->getStelPropertyValue("StarMgr.flagVarStarsDesignation").toBool());
×
1059
        conf->setValue("astro/flag_star_designation_hip",                propMgr->getStelPropertyValue("StarMgr.flagHIPDesignation").toBool());
×
1060
        conf->setValue("stars/labels_amount",                        propMgr->getStelPropertyValue("StarMgr.labelsAmount").toDouble());
×
1061
        conf->setValue("astro/nebula_hints_amount",                        propMgr->getStelPropertyValue("NebulaMgr.hintsAmount").toDouble());
×
1062
        conf->setValue("astro/nebula_labels_amount",                        propMgr->getStelPropertyValue("NebulaMgr.labelsAmount").toDouble());
×
1063
        conf->setValue("astro/nebula_hints_brightness",                propMgr->getStelPropertyValue("NebulaMgr.hintsBrightness").toDouble());
×
1064
        conf->setValue("astro/nebula_labels_brightness",                propMgr->getStelPropertyValue("NebulaMgr.labelsBrightness").toDouble());
×
1065

1066
        conf->setValue("astro/flag_nebula_hints_proportional",                propMgr->getStelPropertyValue("NebulaMgr.hintsProportional").toBool());
×
1067
        conf->setValue("astro/flag_surface_brightness_usage",                propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessUsage").toBool());
×
1068
        conf->setValue("gui/flag_surface_brightness_arcsec",                propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessArcsecUsage").toBool());
×
1069
        conf->setValue("gui/flag_surface_brightness_short",                propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessShortNotationUsage").toBool());
×
1070
        conf->setValue("astro/flag_dso_designation_usage",                propMgr->getStelPropertyValue("NebulaMgr.flagDesignationLabels").toBool());
×
1071
        conf->setValue("astro/flag_dso_outlines_usage",                        propMgr->getStelPropertyValue("NebulaMgr.flagOutlinesDisplayed").toBool());
×
1072
        conf->setValue("astro/flag_dso_additional_names",                propMgr->getStelPropertyValue("NebulaMgr.flagAdditionalNamesDisplayed").toBool());
×
1073
        conf->setValue("astro/flag_nebula_name",                        propMgr->getStelPropertyValue("NebulaMgr.flagHintDisplayed").toBool());
×
1074
        conf->setValue("astro/flag_use_type_filter",                        propMgr->getStelPropertyValue("NebulaMgr.flagTypeFiltersUsage").toBool());
×
1075
        conf->setValue("astro/flag_nebula_display_no_texture",                !propMgr->getStelPropertyValue("StelSkyLayerMgr.flagShow").toBool() );
×
1076

1077
        conf->setValue("astro/flag_size_limits_usage",                        propMgr->getStelPropertyValue("NebulaMgr.flagUseSizeLimits").toBool());
×
1078
        conf->setValue("astro/size_limit_min",                                QString::number(propMgr->getStelPropertyValue("NebulaMgr.minSizeLimit").toDouble(), 'f', 2));
×
1079
        conf->setValue("astro/size_limit_max",                                QString::number(propMgr->getStelPropertyValue("NebulaMgr.maxSizeLimit").toDouble(), 'f', 2));
×
1080

1081
        conf->setValue("projection/type",                                core->getCurrentProjectionTypeKey());
×
1082
        conf->setValue("astro/flag_nutation",                                core->getUseNutation());
×
1083
        conf->setValue("astro/flag_aberration",                                core->getUseAberration());
×
1084
        conf->setValue("astro/aberration_factor",                        core->getAberrationFactor());
×
1085
        conf->setValue("astro/flag_parallax",                                core->getUseParallax());
×
1086
        conf->setValue("astro/parallax_factor",                                core->getParallaxFactor());
×
1087
        conf->setValue("astro/flag_topocentric_coordinates",                core->getUseTopocentricCoordinates());
×
1088
        conf->setValue("astro/solar_system_threads",                        propMgr->getStelPropertyValue("SolarSystem.extraThreads").toInt());
×
1089

1090
        // view dialog / DSO tag settings
1091
        nmgr->storeCatalogFilters();
×
1092

1093
        const Nebula::TypeGroup tflags = static_cast<Nebula::TypeGroup>(nmgr->getTypeFilters());
×
1094
        conf->beginGroup("dso_type_filters");
×
1095
        conf->setValue("flag_show_galaxies",             static_cast<bool>(tflags & Nebula::TypeGalaxies));
×
1096
        conf->setValue("flag_show_active_galaxies",      static_cast<bool>(tflags & Nebula::TypeActiveGalaxies));
×
1097
        conf->setValue("flag_show_interacting_galaxies", static_cast<bool>(tflags & Nebula::TypeInteractingGalaxies));
×
1098
        conf->setValue("flag_show_open_clusters",        static_cast<bool>(tflags & Nebula::TypeOpenStarClusters));
×
1099
        conf->setValue("flag_show_globular_clusters",    static_cast<bool>(tflags & Nebula::TypeGlobularStarClusters));
×
1100
        conf->setValue("flag_show_bright_nebulae",       static_cast<bool>(tflags & Nebula::TypeBrightNebulae));
×
1101
        conf->setValue("flag_show_dark_nebulae",         static_cast<bool>(tflags & Nebula::TypeDarkNebulae));
×
1102
        conf->setValue("flag_show_planetary_nebulae",    static_cast<bool>(tflags & Nebula::TypePlanetaryNebulae));
×
1103
        conf->setValue("flag_show_hydrogen_regions",     static_cast<bool>(tflags & Nebula::TypeHydrogenRegions));
×
1104
        conf->setValue("flag_show_supernova_remnants",   static_cast<bool>(tflags & Nebula::TypeSupernovaRemnants));
×
1105
        conf->setValue("flag_show_galaxy_clusters",      static_cast<bool>(tflags & Nebula::TypeGalaxyClusters));
×
1106
        conf->setValue("flag_show_other",                static_cast<bool>(tflags & Nebula::TypeOther));
×
1107
        conf->endGroup();
×
1108

1109
        // view dialog / landscape tab settings
1110
        // DO NOT SAVE CURRENT LANDSCAPE ID! There is a dedicated button in the landscape tab of the View dialog.
1111
        //conf->setValue("init_location/landscape_name",                propMgr->getStelPropertyValue("LandscapeMgr.currentLandscapeID").toString());
1112
        conf->setValue("landscape/flag_landscape_sets_location",        propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeSetsLocation").toBool());
×
1113
        conf->setValue("landscape/flag_landscape",                        propMgr->getStelPropertyValue("LandscapeMgr.landscapeDisplayed").toBool());
×
1114
        conf->setValue("landscape/flag_atmosphere",                        propMgr->getStelPropertyValue("LandscapeMgr.atmosphereDisplayed").toBool());
×
1115
        conf->setValue("landscape/flag_fog",                                propMgr->getStelPropertyValue("LandscapeMgr.fogDisplayed").toBool());
×
1116
        conf->setValue("landscape/flag_enable_illumination_layer",        propMgr->getStelPropertyValue("LandscapeMgr.illuminationDisplayed").toBool());
×
1117
        conf->setValue("landscape/flag_enable_labels",                        propMgr->getStelPropertyValue("LandscapeMgr.labelsDisplayed").toBool());
×
1118
        conf->setValue("landscape/label_font_size",                        propMgr->getStelPropertyValue("LandscapeMgr.labelFontSize").toInt());
×
1119
        conf->setValue("landscape/label_angle",                                propMgr->getStelPropertyValue("LandscapeMgr.labelAngle").toInt());
×
1120
        conf->setValue("landscape/flag_minimal_brightness",                propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeUseMinimalBrightness").toBool());
×
1121
        conf->setValue("landscape/flag_landscape_sets_minimal_brightness", propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeSetsMinimalBrightness").toBool());
×
1122
        conf->setValue("landscape/minimal_brightness",                        propMgr->getStelPropertyValue("LandscapeMgr.defaultMinimalBrightness").toFloat());
×
1123
        conf->setValue("landscape/flag_transparency",                        propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeUseTransparency").toBool());
×
1124
        conf->setValue("landscape/transparency",                        propMgr->getStelPropertyValue("LandscapeMgr.landscapeTransparency").toFloat());
×
1125
        conf->setValue("landscape/flag_polyline_only",                        propMgr->getStelPropertyValue("LandscapeMgr.flagPolyLineDisplayedOnly").toBool());
×
1126
        conf->setValue("landscape/polyline_thickness",                        propMgr->getStelPropertyValue("LandscapeMgr.polyLineThickness").toInt());
×
1127
        conf->setValue("stars/init_light_pollution_luminance",                propMgr->getStelPropertyValue("StelSkyDrawer.lightPollutionLuminance").toFloat());
×
1128
        conf->setValue("landscape/atmospheric_extinction_coefficient",        propMgr->getStelPropertyValue("StelSkyDrawer.extinctionCoefficient").toFloat());
×
1129
        conf->setValue("landscape/pressure_mbar",                        propMgr->getStelPropertyValue("StelSkyDrawer.atmospherePressure").toFloat());
×
1130
        conf->setValue("landscape/temperature_C",                        propMgr->getStelPropertyValue("StelSkyDrawer.atmosphereTemperature").toFloat());
×
1131

1132
        // view dialog / sky culture tab
1133
        QObject* scmgr = reinterpret_cast<QObject*>(&StelApp::getInstance().getSkyCultureMgr());
×
1134
        scmgr->setProperty("defaultSkyCultureID", scmgr->property("currentSkyCultureID"));
×
1135

1136
        // Save default location
1137
        core->setDefaultLocationID(core->getCurrentLocation().getID());
×
1138

1139
        // configuration dialog / main tab
1140
        //QString langName = StelApp::getInstance().getLocaleMgr().getAppLanguage();
1141
        //conf->setValue("localization/app_locale", StelTranslator::nativeNameToIso639_1Code(langName));
1142
        //langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
1143
        //conf->setValue("localization/sky_locale", StelTranslator::nativeNameToIso639_1Code(langName));
1144
        storeLanguageSettings();
×
1145

1146
        // configuration dialog / selected object info tab
1147
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
1148
        static const QMap<StelObject::InfoStringGroup, QString>selectedObjectInfoMap={
1149
                {StelObject::InfoStringGroup(StelObject::None),                "none"},
×
1150
                {StelObject::InfoStringGroup(StelObject::DefaultInfo),        "default"},
×
1151
                {StelObject::InfoStringGroup(StelObject::ShortInfo),        "short"},
×
1152
                {StelObject::InfoStringGroup(StelObject::AllInfo),        "all"}
×
1153
        };
×
1154
        QString selectedObjectInfo=selectedObjectInfoMap.value(flags, "custom");
×
1155
        conf->setValue("gui/selected_object_info", selectedObjectInfo);
×
1156
        if (selectedObjectInfo=="custom")
×
1157
                saveCustomSelectedInfo();
×
1158

1159
        // toolbar auto-hide status
1160
        conf->setValue("gui/auto_hide_horizontal_toolbar",                propMgr->getStelPropertyValue("StelGui.autoHideHorizontalButtonBar").toBool());
×
1161
        conf->setValue("gui/auto_hide_vertical_toolbar",                propMgr->getStelPropertyValue("StelGui.autoHideVerticalButtonBar").toBool());
×
1162
        conf->setValue("gui/flag_show_quit_button",                        propMgr->getStelPropertyValue("StelGui.flagShowQuitButton").toBool());
×
1163
        conf->setValue("gui/flag_show_nebulae_background_button",        propMgr->getStelPropertyValue("StelGui.flagShowNebulaBackgroundButton").toBool());
×
1164
        conf->setValue("gui/flag_show_dss_button",                        propMgr->getStelPropertyValue("StelGui.flagShowDSSButton").toBool());
×
1165
        conf->setValue("gui/flag_show_hips_button",                        propMgr->getStelPropertyValue("StelGui.flagShowHiPSButton").toBool());
×
1166
        conf->setValue("gui/flag_show_goto_selected_button",                propMgr->getStelPropertyValue("StelGui.flagShowGotoSelectedObjectButton").toBool());
×
1167
        conf->setValue("gui/flag_show_nightmode_button",                propMgr->getStelPropertyValue("StelGui.flagShowNightmodeButton").toBool());
×
1168
        conf->setValue("gui/flag_show_fullscreen_button",                propMgr->getStelPropertyValue("StelGui.flagShowFullscreenButton").toBool());
×
1169

1170
        conf->setValue("gui/flag_show_obslist_button",                        propMgr->getStelPropertyValue("StelGui.flagShowObsListButton").toBool());
×
1171

1172
        conf->setValue("gui/flag_show_icrs_grid_button",                propMgr->getStelPropertyValue("StelGui.flagShowICRSGridButton").toBool());
×
1173
        conf->setValue("gui/flag_show_galactic_grid_button",                propMgr->getStelPropertyValue("StelGui.flagShowGalacticGridButton").toBool());
×
1174
        conf->setValue("gui/flag_show_ecliptic_grid_button",                propMgr->getStelPropertyValue("StelGui.flagShowEclipticGridButton").toBool());
×
1175
        conf->setValue("gui/flag_show_boundaries_button",                propMgr->getStelPropertyValue("StelGui.flagShowConstellationBoundariesButton").toBool());
×
1176
        conf->setValue("gui/flag_show_constellation_arts_button",        propMgr->getStelPropertyValue("StelGui.flagShowConstellationArtsButton").toBool());
×
1177
        conf->setValue("gui/flag_show_asterism_lines_button",                propMgr->getStelPropertyValue("StelGui.flagShowAsterismLinesButton").toBool());
×
1178
        conf->setValue("gui/flag_show_asterism_labels_button",                propMgr->getStelPropertyValue("StelGui.flagShowAsterismLabelsButton").toBool());
×
1179
        conf->setValue("gui/flag_show_decimal_degrees",                        propMgr->getStelPropertyValue("StelApp.flagShowDecimalDegrees").toBool());
×
1180
        conf->setValue("gui/flag_use_azimuth_from_south",                propMgr->getStelPropertyValue("StelApp.flagUseAzimuthFromSouth").toBool());
×
1181
        conf->setValue("gui/flag_use_formatting_output",                propMgr->getStelPropertyValue("StelApp.flagUseFormattingOutput").toBool());
×
1182
        conf->setValue("gui/flag_use_ccs_designations",                        propMgr->getStelPropertyValue("StelApp.flagUseCCSDesignation").toBool());
×
1183
        conf->setValue("gui/flag_overwrite_info_color",                        propMgr->getStelPropertyValue("StelApp.flagOverwriteInfoColor").toBool());
×
1184
        conf->setValue("gui/flag_time_jd",                                gui->getButtonBar()->getFlagTimeJd());
×
1185
        conf->setValue("gui/flag_show_buttons_background",                propMgr->getStelPropertyValue("StelGui.flagUseButtonsBackground").toBool());
×
1186
        conf->setValue("gui/flag_indication_mount_mode",                mvmgr->getFlagIndicationMountMode());
×
1187

1188
        // configuration dialog / navigation tab
1189
        conf->setValue("navigation/flag_enable_zoom_keys",                mvmgr->getFlagEnableZoomKeys());
×
1190
        conf->setValue("navigation/flag_enable_mouse_navigation",        mvmgr->getFlagEnableMouseNavigation());
×
1191
        conf->setValue("navigation/flag_enable_mouse_zooming",                mvmgr->getFlagEnableMouseZooming());
×
1192
        conf->setValue("navigation/flag_enable_move_keys",                mvmgr->getFlagEnableMoveKeys());
×
1193

1194
        // configuration dialog / time tab
1195
        conf->setValue("navigation/startup_time_mode",                        core->getStartupTimeMode());
×
1196
        conf->setValue("navigation/startup_time_stop",                        core->getStartupTimeStop());
×
1197
        conf->setValue("navigation/today_time",                                core->getInitTodayTime());
×
1198
        conf->setValue("navigation/preset_sky_time",                        core->getPresetSkyTime());
×
1199
        conf->setValue("navigation/time_correction_algorithm",                core->getCurrentDeltaTAlgorithmKey());
×
1200
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1201
        conf->setValue("localization/time_display_format",                localeManager.getTimeFormatStr());
×
1202
        conf->setValue("localization/date_display_format",                localeManager.getDateFormatStr());
×
1203

1204

1205
        if (mvmgr->getMountMode() == StelMovementMgr::MountAltAzimuthal)
×
1206
                conf->setValue("navigation/viewing_mode", "horizon");
×
1207
        else
1208
                conf->setValue("navigation/viewing_mode", "equator");
×
1209

1210
        // configuration dialog / tools tab
1211
        conf->setValue("gui/flag_show_flip_buttons",                        propMgr->getStelPropertyValue("StelGui.flagShowFlipButtons").toBool());
×
1212
        conf->setValue("video/viewport_effect",                                StelApp::getInstance().getViewportEffect());
×
1213

1214
        conf->setValue("projection/viewport",                                StelProjector::maskTypeToString(proj->getMaskType()));
×
1215
        conf->setValue("projection/viewport_center_offset_x",                core->getCurrentStelProjectorParams().viewportCenterOffset[0]*100.);
×
1216
        conf->setValue("projection/viewport_center_offset_y",                core->getCurrentStelProjectorParams().viewportCenterOffset[1]*100.);
×
1217
        conf->setValue("projection/flip_horz",                                core->getCurrentStelProjectorParams().flipHorz);
×
1218
        conf->setValue("projection/flip_vert",                                core->getCurrentStelProjectorParams().flipVert);
×
1219
        conf->setValue("navigation/max_fov",                                mvmgr->getUserMaxFov());
×
1220

1221
        conf->setValue("viewing/flag_gravity_labels",                        proj->getFlagGravityLabels());
×
1222
        conf->setValue("navigation/auto_zoom_out_resets_direction",        mvmgr->getFlagAutoZoomOutResetsDirection());
×
1223

1224
        conf->setValue("gui/flag_mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.flagCursorTimeout").toBool());
×
1225
        conf->setValue("gui/mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.cursorTimeout").toFloat());
×
1226
        //conf->setValue("gui/base_font_name",                                QGuiApplication::font().family());
1227
        //conf->setValue("gui/screen_font_size",                        propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
1228
        //conf->setValue("gui/gui_font_size",                                propMgr->getStelPropertyValue("StelApp.guiFontSize").toInt());
1229
        storeFontSettings();
×
1230
        conf->setValue("gui/screen_button_scale",                        propMgr->getStelPropertyValue("StelApp.screenButtonScale").toDouble());
×
1231

1232
        conf->setValue("video/minimum_fps",                                propMgr->getStelPropertyValue("MainView.minFps").toInt());
×
1233
        conf->setValue("video/maximum_fps",                                propMgr->getStelPropertyValue("MainView.maxFps").toInt());
×
1234

1235
        conf->setValue("main/screenshot_dir",                                StelFileMgr::getScreenshotDir());
×
1236
        conf->setValue("main/invert_screenshots_colors",                propMgr->getStelPropertyValue("MainView.flagInvertScreenShotColors").toBool());
×
1237
        conf->setValue("main/screenshot_datetime_filename",                propMgr->getStelPropertyValue("MainView.flagScreenshotDateFileName").toBool());
×
1238
        conf->setValue("main/screenshot_datetime_filemask",                propMgr->getStelPropertyValue("MainView.screenShotFileMask").toString());
×
1239
        conf->setValue("main/screenshot_custom_size",                        propMgr->getStelPropertyValue("MainView.flagUseCustomScreenshotSize").toBool());
×
1240
        conf->setValue("main/screenshot_custom_width",                        propMgr->getStelPropertyValue("MainView.customScreenshotWidth").toInt());
×
1241
        conf->setValue("main/screenshot_custom_height",                        propMgr->getStelPropertyValue("MainView.customScreenshotHeight").toInt());
×
1242

1243
        QWidget& mainWindow = StelMainView::getInstance();
×
1244
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
1245
        QScreen *mainScreen = mainWindow.windowHandle()->screen();
×
1246
        int screenNum=qApp->screens().indexOf(mainScreen);
×
1247
#else
1248
        int screenNum = qApp->desktop()->screenNumber(&StelMainView::getInstance());
1249
#endif
1250
        conf->setValue("video/screen_number", screenNum);
×
1251

1252
        // full screen and window size
1253
        conf->setValue("video/fullscreen", StelMainView::getInstance().isFullScreen());
×
1254
        if (!StelMainView::getInstance().isFullScreen())
×
1255
        {
1256
                QRect screenGeom = QGuiApplication::screens().at(screenNum)->geometry();
×
1257

1258
                conf->setValue("video/screen_w", int(std::lround(mainWindow.size().width() * mainWindow.devicePixelRatio())));
×
1259
                conf->setValue("video/screen_h", int(std::lround(mainWindow.size().height() * mainWindow.devicePixelRatio())));
×
1260
                conf->setValue("video/screen_x", int(std::lround((mainWindow.x() - screenGeom.x()) * mainWindow.devicePixelRatio())));
×
1261
                conf->setValue("video/screen_y", int(std::lround((mainWindow.y() - screenGeom.y()) * mainWindow.devicePixelRatio())));
×
1262
        }
1263

1264
        // clear the restore defaults flag if it is set.
1265
        conf->setValue("main/restore_defaults", false);
×
1266

1267
        updateConfigLabels();
×
1268

1269
        emit core->configurationDataSaved();
×
1270
}
×
1271

1272
void ConfigurationDialog::updateConfigLabels()
×
1273
{
1274
        ui->startupFOVLabel->setText(q_("Startup FOV: %1%2").arg(StelApp::getInstance().getCore()->getMovementMgr()->getCurrentFov()).arg(QChar(0x00B0)));
×
1275

1276
        double az, alt;
1277
        const Vec3d& v = GETSTELMODULE(StelMovementMgr)->getInitViewingDirection();
×
1278
        StelUtils::rectToSphe(&az, &alt, v);
×
1279
        az = 3.*M_PI - az;  // N is zero, E is 90 degrees
×
1280
        if (az > M_PI*2)
×
1281
                az -= M_PI*2;
×
1282
        ui->startupDirectionOfViewlabel->setText(q_("Startup direction of view Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)));
×
1283
}
×
1284

1285
void ConfigurationDialog::setDefaultViewOptions()
×
1286
{
1287
        if (askConfirmation())
×
1288
        {
1289
                qDebug() << "Restore defaults...";
×
1290
                QSettings* conf = StelApp::getInstance().getSettings();
×
1291
                Q_ASSERT(conf);
×
1292

1293
                conf->setValue("main/restore_defaults", true);
×
1294
                // reset all stored panel locations
1295
                conf->beginGroup("DialogPositions");
×
1296
                conf->remove("");
×
1297
                conf->endGroup();
×
1298
        }
1299
        else
1300
                qDebug() << "Restore defaults is canceled...";
×
1301
}
×
1302

1303
void ConfigurationDialog::populatePluginsList()
×
1304
{
1305
        QListWidget *plugins = ui->pluginsListWidget;
×
1306
        plugins->blockSignals(true);
×
1307
        int currentRow = plugins->currentRow();
×
1308
        QString selectedPluginId = "";
×
1309
        if (currentRow>0)
×
1310
                 selectedPluginId = plugins->currentItem()->data(Qt::UserRole).toString();
×
1311

1312
        plugins->clear();
×
1313
        QString selectedPluginName = "";
×
1314
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp::getInstance().getModuleMgr().getPluginsList();        
×
1315
        for (const auto& desc : pluginsList)
×
1316
        {
1317
                QString label = q_(desc.info.displayedName);
×
1318
                QListWidgetItem* item = new QListWidgetItem(label);
×
1319
                item->setData(Qt::UserRole, desc.info.id);
×
1320
                plugins->addItem(item);
×
1321
                if (currentRow>0 && item->data(Qt::UserRole).toString()==selectedPluginId)
×
1322
                        selectedPluginName = label;
×
1323
        }
×
1324
        plugins->sortItems(Qt::AscendingOrder);
×
1325
        plugins->blockSignals(false);
×
1326
        // If we had a valid previous selection (i.e. not first time we populate), restore it
1327

1328
        if (!selectedPluginName.isEmpty())
×
1329
                plugins->setCurrentItem(plugins->findItems(selectedPluginName, Qt::MatchExactly).at(0));
×
1330
        else
1331
                plugins->setCurrentRow(0);
×
1332
}
×
1333

1334
void ConfigurationDialog::pluginsSelectionChanged(QListWidgetItem* item, QListWidgetItem* previousItem)
×
1335
{
1336
        Q_UNUSED(previousItem)
1337
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp::getInstance().getModuleMgr().getPluginsList();
×
1338
        for (const auto& desc : pluginsList)
×
1339
        {
1340
                if (item->data(Qt::UserRole).toString()==desc.info.id)
×
1341
                {
1342
                        QString html = "<html><head></head><body>";
×
1343
                        html += "<h2>" + q_(desc.info.displayedName) + "</h2>";                        
×
1344
                        QString d = desc.info.description;
×
1345
                        d.replace("\n", "<br />");
×
1346
                        html += "<p>" + q_(d) + "</p>";
×
1347
                        html += "<p>";
×
1348
                        QString thanks = desc.info.acknowledgements;
×
1349
                        if (!thanks.isEmpty())
×
1350
                        {
1351
                                html += "<strong>" + q_("Acknowledgments") + "</strong>: " + q_(thanks) + "<br/>";
×
1352
                        }
1353
                        html += "<strong>" + q_("Authors") + "</strong>: " + desc.info.authors;
×
1354
                        html += "<br /><strong>" + q_("Contact") + "</strong>: " + desc.info.contact;
×
1355
                        if (!desc.info.version.isEmpty())
×
1356
                                html += "<br /><strong>" + q_("Version") + "</strong>: " + desc.info.version;
×
1357
                        html += "<br /><strong>" + q_("License") + "</strong>: ";
×
1358
                        if (!desc.info.license.isEmpty())
×
1359
                                html += desc.info.license;
×
1360
                        else
1361
                                html += qc_("unknown", "license");
×
1362
                        html += "</p></body></html>";
×
1363
                        ui->pluginsInfoBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1364
                        ui->pluginsInfoBrowser->setHtml(html);
×
1365
                        ui->pluginLoadAtStartupCheckBox->setChecked(desc.loadAtStartup);
×
1366
                        StelModule* pmod = StelApp::getInstance().getModuleMgr().getModule(desc.info.id, true);
×
1367
                        if (pmod != Q_NULLPTR)
×
1368
                                ui->pluginConfigureButton->setEnabled(pmod->configureGui(false));
×
1369
                        else
1370
                                ui->pluginConfigureButton->setEnabled(false);
×
1371
                        return;
×
1372
                }
×
1373
        }
1374
}
×
1375

1376
void ConfigurationDialog::pluginConfigureCurrentSelection()
×
1377
{
1378
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1379
        if (id.isEmpty())
×
1380
                return;
×
1381

1382
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1383
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1384
        for (const auto& desc : pluginsList)
×
1385
        {
1386
                if (id == desc.info.id)
×
1387
                {
1388
                        StelModule* pmod = moduleMgr.getModule(desc.info.id, QObject::sender()->objectName()=="pluginsListWidget");
×
1389
                        if (pmod != Q_NULLPTR)
×
1390
                        {
1391
                                pmod->configureGui(true);
×
1392
                        }
1393
                        return;
×
1394
                }
1395
        }
1396
}
×
1397

1398
#if (QT_VERSION<QT_VERSION_CHECK(6,7,0))
1399
        void ConfigurationDialog::loadAtStartupChanged(int state)
×
1400
#else
1401
        void ConfigurationDialog::loadAtStartupChanged(Qt::CheckState state)
1402
#endif
1403
{
1404
        if (ui->pluginsListWidget->count() <= 0)
×
1405
                return;
×
1406

1407
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1408
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1409
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1410
        for (const auto& desc : pluginsList)
×
1411
        {
1412
                if (id == desc.info.id)
×
1413
                {
1414
                        moduleMgr.setPluginLoadAtStartup(id, state == Qt::Checked);
×
1415
                        break;
×
1416
                }
1417
        }
1418
}
×
1419

1420
#ifdef ENABLE_SCRIPTING
1421
void ConfigurationDialog::populateScriptsList(void)
×
1422
{
1423
        QListWidget *scripts = ui->scriptListWidget;
×
1424
        scripts->blockSignals(true);
×
1425
        int currentRow = scripts->currentRow();
×
1426
        QString selectedScriptId = "";
×
1427
        if (currentRow>0)
×
1428
                selectedScriptId = scripts->currentItem()->data(Qt::DisplayRole).toString();
×
1429

1430
        scripts->clear();
×
1431
        for (const auto& ssc : StelApp::getInstance().getScriptMgr().getScriptList())
×
1432
        {
1433
                QListWidgetItem* item = new QListWidgetItem(ssc);
×
1434
                scripts->addItem(item);
×
1435
        }
×
1436
        scripts->sortItems(Qt::AscendingOrder);
×
1437
        scripts->blockSignals(false);
×
1438
        // If we had a valid previous selection (i.e. not first time we populate), restore it
1439
        if (!selectedScriptId.isEmpty())
×
1440
                scripts->setCurrentItem(scripts->findItems(selectedScriptId, Qt::MatchExactly).at(0));
×
1441
        else
1442
                scripts->setCurrentRow(0);
×
1443
}
×
1444

1445
void ConfigurationDialog::scriptSelectionChanged(const QString& s)
×
1446
{
1447
        if (s.isEmpty())
×
1448
                return;        
×
1449
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();        
×
1450
        //ui->scriptInfoBrowser->document()->setDefaultStyleSheet(QString(StelApp::getInstance().getCurrentStelStyle()->htmlStyleSheet));
1451
        QString html = scriptMgr.getHtmlDescription(s);
×
1452
        ui->scriptInfoBrowser->setHtml(html);        
×
1453
}
×
1454

1455
void ConfigurationDialog::runScriptClicked(void)
×
1456
{
1457
        if (ui->closeWindowAtScriptRunCheckbox->isChecked())
×
1458
                this->close();
×
1459
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
×
1460
        if (ui->scriptListWidget->currentItem())
×
1461
        {
1462
                scriptMgr.runScript(ui->scriptListWidget->currentItem()->text());
×
1463
        }        
1464
}
×
1465

1466
void ConfigurationDialog::stopScriptClicked(void)
×
1467
{
1468
        StelApp::getInstance().getScriptMgr().stopScript();
×
1469
}
×
1470

1471
void ConfigurationDialog::aScriptIsRunning(void)
×
1472
{        
1473
        ui->scriptStatusLabel->setText(q_("Running script: ") + StelApp::getInstance().getScriptMgr().runningScriptId());
×
1474
        ui->runScriptButton->setEnabled(false);
×
1475
        ui->stopScriptButton->setEnabled(true);        
×
1476
}
×
1477

1478
void ConfigurationDialog::aScriptHasStopped(void)
×
1479
{
1480
        ui->scriptStatusLabel->setText(q_("Running script: [none]"));
×
1481
        ui->runScriptButton->setEnabled(true);
×
1482
        ui->stopScriptButton->setEnabled(false);
×
1483
}
×
1484
#endif
1485

1486

1487
void ConfigurationDialog::setFixedDateTimeToCurrent(void)
×
1488
{
1489
        StelCore* core = StelApp::getInstance().getCore();
×
1490
        double JD = core->getJD();
×
1491
        ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+core->getUTCOffset(JD)/24, Qt::LocalTime));
×
1492
        ui->fixedTimeRadio->setChecked(true);
×
1493
        setStartupTimeMode();
×
1494
}
×
1495

1496

1497
void ConfigurationDialog::resetStarCatalogControls()
×
1498
{
1499
        const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatalogsDescription();
×
1500
        nextStarCatalogToDownload.clear();
×
1501
        int idx=0;
×
1502
        for (const auto& catV : catalogConfig)
×
1503
        {
1504
                ++idx;
×
1505
                const QVariantMap& m = catV.toMap();
×
1506
                const bool checked = m.value("checked").toBool();
×
1507
                if (checked)
×
1508
                        continue;
×
1509
                nextStarCatalogToDownload=m;
×
1510
                break;
×
1511
        }
×
1512

1513
        ui->downloadCancelButton->setVisible(false);
×
1514
        ui->downloadRetryButton->setVisible(false);
×
1515

1516
        if (idx > catalogConfig.size() && !hasDownloadedStarCatalog)
×
1517
        {
1518
                ui->getStarsButton->setVisible(false);
×
1519
                updateStarCatalogControlsText();
×
1520
                return;
×
1521
        }
1522

1523
        ui->getStarsButton->setEnabled(true);
×
1524
        if (!nextStarCatalogToDownload.isEmpty())
×
1525
        {
1526
                nextStarCatalogToDownloadIndex = idx;
×
1527
                starCatalogsCount = catalogConfig.size();
×
1528
                updateStarCatalogControlsText();
×
1529
                ui->getStarsButton->setVisible(true);
×
1530
        }
1531
        else
1532
        {
1533
                updateStarCatalogControlsText();
×
1534
                ui->getStarsButton->setVisible(false);
×
1535
        }
1536
}
×
1537

1538
void ConfigurationDialog::updateStarCatalogControlsText()
×
1539
{
1540
        if (nextStarCatalogToDownload.isEmpty())
×
1541
        {
1542
                //There are no more catalogs left?
1543
                if (hasDownloadedStarCatalog)
×
1544
                {
1545
                        ui->downloadLabel->setText(q_("Finished downloading new star catalogs!\nRestart Stellarium to display them."));
×
1546
                }
1547
                else
1548
                {
1549
                        ui->downloadLabel->setText(q_("All available star catalogs have been installed."));
×
1550
                }
1551
        }
1552
        else
1553
        {
1554
                QString text = QString(q_("Get catalog %1 of %2"))
×
1555
                               .arg(nextStarCatalogToDownloadIndex)
×
1556
                               .arg(starCatalogsCount);
×
1557
                ui->getStarsButton->setText(text);
×
1558
                
1559
                if (isDownloadingStarCatalog)
×
1560
                {
1561
                        QString text = QString(q_("Downloading %1...\n(You can close this window.)"))
×
1562
                                         .arg(nextStarCatalogToDownload.value("id").toString());
×
1563
                        ui->downloadLabel->setText(text);
×
1564
                }
×
1565
                else
1566
                {
1567
                        const QVariantList& magRange = nextStarCatalogToDownload.value("magRange").toList();
×
1568
                        ui->downloadLabel->setText(q_("Download size: %1MB\nStar count: %2 Million\nMagnitude range: %3 - %4")
×
1569
                                .arg(nextStarCatalogToDownload.value("sizeMb").toString(),
×
1570
                                     QString::number(nextStarCatalogToDownload.value("count").toDouble(), 'f', 1),
×
1571
                                     QString::number(magRange.first().toDouble(), 'f', 2),
×
1572
                                     QString::number(magRange.last().toDouble(), 'f', 2)));
×
1573
                }
×
1574
        }
×
1575
}
×
1576

1577
void ConfigurationDialog::cancelDownload(void)
×
1578
{
1579
        Q_ASSERT(currentDownloadFile);
×
1580
        Q_ASSERT(starCatalogDownloadReply);
×
1581
        qWarning() << "Aborting download";
×
1582
        starCatalogDownloadReply->abort();
×
1583
}
×
1584

1585
void ConfigurationDialog::newStarCatalogData()
×
1586
{
1587
        Q_ASSERT(currentDownloadFile);
×
1588
        Q_ASSERT(starCatalogDownloadReply);
×
1589
        Q_ASSERT(progressBar);
×
1590

1591
        // Ignore data from redirection.  (Not needed after Qt 5.6)
1592
        if (!starCatalogDownloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute).isNull())
×
1593
                return;
×
1594
        qint64 size = starCatalogDownloadReply->bytesAvailable();
×
1595
        progressBar->setValue(progressBar->getValue()+static_cast<int>(size/1024));
×
1596
        currentDownloadFile->write(starCatalogDownloadReply->read(size));
×
1597
}
1598

1599
void ConfigurationDialog::downloadStars()
×
1600
{
1601
        Q_ASSERT(!nextStarCatalogToDownload.isEmpty());
×
1602
        Q_ASSERT(!isDownloadingStarCatalog);
×
1603
        Q_ASSERT(starCatalogDownloadReply==Q_NULLPTR);
×
1604
        Q_ASSERT(currentDownloadFile==Q_NULLPTR);
×
1605
        Q_ASSERT(progressBar==Q_NULLPTR);
×
1606

1607
        QString path = StelFileMgr::getUserDir()+QString("/stars/hip_gaia3/")+nextStarCatalogToDownload.value("fileName").toString();
×
1608
        currentDownloadFile = new QFile(path);
×
1609
        if (!currentDownloadFile->open(QIODevice::WriteOnly))
×
1610
        {
1611
                qWarning() << "Can't open a writable file for storing new star catalog: " << QDir::toNativeSeparators(path);
×
1612
                currentDownloadFile->deleteLater();
×
1613
                currentDownloadFile = Q_NULLPTR;
×
1614
                ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextStarCatalogToDownload.value("id").toString(), QString("Can't open a writable file for storing new star catalog: %1").arg(path)));
×
1615
                ui->downloadRetryButton->setVisible(true);
×
1616
                return;
×
1617
        }
1618

1619
        isDownloadingStarCatalog = true;
×
1620
        updateStarCatalogControlsText();
×
1621
        ui->downloadCancelButton->setVisible(true);
×
1622
        ui->downloadRetryButton->setVisible(false);
×
1623
        ui->getStarsButton->setVisible(true);
×
1624
        ui->getStarsButton->setEnabled(false);
×
1625

1626
        QNetworkRequest req(nextStarCatalogToDownload.value("url").toString());
×
1627
        req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
×
1628
        req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false);
×
1629
        req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1());
×
1630
        starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
×
1631
        starCatalogDownloadReply->setReadBufferSize(1024*1024*2);        
×
1632
        connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
×
1633
        connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
×
1634
        #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
1635
        connect(starCatalogDownloadReply, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
×
1636
        #else
1637
        connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
1638
        #endif
1639

1640
        progressBar = StelApp::getInstance().addProgressBar();
×
1641
        progressBar->setValue(0);
×
1642
        progressBar->setRange(0, static_cast<int>(nextStarCatalogToDownload.value("sizeMb").toDouble()*1024));
×
1643
        progressBar->setFormat(QString("%1: %p%").arg(nextStarCatalogToDownload.value("id").toString()));
×
1644

1645
        qDebug() << "Downloading file" << nextStarCatalogToDownload.value("url").toString();
×
1646
}
×
1647

1648
void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
×
1649
{
1650
        Q_ASSERT(currentDownloadFile);
×
1651
        Q_ASSERT(starCatalogDownloadReply);
×
1652

1653
        isDownloadingStarCatalog = false;
×
1654
        qWarning() << "Error downloading file" << starCatalogDownloadReply->url() << ": " << starCatalogDownloadReply->errorString();
×
1655
        ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextStarCatalogToDownload.value("id").toString(), starCatalogDownloadReply->errorString()));
×
1656
        ui->downloadCancelButton->setVisible(false);
×
1657
        ui->downloadRetryButton->setVisible(true);
×
1658
        ui->getStarsButton->setVisible(false);
×
1659
        ui->getStarsButton->setEnabled(true);
×
1660
}
×
1661

1662
void ConfigurationDialog::downloadFinished()
×
1663
{
1664
        Q_ASSERT(currentDownloadFile);
×
1665
        Q_ASSERT(starCatalogDownloadReply);
×
1666
        Q_ASSERT(progressBar);
×
1667

1668
        if (starCatalogDownloadReply->error()!=QNetworkReply::NoError)
×
1669
        {
1670
                starCatalogDownloadReply->deleteLater();
×
1671
                starCatalogDownloadReply = Q_NULLPTR;
×
1672
                currentDownloadFile->close();
×
1673
                currentDownloadFile->deleteLater();
×
1674
                currentDownloadFile = Q_NULLPTR;
×
1675
                StelApp::getInstance().removeProgressBar(progressBar);
×
1676
                progressBar=Q_NULLPTR;
×
1677
                return;
×
1678
        }
1679

1680
        const QVariant& redirect = starCatalogDownloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
×
1681
        if (!redirect.isNull())
×
1682
        {
1683
                // We got a redirection, we need to follow
1684
                starCatalogDownloadReply->deleteLater();
×
1685
                QNetworkRequest req(redirect.toUrl());
×
1686
                req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
×
1687
                req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false);
×
1688
                req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1());
×
1689
                starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
×
1690
                starCatalogDownloadReply->setReadBufferSize(1024*1024*2);
×
1691
                connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
×
1692
                connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
×
1693
                connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
×
1694
                return;
×
1695
        }
×
1696

1697
        Q_ASSERT(starCatalogDownloadReply->bytesAvailable()==0);
×
1698

1699
        isDownloadingStarCatalog = false;
×
1700
        currentDownloadFile->close();
×
1701
        currentDownloadFile->deleteLater();
×
1702
        currentDownloadFile = Q_NULLPTR;
×
1703
        starCatalogDownloadReply->deleteLater();
×
1704
        starCatalogDownloadReply = Q_NULLPTR;
×
1705
        StelApp::getInstance().removeProgressBar(progressBar);
×
1706
        progressBar=Q_NULLPTR;
×
1707

1708
        ui->downloadLabel->setText(q_("Verifying file integrity..."));
×
1709
        if (GETSTELMODULE(StarMgr)->checkAndLoadCatalog(nextStarCatalogToDownload, true)==false)
×
1710
        {
1711
                ui->getStarsButton->setVisible(false);
×
1712
                ui->downloadLabel->setText(q_("Error downloading %1:\nFile is corrupted.").arg(nextStarCatalogToDownload.value("id").toString()));
×
1713
                ui->downloadCancelButton->setVisible(false);
×
1714
                ui->downloadRetryButton->setVisible(true);
×
1715
        }
1716
        else
1717
        {
1718
                hasDownloadedStarCatalog = true;
×
1719
                ui->getStarsButton->setVisible(true);
×
1720
                ui->downloadCancelButton->setVisible(false);
×
1721
                ui->downloadRetryButton->setVisible(false);
×
1722
        }
1723

1724
        resetStarCatalogControls();
×
1725
}
×
1726

1727
void ConfigurationDialog::de430ButtonClicked()
×
1728
{
1729
        StelCore *core=StelApp::getInstance().getCore();
×
1730
        QSettings* conf = StelApp::getInstance().getSettings();
×
1731
        Q_ASSERT(conf);
×
1732

1733
        core->setDe430Active(!core->de430IsActive());
×
1734
        conf->setValue("astro/flag_use_de430", core->de430IsActive());
×
1735

1736
        resetEphemControls(); //refresh labels
×
1737
}
×
1738

1739
void ConfigurationDialog::de431ButtonClicked()
×
1740
{
1741
        StelCore *core=StelApp::getInstance().getCore();
×
1742
        QSettings* conf = StelApp::getInstance().getSettings();
×
1743
        Q_ASSERT(conf);
×
1744

1745
        core->setDe431Active(!core->de431IsActive());
×
1746
        conf->setValue("astro/flag_use_de431", core->de431IsActive());
×
1747

1748
        resetEphemControls(); //refresh labels
×
1749
}
×
1750

1751
void ConfigurationDialog::de440ButtonClicked()
×
1752
{
1753
        StelCore *core=StelApp::getInstance().getCore();
×
1754
        QSettings* conf = StelApp::getInstance().getSettings();
×
1755
        Q_ASSERT(conf);
×
1756

1757
        core->setDe440Active(!core->de440IsActive());
×
1758
        conf->setValue("astro/flag_use_de440", core->de440IsActive());
×
1759

1760
        resetEphemControls(); //refresh labels
×
1761
}
×
1762

1763
void ConfigurationDialog::de441ButtonClicked()
×
1764
{
1765
        StelCore *core=StelApp::getInstance().getCore();
×
1766
        QSettings* conf = StelApp::getInstance().getSettings();
×
1767
        Q_ASSERT(conf);
×
1768

1769
        core->setDe441Active(!core->de441IsActive());
×
1770
        conf->setValue("astro/flag_use_de441", core->de441IsActive());
×
1771

1772
        resetEphemControls(); //refresh labels
×
1773
}
×
1774

1775
void ConfigurationDialog::resetEphemControls()
×
1776
{
1777
        QPair<int, int> mm = qMakePair(-4000, 8000); // VSOP87
×
1778
        StelCore *core=StelApp::getInstance().getCore();
×
1779
        ui->de430checkBox->setEnabled(core->de430IsAvailable());
×
1780
        ui->de431checkBox->setEnabled(core->de431IsAvailable());
×
1781
        ui->de430checkBox->setChecked(core->de430IsActive());
×
1782
        ui->de431checkBox->setChecked(core->de431IsActive());
×
1783
        ui->de440checkBox->setEnabled(core->de440IsAvailable());
×
1784
        ui->de441checkBox->setEnabled(core->de441IsAvailable());
×
1785
        ui->de440checkBox->setChecked(core->de440IsActive());
×
1786
        ui->de441checkBox->setChecked(core->de441IsActive());
×
1787

1788
        if(core->de430IsActive())
×
1789
        {
1790
                ui->de430label->setText("1550..2650");
×
1791
                mm = qMakePair(1550, 2650);
×
1792
        }
1793
        else
1794
        {
1795
                if (core->de430IsAvailable())
×
1796
                        ui->de430label->setText(q_("Available"));
×
1797
                else
1798
                        ui->de430label->setText(q_("Not Available"));
×
1799
        }
1800
        if(core->de431IsActive())
×
1801
        {
1802
                ui->de431label->setText("-13000..17000");
×
1803
                mm = qMakePair(-13000, 17000);
×
1804
        }
1805
        else
1806
        {
1807
                if (core->de431IsAvailable())
×
1808
                        ui->de431label->setText(q_("Available"));
×
1809
                else
1810
                        ui->de431label->setText(q_("Not Available"));
×
1811
        }
1812
        if(core->de440IsActive())
×
1813
        {
1814
                ui->de440label->setText("1550..2650");
×
1815
                mm = qMakePair(1550, 2650);
×
1816
        }
1817
        else
1818
        {
1819
                if (core->de440IsAvailable())
×
1820
                        ui->de440label->setText(q_("Available"));
×
1821
                else
1822
                        ui->de440label->setText(q_("Not Available"));
×
1823
        }
1824
        if(core->de441IsActive())
×
1825
        {
1826
                ui->de441label->setText("-13000..17000");
×
1827
                mm = qMakePair(-13000, 17000);
×
1828
        }
1829
        else
1830
        {
1831
                if (core->de441IsAvailable())
×
1832
                        ui->de441label->setText(q_("Available"));
×
1833
                else
1834
                        ui->de441label->setText(q_("Not Available"));
×
1835
        }
1836
        core->setMinMaxEphemRange(mm);
×
1837
        emit core->ephemAlgorithmChanged();
×
1838
}
×
1839

1840
void ConfigurationDialog::updateSelectedInfoCheckBoxes()
×
1841
{
1842
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
1843
        
1844
        ui->checkBoxName->setChecked(flags & StelObject::Name);
×
1845
        ui->checkBoxCatalogNumbers->setChecked(flags & StelObject::CatalogNumber);
×
1846
        ui->checkBoxVisualMag->setChecked(flags & StelObject::Magnitude);
×
1847
        ui->checkBoxAbsoluteMag->setChecked(flags & StelObject::AbsoluteMagnitude);
×
1848
        ui->checkBoxRaDecJ2000->setChecked(flags & StelObject::RaDecJ2000);
×
1849
        ui->checkBoxRaDecOfDate->setChecked(flags & StelObject::RaDecOfDate);
×
1850
        ui->checkBoxHourAngle->setChecked(flags & StelObject::HourAngle);
×
1851
        ui->checkBoxAltAz->setChecked(flags & StelObject::AltAzi);
×
1852
        ui->checkBoxDistance->setChecked(flags & StelObject::Distance);
×
1853
        ui->checkBoxVelocity->setChecked(flags & StelObject::Velocity);
×
1854
        ui->checkBoxProperMotion->setChecked(flags & StelObject::ProperMotion);
×
1855
        ui->checkBoxSize->setChecked(flags & StelObject::Size);
×
1856
        ui->checkBoxExtra->setChecked(flags & StelObject::Extra);
×
1857
        ui->checkBoxGalacticCoordinates->setChecked(flags & StelObject::GalacticCoord);
×
1858
        ui->checkBoxSupergalacticCoordinates->setChecked(flags & StelObject::SupergalacticCoord);
×
1859
        ui->checkBoxOtherCoords->setChecked(flags & StelObject::OtherCoord);
×
1860
        ui->checkBoxElongation->setChecked(flags & StelObject::Elongation);
×
1861
        ui->checkBoxType->setChecked(flags & StelObject::ObjectType);
×
1862
        ui->checkBoxEclipticCoordsJ2000->setChecked(flags & StelObject::EclipticCoordJ2000);
×
1863
        ui->checkBoxEclipticCoordsOfDate->setChecked(flags & StelObject::EclipticCoordOfDate);
×
1864
        ui->checkBoxConstellation->setChecked(flags & StelObject::IAUConstellation);
×
1865
        ui->checkBoxSiderealTime->setChecked(flags & StelObject::SiderealTime);
×
1866
        ui->checkBoxRTSTime->setChecked(flags & StelObject::RTSTime);
×
1867
        ui->checkBoxSolarLunarPosition->setChecked(flags & StelObject::SolarLunarPosition);
×
1868

1869
        if (StelApp::getInstance().getFlagImmediateSave())
×
1870
        {
1871
                saveCustomSelectedInfo();
×
1872
        }
1873
}
×
1874

1875
void ConfigurationDialog::populateTooltips()
×
1876
{
1877
        ui->checkBoxProperMotion->setToolTip(QString("<p>%1</p>").arg(q_("Annual proper motion (stars) or hourly motion (solar system objects)")));
×
1878
        ui->checkBoxRTSTime->setToolTip(QString("<p>%1</p>").arg(q_("Show time of rising, transit and setting of celestial object. The rising and setting events are defined with the upper limb of the celestial body.")));
×
1879
}
×
1880

1881
void ConfigurationDialog::updateTabBarListWidgetWidth()
×
1882
{
1883
        ui->stackListWidget->setWrapping(false);
×
1884

1885
        // Update list item sizes after translation
1886
        ui->stackListWidget->adjustSize();
×
1887

1888
        QAbstractItemModel* model = ui->stackListWidget->model();
×
1889
        if (!model)
×
1890
                return;
×
1891

1892
        // stackListWidget->font() does not work properly!
1893
        // It has a incorrect fontSize in the first loading, which produces the bug#995107.
1894
        QFont font;
×
1895
        font.setPixelSize(14);
×
1896
        font.setWeight(QFont::Bold);
×
1897
        QFontMetrics fontMetrics(font);
×
1898

1899
        int iconSize = ui->stackListWidget->iconSize().width();
×
1900

1901
        int width = 0;
×
1902
        for (int row = 0; row < model->rowCount(); row++)
×
1903
        {
1904
                int textWidth = fontMetrics.boundingRect(ui->stackListWidget->item(row)->text()).width();
×
1905
                width += iconSize > textWidth ? iconSize : textWidth; // use the wider one
×
1906
                width += 24; // margin - 12px left and 12px right
×
1907
        }
1908

1909
        // Hack to force the window to be resized...
1910
        ui->stackListWidget->setMinimumWidth(width);
×
1911
        ui->stackListWidget->updateGeometry();
×
1912
}
×
1913

1914
void ConfigurationDialog::populateDeltaTAlgorithmsList()
×
1915
{
1916
        Q_ASSERT(ui->deltaTAlgorithmComboBox);
×
1917

1918
        // TRANSLATORS: Full phrase is "Algorithm of DeltaT"
1919
        ui->deltaTLabel->setText(QString("%1 %2T:").arg(q_("Algorithm of")).arg(QChar(0x0394)));
×
1920

1921
        QComboBox* algorithms = ui->deltaTAlgorithmComboBox;
×
1922

1923
        //Save the current selection to be restored later
1924
        algorithms->blockSignals(true);
×
1925
        int index = algorithms->currentIndex();
×
1926
        QVariant selectedAlgorithmId = algorithms->itemData(index);
×
1927
        algorithms->clear();
×
1928
        //For each algorithm, display the localized name and store the key as user
1929
        //data. Unfortunately, there's no other way to do this than with a cycle.
1930
        algorithms->addItem(q_("Without correction"), "WithoutCorrection");
×
1931
        algorithms->addItem(q_("Schoch (1931)"), "Schoch");
×
1932
        algorithms->addItem(q_("Clemence (1948)"), "Clemence");
×
1933
        algorithms->addItem(q_("IAU (1952)"), "IAU");
×
1934
        algorithms->addItem(q_("Astronomical Ephemeris (1960)"), "AstronomicalEphemeris");
×
1935
        algorithms->addItem(q_("Tuckerman (1962, 1964) & Goldstine (1973)"), "TuckermanGoldstine");
×
1936
        algorithms->addItem(q_("Muller & Stephenson (1975)"), "MullerStephenson");
×
1937
        algorithms->addItem(q_("Stephenson (1978)"), "Stephenson1978");
×
1938
        algorithms->addItem(q_("Schmadel & Zech (1979)"), "SchmadelZech1979");
×
1939
        algorithms->addItem(q_("Morrison & Stephenson (1982)"), "MorrisonStephenson1982");
×
1940
        algorithms->addItem(q_("Stephenson & Morrison (1984)"), "StephensonMorrison1984");
×
1941
        algorithms->addItem(q_("Stephenson & Houlden (1986)"), "StephensonHoulden");
×
1942
        algorithms->addItem(q_("Espenak (1987, 1989)"), "Espenak");
×
1943
        algorithms->addItem(q_("Borkowski (1988)"), "Borkowski");
×
1944
        algorithms->addItem(q_("Schmadel & Zech (1988)"), "SchmadelZech1988");
×
1945
        algorithms->addItem(q_("Chapront-Touze & Chapront (1991)"), "ChaprontTouze");        
×
1946
        algorithms->addItem(q_("Stephenson & Morrison (1995)"), "StephensonMorrison1995");
×
1947
        algorithms->addItem(q_("Stephenson (1997)"), "Stephenson1997");
×
1948
        // The dropdown label is too long for the string, and Meeus 1998 is very popular, this should be in the beginning of the tag.
1949
        algorithms->addItem(q_("Meeus (1998) (with Chapront, Chapront-Touze & Francou (1997))"), "ChaprontMeeus");
×
1950
        algorithms->addItem(q_("JPL Horizons"), "JPLHorizons");        
×
1951
        algorithms->addItem(q_("Meeus & Simons (2000)"), "MeeusSimons");
×
1952
        algorithms->addItem(q_("Montenbruck & Pfleger (2000)"), "MontenbruckPfleger");
×
1953
        algorithms->addItem(q_("Reingold & Dershowitz (2002, 2007, 2018)"), "ReingoldDershowitz");
×
1954
        algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "MorrisonStephenson2004");
×
1955
        algorithms->addItem(q_("Espenak & Meeus (2006, 2014)"), "EspenakMeeus");
×
1956
        // GZ: I want to try out some things. Something is still wrong with eclipses, see lp:1275092.
1957
        #ifndef NDEBUG
1958
        algorithms->addItem(q_("Espenak & Meeus (2006, 2014) no extra moon acceleration"), "EspenakMeeusZeroMoonAccel");
×
1959
        #endif
1960
        // Modified Espenak & Meeus (2006) used by default
1961
        algorithms->addItem(q_("Modified Espenak & Meeus (2006, 2014, 2023)").append(" *"), "EspenakMeeusModified");
×
1962
        algorithms->addItem(q_("Reijs (2006)"), "Reijs");
×
1963
        algorithms->addItem(q_("Banjevic (2006)"), "Banjevic");
×
1964
        algorithms->addItem(q_("Islam, Sadiq & Qureshi (2008, 2013)"), "IslamSadiqQureshi");
×
1965
        algorithms->addItem(q_("Khalid, Sultana & Zaidi (2014)"), "KhalidSultanaZaidi");
×
1966
        algorithms->addItem(q_("Stephenson, Morrison & Hohenkerk (2016, 2021)"), "StephensonMorrisonHohenkerk2016");
×
1967
        algorithms->addItem(q_("Henriksson (2017)"), "Henriksson2017");
×
1968
        algorithms->addItem(q_("Custom equation of %1T").arg(QChar(0x0394)), "Custom");
×
1969

1970
        //Restore the selection
1971
        index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::MatchCaseSensitive);
×
1972
        algorithms->setCurrentIndex(index);
×
1973
        //algorithms->model()->sort(0);
1974
        algorithms->blockSignals(false);
×
1975
        setDeltaTAlgorithmDescription();
×
1976
}
×
1977

1978
void ConfigurationDialog::setDeltaTAlgorithm(int algorithmID)
×
1979
{
1980
        StelCore* core = StelApp::getInstance().getCore();
×
1981
        QString currentAlgorithm = ui->deltaTAlgorithmComboBox->itemData(algorithmID).toString();
×
1982
        core->setCurrentDeltaTAlgorithmKey(currentAlgorithm);
×
1983
        setDeltaTAlgorithmDescription();
×
1984
        if (currentAlgorithm.contains("Custom"))
×
1985
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(true);
×
1986
        else
1987
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(false);
×
1988
}
×
1989

1990
void ConfigurationDialog::setDeltaTAlgorithmDescription()
×
1991
{
1992
        ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1993
        ui->deltaTAlgorithmDescription->setHtml(StelApp::getInstance().getCore()->getCurrentDeltaTAlgorithmDescription());
×
1994
}
×
1995

1996
void ConfigurationDialog::showCustomDeltaTEquationDialog()
×
1997
{
1998
        if (customDeltaTEquationDialog == Q_NULLPTR)
×
1999
                customDeltaTEquationDialog = new CustomDeltaTEquationDialog();
×
2000

2001
        customDeltaTEquationDialog->setVisible(true);
×
2002
}
×
2003

2004
void ConfigurationDialog::showConfigureScreenshotsDialog()
×
2005
{
2006
        if (configureScreenshotsDialog == Q_NULLPTR)
×
2007
                configureScreenshotsDialog = new ConfigureScreenshotsDialog();
×
2008

2009
        configureScreenshotsDialog->setVisible(true);
×
2010
}
×
2011

2012
void ConfigurationDialog::populateDateFormatsList()
×
2013
{
2014
        Q_ASSERT(ui->dateFormatsComboBox);
×
2015

2016
        QComboBox* dfmts = ui->dateFormatsComboBox;
×
2017

2018
        //Save the current selection to be restored later
2019
        dfmts->blockSignals(true);
×
2020
        int index = dfmts->currentIndex();
×
2021
        QVariant selectedDateFormat = dfmts->itemData(index);
×
2022
        dfmts->clear();
×
2023
        //For each format, display the localized name and store the key as user data.
2024
        dfmts->addItem(q_("System default"), "system_default");
×
2025
        dfmts->addItem(q_("yyyy-mm-dd (ISO 8601)"), "yyyymmdd");
×
2026
        dfmts->addItem(q_("dd-mm-yyyy"), "ddmmyyyy");
×
2027
        dfmts->addItem(q_("mm-dd-yyyy"), "mmddyyyy");
×
2028
        dfmts->addItem(q_("ww, yyyy-mm-dd"), "wwyyyymmdd");
×
2029
        dfmts->addItem(q_("ww, dd-mm-yyyy"), "wwddmmyyyy");
×
2030
        dfmts->addItem(q_("ww, mm-dd-yyyy"), "wwmmddyyyy");
×
2031
        //Restore the selection
2032
        index = dfmts->findData(selectedDateFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2033
        dfmts->setCurrentIndex(index);
×
2034
        dfmts->blockSignals(false);
×
2035
}
×
2036

2037
void ConfigurationDialog::setDateFormat()
×
2038
{
2039
        QString selectedFormat = ui->dateFormatsComboBox->itemData(ui->dateFormatsComboBox->currentIndex()).toString();
×
2040

2041
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2042
        if (selectedFormat == localeManager.getDateFormatStr())
×
2043
                return;
×
2044

2045
        StelApp::immediateSave("localization/date_display_format", selectedFormat);
×
2046
        localeManager.setDateFormatStr(selectedFormat);        
×
2047
}
×
2048

2049
void ConfigurationDialog::populateTimeFormatsList()
×
2050
{
2051
        Q_ASSERT(ui->timeFormatsComboBox);
×
2052

2053
        QComboBox* tfmts = ui->timeFormatsComboBox;
×
2054

2055
        //Save the current selection to be restored later
2056
        tfmts->blockSignals(true);
×
2057
        int index = tfmts->currentIndex();
×
2058
        QVariant selectedTimeFormat = tfmts->itemData(index);
×
2059
        tfmts->clear();
×
2060
        //For each format, display the localized name and store the key as user
2061
        //data. Unfortunately, there's no other way to do this than with a cycle.
2062
        tfmts->addItem(q_("System default"), "system_default");
×
2063
        tfmts->addItem(q_("12-hour format"), "12h");
×
2064
        tfmts->addItem(q_("24-hour format"), "24h");
×
2065

2066
        //Restore the selection
2067
        index = tfmts->findData(selectedTimeFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2068
        tfmts->setCurrentIndex(index);
×
2069
        tfmts->blockSignals(false);
×
2070
}
×
2071

2072
void ConfigurationDialog::setTimeFormat()
×
2073
{
2074
        QString selectedFormat = ui->timeFormatsComboBox->itemData(ui->timeFormatsComboBox->currentIndex()).toString();
×
2075

2076
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2077
        if (selectedFormat == localeManager.getTimeFormatStr())
×
2078
                return;
×
2079

2080
        StelApp::immediateSave("localization/time_display_format", selectedFormat);
×
2081
        localeManager.setTimeFormatStr(selectedFormat);
×
2082
}
×
2083

2084
void ConfigurationDialog::populateDitherList()
×
2085
{
2086
        Q_ASSERT(ui->ditheringComboBox);
×
2087
        QComboBox* ditherCombo = ui->ditheringComboBox;
×
2088

2089
        ditherCombo->blockSignals(true);
×
2090
        ditherCombo->clear();
×
2091
        if(StelMainView::getInstance().getGLInformation().isHighGraphicsMode)
×
2092
        {
2093
                ditherCombo->addItem(qc_("None","disabled"), "disabled");
×
2094
                ditherCombo->addItem(q_("5/6/5 bits"), "color565");
×
2095
                ditherCombo->addItem(q_("6/6/6 bits"), "color666");
×
2096
                ditherCombo->addItem(q_("8/8/8 bits"), "color888");
×
2097
                ditherCombo->addItem(q_("10/10/10 bits"), "color101010");
×
2098

2099
                // show current setting
2100
                QSettings* conf = StelApp::getInstance().getSettings();
×
2101
                Q_ASSERT(conf);
×
2102
                QVariant selectedDitherFormat = conf->value("video/dithering_mode", "disabled");
×
2103

2104
                int index = ditherCombo->findData(selectedDitherFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2105
                ditherCombo->setCurrentIndex(index);
×
2106
        }
×
2107
        else
2108
        {
2109
                ditherCombo->addItem(q_("Unsupported"), "disabled");
×
2110
                ditherCombo->setDisabled(true);
×
2111
                ditherCombo->setToolTip(q_("Unsupported in low-graphics mode"));
×
2112
        }
2113
        ditherCombo->blockSignals(false);
×
2114
}
×
2115

2116
void ConfigurationDialog::setDitherFormat()
×
2117
{
2118
        QString selectedFormat = ui->ditheringComboBox->itemData(ui->ditheringComboBox->currentIndex()).toString();
×
2119

2120
        QSettings* conf = StelApp::getInstance().getSettings();
×
2121
        Q_ASSERT(conf);
×
2122
        conf->setValue("video/dithering_mode", selectedFormat);
×
2123
        conf->sync();
×
2124

2125
        const auto core = StelApp::getInstance().getCore();
×
2126
        Q_ASSERT(core);
×
2127
        core->setDitheringMode(selectedFormat);
×
2128
}
×
2129

2130
void ConfigurationDialog::populateFontWritingSystemCombo()
×
2131
{
2132
        QComboBox *combo=ui->fontWritingSystemComboBox;
×
2133
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2134
        const QList<QFontDatabase::WritingSystem> writingSystems=QFontDatabase::writingSystems();
×
2135
#else
2136
        QFontDatabase fontDatabase;
2137
        const QList<QFontDatabase::WritingSystem> writingSystems=fontDatabase.writingSystems();
2138
#endif
2139
                for (const auto& system : writingSystems)
×
2140
                {
2141
                        combo->addItem(QFontDatabase::writingSystemName(system) + "  " + QFontDatabase::writingSystemSample(system), system);
×
2142
                }
2143
}
×
2144

2145
void ConfigurationDialog::handleFontBoxWritingSystem(int index)
×
2146
{
2147
        Q_UNUSED(index)
2148
        QComboBox *sender=dynamic_cast<QComboBox *>(QObject::sender());
×
2149
        ui->fontComboBox->setWritingSystem(static_cast<QFontDatabase::WritingSystem>(sender->currentData().toInt()));
×
2150
}
×
2151

2152
void ConfigurationDialog::populateScreenshotFileformatsCombo()
×
2153
{
2154
        QComboBox *combo=ui->screenshotFileFormatComboBox;
×
2155
        // To avoid platform differences, just ask what's available.
2156
        // However, wbmp seems broken, disable it and a few unnecessary formats
2157
        const QList<QByteArray> formats = QImageWriter::supportedImageFormats();
×
2158
        for (const auto& format : formats)
×
2159
        {
2160
                if ((format != "icns") && (format != "cur") && (format != "wbmp"))
×
2161
                        combo->addItem(QString(format));
×
2162
        }
2163
        combo->setCurrentText(StelApp::getInstance().getStelPropertyManager()->getStelPropertyValue("MainView.screenShotFormat").toString()); // maybe not required.
×
2164
}
×
2165

2166
void ConfigurationDialog::storeLanguageSettings()
×
2167
{
2168
        QSettings* conf = StelApp::getInstance().getSettings();
×
2169
        Q_ASSERT(conf);
×
2170
        StelPropertyMgr* propMgr=StelApp::getInstance().getStelPropertyManager();
×
2171
        Q_ASSERT(propMgr);
×
2172

2173
        QString langName = StelApp::getInstance().getLocaleMgr().getAppLanguage();
×
2174
        conf->setValue("localization/app_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
2175
        langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
×
2176
        conf->setValue("localization/sky_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
2177
}
×
2178

2179
void ConfigurationDialog::storeFontSettings()
×
2180
{
2181
        QSettings* conf = StelApp::getInstance().getSettings();
×
2182
        Q_ASSERT(conf);
×
2183
        StelPropertyMgr* propMgr=StelApp::getInstance().getStelPropertyManager();
×
2184
        Q_ASSERT(propMgr);
×
2185

2186
        conf->setValue("gui/base_font_name",        QGuiApplication::font().family());
×
2187
        conf->setValue("gui/screen_font_size",        propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
×
2188
        conf->setValue("gui/gui_font_size",        propMgr->getStelPropertyValue("StelApp.guiFontSize").toInt());
×
2189
}
×
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