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

Stellarium / stellarium / 3996069357

pending completion
3996069357

push

github

Ruslan Kabatsayev
Shorten some lines

5 of 5 new or added lines in 1 file covered. (100.0%)

14663 of 124076 relevant lines covered (11.82%)

22035.13 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
#include "Planet.hpp"
47
#ifdef ENABLE_SCRIPTING
48
#include "StelScriptMgr.hpp"
49
#endif
50
#include "StelTranslator.hpp"
51

52
#include <QSettings>
53
#include <QDebug>
54
#include <QFile>
55
#include <QFileDialog>
56
#include <QFontDialog>
57
#include <QComboBox>
58
#include <QDir>
59
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
60
#include <QWindow>
61
#else
62
#include <QDesktopWidget>
63
#endif
64
#include <QImageWriter>
65
#include <QScreen>
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
        virtual void fixup(QString &input) const Q_DECL_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->closeStelWindow, SIGNAL(clicked()), this, SLOT(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
        #else
193
        ui->groupBox_LanguageSettings->hide();
194
        #endif
195

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

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

207
        connectBoolProperty(ui->nutationCheckBox, "StelCore.flagUseNutation");
×
208
        connectBoolProperty(ui->aberrationCheckBox, "StelCore.flagUseAberration");
×
209
        connectDoubleProperty(ui->aberrationSpinBox, "StelCore.aberrationFactor");
×
210
        connectBoolProperty(ui->topocentricCheckBox, "StelCore.flagUseTopocentricCoordinates");
×
211

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

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

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

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

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

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

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

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

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

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

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

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

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

337
        connectBoolProperty(ui->mouseTimeoutCheckbox,                                "MainView.flagCursorTimeout");
×
338
        connectDoubleProperty(ui->mouseTimeoutSpinBox,                                "MainView.cursorTimeout");
×
339
        connectBoolProperty(ui->useButtonsBackgroundCheckBox,                "StelGui.flagUseButtonsBackground");
×
340
        connectBoolProperty(ui->indicationMountModeCheckBox,                        "StelMovementMgr.flagIndicationMountMode");
×
341
        connectBoolProperty(ui->kineticScrollingCheckBox,                                "StelGui.flagUseKineticScrolling");
×
342
        connectBoolProperty(ui->focusOnDaySpinnerCheckBox,                        "StelGui.flagEnableFocusOnDaySpinner");
×
343
        connectColorButton(ui->overwriteTextColorButton,                                "StelApp.overwriteInfoColor",        "color/info_text_color");
×
344
        connectColorButton(ui->daylightTextColorButton,                                "StelApp.daylightInfoColor",        "color/daylight_text_color");
×
345

346
        // Font selection. We use a hidden, but documented entry in config.ini to optionally show a font selection option.
347
        connectIntProperty(ui->screenFontSizeSpinBox, "StelApp.screenFontSize");
×
348
        connectIntProperty(ui->guiFontSizeSpinBox, "StelApp.guiFontSize");
×
349
        if (StelApp::getInstance().getSettings()->value("gui/flag_font_selection", true).toBool())
×
350
        {
351
                populateFontWritingSystemCombo();
×
352
                connect(ui->fontWritingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleFontBoxWritingSystem(int)));
×
353

354
                ui->fontComboBox->setWritingSystem(QFontDatabase::Any);
×
355
                ui->fontComboBox->setFontFilters(QFontComboBox::ScalableFonts | QFontComboBox::ProportionalFonts);
×
356
                ui->fontComboBox->setCurrentFont(QGuiApplication::font());
×
357
                connect(ui->fontComboBox, SIGNAL(currentFontChanged(QFont)), &StelApp::getInstance(), SLOT(setAppFont(QFont)));
×
358
        }
359
        else
360
        {
361
                ui->fontWritingSystemComboBox->hide();
×
362
                ui->fontComboBox->hide();
×
363
        }
364

365
        // Dithering
366
        populateDitherList();
×
367
        connect(ui->ditheringComboBox, SIGNAL(currentIndexChanged(const int)), this, SLOT(setDitherFormat()));
×
368

369
        // General Option Save
370
        connect(ui->saveViewDirAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveCurrentViewDirSettings()));
×
371
        connect(ui->saveSettingsAsDefaultPushButton, SIGNAL(clicked()), this, SLOT(saveAllSettings()));
×
372
        connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(setDefaultViewOptions()));
×
373

374
        // Screenshots
375
        populateScreenshotFileformatsCombo();
×
376
        connect(ui->pushButtonConfigureScreenshotsDialog, SIGNAL(clicked()), this, SLOT(showConfigureScreenshotsDialog()));
×
377
        connectStringProperty(ui->screenshotFileFormatComboBox, "MainView.screenShotFormat");
×
378
        ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir());
×
379
        connect(ui->screenshotDirEdit, SIGNAL(editingFinished()), this, SLOT(selectScreenshotDir()));
×
380
        connect(ui->screenshotBrowseButton, SIGNAL(clicked()), this, SLOT(browseForScreenshotDir()));
×
381
        connectBoolProperty(ui->invertScreenShotColorsCheckBox, "MainView.flagInvertScreenShotColors");
×
382
        connectBoolProperty(ui->useCustomScreenshotSizeCheckBox, "MainView.flagUseCustomScreenshotSize");
×
383
        ui->customScreenshotWidthLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
384
        ui->customScreenshotHeightLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
385
        connectIntProperty(ui->customScreenshotWidthLineEdit, "MainView.customScreenshotWidth");
×
386
        connectIntProperty(ui->customScreenshotHeightLineEdit, "MainView.customScreenshotHeight");
×
387
        connectIntProperty(ui->dpiSpinBox, "MainView.screenshotDpi");
×
388
        StelMainView *mainView=static_cast<StelMainView *>(StelApp::getInstance().parent());
×
389
        connect(mainView, SIGNAL(screenshotDpiChanged(int)), this, SLOT(updateDpiTooltip()));
×
390
        connect(mainView, SIGNAL(flagUseCustomScreenshotSizeChanged(bool)), this, SLOT(updateDpiTooltip()));
×
391
        connect(mainView, SIGNAL(customScreenshotWidthChanged(int)), this, SLOT(updateDpiTooltip()));
×
392
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
393
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
394
        connect(mainView, SIGNAL(sizeChanged(const QSize&)), this, SLOT(updateDpiTooltip()));
×
395
        updateDpiTooltip();
×
396

397
        connectBoolProperty(ui->autoEnableEnvironmentCheckBox, "LandscapeMgr.flagEnvironmentAutoEnabling");
×
398
        connectBoolProperty(ui->autoChangeLandscapesCheckBox, "LandscapeMgr.flagLandscapeAutoSelection");
×
399

400
        // script tab controls
401
        #ifdef ENABLE_SCRIPTING
402
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
×
403
        connect(ui->scriptListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(scriptSelectionChanged(const QString&)));
×
404
        connect(ui->runScriptButton, SIGNAL(clicked()), this, SLOT(runScriptClicked()));
×
405
        connect(ui->stopScriptButton, SIGNAL(clicked()), this, SLOT(stopScriptClicked()));
×
406
        if (scriptMgr.scriptIsRunning())
×
407
                aScriptIsRunning();
×
408
        else
409
                aScriptHasStopped();
×
410
        connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(aScriptIsRunning()));
×
411
        connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(aScriptHasStopped()));
×
412
        ui->scriptListWidget->setSortingEnabled(true);
×
413
        populateScriptsList();
×
414
        connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScriptsList()));
×
415
        #else
416
        ui->configurationStackedWidget->removeWidget(ui->page_Scripts); // only hide, no delete!
417
        QListWidgetItem *item = ui->stackListWidget->takeItem(5); // take out from its place.
418
        ui->stackListWidget->addItem(item); // We must add it back to the end of the tabs, as...
419
        ui->stackListWidget->item(6)->setHidden(true); // deleting would cause a crash during retranslation. (GH#2544)
420
        #endif
421

422
        // plugins control
423
        connect(ui->pluginsListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(pluginsSelectionChanged(QListWidgetItem*, QListWidgetItem*)));
×
424
        connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int)));
×
425
        connect(ui->pluginsListWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(pluginConfigureCurrentSelection()));
×
426
        connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(pluginConfigureCurrentSelection()));
×
427
        populatePluginsList();
×
428

429
        updateConfigLabels();
×
430
        populateTooltips();
×
431
        updateTabBarListWidgetWidth();
×
432

433
        connect((dynamic_cast<StelGui*>(StelApp::getInstance().getGui())), &StelGui::htmlStyleChanged, this, [=](const QString &style){
×
434
                ui->pluginsInfoBrowser->document()->setDefaultStyleSheet(style);
×
435
                ui->scriptInfoBrowser->document()->setDefaultStyleSheet(style);
×
436
                ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(style);
×
437
        });
×
438
}
×
439

440
void ConfigurationDialog::setKeyNavigationState(bool state)
×
441
{
442
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
443
        mvmgr->setFlagEnableMoveKeys(state);
×
444
        mvmgr->setFlagEnableZoomKeys(state);
×
445
        ui->editShortcutsPushButton->setEnabled(state);
×
446
}
×
447

448
void ConfigurationDialog::updateCurrentLanguage()
×
449
{
450
        QComboBox* cb = ui->programLanguageComboBox;
×
451
        QString appLang = StelApp::getInstance().getLocaleMgr().getAppLanguage();
×
452
        QString l2 = StelTranslator::iso639_1CodeToNativeName(appLang);
×
453

454
        if (cb->currentText() == l2)
×
455
                return;
×
456

457
        int lt = cb->findText(l2, Qt::MatchExactly);
×
458
        if (lt == -1 && appLang.contains('_'))
×
459
        {
460
                l2 = appLang.left(appLang.indexOf('_'));
×
461
                l2=StelTranslator::iso639_1CodeToNativeName(l2);
×
462
                lt = cb->findText(l2, Qt::MatchExactly);
×
463
        }
464
        if (lt!=-1)
×
465
                cb->setCurrentIndex(lt);
×
466
}
×
467

