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

Stellarium / stellarium / 5770622832

pending completion
5770622832

Pull #3348

github

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

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

14813 of 124420 relevant lines covered (11.91%)

27935.46 hits per line

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

0.0
/src/gui/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
        connectBoolProperty(ui->startupTimeStopCheckBox, "StelCore.startupTimeStop");
×
271

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

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

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

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

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

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

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

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

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

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

368
        // Dithering
369
        populateDitherList();
×
370
        connect(ui->ditheringComboBox, SIGNAL(currentIndexChanged(const int)), this, SLOT(setDitherFormat()));
×
371

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

377
        // Screenshots
378
        populateScreenshotFileformatsCombo();
×
379
        connect(ui->pushButtonConfigureScreenshotsDialog, SIGNAL(clicked()), this, SLOT(showConfigureScreenshotsDialog()));
×
380
        connectStringProperty(ui->screenshotFileFormatComboBox, "MainView.screenShotFormat");
×
381
        ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir());
×
382
        connect(ui->screenshotDirEdit, SIGNAL(editingFinished()), this, SLOT(selectScreenshotDir()));
×
383
        connect(ui->screenshotBrowseButton, SIGNAL(clicked()), this, SLOT(browseForScreenshotDir()));
×
384
        connectBoolProperty(ui->invertScreenShotColorsCheckBox, "MainView.flagInvertScreenShotColors");
×
385
        connectBoolProperty(ui->useCustomScreenshotSizeCheckBox, "MainView.flagUseCustomScreenshotSize");
×
386
        ui->customScreenshotWidthLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
387
        ui->customScreenshotHeightLineEdit->setValidator(new MinMaxIntValidator(128, 16384, this));
×
388
        connectIntProperty(ui->customScreenshotWidthLineEdit, "MainView.customScreenshotWidth");
×
389
        connectIntProperty(ui->customScreenshotHeightLineEdit, "MainView.customScreenshotHeight");
×
390
        connectIntProperty(ui->dpiSpinBox, "MainView.screenshotDpi");
×
391
        StelMainView *mainView=static_cast<StelMainView *>(StelApp::getInstance().parent());
×
392
        connect(mainView, SIGNAL(screenshotDpiChanged(int)), this, SLOT(updateDpiTooltip()));
×
393
        connect(mainView, SIGNAL(flagUseCustomScreenshotSizeChanged(bool)), this, SLOT(updateDpiTooltip()));
×
394
        connect(mainView, SIGNAL(customScreenshotWidthChanged(int)), this, SLOT(updateDpiTooltip()));
×
395
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
396
        connect(mainView, SIGNAL(customScreenshotHeightChanged(int)), this, SLOT(updateDpiTooltip()));
×
397
        connect(mainView, SIGNAL(sizeChanged(const QSize&)), this, SLOT(updateDpiTooltip()));
×
398
        updateDpiTooltip();
×
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("viewing/flag_orbits_with_moons",                propMgr->getStelPropertyValue("SolarSystem.flagOrbitsWithMoons").toBool());
×
879
        conf->setValue("astro/flag_light_travel_time",                        propMgr->getStelPropertyValue("SolarSystem.flagLightTravelTime").toBool());
×
880
        conf->setValue("viewing/flag_draw_moon_halo",                        propMgr->getStelPropertyValue("SolarSystem.flagDrawMoonHalo").toBool());
×
881
        conf->setValue("viewing/flag_draw_sun_halo",                        propMgr->getStelPropertyValue("SolarSystem.flagDrawSunHalo").toBool());
×
882
        conf->setValue("viewing/flag_draw_sun_corona",                        propMgr->getStelPropertyValue("SolarSystem.flagPermanentSolarCorona").toBool());
×
883
        conf->setValue("viewing/flag_moon_scaled",                                propMgr->getStelPropertyValue("SolarSystem.flagMoonScale").toBool());
×
884
        conf->setValue("viewing/moon_scale",                                        QString::number(propMgr->getStelPropertyValue("SolarSystem.moonScale").toDouble(), 'f', 2));
×
885
        conf->setValue("viewing/flag_minorbodies_scaled",                propMgr->getStelPropertyValue("SolarSystem.flagMinorBodyScale").toBool());
×
886
        conf->setValue("viewing/minorbodies_scale",                        QString::number(propMgr->getStelPropertyValue("SolarSystem.minorBodyScale").toDouble(), 'f', 2));
×
887
        conf->setValue("viewing/flag_planets_scaled",                        propMgr->getStelPropertyValue("SolarSystem.flagPlanetScale").toBool());
×
888
        conf->setValue("viewing/planets_scale",                                QString::number(propMgr->getStelPropertyValue("SolarSystem.planetScale").toDouble(), 'f', 2));
×
889
        conf->setValue("viewing/flag_sun_scaled",                                propMgr->getStelPropertyValue("SolarSystem.flagSunScale").toBool());
×
890
        conf->setValue("viewing/sun_scale",                                        QString::number(propMgr->getStelPropertyValue("SolarSystem.sunScale").toDouble(), 'f', 2));
×
891
        conf->setValue("astro/meteor_zhr",                                        propMgr->getStelPropertyValue("SporadicMeteorMgr.zhr").toInt());
