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

Stellarium / stellarium / 13280109945

12 Feb 2025 07:19AM UTC coverage: 12.129% (+0.03%) from 12.099%
13280109945

Pull #3751

github

10110111
Regenerate the SC .pot file
Pull Request #3751: Switch skycultures to the new format

14613 of 120480 relevant lines covered (12.13%)

18988.36 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
        // Do the same for sky language:
185
        cb = ui->skycultureLanguageComboBox;
186
        cb->clear();
187
        cb->addItems(StelTranslator::globalTranslator->getAvailableLanguagesNamesNative(StelFileMgr::getLocaleDir(), "skycultures"));
188
        cb->model()->sort(0);
189
        updateCurrentSkyLanguage();
190
        connect(cb->lineEdit(), SIGNAL(editingFinished()), this, SLOT(updateCurrentSkyLanguage()));
191
        connect(cb, SIGNAL(currentIndexChanged(const int)), this, SLOT(selectSkyLanguage(const int)));        
192
        // Language properties are potentially delicate. Accidentally immediate storing may cause obvious problems.
193
        connect(ui->languageSaveToolButton, SIGNAL(clicked()), this, SLOT(storeLanguageSettings()));
194
        #else
195
        ui->groupBox_LanguageSettings->hide();
×
196
        #endif
197

198
        connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadStars()));
×
199
        connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
×
200
        connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downloadStars()));
×
201
        resetStarCatalogControls();
×
202

203
        connect(ui->de430checkBox, SIGNAL(clicked()), this, SLOT(de430ButtonClicked()));
×
204
        connect(ui->de431checkBox, SIGNAL(clicked()), this, SLOT(de431ButtonClicked()));
×
205
        connect(ui->de440checkBox, SIGNAL(clicked()), this, SLOT(de440ButtonClicked()));
×
206
        connect(ui->de441checkBox, SIGNAL(clicked()), this, SLOT(de441ButtonClicked()));
×
207
        resetEphemControls();
×
208

209
        connectBoolProperty(ui->nutationCheckBox, "StelCore.flagUseNutation");
×
210
        connectBoolProperty(ui->aberrationCheckBox, "StelCore.flagUseAberration");
×
211
        connectDoubleProperty(ui->aberrationSpinBox, "StelCore.aberrationFactor");
×
212
        connectBoolProperty(ui->parallaxCheckBox, "StelCore.flagUseParallax");
×
213
        connectDoubleProperty(ui->parallaxSpinBox, "StelCore.parallaxFactor");
×
214
        connectBoolProperty(ui->topocentricCheckBox, "StelCore.flagUseTopocentricCoordinates");
×
215

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

442
        // plugins control
443
        connect(ui->pluginsListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(pluginsSelectionChanged(QListWidgetItem*, QListWidgetItem*)));
×
444
        connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int)));
×
445
        connect(ui->pluginsListWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(pluginConfigureCurrentSelection()));
×
446
        connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(pluginConfigureCurrentSelection()));
×
447
        populatePluginsList();
×
448

449
        updateConfigLabels();
×
450
        populateTooltips();
×
451
        updateTabBarListWidgetWidth();
×
452

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

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

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

474
        if (cb->currentText() == l2)
×
475
                return;
×
476

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

488
void ConfigurationDialog::updateCurrentSkyLanguage()
×
489
{
490
        QComboBox* cb = ui->skycultureLanguageComboBox;
×
491
        QString skyLang = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
×
492
        QString l2 = StelTranslator::iso639_1CodeToNativeName(skyLang);
×
493

494
        if (cb->currentText() == l2)
×
495
                return;
×
496

497
        int lt = cb->findText(l2, Qt::MatchExactly);
×
498
        if (lt == -1 && skyLang.contains('_'))
×
499
        {
500
                l2 = skyLang.left(skyLang.indexOf('_'));
×
501
                l2=StelTranslator::iso639_1CodeToNativeName(l2);
×
502
                lt = cb->findText(l2, Qt::MatchExactly);
×
503
        }
504
        if (lt!=-1)
×
505
                cb->setCurrentIndex(lt);
×
506
}
×
507

508
void ConfigurationDialog::selectLanguage(const int id)
×
509
{
510
        const QString &langName=static_cast<QComboBox*>(sender())->itemText(id);
×
511
        QString code = StelTranslator::nativeNameToIso639_1Code(langName);
×
512
        StelApp::getInstance().getLocaleMgr().setAppLanguage(code);
×
513
        StelMainView::getInstance().initTitleI18n();
×
514
}
×
515

516
void ConfigurationDialog::selectSkyLanguage(const int id)
×
517
{
518
        const QString &langName=static_cast<QComboBox*>(sender())->itemText(id);
×
519
        QString code = StelTranslator::nativeNameToIso639_1Code(langName);
×
520
        StelApp::getInstance().getLocaleMgr().setSkyLanguage(code);
×
521
}
×
522

523
void ConfigurationDialog::setStartupTimeMode()
×
524
{
525
        StelCore *core=StelApp::getInstance().getCore();
×
526
        if (ui->systemTimeRadio->isChecked())
×
527
                core->setStartupTimeMode("actual");
×
528
        else if (ui->todayRadio->isChecked())
×
529
                core->setStartupTimeMode("today");
×
530
        else
531
                core->setStartupTimeMode("preset");
×
532

533
        core->setInitTodayTime(ui->todayTimeSpinBox->time());
×
534
        core->setPresetSkyTime(ui->fixedDateTimeEdit->dateTime());
×
535
}
×
536

537
void ConfigurationDialog::setButtonBarDTFormat()
×
538
{
539
        if (ui->jdRadioButton->isChecked())
×
540
                gui->getButtonBar()->setFlagTimeJd(true);
×
541
        else
542
                gui->getButtonBar()->setFlagTimeJd(false);
×
543
        StelApp::immediateSave("gui/flag_time_jd", ui->jdRadioButton->isChecked());
×
544
}
×
545

546
void ConfigurationDialog::showShortcutsWindow()
×
547
{
548
        StelAction* action = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Shortcuts_Window_Global");
×
549
        if (action)
×
550
                action->setChecked(true);
×
551
}
×
552

553
void ConfigurationDialog::setDiskViewport(bool b)
×
554
{
555
        if (b)
×
556
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskDisk);
×
557
        else
558
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskNone);
×
559
        StelApp::immediateSave("projection/viewport", StelProjector::maskTypeToString(StelApp::getInstance().getCore()->getCurrentStelProjectorParams().maskType));
×
560
}
×
561

562
void ConfigurationDialog::setSphericMirror(bool b)
×
563
{
564
        StelCore* core = StelApp::getInstance().getCore();
×
565
        if (b)
×
566
        {
567
                savedProjectionType = core->getCurrentProjectionType();
×
568
                core->setCurrentProjectionType(StelCore::ProjectionFisheye);
×
569
                StelApp::getInstance().setViewportEffect("sphericMirrorDistorter");
×
570
        }
571
        else
572
        {
573
                core->setCurrentProjectionType(static_cast<StelCore::ProjectionType>(savedProjectionType));
×
574
                StelApp::getInstance().setViewportEffect("none");
×
575
        }
576
}
×
577