468
void ConfigurationDialog::updateCurrentSkyLanguage()
×
469
{
470
        QComboBox* cb = ui->skycultureLanguageComboBox;
×
471
        QString skyLang = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
×
472
        QString l2 = StelTranslator::iso639_1CodeToNativeName(skyLang);
×
473

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

477
        int lt = cb->findText(l2, Qt::MatchExactly);
×
478
        if (lt == -1 && skyLang.contains('_'))
×
479
        {
480
                l2 = skyLang.left(skyLang.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::selectLanguage(const int id)
×
489
{
490
        const QString &langName=static_cast<QComboBox*>(sender())->itemText(id);
×
491
        QString code = StelTranslator::nativeNameToIso639_1Code(langName);
×
492
        StelApp::getInstance().getLocaleMgr().setAppLanguage(code);
×
493
        StelMainView::getInstance().initTitleI18n();
×
494
}
×
495

496
void ConfigurationDialog::selectSkyLanguage(const int id)
×
497
{
498
        const QString &langName=static_cast<QComboBox*>(sender())->itemText(id);
×
499
        QString code = StelTranslator::nativeNameToIso639_1Code(langName);
×
500
        StelApp::getInstance().getLocaleMgr().setSkyLanguage(code);
×
501
}
×
502

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

513
        core->setInitTodayTime(ui->todayTimeSpinBox->time());
×
514
        core->setPresetSkyTime(ui->fixedDateTimeEdit->dateTime());
×
515
}
×
516

517
void ConfigurationDialog::setButtonBarDTFormat()
×
518
{
519
        if (ui->jdRadioButton->isChecked())
×
520
                gui->getButtonBar()->setFlagTimeJd(true);
×
521
        else
522
                gui->getButtonBar()->setFlagTimeJd(false);
×
523
}
×
524

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

532
void ConfigurationDialog::setDiskViewport(bool b)
×
533
{
534
        if (b)
×
535
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskDisk);
×
536
        else
537
                StelApp::getInstance().getCore()->setMaskType(StelProjector::MaskNone);
×
538
}
×
539

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

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

583
void ConfigurationDialog::setNoSelectedInfo()
×
584
{
585
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::None));
×
586
        updateSelectedInfoCheckBoxes();
×
587
}
×
588

589
void ConfigurationDialog::setAllSelectedInfo()
×
590
{
591
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::AllInfo));
×
592
        updateSelectedInfoCheckBoxes();
×
593
}
×
594

595
void ConfigurationDialog::setBriefSelectedInfo()
×
596
{
597
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::ShortInfo));
×
598
        updateSelectedInfoCheckBoxes();
×
599
}
×
600

601
void ConfigurationDialog::setDefaultSelectedInfo()
×
602
{
603
        gui->setInfoTextFilters(StelObject::InfoStringGroup(StelObject::DefaultInfo));
×
604
        updateSelectedInfoCheckBoxes();
×
605
}
×
606

607
void ConfigurationDialog::setSelectedInfoFromCheckBoxes()
×
608
{
609
        // As this signal will be called when a checkbox is toggled,
610
        // change the general mode to Custom.
611
        if (!ui->customSelectedInfoRadio->isChecked())
×
612
                ui->customSelectedInfoRadio->setChecked(true);
×
613
        
614
        StelObject::InfoStringGroup flags(StelObject::None);
×
615

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

665
        gui->setInfoTextFilters(flags);
×
666
        // overwrite custom selected info settings
667
        saveCustomSelectedInfo();
×
668
}
×
669

670
void ConfigurationDialog::setCustomSelectedInfo()
×
671
{
672
        StelObject::InfoStringGroup flags(StelObject::None);
×
673
        QSettings* conf = StelApp::getInstance().getSettings();
×
674
        Q_ASSERT(conf);
×
675

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

725
        gui->setInfoTextFilters(flags);
×
726
        updateSelectedInfoCheckBoxes();
×
727
}
×
728

729
void ConfigurationDialog::saveCustomSelectedInfo()
×
730
{
731
        // configuration dialog / selected object info tab
732
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
733
        QSettings* conf = StelApp::getInstance().getSettings();
×
734
        Q_ASSERT(conf);
×
735

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

764
void ConfigurationDialog::browseForScreenshotDir()
×
765
{
766
        QString oldScreenshorDir = StelFileMgr::getScreenshotDir();
×
767
        QString newScreenshotDir = QFileDialog::getExistingDirectory(Q_NULLPTR, q_("Select screenshot directory"), oldScreenshorDir, QFileDialog::ShowDirsOnly);
×
768

769
        if (!newScreenshotDir.isEmpty()) {
×
770
                // remove trailing slash
771
                if (newScreenshotDir.right(1) == "/")
×
772
                        newScreenshotDir = newScreenshotDir.left(newScreenshotDir.length()-1);
×
773

774
                ui->screenshotDirEdit->setText(newScreenshotDir);
×
775
                selectScreenshotDir();
×
776
        }
777
}
×
778

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

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

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

818
// Store FOV and viewing dir.
819
void ConfigurationDialog::saveCurrentViewDirSettings()
×
820
{
821
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
822
        Q_ASSERT(mvmgr);
×
823

824
        mvmgr->setInitFov(mvmgr->getCurrentFov());
×
825
        mvmgr->setInitViewDirectionToCurrent();
×
826
}
×
827

828

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

836
        // TBD: store more properties directly, avoid to query all modules.
837
        StelPropertyMgr* propMgr=StelApp::getInstance().getStelPropertyManager();
×
838
        Q_ASSERT(propMgr);
×
839

840
        NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
×
841
        Q_ASSERT(nmgr);
×
842
        StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
×
843
        Q_ASSERT(mvmgr);
×
844

845
        StelCore* core = StelApp::getInstance().getCore();
×
846
        const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000);
×
847
        Q_ASSERT(proj);
×
848