×
892
        conf->setValue("astro/flag_milky_way",                                        propMgr->getStelPropertyValue("MilkyWay.flagMilkyWayDisplayed").toBool());
×
893
        conf->setValue("astro/milky_way_intensity",                                QString::number(propMgr->getStelPropertyValue("MilkyWay.intensity").toDouble(), 'f', 2));
×
894
        conf->setValue("astro/milky_way_saturation",                        QString::number(propMgr->getStelPropertyValue("MilkyWay.saturation").toDouble(), 'f', 2));
×
895
        conf->setValue("astro/flag_zodiacal_light",                                propMgr->getStelPropertyValue("ZodiacalLight.flagZodiacalLightDisplayed").toBool());
×
896
        conf->setValue("astro/zodiacal_light_intensity",                        QString::number(propMgr->getStelPropertyValue("ZodiacalLight.intensity").toDouble(), 'f', 2));
×
897
        conf->setValue("astro/grs_longitude",                                        propMgr->getStelPropertyValue("SolarSystem.grsLongitude").toInt());
×
898
        conf->setValue("astro/grs_drift",                                                propMgr->getStelPropertyValue("SolarSystem.grsDrift").toDouble());
×
899
        conf->setValue("astro/grs_jd",                                                propMgr->getStelPropertyValue("SolarSystem.grsJD").toDouble());
×
900
        conf->setValue("astro/shadow_enlargement_danjon",                propMgr->getStelPropertyValue("SolarSystem.earthShadowEnlargementDanjon").toBool());
×
901
        conf->setValue("astro/flag_planets_labels",                                propMgr->getStelPropertyValue("SolarSystem.labelsDisplayed").toBool());
×
902
        conf->setValue("astro/labels_amount",                                        propMgr->getStelPropertyValue("SolarSystem.labelsAmount").toDouble());
×
903
        conf->setValue("viewing/flag_planets_native_names",                propMgr->getStelPropertyValue("SolarSystem.flagNativePlanetNames").toBool());
×
904
        conf->setValue("astro/flag_use_obj_models",                        propMgr->getStelPropertyValue("SolarSystem.flagUseObjModels").toBool());
×
905
        conf->setValue("astro/flag_show_obj_self_shadows",                propMgr->getStelPropertyValue("SolarSystem.flagShowObjSelfShadows").toBool());
×
906
        conf->setValue("astro/apparent_magnitude_algorithm",                Planet::getApparentMagnitudeAlgorithmString());
×
907
        conf->setValue("astro/flag_planets_nomenclature",                propMgr->getStelPropertyValue("NomenclatureMgr.flagShowNomenclature").toBool());
×
908
        conf->setValue("astro/flag_hide_local_nomenclature",                propMgr->getStelPropertyValue("NomenclatureMgr.flagHideLocalNomenclature").toBool());
×
909
        conf->setValue("astro/flag_special_nomenclature_only",                propMgr->getStelPropertyValue("NomenclatureMgr.specialNomenclatureOnlyDisplayed").toBool());
×
910
        conf->setValue("astro/flag_planets_nomenclature_terminator_only",propMgr->getStelPropertyValue("NomenclatureMgr.flagShowTerminatorZoneOnly").toBool());
×
911
        conf->setValue("astro/planet_nomenclature_solar_altitude_min",        propMgr->getStelPropertyValue("NomenclatureMgr.terminatorMinAltitude").toInt());
×
912
        conf->setValue("astro/planet_nomenclature_solar_altitude_max",        propMgr->getStelPropertyValue("NomenclatureMgr.terminatorMaxAltitude").toInt());
×
913

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

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

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

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

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

1057
        // view dialog / DSO tag settings
1058
        nmgr->storeCatalogFilters();
×
1059

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

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

1098
        // view dialog / starlore tab
1099
        QObject* scmgr = reinterpret_cast<QObject*>(&StelApp::getInstance().getSkyCultureMgr());
×
1100
        scmgr->setProperty("defaultSkyCultureID", scmgr->property("currentSkyCultureID"));
×
1101

1102
        // Save default location
1103
        core->setDefaultLocationID(core->getCurrentLocation().getID());
×
1104

1105
        // configuration dialog / main tab
1106
        QString langName = StelApp::getInstance().getLocaleMgr().getAppLanguage();
×
1107
        conf->setValue("localization/app_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
1108
        langName = StelApp::getInstance().getLocaleMgr().getSkyLanguage();
×
1109
        conf->setValue("localization/sky_locale", StelTranslator::nativeNameToIso639_1Code(langName));
×
1110

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

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

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

1170
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1171
        conf->setValue("localization/time_display_format",        localeManager.getTimeFormatStr());
×
1172
        conf->setValue("localization/date_display_format",        localeManager.getDateFormatStr());
×
1173

1174
        // configuration dialog / tools tab
1175
        conf->setValue("gui/flag_show_flip_buttons",                        propMgr->getStelPropertyValue("StelGui.flagShowFlipButtons").toBool());
×
1176
        conf->setValue("video/viewport_effect",                                StelApp::getInstance().getViewportEffect());
×
1177

1178
        conf->setValue("projection/viewport",                                StelProjector::maskTypeToString(proj->getMaskType()));
×
1179
        conf->setValue("projection/viewport_center_offset_x",                core->getCurrentStelProjectorParams().viewportCenterOffset[0]);
×
1180
        conf->setValue("projection/viewport_center_offset_y",                core->getCurrentStelProjectorParams().viewportCenterOffset[1]);
×
1181
        conf->setValue("projection/flip_horz",                                core->getCurrentStelProjectorParams().flipHorz);
×
1182
        conf->setValue("projection/flip_vert",                                core->getCurrentStelProjectorParams().flipVert);
×
1183
        conf->setValue("navigation/max_fov",                                mvmgr->getUserMaxFov());
×
1184

1185
        conf->setValue("viewing/flag_gravity_labels",                        proj->getFlagGravityLabels());
×
1186
        conf->setValue("navigation/auto_zoom_out_resets_direction",        mvmgr->getFlagAutoZoomOutResetsDirection());
×
1187

1188
        conf->setValue("gui/flag_mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.flagCursorTimeout").toBool());