578
void ConfigurationDialog::updateSelectedInfoGui()
×
579
{
580
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
581
        // Selected object info
582
        if (flags == StelObject::InfoStringGroup(StelObject::None))
×
583
        {
584
                ui->noSelectedInfoRadio->setChecked(true);
×
585
        }
586
        else if (flags == StelObject::InfoStringGroup(StelObject::DefaultInfo))
×
587
        {
588
                ui->defaultSelectedInfoRadio->setChecked(true);
×
589
        }
590
        else if (flags == StelObject::InfoStringGroup(StelObject::ShortInfo))
×
591
        {
592
                ui->briefSelectedInfoRadio->setChecked(true);
×
593
        }
594
        else if (flags == StelObject::InfoStringGroup(StelObject::AllInfo))
×
595
        {
596
                ui->allSelectedInfoRadio->setChecked(true);
×
597
        }
598
        else
599
        {
600
                ui->customSelectedInfoRadio->setChecked(true);
×
601
        }
602
        updateSelectedInfoCheckBoxes();
×
603
}
×
604

605
void ConfigurationDialog::setNoSelectedInfo()
×
606
{
607
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::None));
×
608
        StelApp::immediateSave("gui/selected_object_info", "none");
×
609
        updateSelectedInfoCheckBoxes();
×
610
}
×
611

612
void ConfigurationDialog::setAllSelectedInfo()
×
613
{
614
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::AllInfo));
×
615
        StelApp::immediateSave("gui/selected_object_info", "all");
×
616
        updateSelectedInfoCheckBoxes();
×
617
}
×
618

619
void ConfigurationDialog::setBriefSelectedInfo()
×
620
{
621
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::ShortInfo));
×
622
        StelApp::immediateSave("gui/selected_object_info", "short");
×
623
        updateSelectedInfoCheckBoxes();
×
624
}
×
625

626
void ConfigurationDialog::setDefaultSelectedInfo()
×
627
{
628
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::DefaultInfo));
×
629
        StelApp::immediateSave("gui/selected_object_info", "default");
×
630
        updateSelectedInfoCheckBoxes();
×
631
}
×
632

633
void ConfigurationDialog::setSelectedInfoFromCheckBoxes()
×
634
{
635
        // As this signal will be called when a checkbox is toggled,
636
        // change the general mode to Custom.
637
        if (!ui->customSelectedInfoRadio->isChecked())
×
638
        {
639
                ui->customSelectedInfoRadio->setChecked(true);
×
640
                StelApp::immediateSave("gui/selected_object_info", "custom");
×
641
        }
642

643
        StelObject::InfoStringGroup flags(StelObject::None);
×
644

645
        if (ui->checkBoxName->isChecked())
×
646
                flags |= StelObject::Name;
×
647
        if (ui->checkBoxCatalogNumbers->isChecked())
×
648
                flags |= StelObject::CatalogNumber;
×
649
        if (ui->checkBoxVisualMag->isChecked())
×
650
                flags |= StelObject::Magnitude;
×
651
        if (ui->checkBoxAbsoluteMag->isChecked())
×
652
                flags |= StelObject::AbsoluteMagnitude;
×
653
        if (ui->checkBoxRaDecJ2000->isChecked())
×
654
                flags |= StelObject::RaDecJ2000;
×
655
        if (ui->checkBoxRaDecOfDate->isChecked())
×
656
                flags |= StelObject::RaDecOfDate;
×
657
        if (ui->checkBoxHourAngle->isChecked())
×
658
                flags |= StelObject::HourAngle;
×
659
        if (ui->checkBoxAltAz->isChecked())
×
660
                flags |= StelObject::AltAzi;
×
661
        if (ui->checkBoxDistance->isChecked())
×
662
                flags |= StelObject::Distance;
×
663
        if (ui->checkBoxVelocity->isChecked())
×
664
                flags |= StelObject::Velocity;
×
665
        if (ui->checkBoxProperMotion->isChecked())
×
666
                flags |= StelObject::ProperMotion;
×
667
        if (ui->checkBoxSize->isChecked())
×
668
                flags |= StelObject::Size;
×
669
        if (ui->checkBoxExtra->isChecked())
×
670
                flags |= StelObject::Extra;
×
671
        if (ui->checkBoxGalacticCoordinates->isChecked())
×
672
                flags |= StelObject::GalacticCoord;
×
673
        if (ui->checkBoxSupergalacticCoordinates->isChecked())
×
674
                flags |= StelObject::SupergalacticCoord;
×
675
        if (ui->checkBoxOtherCoords->isChecked())
×
676
                flags |= StelObject::OtherCoord;
×
677
        if (ui->checkBoxElongation->isChecked())
×
678
                flags |= StelObject::Elongation;
×
679
        if (ui->checkBoxType->isChecked())
×
680
                flags |= StelObject::ObjectType;
×
681
        if (ui->checkBoxEclipticCoordsJ2000->isChecked())
×
682
                flags |= StelObject::EclipticCoordJ2000;
×
683
        if (ui->checkBoxEclipticCoordsOfDate->isChecked())
×
684
                flags |= StelObject::EclipticCoordOfDate;
×
685
        if (ui->checkBoxConstellation->isChecked())
×
686
                flags |= StelObject::IAUConstellation;
×
687
        if (ui->checkBoxSiderealTime->isChecked())
×
688
                flags |= StelObject::SiderealTime;
×
689
        if (ui->checkBoxRTSTime->isChecked())
×
690
                flags |= StelObject::RTSTime;
×
691
        if (ui->checkBoxSolarLunarPosition->isChecked())
×
692
                flags |= StelObject::SolarLunarPosition;
×
693

694
        gui->setInfoTextFilters(flags);
×
695
        // overwrite custom selected info settings
696
        saveCustomSelectedInfo();
×
697
}
×
698