849
        conf->setValue("gui/screen_font_size",                                        propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
×
850
        conf->setValue("gui/flag_enable_kinetic_scrolling",                propMgr->getStelPropertyValue("StelGui.flagUseKineticScrolling").toBool());
×
851

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

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

1001
        conf->setValue("viewing/constellation_font_size",                propMgr->getStelPropertyValue("ConstellationMgr.fontSize").toInt());
×
1002
        conf->setValue("viewing/flag_constellation_drawing",                propMgr->getStelPropertyValue("ConstellationMgr.linesDisplayed").toBool());
×
1003
        conf->setValue("viewing/flag_constellation_name",                propMgr->getStelPropertyValue("ConstellationMgr.namesDisplayed").toBool());
×
1004
        conf->setValue("viewing/flag_constellation_boundaries",        propMgr->getStelPropertyValue("ConstellationMgr.boundariesDisplayed").toBool());
×
1005
        conf->setValue("viewing/flag_constellation_art",                        propMgr->getStelPropertyValue("ConstellationMgr.artDisplayed").toBool());
×
1006
        conf->setValue("viewing/flag_constellation_isolate_selected",        propMgr->getStelPropertyValue("ConstellationMgr.isolateSelected").toBool());
×
1007
        conf->setValue("viewing/flag_landscape_autoselection",        propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeAutoSelection").toBool());
×
1008
        conf->setValue("viewing/flag_light_pollution_database",        propMgr->getStelPropertyValue("LandscapeMgr.flagUseLightPollutionFromDatabase").toBool());
×
1009
        conf->setValue("viewing/flag_environment_auto_enable",        propMgr->getStelPropertyValue("LandscapeMgr.flagEnvironmentAutoEnabling").toBool());
×
1010
        conf->setValue("viewing/constellation_art_intensity",                propMgr->getStelPropertyValue("ConstellationMgr.artIntensity").toFloat());
×
1011
        conf->setValue("viewing/constellation_name_style",                ConstellationMgr::getConstellationDisplayStyleString(static_cast<ConstellationMgr::ConstellationDisplayStyle> (propMgr->getStelPropertyValue("ConstellationMgr.constellationDisplayStyle").toInt())  ));
×
1012
        conf->setValue("viewing/constellation_line_thickness",        propMgr->getStelPropertyValue("ConstellationMgr.constellationLineThickness").toInt());
×
1013
        conf->setValue("viewing/constellation_boundaries_thickness",        propMgr->getStelPropertyValue("ConstellationMgr.constellationBoundariesThickness").toInt());
×
1014

1015
        conf->setValue("viewing/asterism_font_size",                        propMgr->getStelPropertyValue("AsterismMgr.fontSize").toInt());
×
1016
        conf->setValue("viewing/flag_asterism_drawing",                        propMgr->getStelPropertyValue("AsterismMgr.linesDisplayed").toBool());
×
1017
        conf->setValue("viewing/flag_asterism_name",                        propMgr->getStelPropertyValue("AsterismMgr.namesDisplayed").toBool());
×
1018
        conf->setValue("viewing/asterism_line_thickness",                propMgr->getStelPropertyValue("AsterismMgr.asterismLineThickness").toInt());
×
1019
        conf->setValue("viewing/flag_rayhelper_drawing",                propMgr->getStelPropertyValue("AsterismMgr.rayHelpersDisplayed").toBool());
×
1020
        conf->setValue("viewing/rayhelper_line_thickness",                propMgr->getStelPropertyValue("AsterismMgr.rayHelperThickness").toInt());
×
1021
        conf->setValue("viewing/sky_brightness_label_threshold",        propMgr->getStelPropertyValue("StelSkyDrawer.daylightLabelThreshold").toFloat());
×
1022
        conf->setValue("viewing/flag_night",                                        StelApp::getInstance().getVisionModeNight());
×
1023
        conf->setValue("astro/flag_stars",                                                propMgr->getStelPropertyValue("StarMgr.flagStarsDisplayed").toBool());
×
1024
        conf->setValue("astro/flag_star_name",                                        propMgr->getStelPropertyValue("StarMgr.flagLabelsDisplayed").toBool());
×
1025
        conf->setValue("astro/flag_star_additional_names",                propMgr->getStelPropertyValue("StarMgr.flagAdditionalNamesDisplayed").toBool());
×
1026
        conf->setValue("astro/flag_star_designation_usage",                propMgr->getStelPropertyValue("StarMgr.flagDesignationLabels").toBool());
×
1027
        conf->setValue("astro/flag_star_designation_dbl",        propMgr->getStelPropertyValue("StarMgr.flagDblStarsDesignation").toBool());
×
1028
        conf->setValue("astro/flag_star_designation_var",        propMgr->getStelPropertyValue("StarMgr.flagVarStarsDesignation").toBool());
×
1029
        conf->setValue("astro/flag_star_designation_hip",                propMgr->getStelPropertyValue("StarMgr.flagHIPDesignation").toBool());
×
1030
        conf->setValue("stars/labels_amount",                                        propMgr->getStelPropertyValue("StarMgr.labelsAmount").toDouble());
×
1031
        conf->setValue("astro/nebula_hints_amount",                        propMgr->getStelPropertyValue("NebulaMgr.hintsAmount").toDouble());
×
1032
        conf->setValue("astro/nebula_labels_amount",                        propMgr->getStelPropertyValue("NebulaMgr.labelsAmount").toDouble());
×
1033
        conf->setValue("astro/flag_nebula_hints_proportional",        propMgr->getStelPropertyValue("NebulaMgr.hintsProportional").toBool());
×
1034
        conf->setValue("astro/flag_surface_brightness_usage",        propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessUsage").toBool());
×
1035
        conf->setValue("gui/flag_surface_brightness_arcsec",                propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessArcsecUsage").toBool());
×
1036
        conf->setValue("gui/flag_surface_brightness_short",                propMgr->getStelPropertyValue("NebulaMgr.flagSurfaceBrightnessShortNotationUsage").toBool());
×
1037
        conf->setValue("astro/flag_dso_designation_usage",                propMgr->getStelPropertyValue("NebulaMgr.flagDesignationLabels").toBool());
×
1038
        conf->setValue("astro/flag_dso_outlines_usage",                        propMgr->getStelPropertyValue("NebulaMgr.flagOutlinesDisplayed").toBool());
×
1039
        conf->setValue("astro/flag_dso_additional_names",                propMgr->getStelPropertyValue("NebulaMgr.flagAdditionalNamesDisplayed").toBool());
×
1040
        conf->setValue("astro/flag_nebula_name",                                propMgr->getStelPropertyValue("NebulaMgr.flagHintDisplayed").toBool());
×
1041
        conf->setValue("astro/flag_use_type_filter",                                propMgr->getStelPropertyValue("NebulaMgr.flagTypeFiltersUsage").toBool());
×
1042
        conf->setValue("astro/flag_nebula_display_no_texture",        !propMgr->getStelPropertyValue("StelSkyLayerMgr.flagShow").toBool() );
×
1043

1044
        conf->setValue("astro/flag_size_limits_usage",                        propMgr->getStelPropertyValue("NebulaMgr.flagUseSizeLimits").toBool());
×
1045
        conf->setValue("astro/size_limit_min",                                        QString::number(propMgr->getStelPropertyValue("NebulaMgr.minSizeLimit").toDouble(), 'f', 0));
×
1046
        conf->setValue("astro/size_limit_max",                                        QString::number(propMgr->getStelPropertyValue("NebulaMgr.maxSizeLimit").toDouble(), 'f', 0));
×
1047

1048
        conf->setValue("projection/type",                                        core->getCurrentProjectionTypeKey());
×
1049
        conf->setValue("astro/flag_nutation",                                core->getUseNutation());
×
1050
        conf->setValue("astro/flag_aberration",                                core->getUseAberration());
×
1051
        conf->setValue("astro/aberration_factor",                        core->getAberrationFactor());
×
1052
        conf->setValue("astro/flag_topocentric_coordinates",        core->getUseTopocentricCoordinates());
×
1053

1054
        // view dialog / DSO tag settings
1055
        nmgr->storeCatalogFilters();
×
1056

1057
        const Nebula::TypeGroup tflags = static_cast<Nebula::TypeGroup>(nmgr->getTypeFilters());
×
1058
        conf->beginGroup("dso_type_filters");
×
1059
        conf->setValue("flag_show_galaxies",             static_cast<bool>(tflags & Nebula::TypeGalaxies));
×
1060
        conf->setValue("flag_show_active_galaxies",      static_cast<bool>(tflags & Nebula::TypeActiveGalaxies));
×
1061
        conf->setValue("flag_show_interacting_galaxies", static_cast<bool>(tflags & Nebula::TypeInteractingGalaxies));
×
1062
        conf->setValue("flag_show_open_clusters",        static_cast<bool>(tflags & Nebula::TypeOpenStarClusters));
×
1063
        conf->setValue("flag_show_globular_clusters",    static_cast<bool>(tflags & Nebula::TypeGlobularStarClusters));
×
1064
        conf->setValue("flag_show_bright_nebulae",       static_cast<bool>(tflags & Nebula::TypeBrightNebulae));
×
1065
        conf->setValue("flag_show_dark_nebulae",         static_cast<bool>(tflags & Nebula::TypeDarkNebulae));
×
1066
        conf->setValue("flag_show_planetary_nebulae",    static_cast<bool>(tflags & Nebula::TypePlanetaryNebulae));
×
1067
        conf->setValue("flag_show_hydrogen_regions",     static_cast<bool>(tflags & Nebula::TypeHydrogenRegions));
×
1068
        conf->setValue("flag_show_supernova_remnants",   static_cast<bool>(tflags & Nebula::TypeSupernovaRemnants));
×
1069
        conf->setValue("flag_show_galaxy_clusters",      static_cast<bool>(tflags & Nebula::TypeGalaxyClusters));
×
1070
        conf->setValue("flag_show_other",                static_cast<bool>(tflags & Nebula::TypeOther));
×
1071
        conf->endGroup();
×
1072

1073
        // view dialog / landscape tab settings
1074
        // DO NOT SAVE CURRENT LANDSCAPE ID! There is a dedicated button in the landscape tab of the View dialog.
1075
        //conf->setValue("init_location/landscape_name",                     propMgr->getStelPropertyValue("LandscapeMgr.currentLandscapeID").toString());
1076
        conf->setValue("landscape/flag_landscape_sets_location",           propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeSetsLocation").toBool());
×
1077
        conf->setValue("landscape/flag_landscape",                         propMgr->getStelPropertyValue("LandscapeMgr.landscapeDisplayed").toBool());
×
1078
        conf->setValue("landscape/flag_atmosphere",                        propMgr->getStelPropertyValue("LandscapeMgr.atmosphereDisplayed").toBool());
×
1079
        conf->setValue("landscape/flag_fog",                               propMgr->getStelPropertyValue("LandscapeMgr.fogDisplayed").toBool());
×
1080
        conf->setValue("landscape/flag_enable_illumination_layer",         propMgr->getStelPropertyValue("LandscapeMgr.illuminationDisplayed").toBool());
×
1081
        conf->setValue("landscape/flag_enable_labels",                     propMgr->getStelPropertyValue("LandscapeMgr.labelsDisplayed").toBool());
×
1082
        conf->setValue("landscape/label_font_size",                           propMgr->getStelPropertyValue("LandscapeMgr.labelFontSize").toInt());
×
1083
        conf->setValue("landscape/flag_minimal_brightness",                propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeUseMinimalBrightness").toBool());
×
1084
        conf->setValue("landscape/flag_landscape_sets_minimal_brightness", propMgr->getStelPropertyValue("LandscapeMgr.flagLandscapeSetsMinimalBrightness").toBool());
×
1085
        conf->setValue("landscape/minimal_brightness",                     propMgr->getStelPropertyValue("LandscapeMgr.defaultMinimalBrightness").toFloat());
×
1086
        conf->setValue("landscape/flag_polyline_only",                     propMgr->getStelPropertyValue("LandscapeMgr.flagPolyLineDisplayedOnly").toBool());
×
1087
        conf->setValue("landscape/polyline_thickness",                     propMgr->getStelPropertyValue("LandscapeMgr.polyLineThickness").toInt());
×
1088
        conf->setValue("stars/init_light_pollution_luminance",             propMgr->getStelPropertyValue("StelSkyDrawer.lightPollutionLuminance").toFloat());
×
1089
        conf->setValue("landscape/atmospheric_extinction_coefficient",     propMgr->getStelPropertyValue("StelSkyDrawer.extinctionCoefficient").toFloat());
×
1090
        conf->setValue("landscape/pressure_mbar",                          propMgr->getStelPropertyValue("StelSkyDrawer.atmospherePressure").toFloat());
×
1091
        conf->setValue("landscape/temperature_C",                          propMgr->getStelPropertyValue("StelSkyDrawer.atmosphereTemperature").toFloat());
×
1092

1093
        // view dialog / starlore tab
1094
        QObject* scmgr = reinterpret_cast<QObject*>(&StelApp::getInstance().getSkyCultureMgr());
×
1095
        scmgr->setProperty("defaultSkyCultureID", scmgr->property("currentSkyCultureID"));
×
1096

1097
        // Save default location
1098
        core->setDefaultLocationID(core->getCurrentLocation().getID());
×
1099

1100
        // configuration dialog / main tab
1101
        QString langName = StelApp::getInstance().getLocaleMgr().getAppLanguage();
×
1102
        conf->setValue("localization/app_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
1103
        langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
×
1104
        conf->setValue("localization/sky_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
1105

1106
        // configuration dialog / selected object info tab
1107
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
1108
        if (flags == StelObject::InfoStringGroup(StelObject::None))
×
1109
                conf->setValue("gui/selected_object_info", "none");
×
1110
        else if (flags == StelObject::InfoStringGroup(StelObject::DefaultInfo))
×
1111
            conf->setValue("gui/selected_object_info", "default");
×
1112
        else if (flags == StelObject::InfoStringGroup(StelObject::ShortInfo))
×
1113
                conf->setValue("gui/selected_object_info", "short");
×
1114
        else if (flags == StelObject::InfoStringGroup(StelObject::AllInfo))
×
1115
                conf->setValue("gui/selected_object_info", "all");
×
1116
        else
1117
        {
1118
                conf->setValue("gui/selected_object_info", "custom");
×
1119
                saveCustomSelectedInfo();
×
1120
        }
1121

1122
        // toolbar auto-hide status
1123
        conf->setValue("gui/auto_hide_horizontal_toolbar",                propMgr->getStelPropertyValue("StelGui.autoHideHorizontalButtonBar").toBool());
×
1124
        conf->setValue("gui/auto_hide_vertical_toolbar",                        propMgr->getStelPropertyValue("StelGui.autoHideVerticalButtonBar").toBool());
×
1125
        conf->setValue("gui/flag_show_quit_button",                                propMgr->getStelPropertyValue("StelGui.flagShowQuitButton").toBool());
×
1126
        conf->setValue("gui/flag_show_nebulae_background_button",propMgr->getStelPropertyValue("StelGui.flagShowNebulaBackgroundButton").toBool());
×
1127
        conf->setValue("gui/flag_show_dss_button",                                propMgr->getStelPropertyValue("StelGui.flagShowDSSButton").toBool());
×
1128
        conf->setValue("gui/flag_show_hips_button",                                propMgr->getStelPropertyValue("StelGui.flagShowHiPSButton").toBool());
×
1129
        conf->setValue("gui/flag_show_goto_selected_button",        propMgr->getStelPropertyValue("StelGui.flagShowGotoSelectedObjectButton").toBool());
×
1130
        conf->setValue("gui/flag_show_nightmode_button",                propMgr->getStelPropertyValue("StelGui.flagShowNightmodeButton").toBool());
×
1131
        conf->setValue("gui/flag_show_fullscreen_button",                propMgr->getStelPropertyValue("StelGui.flagShowFullscreenButton").toBool());
×
1132
        
1133
    conf->setValue("gui/flag_show_obslist_button",                propMgr->getStelPropertyValue("StelGui.flagShowObsListButton").toBool());
×
1134
    
1135
    conf->setValue("gui/flag_show_icrs_grid_button",                        propMgr->getStelPropertyValue("StelGui.flagShowICRSGridButton").toBool());
×
1136
        conf->setValue("gui/flag_show_galactic_grid_button",                propMgr->getStelPropertyValue("StelGui.flagShowGalacticGridButton").toBool());
×
1137
        conf->setValue("gui/flag_show_ecliptic_grid_button",                propMgr->getStelPropertyValue("StelGui.flagShowEclipticGridButton").toBool());
×
1138
        conf->setValue("gui/flag_show_boundaries_button",                propMgr->getStelPropertyValue("StelGui.flagShowConstellationBoundariesButton").toBool());
×
1139
        conf->setValue("gui/flag_show_asterism_lines_button",        propMgr->getStelPropertyValue("StelGui.flagShowAsterismLinesButton").toBool());
×
1140
        conf->setValue("gui/flag_show_asterism_labels_button",        propMgr->getStelPropertyValue("StelGui.flagShowAsterismLabelsButton").toBool());
×
1141
        conf->setValue("gui/flag_show_decimal_degrees",                propMgr->getStelPropertyValue("StelApp.flagShowDecimalDegrees").toBool());
×
1142
        conf->setValue("gui/flag_use_azimuth_from_south",                propMgr->getStelPropertyValue("StelApp.flagUseAzimuthFromSouth").toBool());
×
1143
        conf->setValue("gui/flag_use_formatting_output",                        propMgr->getStelPropertyValue("StelApp.flagUseFormattingOutput").toBool());
×
1144
        conf->setValue("gui/flag_use_ccs_designations",                        propMgr->getStelPropertyValue("StelApp.flagUseCCSDesignation").toBool());
×
1145
        conf->setValue("gui/flag_overwrite_info_color",                        propMgr->getStelPropertyValue("StelApp.flagOverwriteInfoColor").toBool());
×
1146
        conf->setValue("gui/flag_time_jd",                                                gui->getButtonBar()->getFlagTimeJd());
×
1147
        conf->setValue("gui/flag_show_buttons_background",                propMgr->getStelPropertyValue("StelGui.flagUseButtonsBackground").toBool());
×
1148
        conf->setValue("gui/flag_indication_mount_mode",                mvmgr->getFlagIndicationMountMode());
×
1149

1150
        // configuration dialog / navigation tab
1151
        conf->setValue("navigation/flag_enable_zoom_keys",                mvmgr->getFlagEnableZoomKeys());
×
1152
        conf->setValue("navigation/flag_enable_mouse_navigation",        mvmgr->getFlagEnableMouseNavigation());
×
1153
        conf->setValue("navigation/flag_enable_mouse_zooming",                mvmgr->getFlagEnableMouseZooming());
×
1154
        conf->setValue("navigation/flag_enable_move_keys",                mvmgr->getFlagEnableMoveKeys());
×
1155
        conf->setValue("navigation/startup_time_mode",                        core->getStartupTimeMode());
×
1156
        conf->setValue("navigation/today_time",                                core->getInitTodayTime());
×
1157
        conf->setValue("navigation/preset_sky_time",                        core->getPresetSkyTime());
×
1158
        conf->setValue("navigation/time_correction_algorithm",        core->getCurrentDeltaTAlgorithmKey());
×
1159
        if (mvmgr->getMountMode() == StelMovementMgr::MountAltAzimuthal)
×
1160
                conf->setValue("navigation/viewing_mode", "horizon");
×
1161
        else
1162
                conf->setValue("navigation/viewing_mode", "equator");
×
1163

1164
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1165
        conf->setValue("localization/time_display_format",        localeManager.getTimeFormatStr());
×
1166
        conf->setValue("localization/date_display_format",        localeManager.getDateFormatStr());
×
1167

1168
        // configuration dialog / tools tab
1169
        conf->setValue("gui/flag_show_flip_buttons",                        propMgr->getStelPropertyValue("StelGui.flagShowFlipButtons").toBool());
×
1170
        conf->setValue("video/viewport_effect",                                StelApp::getInstance().getViewportEffect());
×
1171

1172
        conf->setValue("projection/viewport",                                StelProjector::maskTypeToString(proj->getMaskType()));
×
1173
        conf->setValue("projection/viewport_center_offset_x",                core->getCurrentStelProjectorParams().viewportCenterOffset[0]);
×
1174
        conf->setValue("projection/viewport_center_offset_y",                core->getCurrentStelProjectorParams().viewportCenterOffset[1]);
×
1175
        conf->setValue("projection/flip_horz",                                core->getCurrentStelProjectorParams().flipHorz);
×
1176
        conf->setValue("projection/flip_vert",                                core->getCurrentStelProjectorParams().flipVert);
×
1177
        conf->setValue("navigation/max_fov",                                mvmgr->getUserMaxFov());
×
1178

1179
        conf->setValue("viewing/flag_gravity_labels",                        proj->getFlagGravityLabels());
×
1180
        conf->setValue("navigation/auto_zoom_out_resets_direction",        mvmgr->getFlagAutoZoomOutResetsDirection());
×
1181

1182
        conf->setValue("gui/flag_mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.flagCursorTimeout").toBool());
×
1183
        conf->setValue("gui/mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.cursorTimeout").toFloat());
×
1184
        conf->setValue("gui/base_font_name",                                QGuiApplication::font().family());
×
1185
        conf->setValue("gui/screen_font_size",                                propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
×
1186
        conf->setValue("gui/gui_font_size",                                propMgr->getStelPropertyValue("StelApp.guiFontSize").toInt());
×
1187

1188

1189
        conf->setValue("main/screenshot_dir",                                StelFileMgr::getScreenshotDir());
×
1190
        conf->setValue("main/invert_screenshots_colors",                propMgr->getStelPropertyValue("MainView.flagInvertScreenShotColors").toBool());
×
1191
        conf->setValue("main/screenshot_datetime_filename",                propMgr->getStelPropertyValue("MainView.flagScreenshotDateFileName").toBool());
×
1192
        conf->setValue("main/screenshot_datetime_filemask",                propMgr->getStelPropertyValue("MainView.screenShotFileMask").toString());
×
1193
        conf->setValue("main/screenshot_custom_size",                        propMgr->getStelPropertyValue("MainView.flagUseCustomScreenshotSize").toBool());
×
1194
        conf->setValue("main/screenshot_custom_width",                        propMgr->getStelPropertyValue("MainView.customScreenshotWidth").toInt());
×
1195
        conf->setValue("main/screenshot_custom_height",                        propMgr->getStelPropertyValue("MainView.customScreenshotHeight").toInt());
×
1196

1197
        QWidget& mainWindow = StelMainView::getInstance();
×
1198
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
1199
        QScreen *mainScreen = mainWindow.windowHandle()->screen();
1200
        int screenNum=qApp->screens().indexOf(mainScreen);
1201
#else
1202
        int screenNum = qApp->desktop()->screenNumber(&StelMainView::getInstance());
×
1203
#endif
1204
        conf->setValue("video/screen_number", screenNum);
×
1205

1206
        // full screen and window size
1207
        conf->setValue("video/fullscreen", StelMainView::getInstance().isFullScreen());
×
1208
        if (!StelMainView::getInstance().isFullScreen())
×
1209
        {
1210
                QRect screenGeom = QGuiApplication::screens().at(screenNum)->geometry();
×
1211

1212
                conf->setValue("video/screen_w", mainWindow.size().width());
×
1213
                conf->setValue("video/screen_h", mainWindow.size().height());
×
1214
                conf->setValue("video/screen_x", mainWindow.x() - screenGeom.x());
×
1215
                conf->setValue("video/screen_y", mainWindow.y() - screenGeom.y());
×
1216
        }
1217

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

1221
        updateConfigLabels();
×
1222

1223
        emit core->configurationDataSaved();
×
1224
}
×
1225

1226
void ConfigurationDialog::updateConfigLabels()
×
1227
{
1228
        ui->startupFOVLabel->setText(q_("Startup FOV: %1%2").arg(StelApp::getInstance().getCore()->getMovementMgr()->getCurrentFov()).arg(QChar(0x00B0)));
×
1229

1230
        double az, alt;
1231
        const Vec3d& v = GETSTELMODULE(StelMovementMgr)->getInitViewingDirection();
×
1232
        StelUtils::rectToSphe(&az, &alt, v);
×
1233
        az = 3.*M_PI - az;  // N is zero, E is 90 degrees
×
1234
        if (az > M_PI*2)
×
1235
                az -= M_PI*2;
×
1236
        ui->startupDirectionOfViewlabel->setText(q_("Startup direction of view Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)));
×
1237
}
×
1238

1239
void ConfigurationDialog::setDefaultViewOptions()
×
1240
{
1241
        if (askConfirmation())
×
1242
        {
1243
                qDebug() << "Restore defaults...";
×
1244
                QSettings* conf = StelApp::getInstance().getSettings();
×
1245
                Q_ASSERT(conf);
×
1246

1247
                conf->setValue("main/restore_defaults", true);
×
1248
                // reset all stored panel locations
1249
                conf->beginGroup("DialogPositions");
×
1250
                conf->remove("");
×
1251
                conf->endGroup();
×
1252
        }
1253
        else
1254
                qDebug() << "Restore defaults is canceled...";
×
1255
}
×
1256

1257
void ConfigurationDialog::populatePluginsList()
×
1258
{
1259
        QListWidget *plugins = ui->pluginsListWidget;
×
1260
        plugins->blockSignals(true);
×
1261
        int currentRow = plugins->currentRow();
×
1262
        QString selectedPluginId = "";
×
1263
        if (currentRow>0)
×
1264
                 selectedPluginId = plugins->currentItem()->data(Qt::UserRole).toString();
×
1265

1266
        plugins->clear();
×
1267
        QString selectedPluginName = "";
×
1268
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp::getInstance().getModuleMgr().getPluginsList();        
×
1269
        for (const auto& desc : pluginsList)
×
1270
        {
1271
                QString label = q_(desc.info.displayedName);
×
1272
                QListWidgetItem* item = new QListWidgetItem(label);
×
1273
                item->setData(Qt::UserRole, desc.info.id);
×
1274
                plugins->addItem(item);
×
1275
                if (currentRow>0 && item->data(Qt::UserRole).toString()==selectedPluginId)
×
1276
                        selectedPluginName = label;
×
1277
        }
×
1278
        plugins->sortItems(Qt::AscendingOrder);
×
1279
        plugins->blockSignals(false);
×
1280
        // If we had a valid previous selection (i.e. not first time we populate), restore it
1281

1282
        if (!selectedPluginName.isEmpty())
×
1283
                plugins->setCurrentItem(plugins->findItems(selectedPluginName, Qt::MatchExactly).at(0));
×
1284
        else
1285
                plugins->setCurrentRow(0);
×
1286
}
×
1287

1288
void ConfigurationDialog::pluginsSelectionChanged(QListWidgetItem* item, QListWidgetItem* previousItem)
×
1289
{
1290
        Q_UNUSED(previousItem)
1291
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp::getInstance().getModuleMgr().getPluginsList();
×
1292
        for (const auto& desc : pluginsList)
×
1293
        {
1294
                if (item->data(Qt::UserRole).toString()==desc.info.id)
×
1295
                {
1296
                        QString html = "<html><head></head><body>";
×
1297
                        html += "<h2>" + q_(desc.info.displayedName) + "</h2>";                        
×
1298
                        QString d = desc.info.description;
×
1299
                        d.replace("\n", "<br />");
×
1300
                        html += "<p>" + q_(d) + "</p>";
×
1301
                        html += "<p>";
×
1302
                        QString thanks = desc.info.acknowledgements;
×
1303
                        if (!thanks.isEmpty())
×
1304
                        {
1305
                                html += "<strong>" + q_("Acknowledgments") + "</strong>: " + q_(thanks) + "<br/>";
×
1306
                        }
1307
                        html += "<strong>" + q_("Authors") + "</strong>: " + desc.info.authors;
×
1308
                        html += "<br /><strong>" + q_("Contact") + "</strong>: " + desc.info.contact;
×
1309
                        if (!desc.info.version.isEmpty())
×
1310
                                html += "<br /><strong>" + q_("Version") + "</strong>: " + desc.info.version;
×
1311
                        html += "<br /><strong>" + q_("License") + "</strong>: ";
×
1312
                        if (!desc.info.license.isEmpty())
×
1313
                                html += desc.info.license;
×
1314
                        else
1315
                                html += qc_("unknown", "license");
×
1316
                        html += "</p></body></html>";
×
1317
                        ui->pluginsInfoBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1318
                        ui->pluginsInfoBrowser->setHtml(html);
×
1319
                        ui->pluginLoadAtStartupCheckBox->setChecked(desc.loadAtStartup);
×
1320
                        StelModule* pmod = StelApp::getInstance().getModuleMgr().getModule(desc.info.id, true);
×
1321
                        if (pmod != Q_NULLPTR)
×
1322
                                ui->pluginConfigureButton->setEnabled(pmod->configureGui(false));
×
1323
                        else
1324
                                ui->pluginConfigureButton->setEnabled(false);
×
1325
                        return;
×
1326
                }
×
1327
        }
1328
}
×
1329

1330
void ConfigurationDialog::pluginConfigureCurrentSelection()
×
1331
{
1332
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1333
        if (id.isEmpty())
×
1334
                return;
×
1335

1336
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1337
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1338
        for (const auto& desc : pluginsList)
×
1339
        {
1340
                if (id == desc.info.id)
×
1341
                {
1342
                        StelModule* pmod = moduleMgr.getModule(desc.info.id, QObject::sender()->objectName()=="pluginsListWidget");
×
1343
                        if (pmod != Q_NULLPTR)
×
1344
                        {
1345
                                pmod->configureGui(true);
×
1346
                        }
1347
                        return;
×
1348
                }
1349
        }
1350
}
×
1351

1352
void ConfigurationDialog::loadAtStartupChanged(int state)
×
1353
{
1354
        if (ui->pluginsListWidget->count() <= 0)
×
1355
                return;
×
1356

1357
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1358
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1359
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1360
        for (const auto& desc : pluginsList)
×
1361
        {
1362
                if (id == desc.info.id)
×
1363
                {
1364
                        moduleMgr.setPluginLoadAtStartup(id, state == Qt::Checked);
×
1365
                        break;
×
1366
                }
1367
        }
1368
}
×
1369

1370
#ifdef ENABLE_SCRIPTING
1371
void ConfigurationDialog::populateScriptsList(void)
×
1372
{
1373
        QListWidget *scripts = ui->scriptListWidget;
×
1374
        scripts->blockSignals(true);
×
1375
        int currentRow = scripts->currentRow();
×
1376
        QString selectedScriptId = "";
×
1377
        if (currentRow>0)
×
1378
                selectedScriptId = scripts->currentItem()->data(Qt::DisplayRole).toString();
×
1379

1380
        scripts->clear();
×
1381
        for (const auto& ssc : StelApp::getInstance().getScriptMgr().getScriptList())
×
1382
        {
1383
                QListWidgetItem* item = new QListWidgetItem(ssc);
×
1384
                scripts->addItem(item);
×
1385
        }
×
1386
        scripts->sortItems(Qt::AscendingOrder);
×
1387
        scripts->blockSignals(false);
×
1388
        // If we had a valid previous selection (i.e. not first time we populate), restore it
1389
        if (!selectedScriptId.isEmpty())
×
1390
                scripts->setCurrentItem(scripts->findItems(selectedScriptId, Qt::MatchExactly).at(0));
×
1391
        else
1392
                scripts->setCurrentRow(0);
×
1393
}
×
1394

1395
void ConfigurationDialog::scriptSelectionChanged(const QString& s)
×
1396
{
1397
        if (s.isEmpty())
×
1398
                return;        
×
1399
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();        
×
1400
        //ui->scriptInfoBrowser->document()->setDefaultStyleSheet(QString(StelApp::getInstance().getCurrentStelStyle()->htmlStyleSheet));
1401
        QString html = scriptMgr.getHtmlDescription(s);
×
1402
        ui->scriptInfoBrowser->setHtml(html);        
×
1403
}
×
1404

1405
void ConfigurationDialog::runScriptClicked(void)
×
1406
{
1407
        if (ui->closeWindowAtScriptRunCheckbox->isChecked())
×
1408
                this->close();
×
1409
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
×
1410
        if (ui->scriptListWidget->currentItem())
×
1411
        {
1412
                scriptMgr.runScript(ui->scriptListWidget->currentItem()->text());
×
1413
        }        
1414
}
×
1415

1416
void ConfigurationDialog::stopScriptClicked(void)
×
1417
{
1418
        StelApp::getInstance().getScriptMgr().stopScript();
×
1419
}
×
1420

1421
void ConfigurationDialog::aScriptIsRunning(void)
×
1422
{        
1423
        ui->scriptStatusLabel->setText(q_("Running script: ") + StelApp::getInstance().getScriptMgr().runningScriptId());
×
1424
        ui->runScriptButton->setEnabled(false);
×
1425
        ui->stopScriptButton->setEnabled(true);        
×
1426
}
×
1427

1428
void ConfigurationDialog::aScriptHasStopped(void)
×
1429
{
1430
        ui->scriptStatusLabel->setText(q_("Running script: [none]"));
×
1431
        ui->runScriptButton->setEnabled(true);
×
1432
        ui->stopScriptButton->setEnabled(false);
×
1433
}
×
1434
#endif
1435

1436

1437
void ConfigurationDialog::setFixedDateTimeToCurrent(void)
×
1438
{
1439
        StelCore* core = StelApp::getInstance().getCore();
×
1440
        double JD = core->getJD();
×
1441
        ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+core->getUTCOffset(JD)/24, Qt::LocalTime));
×
1442
        ui->fixedTimeRadio->setChecked(true);
×
1443
        setStartupTimeMode();
×
1444
}
×
1445

1446

1447
void ConfigurationDialog::resetStarCatalogControls()
×
1448
{
1449
        const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatalogsDescription();
×
1450
        nextStarCatalogToDownload.clear();
×
1451
        int idx=0;
×
1452
        for (const auto& catV : catalogConfig)
×
1453
        {
1454
                ++idx;
×
1455
                const QVariantMap& m = catV.toMap();
×
1456
                const bool checked = m.value("checked").toBool();
×
1457
                if (checked)
×
1458
                        continue;
×
1459
                nextStarCatalogToDownload=m;
×
1460
                break;
×
1461
        }
×
1462

1463
        ui->downloadCancelButton->setVisible(false);
×
1464
        ui->downloadRetryButton->setVisible(false);
×
1465

1466
        if (idx > catalogConfig.size() && !hasDownloadedStarCatalog)
×
1467
        {
1468
                ui->getStarsButton->setVisible(false);
×
1469
                updateStarCatalogControlsText();
×
1470
                return;
×
1471
        }
1472

1473
        ui->getStarsButton->setEnabled(true);
×
1474
        if (!nextStarCatalogToDownload.isEmpty())
×
1475
        {
1476
                nextStarCatalogToDownloadIndex = idx;
×
1477
                starCatalogsCount = catalogConfig.size();
×
1478
                updateStarCatalogControlsText();
×
1479
                ui->getStarsButton->setVisible(true);
×
1480
        }
1481
        else
1482
        {
1483
                updateStarCatalogControlsText();
×
1484
                ui->getStarsButton->setVisible(false);
×
1485
        }
1486
}
×
1487

1488
void ConfigurationDialog::updateStarCatalogControlsText()
×
1489
{
1490
        if (nextStarCatalogToDownload.isEmpty())
×
1491
        {
1492
                //There are no more catalogs left?
1493
                if (hasDownloadedStarCatalog)
×
1494
                {
1495
                        ui->downloadLabel->setText(q_("Finished downloading new star catalogs!\nRestart Stellarium to display them."));
×
1496
                }
1497
                else
1498
                {
1499
                        ui->downloadLabel->setText(q_("All available star catalogs have been installed."));
×
1500
                }
1501
        }
1502
        else
1503
        {
1504
                QString text = QString(q_("Get catalog %1 of %2"))
×
1505
                               .arg(nextStarCatalogToDownloadIndex)
×
1506
                               .arg(starCatalogsCount);
×
1507
                ui->getStarsButton->setText(text);
×
1508
                
1509
                if (isDownloadingStarCatalog)
×
1510
                {
1511
                        QString text = QString(q_("Downloading %1...\n(You can close this window.)"))
×
1512
                                         .arg(nextStarCatalogToDownload.value("id").toString());
×
1513
                        ui->downloadLabel->setText(text);
×
1514
                }
×
1515
                else
1516
                {
1517
                        const QVariantList& magRange = nextStarCatalogToDownload.value("magRange").toList();
×
1518
                        ui->downloadLabel->setText(q_("Download size: %1MB\nStar count: %2 Million\nMagnitude range: %3 - %4")
×
1519
                                .arg(nextStarCatalogToDownload.value("sizeMb").toString(),
×
1520
                                     QString::number(nextStarCatalogToDownload.value("count").toDouble(), 'f', 1),
×
1521
                                     magRange.first().toString(),
×
1522
                                     magRange.last().toString()));
×
1523
                }
×
1524
        }
×
1525
}
×
1526

1527
void ConfigurationDialog::cancelDownload(void)
×
1528
{
1529
        Q_ASSERT(currentDownloadFile);
×
1530
        Q_ASSERT(starCatalogDownloadReply);
×
1531
        qWarning() << "Aborting download";
×
1532
        starCatalogDownloadReply->abort();
×
1533
}
×
1534

1535
void ConfigurationDialog::newStarCatalogData()
×
1536
{
1537
        Q_ASSERT(currentDownloadFile);
×
1538
        Q_ASSERT(starCatalogDownloadReply);
×
1539
        Q_ASSERT(progressBar);
×
1540

1541
        // Ignore data from redirection.  (Not needed after Qt 5.6)
1542
        if (!starCatalogDownloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute).isNull())
×
1543
                return;
×
1544
        qint64 size = starCatalogDownloadReply->bytesAvailable();
×
1545
        progressBar->setValue(progressBar->getValue()+static_cast<int>(size/1024));
×
1546
        currentDownloadFile->write(starCatalogDownloadReply->read(size));
×
1547
}
1548

1549
void ConfigurationDialog::downloadStars()
×
1550
{
1551
        Q_ASSERT(!nextStarCatalogToDownload.isEmpty());
×
1552
        Q_ASSERT(!isDownloadingStarCatalog);
×
1553
        Q_ASSERT(starCatalogDownloadReply==Q_NULLPTR);
×
1554
        Q_ASSERT(currentDownloadFile==Q_NULLPTR);
×
1555
        Q_ASSERT(progressBar==Q_NULLPTR);
×
1556

1557
        QString path = StelFileMgr::getUserDir()+QString("/stars/default/")+nextStarCatalogToDownload.value("fileName").toString();
×
1558
        currentDownloadFile = new QFile(path);
×
1559
        if (!currentDownloadFile->open(QIODevice::WriteOnly))
×
1560
        {
1561
                qWarning() << "Can't open a writable file for storing new star catalog: " << QDir::toNativeSeparators(path);
×
1562
                currentDownloadFile->deleteLater();
×
1563
                currentDownloadFile = Q_NULLPTR;
×
1564
                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)));
×
1565
                ui->downloadRetryButton->setVisible(true);
×
1566
                return;
×
1567
        }
1568

1569
        isDownloadingStarCatalog = true;
×
1570
        updateStarCatalogControlsText();
×
1571
        ui->downloadCancelButton->setVisible(true);
×
1572
        ui->downloadRetryButton->setVisible(false);
×
1573
        ui->getStarsButton->setVisible(true);
×
1574
        ui->getStarsButton->setEnabled(false);
×
1575

1576
        QNetworkRequest req(nextStarCatalogToDownload.value("url").toString());
×
1577
        req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
×
1578
        req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false);
×
1579
        req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1());
×
1580
        starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
×
1581
        starCatalogDownloadReply->setReadBufferSize(1024*1024*2);        
×
1582
        connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
×
1583
        connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
×
1584
        connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
×
1585

1586
        progressBar = StelApp::getInstance().addProgressBar();
×
1587
        progressBar->setValue(0);
×
1588
        progressBar->setRange(0, static_cast<int>(nextStarCatalogToDownload.value("sizeMb").toDouble()*1024));
×
1589
        progressBar->setFormat(QString("%1: %p%").arg(nextStarCatalogToDownload.value("id").toString()));
×
1590

1591
        qDebug() << "Downloading file" << nextStarCatalogToDownload.value("url").toString();
×
1592
}
×
1593