×
1189
        conf->setValue("gui/mouse_cursor_timeout",                        propMgr->getStelPropertyValue("MainView.cursorTimeout").toFloat());
×
1190
        conf->setValue("gui/base_font_name",                                QGuiApplication::font().family());
×
1191
        conf->setValue("gui/screen_font_size",                                propMgr->getStelPropertyValue("StelApp.screenFontSize").toInt());
×
1192
        conf->setValue("gui/gui_font_size",                                propMgr->getStelPropertyValue("StelApp.guiFontSize").toInt());
×
1193

1194
        conf->setValue("video/minimum_fps",                                propMgr->getStelPropertyValue("MainView.minFps").toInt());
×
1195
        conf->setValue("video/maximum_fps",                                propMgr->getStelPropertyValue("MainView.maxFps").toInt());
×
1196

1197
        conf->setValue("main/screenshot_dir",                                StelFileMgr::getScreenshotDir());
×
1198
        conf->setValue("main/invert_screenshots_colors",                propMgr->getStelPropertyValue("MainView.flagInvertScreenShotColors").toBool());
×
1199
        conf->setValue("main/screenshot_datetime_filename",                propMgr->getStelPropertyValue("MainView.flagScreenshotDateFileName").toBool());
×
1200
        conf->setValue("main/screenshot_datetime_filemask",                propMgr->getStelPropertyValue("MainView.screenShotFileMask").toString());
×
1201
        conf->setValue("main/screenshot_custom_size",                        propMgr->getStelPropertyValue("MainView.flagUseCustomScreenshotSize").toBool());
×
1202
        conf->setValue("main/screenshot_custom_width",                        propMgr->getStelPropertyValue("MainView.customScreenshotWidth").toInt());
×
1203
        conf->setValue("main/screenshot_custom_height",                        propMgr->getStelPropertyValue("MainView.customScreenshotHeight").toInt());
×
1204

1205
        QWidget& mainWindow = StelMainView::getInstance();
×
1206
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
1207
        QScreen *mainScreen = mainWindow.windowHandle()->screen();
1208
        int screenNum=qApp->screens().indexOf(mainScreen);
1209
#else
1210
        int screenNum = qApp->desktop()->screenNumber(&StelMainView::getInstance());
×
1211
#endif
1212
        conf->setValue("video/screen_number", screenNum);
×
1213

1214
        // full screen and window size
1215
        conf->setValue("video/fullscreen", StelMainView::getInstance().isFullScreen());
×
1216
        if (!StelMainView::getInstance().isFullScreen())
×
1217
        {
1218
                QRect screenGeom = QGuiApplication::screens().at(screenNum)->geometry();
×
1219

1220
                conf->setValue("video/screen_w", int(std::lround(mainWindow.size().width() * mainWindow.devicePixelRatio())));
×
1221
                conf->setValue("video/screen_h", int(std::lround(mainWindow.size().height() * mainWindow.devicePixelRatio())));
×
1222
                conf->setValue("video/screen_x", int(std::lround((mainWindow.x() - screenGeom.x()) * mainWindow.devicePixelRatio())));
×
1223
                conf->setValue("video/screen_y", int(std::lround((mainWindow.y() - screenGeom.y()) * mainWindow.devicePixelRatio())));
×
1224
        }
1225

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

1229
        updateConfigLabels();
×
1230

1231
        emit core->configurationDataSaved();
×
1232
}
×
1233