699
void ConfigurationDialog::setCustomSelectedInfo()
×
700
{
701
        StelObject::InfoStringGroup flags(StelObject::None);
×
702
        QSettings* conf = StelApp::getInstance().getSettings();
×
703
        Q_ASSERT(conf);
×
704

705
        if (conf->value("custom_selected_info/flag_show_name", false).toBool())
×
706
                flags |= StelObject::Name;
×
707
        if (conf->value("custom_selected_info/flag_show_catalognumber", false).toBool())
×
708
                flags |= StelObject::CatalogNumber;
×
709
        if (conf->value("custom_selected_info/flag_show_magnitude", false).toBool())
×
710
                flags |= StelObject::Magnitude;
×
711
        if (conf->value("custom_selected_info/flag_show_absolutemagnitude", false).toBool())
×
712
                flags |= StelObject::AbsoluteMagnitude;
×
713
        if (conf->value("custom_selected_info/flag_show_radecj2000", false).toBool())
×
714
                flags |= StelObject::RaDecJ2000;
×
715
        if (conf->value("custom_selected_info/flag_show_radecofdate", false).toBool())
×
716
                flags |= StelObject::RaDecOfDate;
×
717
        if (conf->value("custom_selected_info/flag_show_hourangle", false).toBool())
×
718
                flags |= StelObject::HourAngle;
×
719
        if (conf->value("custom_selected_info/flag_show_altaz", false).toBool())
×
720
                flags |= StelObject::AltAzi;
×
721
        if (conf->value("custom_selected_info/flag_show_elongation", false).toBool())
×
722
                flags |= StelObject::Elongation;
×
723
        if (conf->value("custom_selected_info/flag_show_distance", false).toBool())
×
724
                flags |= StelObject::Distance;
×
725
        if (conf->value("custom_selected_info/flag_show_velocity", false).toBool())
×
726
                flags |= StelObject::Velocity;
×
727
        if (conf->value("custom_selected_info/flag_show_propermotion", false).toBool())
×
728
                flags |= StelObject::ProperMotion;
×
729
        if (conf->value("custom_selected_info/flag_show_size", false).toBool())
×
730
                flags |= StelObject::Size;
×
731
        if (conf->value("custom_selected_info/flag_show_extra", false).toBool())
×
732
                flags |= StelObject::Extra;
×
733
        if (conf->value("custom_selected_info/flag_show_galcoord", false).toBool())
×
734
                flags |= StelObject::GalacticCoord;
×
735
        if (conf->value("custom_selected_info/flag_show_supergalcoord", false).toBool())
×
736
                flags |= StelObject::SupergalacticCoord;
×
737
        if (conf->value("custom_selected_info/flag_show_othercoord", false).toBool())
×
738
                flags |= StelObject::OtherCoord;
×
739
        if (conf->value("custom_selected_info/flag_show_type", false).toBool())
×
740
                flags |= StelObject::ObjectType;
×
741
        if (conf->value("custom_selected_info/flag_show_eclcoordofdate", false).toBool())
×
742
                flags |= StelObject::EclipticCoordOfDate;
×
743
        if (conf->value("custom_selected_info/flag_show_eclcoordj2000", false).toBool())
×
744
                flags |= StelObject::EclipticCoordJ2000;
×
745
        if (conf->value("custom_selected_info/flag_show_constellation", false).toBool())
×
746
                flags |= StelObject::IAUConstellation;
×
747
        if (conf->value("custom_selected_info/flag_show_sidereal_time", false).toBool())
×
748
                flags |= StelObject::SiderealTime;
×
749
        if (conf->value("custom_selected_info/flag_show_rts_time", false).toBool())
×
750
                flags |= StelObject::RTSTime;
×
751
        if (conf->value("custom_selected_info/flag_show_solar_lunar", false).toBool())
×
752
                flags |= StelObject::SolarLunarPosition;
×
753

754
        gui->setInfoTextFilters(flags);
×
755
        updateSelectedInfoCheckBoxes();
×
756
}
×
757

758
void ConfigurationDialog::saveCustomSelectedInfo()
×
759
{
760
        // configuration dialog / selected object info tab
761
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
762
        QSettings* conf = StelApp::getInstance().getSettings();
×
763
        Q_ASSERT(conf);
×
764

765
        conf->beginGroup("custom_selected_info");
×
766
        conf->setValue("flag_show_name",                                static_cast<bool>(flags & StelObject::Name));
×
767
        conf->setValue("flag_show_catalognumber",                static_cast<bool>(flags & StelObject::CatalogNumber));
×
768
        conf->setValue("flag_show_magnitude",                        static_cast<bool>(flags & StelObject::Magnitude));
×
769
        conf->setValue("flag_show_absolutemagnitude",        static_cast<bool>(flags & StelObject::AbsoluteMagnitude));
×
770
        conf->setValue("flag_show_radecj2000",                static_cast<bool>(flags & StelObject::RaDecJ2000));
×
771
        conf->setValue("flag_show_radecofdate",                static_cast<bool>(flags & StelObject::RaDecOfDate));
×
772
        conf->setValue("flag_show_hourangle",                        static_cast<bool>(flags & StelObject::HourAngle));
×
773
        conf->setValue("flag_show_altaz",                                static_cast<bool>(flags & StelObject::AltAzi));
×
774
        conf->setValue("flag_show_elongation",                        static_cast<bool>(flags & StelObject::Elongation));
×
775
        conf->setValue("flag_show_distance",                        static_cast<bool>(flags & StelObject::Distance));
×
776
        conf->setValue("flag_show_velocity",                        static_cast<bool>(flags & StelObject::Velocity));
×
777
        conf->setValue("flag_show_propermotion",                static_cast<bool>(flags & StelObject::ProperMotion));
×
778
        conf->setValue("flag_show_size",                                static_cast<bool>(flags & StelObject::Size));
×
779
        conf->setValue("flag_show_extra",                                static_cast<bool>(flags & StelObject::Extra));
×
780
        conf->setValue("flag_show_galcoord",                        static_cast<bool>(flags & StelObject::GalacticCoord));
×
781
        conf->setValue("flag_show_supergalcoord",                static_cast<bool>(flags & StelObject::SupergalacticCoord));
×
782
        conf->setValue("flag_show_othercoord",                        static_cast<bool>(flags & StelObject::OtherCoord));
×
783
        conf->setValue("flag_show_type",                                static_cast<bool>(flags & StelObject::ObjectType));
×
784
        conf->setValue("flag_show_eclcoordofdate",                static_cast<bool>(flags & StelObject::EclipticCoordOfDate));
×
785
        conf->setValue("flag_show_eclcoordj2000",                static_cast<bool>(flags & StelObject::EclipticCoordJ2000));
×
786
        conf->setValue("flag_show_constellation",                static_cast<bool>(flags & StelObject::IAUConstellation));
×
787
        conf->setValue("flag_show_sidereal_time",                static_cast<bool>(flags & StelObject::SiderealTime));
×
788
        conf->setValue("flag_show_rts_time",                        static_cast<bool>(flags & StelObject::RTSTime));
×
789
        conf->setValue("flag_show_solar_lunar",                        static_cast<bool>(flags & StelObject::SolarLunarPosition));
×
790
        conf->endGroup();
×
791
}
×
792

793
void ConfigurationDialog::browseForScreenshotDir()
×
794
{
795
        const QString &oldScreenshotDir = StelFileMgr::getScreenshotDir();
×
796
        QString newScreenshotDir = QFileDialog::getExistingDirectory(&StelMainView::getInstance(), q_("Select screenshot directory"), oldScreenshotDir, QFileDialog::ShowDirsOnly);
×
797

798
        if (!newScreenshotDir.isEmpty()) {
×
799
                // remove trailing slash
800
                if (newScreenshotDir.right(1) == "/")
×
801
                        newScreenshotDir = newScreenshotDir.left(newScreenshotDir.length()-1);
×
802

803
                ui->screenshotDirEdit->setText(newScreenshotDir);
×
804
                selectScreenshotDir();
×
805
        }
806
}
×
807

808
void ConfigurationDialog::selectScreenshotDir()
×
809
{
810
        QString dir = ui->screenshotDirEdit->text();
×
811
        try
812
        {
813
                StelFileMgr::setScreenshotDir(dir);
×
814
        }
815
        catch (std::runtime_error& e)
×
816
        {
817
                Q_UNUSED(e)
818
                // nop
819
                // this will happen when people are only half way through typing dirs
820
        }
×
821
}
×
822