1594
void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
×
1595
{
1596
        Q_ASSERT(currentDownloadFile);
×
1597
        Q_ASSERT(starCatalogDownloadReply);
×
1598

1599
        isDownloadingStarCatalog = false;
×
1600
        qWarning() << "Error downloading file" << starCatalogDownloadReply->url() << ": " << starCatalogDownloadReply->errorString();
×
1601
        ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextStarCatalogToDownload.value("id").toString(), starCatalogDownloadReply->errorString()));
×
1602
        ui->downloadCancelButton->setVisible(false);
×
1603
        ui->downloadRetryButton->setVisible(true);
×
1604
        ui->getStarsButton->setVisible(false);
×
1605
        ui->getStarsButton->setEnabled(true);
×
1606
}
×
1607

1608
void ConfigurationDialog::downloadFinished()
×
1609
{
1610
        Q_ASSERT(currentDownloadFile);
×
1611
        Q_ASSERT(starCatalogDownloadReply);
×
1612
        Q_ASSERT(progressBar);
×
1613

1614
        if (starCatalogDownloadReply->error()!=QNetworkReply::NoError)
×
1615
        {
1616
                starCatalogDownloadReply->deleteLater();
×
1617
                starCatalogDownloadReply = Q_NULLPTR;
×
1618
                currentDownloadFile->close();
×
1619
                currentDownloadFile->deleteLater();
×
1620
                currentDownloadFile = Q_NULLPTR;
×
1621
                StelApp::getInstance().removeProgressBar(progressBar);
×
1622
                progressBar=Q_NULLPTR;
×
1623
                return;
×
1624
        }
1625

1626
        const QVariant& redirect = starCatalogDownloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
×
1627
        if (!redirect.isNull())
×
1628
        {
1629
                // We got a redirection, we need to follow
1630
                starCatalogDownloadReply->deleteLater();
×
1631
                QNetworkRequest req(redirect.toUrl());
×
1632
                req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
×
1633
                req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false);
×
1634
                req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1());