1234
void ConfigurationDialog::updateConfigLabels()
×
1235
{
1236
        ui->startupFOVLabel->setText(q_("Startup FOV: %1%2").arg(StelApp::getInstance().getCore()->getMovementMgr()->getCurrentFov()).arg(QChar(0x00B0)));
×
1237

1238
        double az, alt;
1239
        const Vec3d& v = GETSTELMODULE(StelMovementMgr)->getInitViewingDirection();
×
1240
        StelUtils::rectToSphe(&az, &alt, v);
×
1241
        az = 3.*M_PI - az;  // N is zero, E is 90 degrees
×
1242
        if (az > M_PI*2)
×
1243
                az -= M_PI*2;
×
1244
        ui->startupDirectionOfViewlabel->setText(q_("Startup direction of view Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)));
×
1245
}
×
1246

1247
void ConfigurationDialog::setDefaultViewOptions()
×
1248
{
1249
        if (askConfirmation())
×
1250
        {
1251
                qDebug() << "Restore defaults...";
×
1252
                QSettings* conf = StelApp::getInstance().getSettings();
×
1253
                Q_ASSERT(conf);
×
1254

1255
                conf->setValue("main/restore_defaults", true);
×
1256
                // reset all stored panel locations
1257
                conf->beginGroup("DialogPositions");
×
1258
                conf->remove("");
×
1259
                conf->endGroup();
×
1260
        }
1261
        else
1262
                qDebug() << "Restore defaults is canceled...";
×
1263
}
×
1264

1265
void ConfigurationDialog::populatePluginsList()
×
1266
{
1267
        QListWidget *plugins = ui->pluginsListWidget;
×
1268
        plugins->blockSignals(true);
×
1269
        int currentRow = plugins->currentRow();
×
1270
        QString selectedPluginId = "";
×
1271
        if (currentRow>0)
×
1272
                 selectedPluginId = plugins->currentItem()->data(Qt::UserRole).toString();
×
1273

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

1290
        if (!selectedPluginName.isEmpty())
×
1291
                plugins->setCurrentItem(plugins->findItems(selectedPluginName, Qt::MatchExactly).at(0));
×
1292
        else
1293
                plugins->setCurrentRow(0);
×
1294
}
×
1295

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

1338
void ConfigurationDialog::pluginConfigureCurrentSelection()
×
1339
{
1340
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1341
        if (id.isEmpty())
×
1342
                return;
×
1343

1344
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1345
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1346
        for (const auto& desc : pluginsList)
×
1347
        {
1348
                if (id == desc.info.id)
×
1349
                {
1350
                        StelModule* pmod = moduleMgr.getModule(desc.info.id, QObject::sender()->objectName()=="pluginsListWidget");
×
1351
                        if (pmod != Q_NULLPTR)
×
1352
                        {
1353
                                pmod->configureGui(true);
×
1354
                        }
1355
                        return;
×
1356
                }
1357
        }
1358
}
×
1359

1360
void ConfigurationDialog::loadAtStartupChanged(int state)
×
1361
{
1362
        if (ui->pluginsListWidget->count() <= 0)
×
1363
                return;
×
1364

1365
        QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole).toString();
×
1366
        StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
×
1367
        const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr.getPluginsList();
×
1368
        for (const auto& desc : pluginsList)
×
1369
        {
1370
                if (id == desc.info.id)
×
1371
                {
1372
                        moduleMgr.setPluginLoadAtStartup(id, state == Qt::Checked);
×
1373
                        break;
×
1374
                }
1375
        }
1376
}
×
1377

1378
#ifdef ENABLE_SCRIPTING
1379
void ConfigurationDialog::populateScriptsList(void)
×
1380
{
1381
        QListWidget *scripts = ui->scriptListWidget;
×
1382
        scripts->blockSignals(true);
×
1383
        int currentRow = scripts->currentRow();
×
1384
        QString selectedScriptId = "";
×
1385
        if (currentRow>0)
×
1386
                selectedScriptId = scripts->currentItem()->data(Qt::DisplayRole).toString();
×
1387

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

1403
void ConfigurationDialog::scriptSelectionChanged(const QString& s)
×
1404
{
1405
        if (s.isEmpty())
×
1406
                return;        
×
1407
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();        
×
1408
        //ui->scriptInfoBrowser->document()->setDefaultStyleSheet(QString(StelApp::getInstance().getCurrentStelStyle()->htmlStyleSheet));
1409
        QString html = scriptMgr.getHtmlDescription(s);
×
1410
        ui->scriptInfoBrowser->setHtml(html);        
×
1411
}
×
1412

1413
void ConfigurationDialog::runScriptClicked(void)
×
1414
{
1415
        if (ui->closeWindowAtScriptRunCheckbox->isChecked())
×
1416
                this->close();
×
1417
        StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
×
1418
        if (ui->scriptListWidget->currentItem())
×
1419
        {
1420
                scriptMgr.runScript(ui->scriptListWidget->currentItem()->text());
×
1421
        }        
1422
}
×
1423

1424
void ConfigurationDialog::stopScriptClicked(void)
×
1425
{
1426
        StelApp::getInstance().getScriptMgr().stopScript();
×
1427
}
×
1428

1429
void ConfigurationDialog::aScriptIsRunning(void)
×
1430
{        
1431
        ui->scriptStatusLabel->setText(q_("Running script: ") + StelApp::getInstance().getScriptMgr().runningScriptId());
×
1432
        ui->runScriptButton->setEnabled(false);
×
1433
        ui->stopScriptButton->setEnabled(true);        
×
1434
}
×
1435

1436
void ConfigurationDialog::aScriptHasStopped(void)
×
1437
{
1438
        ui->scriptStatusLabel->setText(q_("Running script: [none]"));
×
1439
        ui->runScriptButton->setEnabled(true);
×
1440
        ui->stopScriptButton->setEnabled(false);
×
1441
}
×
1442
#endif
1443

1444

1445
void ConfigurationDialog::setFixedDateTimeToCurrent(void)
×
1446
{
1447
        StelCore* core = StelApp::getInstance().getCore();
×
1448
        double JD = core->getJD();
×
1449
        ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+core->getUTCOffset(JD)/24, Qt::LocalTime));
×
1450
        ui->fixedTimeRadio->setChecked(true);
×
1451
        setStartupTimeMode();
×
1452
}
×
1453