823
void ConfigurationDialog::updateDpiTooltip()
×
824
{
825
        StelMainView *mainView=static_cast<StelMainView *>(StelApp::getInstance().parent());
×
826
        const QString qMM=qc_("mm", "millimeters");
×
827
        const int dpi=mainView->getScreenshotDpi();
×
828
        double mmX, mmY;
829
        if (mainView->getFlagUseCustomScreenshotSize())
×
830
        {
831
                mmX=mainView->getCustomScreenshotWidth()*25.4/dpi;
×
832
                mmY=mainView->getCustomScreenshotHeight()*25.4/dpi;
×
833
        }
834
        else
835
        {
836
                mmX=mainView->window()->width()*25.4/dpi;
×
837
                mmY=mainView->window()->height()*25.4/dpi;
×
838
        }
839

840
        ui->dpiSpinBox->setToolTip("<html><head/><body><p>" +
×
841
                                   q_("Dots per Inch (for image metadata).") + "</p><p>" +
×
842
                                   q_("Current designated print size") +
×
843
                                   QString(": %1&times;%2 %3").arg(QString::number(mmX, 'f', 1), QString::number(mmY, 'f', 1), qMM) +
×
844
                                   + "</p></body></html>");
845
}
×
846

847
// Store FOV and viewing dir.
848
void ConfigurationDialog::saveCurrentViewDirSettings()
×
849
{
850
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
851
        Q_ASSERT(mvmgr);
×
852

853
        mvmgr->setInitFov(mvmgr->getCurrentFov());
×
854
        mvmgr->setInitViewDirectionToCurrent();
×
855
}
×
856

857

858
// Save the current viewing options including sky culture
859
// This doesn't include the current viewing direction, landscape, time and FOV since those have specific controls
860
void ConfigurationDialog::saveAllSettings()
×
861
{
862
        QSettings* conf = StelApp::getInstance().getSettings();
×
863
        Q_ASSERT(conf);
×
864

865
        // TBD: store more properties directly, avoid to query all modules.
866
        StelPropertyMgr* propMgr=StelApp::getInstance().getStelPropertyManager();
×
867
        Q_ASSERT(propMgr);
×
868

869
        NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
×
870
        Q_ASSERT(nmgr);
×
871
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
872
        Q_ASSERT(mvmgr);
×
873

874
        StelCore* core = StelApp::getInstance().getCore();
×
875
        const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000);
×
876
        Q_ASSERT(proj);
×
877

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

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

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

1038
        conf->setValue("viewing/constellation_font_size",        propMgr->getStelPropertyValue("ConstellationMgr.fontSize").toInt());
×
1039
        conf->setValue("viewing/flag_constellation_drawing",        propMgr->getStelPropertyValue("ConstellationMgr.linesDisplayed").toBool());
×
1040
        conf->setValue("viewing/flag_constellation_name",        propMgr->getStelPropertyValue("ConstellationMgr.namesDisplayed").toBool());
×
1041
        conf->setValue("viewing/flag_constellation_boundaries",        propMgr->getStelPropertyValue("ConstellationMgr.boundariesDisplayed").toBool());
×
1042
        conf->setValue("viewing/flag_constellation_art",        propMgr->getStelPropertyValue("ConstellationMgr.artDisplayed").toBool());
×
1043
        conf->setValue("viewing/flag_constellation_isolate_selected",        propMgr->getStelPropertyValue("ConstellationMgr.isolateSelected").toBool());
×
1044
        conf->setValue("viewing/flag_asterism_isolate_selected",        propMgr->getStelPropertyValue("AsterismMgr.isolateAsterismSelected").toBool());