×
1635
                starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
×
1636
                starCatalogDownloadReply->setReadBufferSize(1024*1024*2);
×
1637
                connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
×
1638
                connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
×
1639
                connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
×
1640
                return;
×
1641
        }
×
1642

1643
        Q_ASSERT(starCatalogDownloadReply->bytesAvailable()==0);
×
1644

1645
        isDownloadingStarCatalog = false;
×
1646
        currentDownloadFile->close();
×
1647
        currentDownloadFile->deleteLater();
×
1648
        currentDownloadFile = Q_NULLPTR;
×
1649
        starCatalogDownloadReply->deleteLater();
×
1650
        starCatalogDownloadReply = Q_NULLPTR;
×
1651
        StelApp::getInstance().removeProgressBar(progressBar);
×
1652
        progressBar=Q_NULLPTR;
×
1653

1654
        ui->downloadLabel->setText(q_("Verifying file integrity..."));
×
1655
        if (GETSTELMODULE(StarMgr)->checkAndLoadCatalog(nextStarCatalogToDownload)==false)
×
1656
        {
1657
                ui->getStarsButton->setVisible(false);
×
1658
                ui->downloadLabel->setText(q_("Error downloading %1:\nFile is corrupted.").arg(nextStarCatalogToDownload.value("id").toString()));
×
1659
                ui->downloadCancelButton->setVisible(false);
×
1660
                ui->downloadRetryButton->setVisible(true);
×
1661
        }