1454

1455
void ConfigurationDialog::resetStarCatalogControls()
×
1456
{
1457
        const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatalogsDescription();
×
1458
        nextStarCatalogToDownload.clear();
×
1459
        int idx=0;
×
1460
        for (const auto& catV : catalogConfig)
×
1461
        {
1462
                ++idx;
×
1463
                const QVariantMap& m = catV.toMap();
×
1464
                const bool checked = m.value("checked").toBool();
×
1465
                if (checked)
×
1466
                        continue;
×
1467
                nextStarCatalogToDownload=m;
×
1468
                break;
×
1469
        }
×
1470

1471
        ui->downloadCancelButton->setVisible(false);
×
1472
        ui->downloadRetryButton->setVisible(false);
×
1473

1474
        if (idx > catalogConfig.size() && !hasDownloadedStarCatalog)
×
1475
        {
1476
                ui->getStarsButton->setVisible(false);
×
1477
                updateStarCatalogControlsText();
×
1478
                return;
×
1479
        }
1480

1481
        ui->getStarsButton->setEnabled(true);
×
1482
        if (!nextStarCatalogToDownload.isEmpty())
×
1483
        {
1484
                nextStarCatalogToDownloadIndex = idx;
×
1485
                starCatalogsCount = catalogConfig.size();
×
1486
                updateStarCatalogControlsText();
×
1487
                ui->getStarsButton->setVisible(true);
×
1488
        }
1489
        else
1490
        {
1491
                updateStarCatalogControlsText();
×
1492
                ui->getStarsButton->setVisible(false);
×
1493
        }
1494
}
×
1495

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

1535
void ConfigurationDialog::cancelDownload(void)
×
1536
{
1537
        Q_ASSERT(currentDownloadFile);
×
1538
        Q_ASSERT(starCatalogDownloadReply);
×
1539
        qWarning() << "Aborting download";
×
1540
        starCatalogDownloadReply->abort();
×
1541
}
×
1542

1543
void ConfigurationDialog::newStarCatalogData()
×
1544
{
1545
        Q_ASSERT(currentDownloadFile);
×
1546
        Q_ASSERT(starCatalogDownloadReply);
×
1547
        Q_ASSERT(progressBar);
×
1548

1549
        // Ignore data from redirection.  (Not needed after Qt 5.6)
1550
        if (!starCatalogDownloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute).isNull())
×
1551
                return;
×
1552
        qint64 size = starCatalogDownloadReply->bytesAvailable();
×
1553
        progressBar->setValue(progressBar->getValue()+static_cast<int>(size/1024));
×
1554
        currentDownloadFile->write(starCatalogDownloadReply->read(size));
×
1555
}
1556

1557
void ConfigurationDialog::downloadStars()
×
1558
{
1559
        Q_ASSERT(!nextStarCatalogToDownload.isEmpty());
×
1560
        Q_ASSERT(!isDownloadingStarCatalog);
×
1561
        Q_ASSERT(starCatalogDownloadReply==Q_NULLPTR);
×
1562
        Q_ASSERT(currentDownloadFile==Q_NULLPTR);
×
1563
        Q_ASSERT(progressBar==Q_NULLPTR);
×
1564

1565
        QString path = StelFileMgr::getUserDir()+QString("/stars/default/")+nextStarCatalogToDownload.value("fileName").toString();
×
1566
        currentDownloadFile = new QFile(path);
×
1567
        if (!currentDownloadFile->open(QIODevice::WriteOnly))
×
1568
        {
1569
                qWarning() << "Can't open a writable file for storing new star catalog: " << QDir::toNativeSeparators(path);
×
1570
                currentDownloadFile->deleteLater();
×
1571
                currentDownloadFile = Q_NULLPTR;
×
1572
                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)));
×
1573
                ui->downloadRetryButton->setVisible(true);
×
1574
                return;
×
1575
        }
1576

1577
        isDownloadingStarCatalog = true;
×
1578
        updateStarCatalogControlsText();
×
1579
        ui->downloadCancelButton->setVisible(true);
×
1580
        ui->downloadRetryButton->setVisible(false);
×
1581
        ui->getStarsButton->setVisible(true);
×
1582
        ui->getStarsButton->setEnabled(false);
×
1583

1584
        QNetworkRequest req(nextStarCatalogToDownload.value("url").toString());
×
1585
        req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
×
1586
        req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false);
×
1587
        req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1());
×
1588
        starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
×
1589
        starCatalogDownloadReply->setReadBufferSize(1024*1024*2);        
×
1590
        connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
×
1591
        connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
×
1592
        connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
×
1593

1594
        progressBar = StelApp::getInstance().addProgressBar();
×
1595
        progressBar->setValue(0);
×
1596
        progressBar->setRange(0, static_cast<int>(nextStarCatalogToDownload.value("sizeMb").toDouble()*1024));
×
1597
        progressBar->setFormat(QString("%1: %p%").arg(nextStarCatalogToDownload.value("id").toString()));
×
1598

1599
        qDebug() << "Downloading file" << nextStarCatalogToDownload.value("url").toString();
×
1600
}
×
1601