×
1045
        conf->setValue("viewing/flag_landscape_autoselection",        propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeAutoSelection").toBool());
×
1046
        conf->setValue("viewing/flag_light_pollution_database",        propMgr->getStelPropertyValue("LandscapeMgr.flagUseLightPollutionFromDatabase").toBool());
×
1047
        conf->setValue("viewing/flag_environment_auto_enable",        propMgr->getStelPropertyValue("LandscapeMgr.flagEnvironmentAutoEnabling").toBool());
×
1048
        conf->setValue("viewing/constellation_art_intensity",        propMgr->getStelPropertyValue("ConstellationMgr.artIntensity").toFloat());
×
1049
        conf->setValue("viewing/constellation_name_style",        ConstellationMgr::getConstellationDisplayStyleString(static_cast<ConstellationMgr::ConstellationDisplayStyle> (propMgr->getStelPropertyValue("ConstellationMgr.constellationDisplayStyle").toInt())  ));
×
1050
        conf->setValue("viewing/constellation_line_thickness",        propMgr->getStelPropertyValue("ConstellationMgr.constellationLineThickness").toInt());
×
1051
        conf->setValue("viewing/constellation_boundaries_thickness",        propMgr->getStelPropertyValue("ConstellationMgr.constellationBoundariesThickness").toInt());
×
1052

1053
        conf->setValue("viewing/asterism_font_size",                propMgr->getStelPropertyValue("AsterismMgr.fontSize").toInt());
×
1054
        conf->setValue("viewing/flag_asterism_drawing",                propMgr->getStelPropertyValue("AsterismMgr.linesDisplayed").toBool());
×
1055
        conf->setValue("viewing/flag_asterism_name",                propMgr->getStelPropertyValue("AsterismMgr.namesDisplayed").toBool());
×
1056
        conf->setValue("viewing/asterism_line_thickness",        propMgr->getStelPropertyValue("AsterismMgr.asterismLineThickness").toInt());
×
1057
        conf->setValue("viewing/flag_rayhelper_drawing",        propMgr->getStelPropertyValue("AsterismMgr.rayHelpersDisplayed").toBool());
×
1058
        conf->setValue("viewing/rayhelper_line_thickness",        propMgr->getStelPropertyValue("AsterismMgr.rayHelperThickness").toInt());
×
1059
        conf->setValue("viewing/sky_brightness_label_threshold",propMgr->getStelPropertyValue("StelSkyDrawer.daylightLabelThreshold").toFloat());
×
1060
        conf->setValue("viewing/flag_night",                        StelApp::getInstance().getVisionModeNight());
×
1061
        conf->setValue("astro/flag_stars",                        propMgr->getStelPropertyValue("StarMgr.flagStarsDisplayed").toBool());
×
1062
        conf->setValue("astro/flag_star_name",                        propMgr->getStelPropertyValue("StarMgr.flagLabelsDisplayed").toBool());
×
1063
        conf->setValue("astro/flag_star_additional_names",        propMgr->getStelPropertyValue("StarMgr.flagAdditionalNamesDisplayed").toBool());
×
1064
        conf->setValue("astro/flag_star_designation_usage",        propMgr->getStelPropertyValue("StarMgr.flagDesignationLabels").toBool());
×
1065
        conf->setValue("astro/flag_star_designation_dbl",        propMgr->getStelPropertyValue("StarMgr.flagDblStarsDesignation").toBool());
×
1066
        conf->setValue("astro/flag_star_designation_var",        propMgr->getStelPropertyValue("StarMgr.flagVarStarsDesignation").toBool());
×
1067
        conf->setValue("astro/flag_star_designation_hip",        propMgr->getStelPropertyValue("StarMgr.flagHIPDesignation").toBool());
×
1068
        conf->setValue("stars/labels_amount",                        propMgr->getStelPropertyValue("StarMgr.labelsAmount").toDouble());
×
1069
        conf->setValue("astro/nebula_hints_amount",                propMgr->getStelPropertyValue("NebulaMgr.hintsAmount").toDouble());
×
1070
        conf->setValue("astro/nebula_labels_amount",                propMgr->getStelPropertyValue("NebulaMgr.labelsAmount").toDouble());
×
1071
        conf->setValue("astro/nebula_hints_brightness",                propMgr->getStelPropertyValue("NebulaMgr.hintsBrightness").toDouble());
×
1072
        conf->setValue("astro/nebula_labels_brightness",        propMgr->getStelPropertyValue("NebulaMgr.labelsBrightness").toDouble());
×
1073

1074
        conf->setValue("astro/flag_nebula_hints_proportional",        propMgr->getStelPropertyValue("NebulaMgr.hintsProportional").toBool());
×
1075
        conf->setValue("astro/flag_surface_brightness_usage",        propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessUsage").toBool());
×
1076
        conf->setValue("gui/flag_surface_brightness_arcsec",        propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessArcsecUsage").toBool());
×
1077
        conf->setValue("gui/flag_surface_brightness_short",        propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessShortNotationUsage").toBool());
×
1078
        conf->setValue("astro/flag_dso_designation_usage",        propMgr->getStelPropertyValue("NebulaMgr.flagDesignationLabels").toBool());
×
1079
        conf->setValue("astro/flag_dso_outlines_usage",                propMgr->getStelPropertyValue("NebulaMgr.flagOutlinesDisplayed").toBool());
×
1080
        conf->setValue("astro/flag_dso_additional_names",        propMgr->getStelPropertyValue("NebulaMgr.flagAdditionalNamesDisplayed").toBool());
×
1081
        conf->setValue("astro/flag_nebula_name",                propMgr->getStelPropertyValue("NebulaMgr.flagHintDisplayed").toBool());
×
1082
        conf->setValue("astro/flag_use_type_filter",                propMgr->getStelPropertyValue("NebulaMgr.flagTypeFiltersUsage").toBool());
×
1083
        conf->setValue("astro/flag_nebula_display_no_texture",        !propMgr->getStelPropertyValue("StelSkyLayerMgr.flagShow").toBool() );
×
1084

1085
        conf->setValue("astro/flag_size_limits_usage",                propMgr->getStelPropertyValue("NebulaMgr.flagUseSizeLimits").toBool());
×
1086
        conf->setValue("astro/size_limit_min",                        QString::number(propMgr->getStelPropertyValue("NebulaMgr.minSizeLimit").toDouble(), 'f', 2));
×
1087
        conf->setValue("astro/size_limit_max",                        QString::number(propMgr->getStelPropertyValue("NebulaMgr.maxSizeLimit").toDouble(), 'f', 2));
×
1088

1089
        conf->setValue("projection/type",                        core->getCurrentProjectionTypeKey());
×
1090
        conf->setValue("astro/flag_nutation",                        core->getUseNutation());
×
1091
        conf->setValue("astro/flag_aberration",                        core->getUseAberration());
×
1092
        conf->setValue("astro/aberration_factor",                core->getAberrationFactor());
×
1093
        conf->setValue("astro/flag_parallax",                        core->getUseParallax());
×
1094
        conf->setValue("astro/parallax_factor",                core->getParallaxFactor());
×
1095
        conf->setValue("astro/flag_topocentric_coordinates",        core->getUseTopocentricCoordinates());
×
1096
        conf->setValue("astro/solar_system_threads",                propMgr->getStelPropertyValue("SolarSystem.extraThreads").toInt());
×
1097

1098
        // view dialog / DSO tag settings
1099
        nmgr->storeCatalogFilters();
×
1100

1101
        const Nebula::TypeGroup tflags = static_cast<Nebula::TypeGroup>(nmgr->getTypeFilters());
×
1102
        conf->beginGroup("dso_type_filters");
×
1103
        conf->setValue("flag_show_galaxies",             static_cast<bool>(tflags & Nebula::TypeGalaxies));
×
1104
        conf->setValue("flag_show_active_galaxies",      static_cast<bool>(tflags & Nebula::TypeActiveGalaxies));
×
1105
        conf->setValue("flag_show_interacting_galaxies", static_cast<bool>(tflags & Nebula::TypeInteractingGalaxies));
×
1106
        conf->setValue("flag_show_open_clusters",        static_cast<bool>(tflags & Nebula::TypeOpenStarClusters));
×
1107
        conf->setValue("flag_show_globular_clusters",    static_cast<bool>(tflags & Nebula::TypeGlobularStarClusters));
×
1108
        conf->setValue("flag_show_bright_nebulae",       static_cast<bool>(tflags & Nebula::TypeBrightNebulae));
×
1109
        conf->setValue("flag_show_dark_nebulae",         static_cast<bool>(tflags & Nebula::TypeDarkNebulae));
×
1110
        conf->setValue("flag_show_planetary_nebulae",    static_cast<bool>(tflags & Nebula::TypePlanetaryNebulae));
×
1111
        conf->setValue("flag_show_hydrogen_regions",     static_cast<bool>(tflags & Nebula::TypeHydrogenRegions));
×
1112
        conf->setValue("flag_show_supernova_remnants",   static_cast<bool>(tflags & Nebula::TypeSupernovaRemnants));
×
1113
        conf->setValue("flag_show_galaxy_clusters",      static_cast<bool>(tflags & Nebula::TypeGalaxyClusters));
×
1114
        conf->setValue("flag_show_other",                static_cast<bool>(tflags & Nebula::TypeOther));
×
1115
        conf->endGroup();
×
1116

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

1140
        // view dialog / starlore tab
1141
        QObject* scmgr = reinterpret_cast<QObject*>(&StelApp::getInstance().getSkyCultureMgr());
×
1142
        scmgr->setProperty("defaultSkyCultureID", scmgr->property("currentSkyCultureID"));
×
1143

1144
        // Save default location
1145
        core->setDefaultLocationID(core->getCurrentLocation().getID());
×
1146

1147
        // configuration dialog / main tab
1148
        //QString langName = StelApp::getInstance().getLocaleMgr().getAppLanguage();
1149
        //conf->setValue("localization/app_locale", StelTranslator::nativeNameToIso639_1Code(langName));
1150
        //langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
1151
        //conf->setValue("localization/sky_locale", StelTranslator::nativeNameToIso639_1Code(langName));
1152
        storeLanguageSettings();
×
1153

1154
        // configuration dialog / selected object info tab
1155
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
1156
        static const QMap<StelObject::InfoStringGroup, QString>selectedObjectInfoMap={
1157
                {StelObject::InfoStringGroup(StelObject::None),                "none"},
×
1158
                {StelObject::InfoStringGroup(StelObject::DefaultInfo),        "default"},
×
1159
                {StelObject::InfoStringGroup(StelObject::ShortInfo),        "short"},
×
1160
                {StelObject::InfoStringGroup(StelObject::AllInfo),                "all"}
×
1161
        };
×
1162
        QString selectedObjectInfo=selectedObjectInfoMap.value(flags, "custom");
×
1163
        conf->setValue("gui/selected_object_info", selectedObjectInfo);
×
1164
        if (selectedObjectInfo=="custom")
×
1165
                saveCustomSelectedInfo();
×
1166

1167
        // toolbar auto-hide status
1168
        conf->setValue("gui/auto_hide_horizontal_toolbar",                                propMgr->getStelPropertyValue("StelGui.autoHideHorizontalButtonBar").toBool());
×
1169
        conf->setValue("gui/auto_hide_vertical_toolbar",                                propMgr->getStelPropertyValue("StelGui.autoHideVerticalButtonBar").toBool());
×
1170
        conf->setValue("gui/flag_show_quit_button",                                        propMgr->getStelPropertyValue("StelGui.flagShowQuitButton").toBool());
×
1171
        conf->setValue("gui/flag_show_nebulae_background_button",        propMgr->getStelPropertyValue("StelGui.flagShowNebulaBackgroundButton").toBool());
×
1172
        conf->setValue("gui/flag_show_dss_button",                                        propMgr->getStelPropertyValue("StelGui.flagShowDSSButton").toBool());
×
1173
        conf->setValue("gui/flag_show_hips_button",                                        propMgr->getStelPropertyValue("StelGui.flagShowHiPSButton").toBool());
×
1174
        conf->setValue("gui/flag_show_goto_selected_button",                        propMgr->getStelPropertyValue("StelGui.flagShowGotoSelectedObjectButton").toBool());
×
1175
        conf->setValue("gui/flag_show_nightmode_button",                                propMgr->getStelPropertyValue("StelGui.flagShowNightmodeButton").toBool());
×
1176
        conf->setValue("gui/flag_show_fullscreen_button",                                propMgr->getStelPropertyValue("StelGui.flagShowFullscreenButton").toBool());
×
1177

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

1180
        conf->setValue("gui/flag_show_icrs_grid_button",                                propMgr->getStelPropertyValue("StelGui.flagShowICRSGridButton").toBool());
×
1181
        conf->setValue("gui/flag_show_galactic_grid_button",                        propMgr->getStelPropertyValue("StelGui.flagShowGalacticGridButton").toBool());
×
1182
        conf->setValue("gui/flag_show_ecliptic_grid_button",                        propMgr->getStelPropertyValue("StelGui.flagShowEclipticGridButton").toBool());
×
1183
        conf->setValue("gui/flag_show_boundaries_button",                        propMgr->getStelPropertyValue("StelGui.flagShowConstellationBoundariesButton").toBool());
×
1184
        conf->setValue("gui/flag_show_constellation_arts_button",                propMgr->getStelPropertyValue("StelGui.flagShowConstellationArtsButton").toBool());
×
1185
        conf->setValue("gui/flag_show_asterism_lines_button",                        propMgr->getStelPropertyValue("StelGui.flagShowAsterismLinesButton").toBool());
×
1186
        conf->setValue("gui/flag_show_asterism_labels_button",                        propMgr->getStelPropertyValue("StelGui.flagShowAsterismLabelsButton").toBool());
×
1187
        conf->setValue("gui/flag_show_decimal_degrees",                                propMgr->getStelPropertyValue("StelApp.flagShowDecimalDegrees").toBool());
×
1188
        conf->setValue("gui/flag_use_azimuth_from_south",                        propMgr->getStelPropertyValue("StelApp.flagUseAzimuthFromSouth").toBool());
×
1189
        conf->setValue("gui/flag_use_formatting_output",                                propMgr->getStelPropertyValue("StelApp.flagUseFormattingOutput").toBool());
×
1190
        conf->setValue("gui/flag_use_ccs_designations",                                propMgr->getStelPropertyValue("StelApp.flagUseCCSDesignation").toBool());
×
1191
        conf->setValue("gui/flag_overwrite_info_color",                                propMgr->getStelPropertyValue("StelApp.flagOverwriteInfoColor").toBool());
×
1192
        conf->setValue("gui/flag_time_jd",                                                        gui->getButtonBar()->getFlagTimeJd());
×
1193
        conf->setValue("gui/flag_show_buttons_background",                        propMgr->getStelPropertyValue("StelGui.flagUseButtonsBackground").toBool());
×
1194
        conf->setValue("gui/flag_indication_mount_mode",                                mvmgr->getFlagIndicationMountMode());
×
1195

1196
        // configuration dialog / navigation tab
1197
        conf->setValue("navigation/flag_enable_zoom_keys",                        mvmgr->getFlagEnableZoomKeys());
×
1198
        conf->setValue("navigation/flag_enable_mouse_navigation",                mvmgr->getFlagEnableMouseNavigation());
×
1199
        conf->setValue("navigation/flag_enable_mouse_zooming",                mvmgr->getFlagEnableMouseZooming());
×
1200
        conf->setValue("navigation/flag_enable_move_keys",                        mvmgr->getFlagEnableMoveKeys());
×
1201

1202
        // configuration dialog / time tab
1203
        conf->setValue("navigation/startup_time_mode",                                core->getStartupTimeMode());
×
1204
        conf->setValue("navigation/startup_time_stop",                                core->getStartupTimeStop());
×
1205
        conf->setValue("navigation/today_time",                                                core->getInitTodayTime());
×
1206
        conf->setValue("navigation/preset_sky_time",                                        core->getPresetSkyTime());
×
1207
        conf->setValue("navigation/time_correction_algorithm",                        core->getCurrentDeltaTAlgorithmKey());
×
1208
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1209
        conf->setValue("localization/time_display_format",                                localeManager.getTimeFormatStr());
×
1210
        conf->setValue("localization/date_display_format",                                localeManager.getDateFormatStr());
×
1211

1212

1213
        if (mvmgr->getMountMode() == StelMovementMgr::MountAltAzimuthal)
×
1214
                conf->setValue("navigation/viewing_mode", "horizon");
×
1215
        else
1216
                conf->setValue("navigation/viewing_mode", "equator");
×
1217

1218
        // configuration dialog / tools tab
1219
        conf->setValue("gui/flag_show_flip_buttons",                                        propMgr->getStelPropertyValue("StelGui.flagShowFlipButtons").toBool());
×
1220
        conf->setValue("video/viewport_effect",                                                StelApp::getInstance().getViewportEffect());
×
1221

1222
        conf->setValue("projection/viewport",                                                        StelProjector::maskTypeToString(proj->getMaskType()));
×
1223
        conf->setValue("projection/viewport_center_offset_x",                        core->getCurrentStelProjectorParams().viewportCenterOffset[0]*100.);
×
1224
        conf->setValue("projection/viewport_center_offset_y",                        core->getCurrentStelProjectorParams().viewportCenterOffset[1]*100.);
×
1225
        conf->setValue("projection/flip_horz",                                                        core->getCurrentStelProjectorParams().flipHorz);
×
1226
        conf->setValue("projection/flip_vert",                                                        core->getCurrentStelProjectorParams().flipVert);
×
1227
        conf->setValue("navigation/max_fov",                                                mvmgr->getUserMaxFov());
×
1228

1229
        conf->setValue("viewing/flag_gravity_labels",                                        proj->getFlagGravityLabels());
×
1230
        conf->setValue("navigation/auto_zoom_out_resets_direction",        mvmgr->getFlagAutoZoomOutResetsDirection());
×
1231

1232
        conf->setValue("gui/flag_mouse_cursor_timeout",                                propMgr->getStelPropertyValue("MainView.flagCursorTimeout").toBool());
×
1233
        conf->setValue("gui/mouse_cursor_timeout",                                        propMgr->getStelPropertyValue("MainView.cursorTimeout").toFloat());
×
1234
        //conf->setValue("gui/base_font_name",                                                QGuiApplication::font().family());
1235
        //conf->setValue("gui/screen_font_size",                                                propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
1236
        //conf->setValue("gui/gui_font_size",                                                        propMgr->getStelPropertyValue("StelApp.guiFontSize").toInt());
1237
        storeFontSettings();
×
1238

1239
        conf->setValue("video/minimum_fps",                                                propMgr->getStelPropertyValue("MainView.minFps").toInt());
×
1240
        conf->setValue("video/maximum_fps",                                                propMgr->getStelPropertyValue("MainView.maxFps").toInt());
×
1241

1242
        conf->setValue("main/screenshot_dir",                                                StelFileMgr::getScreenshotDir());
×
1243
        conf->setValue("main/invert_screenshots_colors",                                propMgr->getStelPropertyValue("MainView.flagInvertScreenShotColors").toBool());
×
1244
        conf->setValue("main/screenshot_datetime_filename",                        propMgr->getStelPropertyValue("MainView.flagScreenshotDateFileName").toBool());
×
1245
        conf->setValue("main/screenshot_datetime_filemask",                        propMgr->getStelPropertyValue("MainView.screenShotFileMask").toString());
×
1246
        conf->setValue("main/screenshot_custom_size",                                propMgr->getStelPropertyValue("MainView.flagUseCustomScreenshotSize").toBool());
×
1247
        conf->setValue("main/screenshot_custom_width",                                propMgr->getStelPropertyValue("MainView.customScreenshotWidth").toInt());
×
1248
        conf->setValue("main/screenshot_custom_height",                                propMgr->getStelPropertyValue("MainView.customScreenshotHeight").toInt());
×
1249

1250
        QWidget& mainWindow = StelMainView::getInstance();
×
1251
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
1252
        QScreen *mainScreen = mainWindow.windowHandle()->screen();
×
1253
        int screenNum=qApp->screens().indexOf(mainScreen);
×
1254
#else
1255
        int screenNum = qApp->desktop()->screenNumber(&StelMainView::getInstance());
1256
#endif
1257
        conf->setValue("video/screen_number", screenNum);
×
1258

1259
        // full screen and window size
1260
        conf->setValue("video/fullscreen", StelMainView::getInstance().isFullScreen());
×
1261
        if (!StelMainView::getInstance().isFullScreen())
×
1262
        {
1263
                QRect screenGeom = QGuiApplication::screens().at(screenNum)->geometry();
×
1264

1265
                conf->setValue("video/screen_w", int(std::lround(mainWindow.size().width() * mainWindow.devicePixelRatio())));
×
1266
                conf->setValue("video/screen_h", int(std::lround(mainWindow.size().height() * mainWindow.devicePixelRatio())));
×
1267
                conf->setValue("video/screen_x", int(std::lround((mainWindow.x() - screenGeom.x()) * mainWindow.devicePixelRatio())));
×
1268
                conf->setValue("video/screen_y", int(std::lround((mainWindow.y() - screenGeom.y()) * mainWindow.devicePixelRatio())));
×
1269
        }
1270

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

1274
        updateConfigLabels();
×
1275

1276
        emit core->configurationDataSaved();
×
1277
}
×
1278

1279
void ConfigurationDialog::updateConfigLabels()
×
1280
{
1281
        ui->startupFOVLabel->setText(q_("Startup FOV: %1%2").arg(StelApp::getInstance().getCore()->getMovementMgr()->getCurrentFov()).arg(QChar(0x00B0)));
×
1282

1283
        double az, alt;
1284
        const Vec3d& v = GETSTELMODULE(StelMovementMgr)->getInitViewingDirection();
×
1285
        StelUtils::rectToSphe(&az, &alt, v);
×
1286
        az = 3.*M_PI - az;  // N is zero, E is 90 degrees
×
1287
        if (az > M_PI*2)
×
1288
                az -= M_PI*2;
×
1289
        ui->startupDirectionOfViewlabel->setText(q_("Startup direction of view Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)));
×
1290
}
×
1291

1292
void ConfigurationDialog::setDefaultViewOptions()
×
1293
{
1294
        if (askConfirmation())
×
1295
        {
1296
                qDebug() << "Restore defaults...";
×
1297
                QSettings* conf = StelApp::getInstance().getSettings();
×
1298
                Q_ASSERT(conf);
×
1299

1300
                conf->setValue("main/restore_defaults", true);
×
1301
                // reset all stored panel locations
1302
                conf->beginGroup("DialogPositions");
×
1303
                conf->remove("");
×
1304
                conf->endGroup();
×
1305
        }
1306
        else
1307
                qDebug() << "Restore defaults is canceled...";
×
1308
}
×
1309

1310
void ConfigurationDialog::populatePluginsList()
×
1311
{
1312
        QListWidget *plugins = ui->pluginsListWidget;
×
1313
        plugins->blockSignals(true);
×
1314
        int currentRow = plugins->currentRow();
×
1315
        QString selectedPluginId = "";
×
1316
        if (currentRow>0)
×
1317
                 selectedPluginId = plugins->currentItem()->data(Qt::UserRole).toString();
×
1318

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

1335
        if (!selectedPluginName.isEmpty())
×
1336
                plugins->setCurrentItem(plugins->findItems(selectedPluginName, Qt::MatchExactly).at(0));
×
1337
        else
1338
                plugins->setCurrentRow(0);
×
1339
}
×
1340

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

1383
void ConfigurationDialog::pluginConfigureCurrentSelection()
×
1384
{
1385
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1386
        if (id.isEmpty())
×
1387
                return;
×
1388

1389
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1390
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1391
        for (const auto& desc : pluginsList)
×
1392
        {
1393
                if (id == desc.info.id)
×
1394
                {
1395
                        StelModule* pmod = moduleMgr.getModule(desc.info.id, QObject::sender()->objectName()=="pluginsListWidget");
×
1396
                        if (pmod != Q_NULLPTR)
×
1397
                        {
1398
                                pmod->configureGui(true);
×
1399
                        }
1400
                        return;
×
1401
                }
1402
        }
1403
}
×
1404

1405
void ConfigurationDialog::loadAtStartupChanged(int state)
×
1406
{
1407
        if (ui->pluginsListWidget->count() <= 0)
×
1408
                return;
×
1409

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

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

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

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

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

1469
void ConfigurationDialog::stopScriptClicked(void)
×
1470
{
1471
        StelApp::getInstance().getScriptMgr().stopScript();
×
1472
}
×
1473

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

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

1489

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

1499

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

1516
        ui->downloadCancelButton->setVisible(false);
×
1517
        ui->downloadRetryButton->setVisible(false);
×
1518

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

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

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

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

1588
void ConfigurationDialog::newStarCatalogData()
×
1589
{
1590
        Q_ASSERT(currentDownloadFile);
×
1591
        Q_ASSERT(starCatalogDownloadReply);
×
1592
        Q_ASSERT(progressBar);
×
1593

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

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

1610
        QString path = StelFileMgr::getUserDir()+QString("/stars/hip_gaia3/")+nextStarCatalogToDownload.value("fileName").toString();
×
1611
        currentDownloadFile = new QFile(path);
×
1612
        if (!currentDownloadFile->open(QIODevice::WriteOnly))
×
1613
        {
1614
                qWarning() << "Can't open a writable file for storing new star catalog: " << QDir::toNativeSeparators(path);
×
1615
                currentDownloadFile->deleteLater();
×
1616
                currentDownloadFile = Q_NULLPTR;
×
1617
                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)));
×
1618
                ui->downloadRetryButton->setVisible(true);
×
1619
                return;
×
1620
        }
1621

1622
        isDownloadingStarCatalog = true;
×
1623
        updateStarCatalogControlsText();
×
1624
        ui->downloadCancelButton->setVisible(true);
×
1625
        ui->downloadRetryButton->setVisible(false);
×
1626
        ui->getStarsButton->setVisible(true);
×
1627
        ui->getStarsButton->setEnabled(false);
×
1628

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

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

1648
        qDebug() << "Downloading file" << nextStarCatalogToDownload.value("url").toString();
×
1649
}
×
1650

1651
void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
×
1652
{
1653
        Q_ASSERT(currentDownloadFile);
×
1654
        Q_ASSERT(starCatalogDownloadReply);
×
1655

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

1665
void ConfigurationDialog::downloadFinished()
×
1666
{
1667
        Q_ASSERT(currentDownloadFile);
×
1668
        Q_ASSERT(starCatalogDownloadReply);
×
1669
        Q_ASSERT(progressBar);
×
1670

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

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

1700
        Q_ASSERT(starCatalogDownloadReply->bytesAvailable()==0);
×
1701

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

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

1727
        resetStarCatalogControls();
×
1728
}
×
1729

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

1736
        core->setDe430Active(!core->de430IsActive());
×
1737
        conf->setValue("astro/flag_use_de430", core->de430IsActive());
×
1738

1739
        resetEphemControls(); //refresh labels
×
1740
}
×
1741

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

1748
        core->setDe431Active(!core->de431IsActive());
×
1749
        conf->setValue("astro/flag_use_de431", core->de431IsActive());
×
1750

1751
        resetEphemControls(); //refresh labels
×
1752
}
×
1753

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

1760
        core->setDe440Active(!core->de440IsActive());
×
1761
        conf->setValue("astro/flag_use_de440", core->de440IsActive());
×
1762

1763
        resetEphemControls(); //refresh labels
×
1764
}
×
1765

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

1772
        core->setDe441Active(!core->de441IsActive());
×
1773
        conf->setValue("astro/flag_use_de441", core->de441IsActive());
×
1774

1775
        resetEphemControls(); //refresh labels
×
1776
}
×
1777

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

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

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