1662
        else
1663
        {
1664
                hasDownloadedStarCatalog = true;
×
1665
                ui->getStarsButton->setVisible(true);
×
1666
                ui->downloadCancelButton->setVisible(false);
×
1667
                ui->downloadRetryButton->setVisible(false);
×
1668
        }
1669

1670
        resetStarCatalogControls();
×
1671
}
×
1672

1673
void ConfigurationDialog::de430ButtonClicked()
×
1674
{
1675
        StelCore *core=StelApp::getInstance().getCore();
×
1676
        QSettings* conf = StelApp::getInstance().getSettings();
×
1677
        Q_ASSERT(conf);
×
1678

1679
        core->setDe430Active(!core->de430IsActive());
×
1680
        conf->setValue("astro/flag_use_de430", core->de430IsActive());
×
1681

1682
        resetEphemControls(); //refresh labels
×
1683
}
×
1684

1685
void ConfigurationDialog::de431ButtonClicked()
×
1686
{
1687
        StelCore *core=StelApp::getInstance().getCore();
×
1688
        QSettings* conf = StelApp::getInstance().getSettings();
×
1689
        Q_ASSERT(conf);
×
1690

1691
        core->setDe431Active(!core->de431IsActive());
×
1692
        conf->setValue("astro/flag_use_de431", core->de431IsActive());
×
1693

1694
        resetEphemControls(); //refresh labels
×
1695
}
×
1696

1697
void ConfigurationDialog::de440ButtonClicked()
×
1698
{
1699
        StelCore *core=StelApp::getInstance().getCore();
×
1700
        QSettings* conf = StelApp::getInstance().getSettings();
×
1701
        Q_ASSERT(conf);
×
1702

1703
        core->setDe440Active(!core->de440IsActive());
×
1704
        conf->setValue("astro/flag_use_de440", core->de440IsActive());
×
1705

1706
        resetEphemControls(); //refresh labels
×
1707
}
×
1708

1709
void ConfigurationDialog::de441ButtonClicked()
×
1710
{
1711
        StelCore *core=StelApp::getInstance().getCore();
×
1712
        QSettings* conf = StelApp::getInstance().getSettings();
×
1713
        Q_ASSERT(conf);
×
1714

1715
        core->setDe441Active(!core->de441IsActive());
×
1716
        conf->setValue("astro/flag_use_de441", core->de441IsActive());
×
1717

1718
        resetEphemControls(); //refresh labels
×
1719
}
×
1720