1602
void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
×
1603
{
1604
        Q_ASSERT(currentDownloadFile);
×
1605
        Q_ASSERT(starCatalogDownloadReply);
×
1606

1607
        isDownloadingStarCatalog = false;
×
1608
        qWarning() << "Error downloading file" << starCatalogDownloadReply->url() << ": " << starCatalogDownloadReply->errorString();
×
1609
        ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextStarCatalogToDownload.value("id").toString(), starCatalogDownloadReply->errorString()));
×
1610
        ui->downloadCancelButton->setVisible(false);
×
1611
        ui->downloadRetryButton->setVisible(true);
×
1612
        ui->getStarsButton->setVisible(false);
×
1613
        ui->getStarsButton->setEnabled(true);
×
1614
}
×
1615

1616
void ConfigurationDialog::downloadFinished()
×
1617
{
1618
        Q_ASSERT(currentDownloadFile);
×
1619
        Q_ASSERT(starCatalogDownloadReply);
×
1620
        Q_ASSERT(progressBar);
×
1621

1622
        if (starCatalogDownloadReply->error()!=QNetworkReply::NoError)
×
1623
        {
1624
                starCatalogDownloadReply->deleteLater();
×
1625
                starCatalogDownloadReply = Q_NULLPTR;
×
1626
                currentDownloadFile->close();
×
1627
                currentDownloadFile->deleteLater();
×
1628
                currentDownloadFile = Q_NULLPTR;
×
1629
                StelApp::getInstance().removeProgressBar(progressBar);
×
1630
                progressBar=Q_NULLPTR;
×
1631
                return;
×
1632
        }
1633

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

1651
        Q_ASSERT(starCatalogDownloadReply->bytesAvailable()==0);
×
1652

1653
        isDownloadingStarCatalog = false;
×
1654
        currentDownloadFile->close();
×
1655
        currentDownloadFile->deleteLater();
×
1656
        currentDownloadFile = Q_NULLPTR;
×
1657
        starCatalogDownloadReply->deleteLater();
×
1658
        starCatalogDownloadReply = Q_NULLPTR;
×
1659
        StelApp::getInstance().removeProgressBar(progressBar);
×
1660
        progressBar=Q_NULLPTR;
×
1661

1662
        ui->downloadLabel->setText(q_("Verifying file integrity..."));
×
1663
        if (GETSTELMODULE(StarMgr)->checkAndLoadCatalog(nextStarCatalogToDownload)==false)
×
1664
        {
1665
                ui->getStarsButton->setVisible(false);
×
1666
                ui->downloadLabel->setText(q_("Error downloading %1:\nFile is corrupted.").arg(nextStarCatalogToDownload.value("id").toString()));
×
1667
                ui->downloadCancelButton->setVisible(false);
×
1668
                ui->downloadRetryButton->setVisible(true);
×
1669
        }
1670
        else
1671
        {
1672
                hasDownloadedStarCatalog = true;
×
1673
                ui->getStarsButton->setVisible(true);
×
1674
                ui->downloadCancelButton->setVisible(false);
×
1675
                ui->downloadRetryButton->setVisible(false);
×
1676
        }
1677

1678
        resetStarCatalogControls();
×
1679
}
×
1680

1681
void ConfigurationDialog::de430ButtonClicked()
×
1682
{
1683
        StelCore *core=StelApp::getInstance().getCore();
×
1684
        QSettings* conf = StelApp::getInstance().getSettings();
×
1685
        Q_ASSERT(conf);
×
1686

1687
        core->setDe430Active(!core->de430IsActive());
×
1688
        conf->setValue("astro/flag_use_de430", core->de430IsActive());
×
1689

1690
        resetEphemControls(); //refresh labels
×
1691
}
×
1692

1693
void ConfigurationDialog::de431ButtonClicked()
×
1694
{
1695
        StelCore *core=StelApp::getInstance().getCore();
×
1696
        QSettings* conf = StelApp::getInstance().getSettings();
×
1697
        Q_ASSERT(conf);
×
1698

1699
        core->setDe431Active(!core->de431IsActive());
×
1700
        conf->setValue("astro/flag_use_de431", core->de431IsActive());
×
1701

1702
        resetEphemControls(); //refresh labels
×
1703
}
×
1704

1705
void ConfigurationDialog::de440ButtonClicked()
×
1706
{
1707
        StelCore *core=StelApp::getInstance().getCore();
×
1708
        QSettings* conf = StelApp::getInstance().getSettings();
×
1709
        Q_ASSERT(conf);
×
1710

1711
        core->setDe440Active(!core->de440IsActive());
×
1712
        conf->setValue("astro/flag_use_de440", core->de440IsActive());
×
1713

1714
        resetEphemControls(); //refresh labels
×
1715
}
×
1716

1717
void ConfigurationDialog::de441ButtonClicked()
×
1718
{
1719
        StelCore *core=StelApp::getInstance().getCore();
×
1720
        QSettings* conf = StelApp::getInstance().getSettings();
×
1721
        Q_ASSERT(conf);
×
1722

1723
        core->setDe441Active(!core->de441IsActive());
×
1724
        conf->setValue("astro/flag_use_de441", core->de441IsActive());
×
1725

1726
        resetEphemControls(); //refresh labels
×
1727
}
×
1728