1872
        if (StelApp::getInstance().getFlagImmediateSave())
×
1873
        {
1874
                saveCustomSelectedInfo();
×
1875
        }
1876
}
×
1877

1878
void ConfigurationDialog::populateTooltips()
×
1879
{
1880
        ui->checkBoxProperMotion->setToolTip(QString("<p>%1</p>").arg(q_("Annual proper motion (stars) or hourly motion (solar system objects)")));
×
1881
        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.")));
×
1882
}
×
1883

1884
void ConfigurationDialog::updateTabBarListWidgetWidth()
×
1885
{
1886
        ui->stackListWidget->setWrapping(false);
×
1887

1888
        // Update list item sizes after translation
1889
        ui->stackListWidget->adjustSize();
×
1890

1891
        QAbstractItemModel* model = ui->stackListWidget->model();
×
1892
        if (!model)
×
1893
                return;
×
1894

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

1902
        int iconSize = ui->stackListWidget->iconSize().width();
×
1903

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

1912
        // Hack to force the window to be resized...
1913
        ui->stackListWidget->setMinimumWidth(width);
×
1914
        ui->stackListWidget->updateGeometry();
×
1915
}
×
1916

1917
void ConfigurationDialog::populateDeltaTAlgorithmsList()
×
1918
{
1919
        Q_ASSERT(ui->deltaTAlgorithmComboBox);
×
1920

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

1924
        QComboBox* algorithms = ui->deltaTAlgorithmComboBox;
×
1925

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

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

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

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

1999
void ConfigurationDialog::showCustomDeltaTEquationDialog()
×
2000
{
2001
        if (customDeltaTEquationDialog == Q_NULLPTR)
×
2002
                customDeltaTEquationDialog = new CustomDeltaTEquationDialog();
×
2003

2004
        customDeltaTEquationDialog->setVisible(true);
×
2005
}
×
2006

2007
void ConfigurationDialog::showConfigureScreenshotsDialog()
×
2008
{
2009
        if (configureScreenshotsDialog == Q_NULLPTR)
×
2010
                configureScreenshotsDialog = new ConfigureScreenshotsDialog();
×
2011

2012
        configureScreenshotsDialog->setVisible(true);
×
2013
}
×
2014

2015
void ConfigurationDialog::populateDateFormatsList()
×
2016
{
2017
        Q_ASSERT(ui->dateFormatsComboBox);
×
2018

2019
        QComboBox* dfmts = ui->dateFormatsComboBox;
×
2020

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

2040
void ConfigurationDialog::setDateFormat()
×
2041
{
2042
        QString selectedFormat = ui->dateFormatsComboBox->itemData(ui->dateFormatsComboBox->currentIndex()).toString();
×
2043

2044
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2045
        if (selectedFormat == localeManager.getDateFormatStr())
×
2046
                return;
×
2047

2048
        StelApp::immediateSave("localization/date_display_format", selectedFormat);
×
2049
        localeManager.setDateFormatStr(selectedFormat);        
×
2050
}
×
2051

2052
void ConfigurationDialog::populateTimeFormatsList()
×
2053
{
2054
        Q_ASSERT(ui->timeFormatsComboBox);
×
2055

2056
        QComboBox* tfmts = ui->timeFormatsComboBox;
×
2057

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

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

2075
void ConfigurationDialog::setTimeFormat()
×
2076
{
2077
        QString selectedFormat = ui->timeFormatsComboBox->itemData(ui->timeFormatsComboBox->currentIndex()).toString();
×
2078

2079
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2080
        if (selectedFormat == localeManager.getTimeFormatStr())
×
2081
                return;
×
2082

2083
        StelApp::immediateSave("localization/time_display_format", selectedFormat);
×
2084
        localeManager.setTimeFormatStr(selectedFormat);
×
2085
}
×
2086

2087
void ConfigurationDialog::populateDitherList()
×
2088
{
2089
        Q_ASSERT(ui->ditheringComboBox);
×
2090
        QComboBox* ditherCombo = ui->ditheringComboBox;
×
2091

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

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

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

2119
void ConfigurationDialog::setDitherFormat()
×
2120
{
2121
        QString selectedFormat = ui->ditheringComboBox->itemData(ui->ditheringComboBox->currentIndex()).toString();
×
2122

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

2128
        const auto core = StelApp::getInstance().getCore();
×
2129
        Q_ASSERT(core);
×
2130
        core->setDitheringMode(selectedFormat);
×
2131
}
×
2132

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

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

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

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

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

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

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