1721
void ConfigurationDialog::resetEphemControls()
×
1722
{
1723
        StelCore *core=StelApp::getInstance().getCore();
×
1724
        ui->de430checkBox->setEnabled(core->de430IsAvailable());
×
1725
        ui->de431checkBox->setEnabled(core->de431IsAvailable());
×
1726
        ui->de430checkBox->setChecked(core->de430IsActive());
×
1727
        ui->de431checkBox->setChecked(core->de431IsActive());
×
1728
        ui->de440checkBox->setEnabled(core->de440IsAvailable());
×
1729
        ui->de441checkBox->setEnabled(core->de441IsAvailable());
×
1730
        ui->de440checkBox->setChecked(core->de440IsActive());
×
1731
        ui->de441checkBox->setChecked(core->de441IsActive());
×
1732

1733
        if(core->de430IsActive())
×
1734
                ui->de430label->setText("1550..2650");
×
1735
        else
1736
        {
1737
                if (core->de430IsAvailable())
×
1738
                        ui->de430label->setText(q_("Available"));
×
1739
                else
1740
                        ui->de430label->setText(q_("Not Available"));
×
1741
        }
1742
        if(core->de431IsActive())
×
1743
                ui->de431label->setText("-13000..17000");
×
1744
        else
1745
        {
1746
                if (core->de431IsAvailable())
×
1747
                        ui->de431label->setText(q_("Available"));
×
1748
                else
1749
                        ui->de431label->setText(q_("Not Available"));
×
1750
        }
1751
        if(core->de440IsActive())
×
1752
                ui->de440label->setText("1550..2650");
×
1753
        else
1754
        {
1755
                if (core->de440IsAvailable())
×
1756
                        ui->de440label->setText(q_("Available"));
×
1757
                else
1758
                        ui->de440label->setText(q_("Not Available"));
×
1759
        }
1760
        if(core->de441IsActive())
×
1761
                ui->de441label->setText("-13000..17000");
×
1762
        else
1763
        {
1764
                if (core->de441IsAvailable())
×
1765
                        ui->de441label->setText(q_("Available"));
×
1766
                else
1767
                        ui->de441label->setText(q_("Not Available"));
×
1768
        }
1769
}
×
1770

1771
void ConfigurationDialog::updateSelectedInfoCheckBoxes()
×
1772
{
1773
        const StelObject::InfoStringGroup& flags = gui->getInfoTextFilters();
×
1774
        
1775
        ui->checkBoxName->setChecked(flags & StelObject::Name);
×
1776
        ui->checkBoxCatalogNumbers->setChecked(flags & StelObject::CatalogNumber);
×
1777
        ui->checkBoxVisualMag->setChecked(flags & StelObject::Magnitude);
×
1778
        ui->checkBoxAbsoluteMag->setChecked(flags & StelObject::AbsoluteMagnitude);
×
1779
        ui->checkBoxRaDecJ2000->setChecked(flags & StelObject::RaDecJ2000);
×
1780
        ui->checkBoxRaDecOfDate->setChecked(flags & StelObject::RaDecOfDate);
×
1781
        ui->checkBoxHourAngle->setChecked(flags & StelObject::HourAngle);
×
1782
        ui->checkBoxAltAz->setChecked(flags & StelObject::AltAzi);
×
1783
        ui->checkBoxDistance->setChecked(flags & StelObject::Distance);
×
1784
        ui->checkBoxVelocity->setChecked(flags & StelObject::Velocity);
×
1785
        ui->checkBoxProperMotion->setChecked(flags & StelObject::ProperMotion);
×
1786
        ui->checkBoxSize->setChecked(flags & StelObject::Size);
×
1787
        ui->checkBoxExtra->setChecked(flags & StelObject::Extra);
×
1788
        ui->checkBoxGalacticCoordinates->setChecked(flags & StelObject::GalacticCoord);
×
1789
        ui->checkBoxSupergalacticCoordinates->setChecked(flags & StelObject::SupergalacticCoord);
×
1790
        ui->checkBoxOtherCoords->setChecked(flags & StelObject::OtherCoord);
×
1791
        ui->checkBoxElongation->setChecked(flags & StelObject::Elongation);
×
1792
        ui->checkBoxType->setChecked(flags & StelObject::ObjectType);
×
1793
        ui->checkBoxEclipticCoordsJ2000->setChecked(flags & StelObject::EclipticCoordJ2000);
×
1794
        ui->checkBoxEclipticCoordsOfDate->setChecked(flags & StelObject::EclipticCoordOfDate);
×
1795
        ui->checkBoxConstellation->setChecked(flags & StelObject::IAUConstellation);
×
1796
        ui->checkBoxSiderealTime->setChecked(flags & StelObject::SiderealTime);
×
1797
        ui->checkBoxRTSTime->setChecked(flags & StelObject::RTSTime);
×
1798
        ui->checkBoxSolarLunarPosition->setChecked(flags & StelObject::SolarLunarPosition);
×
1799
}
×
1800

1801
void ConfigurationDialog::populateTooltips()
×
1802
{
1803
        ui->checkBoxProperMotion->setToolTip(QString("<p>%1</p>").arg(q_("Annual proper motion (stars) or hourly motion (solar system objects)")));
×
1804
        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.")));
×
1805
}
×
1806

1807
void ConfigurationDialog::updateTabBarListWidgetWidth()
×
1808
{
1809
        ui->stackListWidget->setWrapping(false);
×
1810

1811
        // Update list item sizes after translation
1812
        ui->stackListWidget->adjustSize();
×
1813

1814
        QAbstractItemModel* model = ui->stackListWidget->model();
×
1815
        if (!model)
×
1816
                return;
×
1817

1818
        // stackListWidget->font() does not work properly!
1819
        // It has a incorrect fontSize in the first loading, which produces the bug#995107.
1820
        QFont font;
×
1821
        font.setPixelSize(14);
×
1822
        font.setWeight(QFont::Bold);
×
1823
        QFontMetrics fontMetrics(font);
×
1824

1825
        int iconSize = ui->stackListWidget->iconSize().width();
×
1826

1827
        int width = 0;
×
1828
        for (int row = 0; row < model->rowCount(); row++)
×
1829
        {
1830
                int textWidth = fontMetrics.boundingRect(ui->stackListWidget->item(row)->text()).width();
×
1831
                width += iconSize > textWidth ? iconSize : textWidth; // use the wider one
×
1832
                width += 24; // margin - 12px left and 12px right
×
1833
        }
1834

1835
        // Hack to force the window to be resized...
1836
        ui->stackListWidget->setMinimumWidth(width);
×
1837
        ui->stackListWidget->updateGeometry();
×
1838
}
×
1839

1840
void ConfigurationDialog::populateDeltaTAlgorithmsList()
×
1841
{
1842
        Q_ASSERT(ui->deltaTAlgorithmComboBox);
×
1843

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

1847
        ui->pushButtonCustomDeltaTEquationDialog->setFixedHeight(ui->deltaTAlgorithmComboBox->height());
×
1848

1849
        QComboBox* algorithms = ui->deltaTAlgorithmComboBox;
×
1850

1851
        //Save the current selection to be restored later
1852
        algorithms->blockSignals(true);
×
1853
        int index = algorithms->currentIndex();
×
1854
        QVariant selectedAlgorithmId = algorithms->itemData(index);
×
1855
        algorithms->clear();
×
1856
        //For each algorithm, display the localized name and store the key as user
1857
        //data. Unfortunately, there's no other way to do this than with a cycle.
1858
        algorithms->addItem(q_("Without correction"), "WithoutCorrection");
×
1859
        algorithms->addItem(q_("Schoch (1931)"), "Schoch");
×
1860
        algorithms->addItem(q_("Clemence (1948)"), "Clemence");
×
1861
        algorithms->addItem(q_("IAU (1952)"), "IAU");
×
1862
        algorithms->addItem(q_("Astronomical Ephemeris (1960)"), "AstronomicalEphemeris");
×
1863
        algorithms->addItem(q_("Tuckerman (1962, 1964) & Goldstine (1973)"), "TuckermanGoldstine");
×
1864
        algorithms->addItem(q_("Muller & Stephenson (1975)"), "MullerStephenson");
×
1865
        algorithms->addItem(q_("Stephenson (1978)"), "Stephenson1978");
×
1866
        algorithms->addItem(q_("Schmadel & Zech (1979)"), "SchmadelZech1979");
×
1867
        algorithms->addItem(q_("Morrison & Stephenson (1982)"), "MorrisonStephenson1982");
×
1868
        algorithms->addItem(q_("Stephenson & Morrison (1984)"), "StephensonMorrison1984");
×
1869
        algorithms->addItem(q_("Stephenson & Houlden (1986)"), "StephensonHoulden");
×
1870
        algorithms->addItem(q_("Espenak (1987, 1989)"), "Espenak");
×
1871
        algorithms->addItem(q_("Borkowski (1988)"), "Borkowski");
×
1872
        algorithms->addItem(q_("Schmadel & Zech (1988)"), "SchmadelZech1988");
×
1873
        algorithms->addItem(q_("Chapront-Touze & Chapront (1991)"), "ChaprontTouze");        
×
1874
        algorithms->addItem(q_("Stephenson & Morrison (1995)"), "StephensonMorrison1995");
×
1875
        algorithms->addItem(q_("Stephenson (1997)"), "Stephenson1997");
×
1876
        // The dropdown label is too long for the string, and Meeus 1998 is very popular, this should be in the beginning of the tag.
1877
        algorithms->addItem(q_("Meeus (1998) (with Chapront, Chapront-Touze & Francou (1997))"), "ChaprontMeeus");
×
1878
        algorithms->addItem(q_("JPL Horizons"), "JPLHorizons");        
×
1879
        algorithms->addItem(q_("Meeus & Simons (2000)"), "MeeusSimons");
×
1880
        algorithms->addItem(q_("Montenbruck & Pfleger (2000)"), "MontenbruckPfleger");
×
1881
        algorithms->addItem(q_("Reingold & Dershowitz (2002, 2007, 2018)"), "ReingoldDershowitz");
×
1882
        algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "MorrisonStephenson2004");