1729
void ConfigurationDialog::resetEphemControls()
×
1730
{
1731
        StelCore *core=StelApp::getInstance().getCore();
×
1732
        ui->de430checkBox->setEnabled(core->de430IsAvailable());
×
1733
        ui->de431checkBox->setEnabled(core->de431IsAvailable());
×
1734
        ui->de430checkBox->setChecked(core->de430IsActive());
×
1735
        ui->de431checkBox->setChecked(core->de431IsActive());
×
1736
        ui->de440checkBox->setEnabled(core->de440IsAvailable());
×
1737
        ui->de441checkBox->setEnabled(core->de441IsAvailable());
×
1738
        ui->de440checkBox->setChecked(core->de440IsActive());
×
1739
        ui->de441checkBox->setChecked(core->de441IsActive());
×
1740

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

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

1809
void ConfigurationDialog::populateTooltips()
×
1810
{
1811
        ui->checkBoxProperMotion->setToolTip(QString("<p>%1</p>").arg(q_("Annual proper motion (stars) or hourly motion (solar system objects)")));
×
1812
        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.")));
×
1813
}
×
1814

1815
void ConfigurationDialog::updateTabBarListWidgetWidth()
×
1816
{
1817
        ui->stackListWidget->setWrapping(false);
×
1818

1819
        // Update list item sizes after translation
1820
        ui->stackListWidget->adjustSize();
×
1821

1822
        QAbstractItemModel* model = ui->stackListWidget->model();
×
1823
        if (!model)
×
1824
                return;
×
1825

1826
        // stackListWidget->font() does not work properly!
1827
        // It has a incorrect fontSize in the first loading, which produces the bug#995107.
1828
        QFont font;
×
1829
        font.setPixelSize(14);
×
1830
        font.setWeight(QFont::Bold);
×
1831
        QFontMetrics fontMetrics(font);
×
1832

1833
        int iconSize = ui->stackListWidget->iconSize().width();
×
1834

1835
        int width = 0;
×
1836
        for (int row = 0; row < model->rowCount(); row++)
×
1837
        {
1838
                int textWidth = fontMetrics.boundingRect(ui->stackListWidget->item(row)->text()).width();
×
1839
                width += iconSize > textWidth ? iconSize : textWidth; // use the wider one
×
1840
                width += 24; // margin - 12px left and 12px right
×
1841
        }
1842

1843
        // Hack to force the window to be resized...
1844
        ui->stackListWidget->setMinimumWidth(width);
×
1845
        ui->stackListWidget->updateGeometry();
×
1846
}
×
1847

1848
void ConfigurationDialog::populateDeltaTAlgorithmsList()
×
1849
{
1850
        Q_ASSERT(ui->deltaTAlgorithmComboBox);
×
1851

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

1855
        ui->pushButtonCustomDeltaTEquationDialog->setFixedHeight(ui->deltaTAlgorithmComboBox->height());
×
1856

1857
        QComboBox* algorithms = ui->deltaTAlgorithmComboBox;
×
1858

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

1906
        //Restore the selection
1907
        index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::MatchCaseSensitive);
×
1908
        algorithms->setCurrentIndex(index);
×
1909
        //algorithms->model()->sort(0);
1910
        algorithms->blockSignals(false);
×
1911
        setDeltaTAlgorithmDescription();
×
1912
}
×
1913

1914
void ConfigurationDialog::setDeltaTAlgorithm(int algorithmID)
×
1915
{
1916
        StelCore* core = StelApp::getInstance().getCore();
×
1917
        QString currentAlgorithm = ui->deltaTAlgorithmComboBox->itemData(algorithmID).toString();
×
1918
        core->setCurrentDeltaTAlgorithmKey(currentAlgorithm);
×
1919
        setDeltaTAlgorithmDescription();
×
1920
        if (currentAlgorithm.contains("Custom"))
×
1921
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(true);
×
1922
        else
1923
                ui->pushButtonCustomDeltaTEquationDialog->setEnabled(false);
×
1924
}
×
1925

1926
void ConfigurationDialog::setDeltaTAlgorithmDescription()
×
1927
{
1928
        ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
1929
        ui->deltaTAlgorithmDescription->setHtml(StelApp::getInstance().getCore()->getCurrentDeltaTAlgorithmDescription());
×
1930
}
×
1931

1932
void ConfigurationDialog::showCustomDeltaTEquationDialog()
×
1933
{
1934
        if (customDeltaTEquationDialog == Q_NULLPTR)
×
1935
                customDeltaTEquationDialog = new CustomDeltaTEquationDialog();
×
1936

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

1940
void ConfigurationDialog::showConfigureScreenshotsDialog()
×
1941
{
1942
        if (configureScreenshotsDialog == Q_NULLPTR)
×
1943
                configureScreenshotsDialog = new ConfigureScreenshotsDialog();
×
1944

1945
        configureScreenshotsDialog->setVisible(true);
×
1946
}
×
1947

1948
void ConfigurationDialog::populateDateFormatsList()
×
1949
{
1950
        Q_ASSERT(ui->dateFormatsComboBox);
×
1951

1952
        QComboBox* dfmts = ui->dateFormatsComboBox;
×
1953

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

1973
void ConfigurationDialog::setDateFormat()
×
1974
{
1975
        QString selectedFormat = ui->dateFormatsComboBox->itemData(ui->dateFormatsComboBox->currentIndex()).toString();
×
1976

1977
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
1978
        if (selectedFormat == localeManager.getDateFormatStr())
×
1979
                return;
×
1980

1981
        localeManager.setDateFormatStr(selectedFormat);        
×
1982
}
×
1983

1984
void ConfigurationDialog::populateTimeFormatsList()
×
1985
{
1986
        Q_ASSERT(ui->timeFormatsComboBox);
×
1987

1988
        QComboBox* tfmts = ui->timeFormatsComboBox;
×
1989

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

2001
        //Restore the selection
2002
        index = tfmts->findData(selectedTimeFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2003
        tfmts->setCurrentIndex(index);
×
2004
        tfmts->blockSignals(false);
×
2005
}
×
2006

2007
void ConfigurationDialog::setTimeFormat()
×
2008
{
2009
        QString selectedFormat = ui->timeFormatsComboBox->itemData(ui->timeFormatsComboBox->currentIndex()).toString();
×
2010

2011
        StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
×
2012
        if (selectedFormat == localeManager.getTimeFormatStr())
×
2013
                return;
×
2014

2015
        localeManager.setTimeFormatStr(selectedFormat);        
×
2016
}
×
2017

2018
void ConfigurationDialog::populateDitherList()
×
2019
{
2020
        Q_ASSERT(ui->ditheringComboBox);
×
2021
        QComboBox* ditherCombo = ui->ditheringComboBox;
×
2022

2023
        ditherCombo->blockSignals(true);
×
2024
        ditherCombo->clear();
×
2025
        if(StelMainView::getInstance().getGLInformation().isHighGraphicsMode)
×
2026
        {
2027
                ditherCombo->addItem(qc_("None","disabled"), "disabled");
×
2028
                ditherCombo->addItem(q_("5/6/5 bits"), "color565");
×
2029
                ditherCombo->addItem(q_("6/6/6 bits"), "color666");
×
2030
                ditherCombo->addItem(q_("8/8/8 bits"), "color888");
×
2031
                ditherCombo->addItem(q_("10/10/10 bits"), "color101010");
×
2032

2033
                // show current setting
2034
                QSettings* conf = StelApp::getInstance().getSettings();
×
2035
                Q_ASSERT(conf);
×
2036
                QVariant selectedDitherFormat = conf->value("video/dithering_mode", "disabled");
×
2037

2038
                int index = ditherCombo->findData(selectedDitherFormat, Qt::UserRole, Qt::MatchCaseSensitive);
×
2039
                ditherCombo->setCurrentIndex(index);
×
2040
        }
×
2041
        else
2042
        {
2043
                ditherCombo->addItem(q_("Unsupported"), "disabled");
×
2044
                ditherCombo->setDisabled(true);
×
2045
                ditherCombo->setToolTip(q_("Unsupported in low-graphics mode"));
×
2046
        }
2047
        ditherCombo->blockSignals(false);
×
2048
}
×
2049

2050
void ConfigurationDialog::setDitherFormat()
×
2051
{
2052
        QString selectedFormat = ui->ditheringComboBox->itemData(ui->ditheringComboBox->currentIndex()).toString();
×
2053

2054
        QSettings* conf = StelApp::getInstance().getSettings();
×
2055
        Q_ASSERT(conf);
×
2056
        conf->setValue("video/dithering_mode", selectedFormat);
×
2057
        conf->sync();
×
2058

2059
        const auto core = StelApp::getInstance().getCore();
×
2060
        Q_ASSERT(core);
×
2061
        core->setDitheringMode(selectedFormat);
×
2062
}
×
2063

2064
void ConfigurationDialog::populateFontWritingSystemCombo()
×
2065
{
2066
        QComboBox *combo=ui->fontWritingSystemComboBox;
×
2067
        QFontDatabase fontDatabase;
×
2068
        const QList<QFontDatabase::WritingSystem> writingSystems=fontDatabase.writingSystems();
×
2069
                for (const auto& system : writingSystems)
×
2070
                {
2071
                        combo->addItem(QFontDatabase::writingSystemName(system) + "  " + QFontDatabase::writingSystemSample(system), system);
×
2072
                }
2073
}
×
2074

2075
void ConfigurationDialog::handleFontBoxWritingSystem(int index)
×
2076
{
2077
        Q_UNUSED(index)
2078
        QComboBox *sender=dynamic_cast<QComboBox *>(QObject::sender());
×
2079
        ui->fontComboBox->setWritingSystem(static_cast<QFontDatabase::WritingSystem>(sender->currentData().toInt()));
×
2080
}
×
2081

2082
void ConfigurationDialog::populateScreenshotFileformatsCombo()
×
2083
{
2084
        QComboBox *combo=ui->screenshotFileFormatComboBox;
×
2085
        // To avoid platform differences, just ask what's available.
2086
        // However, wbmp seems broken, disable it and a few unnecessary formats
2087
        const QList<QByteArray> formats = QImageWriter::supportedImageFormats();
×
2088
        for (const auto& format : formats)
×
2089
        {
2090
                if ((format != "icns") && (format != "cur") && (format != "wbmp"))
×
2091
                        combo->addItem(QString(format));
×
2092
        }
2093
        combo->setCurrentText(StelApp::getInstance().getStelPropertyManager()->getStelPropertyValue("MainView.screenShotFormat").toString()); // maybe not required.
×
2094
}
×
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