×
1883
        algorithms->addItem(q_("Espenak & Meeus (2006)"), "EspenakMeeus");
×
1884
        // GZ: I want to try out some things. Something is still wrong with eclipses, see lp:1275092.
1885
        #ifndef NDEBUG
1886
        algorithms->addItem(q_("Espenak & Meeus (2006) no extra moon acceleration"), "EspenakMeeusZeroMoonAccel");
×
1887
        #endif
1888
        // Modified Espenak & Meeus (2006) used by default
1889
        algorithms->addItem(q_("Modified Espenak & Meeus (2006, 2022)").append(" *"), "EspenakMeeusModified");
×
1890
        algorithms->addItem(q_("Reijs (2006)"), "Reijs");
×
1891
        algorithms->addItem(q_("Banjevic (2006)"), "Banjevic");
×
1892
        algorithms->addItem(q_("Islam, Sadiq & Qureshi (2008, 2013)"), "IslamSadiqQureshi");
×
1893
        algorithms->addItem(q_("Khalid, Sultana & Zaidi (2014)"), "KhalidSultanaZaidi");
×
1894
        algorithms->addItem(q_("Stephenson, Morrison & Hohenkerk (2016, 2021)"), "StephensonMorrisonHohenkerk2016");
×
1895
        algorithms->addItem(q_("Henriksson (2017)"), "Henriksson2017");
×
1896
        algorithms->addItem(q_("Custom equation of %1T").arg(QChar(0x0394)), "Custom");
×
1897

1898
        //Restore the selection
1899
        index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::MatchCaseSensitive);
×
1900
        algorithms->setCurrentIndex(index);
×
1901
        //algorithms->model()->sort(0);
1902
        algorithms->blockSignals(false);
×
1903
        setDeltaTAlgorithmDescription();
×
1904
}
×
1905

1906
void ConfigurationDialog::setDeltaTAlgorithm(int algorithmID)
×
1907
{
1908
        StelCore* core = StelApp::getInstance().getCore();
×
1909
        QString currentAlgorithm = ui->deltaTAlgorithmComboBox->itemData(algorithmID).toString();
×
1910
        core->setCurrentDeltaTAlgorithmKey(currentAlgorithm);
×
1911
        setDeltaTAlgorithmDescription();
×
1912
        if (currentAlgorithm.contains("Custom"))
×
1913
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(true);
×
1914
        else
1915
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(false);
×
1916
}
×
1917

1918
void ConfigurationDialog::setDeltaTAlgorithmDescription()
×
1919
{
1920
        ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1921
        ui->deltaTAlgorithmDescription->setHtml(StelApp::getInstance().getCore()->getCurrentDeltaTAlgorithmDescription());
×
1922
}
×
1923

1924
void ConfigurationDialog::showCustomDeltaTEquationDialog()
×
1925
{
1926
        if (customDeltaTEquationDialog == Q_NULLPTR)
×
1927
                customDeltaTEquationDialog = new CustomDeltaTEquationDialog();
×
1928

1929
        customDeltaTEquationDialog->setVisible(true);
×
1930
}
×
1931

1932
void ConfigurationDialog::showConfigureScreenshotsDialog()
×
1933
{
1934
        if (configureScreenshotsDialog == Q_NULLPTR)
×
1935
                configureScreenshotsDialog = new ConfigureScreenshotsDialog();
×
1936

1937
        configureScreenshotsDialog->setVisible(true);
×
1938
}
×
1939

1940
void ConfigurationDialog::populateDateFormatsList()
×
1941
{
1942
        Q_ASSERT(ui->dateFormatsComboBox);
×
1943

1944
        QComboBox* dfmts = ui->dateFormatsComboBox;
×
1945

1946
        //Save the current selection to be restored later
1947
        dfmts->blockSignals(true);
×
1948
        int index = dfmts->currentIndex();
×
1949
        QVariant selectedDateFormat = dfmts->itemData(index);
×
1950
        dfmts->clear();
×
1951
        //For each format, display the localized name and store the key as user data.
1952
        dfmts->addItem(q_("System default"), "system_default");
×
1953
        dfmts->addItem(q_("yyyy-mm-dd (ISO 8601)"), "yyyymmdd");
×
1954
        dfmts->addItem(q_("dd-mm-yyyy"), "ddmmyyyy");
×
1955
        dfmts->addItem(q_("mm-dd-yyyy"), "mmddyyyy");
×
1956
        dfmts->addItem(q_("ww, yyyy-mm-dd"), "wwyyyymmdd");
×
1957
        dfmts->addItem(q_("ww, dd-mm-yyyy"), "wwddmmyyyy");
×
1958
        dfmts->addItem(q_("ww, mm-dd-yyyy"), "wwmmddyyyy");
×
1959
        //Restore the selection
1960
        index = dfmts->findData(selectedDateFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
1961
        dfmts->setCurrentIndex(index);
×
1962
        dfmts->blockSignals(false);
×
1963
}
×
1964

1965
void ConfigurationDialog::setDateFormat()
×
1966
{
1967
        QString selectedFormat = ui->dateFormatsComboBox->itemData(ui->dateFormatsComboBox->currentIndex()).toString();
×
1968

1969
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1970
        if (selectedFormat == localeManager.getDateFormatStr())
×
1971
                return;
×
1972

1973
        localeManager.setDateFormatStr(selectedFormat);        
×
1974
}
×
1975

1976
void ConfigurationDialog::populateTimeFormatsList()
×
1977
{
1978
        Q_ASSERT(ui->timeFormatsComboBox);
×
1979

1980
        QComboBox* tfmts = ui->timeFormatsComboBox;
×
1981

1982
        //Save the current selection to be restored later
1983
        tfmts->blockSignals(true);
×
1984
        int index = tfmts->currentIndex();
×
1985
        QVariant selectedTimeFormat = tfmts->itemData(index);
×
1986
        tfmts->clear();
×
1987
        //For each format, display the localized name and store the key as user
1988
        //data. Unfortunately, there's no other way to do this than with a cycle.
1989
        tfmts->addItem(q_("System default"), "system_default");
×
1990
        tfmts->addItem(q_("12-hour format"), "12h");
×
1991
        tfmts->addItem(q_("24-hour format"), "24h");
×
1992

1993
        //Restore the selection
1994
        index = tfmts->findData(selectedTimeFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
1995
        tfmts->setCurrentIndex(index);
×
1996
        tfmts->blockSignals(false);
×
1997
}
×
1998

1999
void ConfigurationDialog::setTimeFormat()
×
2000
{
2001
        QString selectedFormat = ui->timeFormatsComboBox->itemData(ui->timeFormatsComboBox->currentIndex()).toString();
×
2002

2003
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2004
        if (selectedFormat == localeManager.getTimeFormatStr())
×
2005
                return;
×
2006

2007
        localeManager.setTimeFormatStr(selectedFormat);        
×
2008
}
×
2009

2010
void ConfigurationDialog::populateDitherList()
×
2011
{
2012
        Q_ASSERT(ui->ditheringComboBox);
×
2013
        QComboBox* ditherCombo = ui->ditheringComboBox;
×
2014

2015
        ditherCombo->blockSignals(true);
×
2016
        ditherCombo->clear();
×
2017
        ditherCombo->addItem(qc_("None","disabled"), "disabled");
×
2018
        ditherCombo->addItem(q_("5/6/5 bits"), "color565");
×
2019
        ditherCombo->addItem(q_("6/6/6 bits"), "color666");
×
2020
        ditherCombo->addItem(q_("8/8/8 bits"), "color888");
×
2021
        ditherCombo->addItem(q_("10/10/10 bits"), "color101010");
×
2022

2023
        // show current setting
2024
        QSettings* conf = StelApp::getInstance().getSettings();
×
2025
        Q_ASSERT(conf);
×
2026
        QVariant selectedDitherFormat = conf->value("video/dithering_mode", "disabled");
×
2027

2028
        int index = ditherCombo->findData(selectedDitherFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2029
        ditherCombo->setCurrentIndex(index);
×
2030
        ditherCombo->blockSignals(false);
×
2031
}
×
2032

2033
void ConfigurationDialog::setDitherFormat()
×
2034
{
2035
        QString selectedFormat = ui->ditheringComboBox->itemData(ui->ditheringComboBox->currentIndex()).toString();
×
2036

2037
        QSettings* conf = StelApp::getInstance().getSettings();
×
2038
        Q_ASSERT(conf);
×
2039
        conf->setValue("video/dithering_mode", selectedFormat);
×
2040
        conf->sync();
×
2041

2042
        const auto core = StelApp::getInstance().getCore();
×
2043
        Q_ASSERT(core);
×
2044
        core->setDitheringMode(selectedFormat);
×
2045
}
×
2046

2047
void ConfigurationDialog::populateFontWritingSystemCombo()
×
2048
{
2049
        QComboBox *combo=ui->fontWritingSystemComboBox;
×
2050
        QFontDatabase fontDatabase;
×
2051
        const QList<QFontDatabase::WritingSystem> writingSystems=fontDatabase.writingSystems();
×
2052
                for (const auto& system : writingSystems)
×
2053
                {
2054
                        combo->addItem(QFontDatabase::writingSystemName(system) + "  " + QFontDatabase::writingSystemSample(system), system);
×
2055
                }
2056
}
×
2057

2058
void ConfigurationDialog::handleFontBoxWritingSystem(int index)
×
2059
{
2060
        Q_UNUSED(index)
2061
        QComboBox *sender=dynamic_cast<QComboBox *>(QObject::sender());
×
2062
        ui->fontComboBox->setWritingSystem(static_cast<QFontDatabase::WritingSystem>(sender->currentData().toInt()));
×
2063
}
×
2064

2065
void ConfigurationDialog::populateScreenshotFileformatsCombo()
×
2066
{
2067
        QComboBox *combo=ui->screenshotFileFormatComboBox;
×
2068
        // To avoid platform differences, just ask what's available.
2069
        // However, wbmp seems broken, disable it and a few unnecessary formats
2070
        const QList<QByteArray> formats = QImageWriter::supportedImageFormats();
×
2071
        for (const auto& format : formats)
×
2072
        {
2073
                if ((format != "icns") && (format != "cur") && (format != "wbmp"))
×
2074
                        combo->addItem(QString(format));
×
2075
        }
2076
        combo->setCurrentText(StelApp::getInstance().getStelPropertyManager()->getStelPropertyValue("MainView.screenShotFormat").toString()); // maybe not required.
×
2077
}
×
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