ConfigurationDialog.cpp   ConfigurationDialog.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2008 Fabien Chereau * Copyright (C) 2008 Fabien Chereau
* Copyright (C) 2012 Timothy Reaves
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Dialog.hpp" #include "Dialog.hpp"
#include "ConfigurationDialog.hpp" #include "ConfigurationDialog.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "ui_configurationDialog.h" #include "ui_configurationDialog.h"
#include "StelAppGraphicsWidget.hpp" #include "StelAppGraphicsWidget.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
skipping to change at line 47 skipping to change at line 48
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "MeteorMgr.hpp" #include "MeteorMgr.hpp"
#include "ConstellationMgr.hpp" #include "ConstellationMgr.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#ifndef DISABLE_SCRIPTING
#include "StelScriptMgr.hpp" #include "StelScriptMgr.hpp"
#endif
#include "LabelMgr.hpp" #include "LabelMgr.hpp"
#include "ScreenImageMgr.hpp" #include "ScreenImageMgr.hpp"
#include "SkyGui.hpp" #include "SkyGui.hpp"
#include "StelJsonParser.hpp" #include "StelJsonParser.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui) ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui)
{ {
ui = new Ui_configurationDialogForm; ui = new Ui_configurationDialogForm;
hasDownloadedStarCatalog = false; hasDownloadedStarCatalog = false;
isDownloadingStarCatalog = false;
savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType(); savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType();
} }
ConfigurationDialog::~ConfigurationDialog() ConfigurationDialog::~ConfigurationDialog()
{ {
delete ui; delete ui;
} }
void ConfigurationDialog::languageChanged() void ConfigurationDialog::retranslate()
{ {
if (dialog) { if (dialog) {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
ui->stackListWidget->repaint();
}
//Script information //Hack to shrink the tabs to optimal size after language cha
//(trigger re-displaying the description of the current item) nge
scriptSelectionChanged(ui->scriptListWidget->currentItem()->text()); //by causing the list items to be laid out again.
ui->stackListWidget->setWrapping(false);
//Initial FOV and direction on the "Main" page
updateConfigLabels();
//Star catalog download button and info
updateStarCatalogControlsText();
//Script information
//(trigger re-displaying the description of the current item
)
#ifndef DISABLE_SCRIPTING
scriptSelectionChanged(ui->scriptListWidget->currentItem()->
text());
#endif
//Plug-in information //Plug-in information
//(the same trick) populatePluginsList();
pluginsSelectionChanged(ui->pluginsListWidget->currentItem()->text() }
);
} }
void ConfigurationDialog::styleChanged() void ConfigurationDialog::styleChanged()
{ {
// Nothing for now // Nothing for now
} }
void ConfigurationDialog::createDialogContent() void ConfigurationDialog::createDialogContent()
{ {
const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000); const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000);
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
ui->setupUi(dialog); ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(languageChanged())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
// Set the main tab activated by default // Set the main tab activated by default
ui->configurationStackedWidget->setCurrentIndex(0); ui->configurationStackedWidget->setCurrentIndex(0);
ui->stackListWidget->setCurrentRow(0); ui->stackListWidget->setCurrentRow(0);
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
// Main tab // Main tab
// Fill the language list widget from the available list // Fill the language list widget from the available list
QString appLang = StelApp::getInstance().getLocaleMgr().getAppLangua ge(); QString appLang = StelApp::getInstance().getLocaleMgr().getAppLangua ge();
QComboBox* cb = ui->programLanguageComboBox; QComboBox* cb = ui->programLanguageComboBox;
cb->clear(); cb->clear();
cb->addItems(StelTranslator::globalTranslator.getAvailableLanguagesN amesNative(StelFileMgr::getLocaleDir())); cb->addItems(StelTranslator::globalTranslator.getAvailableLanguagesN amesNative(StelFileMgr::getLocaleDir()));
cb->model()->sort(0);
QString l2 = StelTranslator::iso639_1CodeToNativeName(appLang); QString l2 = StelTranslator::iso639_1CodeToNativeName(appLang);
int lt = cb->findText(l2, Qt::MatchExactly); int lt = cb->findText(l2, Qt::MatchExactly);
if (lt == -1 && appLang.contains('_')) if (lt == -1 && appLang.contains('_'))
{ {
l2 = appLang.left(appLang.indexOf('_')); l2 = appLang.left(appLang.indexOf('_'));
l2=StelTranslator::iso639_1CodeToNativeName(l2); l2=StelTranslator::iso639_1CodeToNativeName(l2);
lt = cb->findText(l2, Qt::MatchExactly); lt = cb->findText(l2, Qt::MatchExactly);
} }
if (lt!=-1) if (lt!=-1)
cb->setCurrentIndex(lt); cb->setCurrentIndex(lt);
connect(cb, SIGNAL(currentIndexChanged(const QString&)), this, SLOT( languageChanged(const QString&))); connect(cb, SIGNAL(currentIndexChanged(const QString&)), this, SLOT( selectLanguage(const QString&)));
connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadSt ars())); connect(ui->getStarsButton, SIGNAL(clicked()), this, SLOT(downloadSt ars()));
connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(canc elDownload())); connect(ui->downloadCancelButton, SIGNAL(clicked()), this, SLOT(canc elDownload()));
connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downl oadStars())); connect(ui->downloadRetryButton, SIGNAL(clicked()), this, SLOT(downl oadStars()));
refreshStarCatalogButton(); resetStarCatalogControls();
// Selected object info // Selected object info
if (gui->getInfoTextFilters() == (StelObject::InfoStringGroup)0) if (gui->getInfoTextFilters() == (StelObject::InfoStringGroup)0)
ui->noSelectedInfoRadio->setChecked(true); ui->noSelectedInfoRadio->setChecked(true);
else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::ShortInfo)) else if (gui->getInfoTextFilters() == StelObject::InfoStringGroup(St elObject::ShortInfo))
ui->briefSelectedInfoRadio->setChecked(true); ui->briefSelectedInfoRadio->setChecked(true);
else else
ui->allSelectedInfoRadio->setChecked(true); ui->allSelectedInfoRadio->setChecked(true);
connect(ui->noSelectedInfoRadio, SIGNAL(released()), this, SLOT(setN oSelectedInfo())); connect(ui->noSelectedInfoRadio, SIGNAL(released()), this, SLOT(setN oSelectedInfo()));
connect(ui->allSelectedInfoRadio, SIGNAL(released()), this, SLOT(set AllSelectedInfo())); connect(ui->allSelectedInfoRadio, SIGNAL(released()), this, SLOT(set AllSelectedInfo()));
skipping to change at line 156 skipping to change at line 171
else if (core->getStartupTimeMode()=="today") else if (core->getStartupTimeMode()=="today")
ui->todayRadio->setChecked(true); ui->todayRadio->setChecked(true);
else else
ui->fixedTimeRadio->setChecked(true); ui->fixedTimeRadio->setChecked(true);
connect(ui->systemTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSt artupTimeMode())); connect(ui->systemTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSt artupTimeMode()));
connect(ui->todayRadio, SIGNAL(clicked(bool)), this, SLOT(setStartup TimeMode())); connect(ui->todayRadio, SIGNAL(clicked(bool)), this, SLOT(setStartup TimeMode()));
connect(ui->fixedTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSta rtupTimeMode())); connect(ui->fixedTimeRadio, SIGNAL(clicked(bool)), this, SLOT(setSta rtupTimeMode()));
ui->todayTimeSpinBox->setTime(core->getInitTodayTime()); ui->todayTimeSpinBox->setTime(core->getInitTodayTime());
connect(ui->todayTimeSpinBox, SIGNAL(timeChanged(QTime)), core, SLOT (setInitTodayTime(QTime))); connect(ui->todayTimeSpinBox, SIGNAL(timeChanged(QTime)), core, SLOT (setInitTodayTime(QTime)));
ui->fixedDateTimeEdit->setMinimumDate(QDate(100,1,1));
ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(core->ge tPresetSkyTime())); ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(core->ge tPresetSkyTime()));
connect(ui->fixedDateTimeEdit, SIGNAL(dateTimeChanged(QDateTime)), c ore, SLOT(setPresetSkyTime(QDateTime))); connect(ui->fixedDateTimeEdit, SIGNAL(dateTimeChanged(QDateTime)), c ore, SLOT(setPresetSkyTime(QDateTime)));
ui->enableKeysNavigationCheckBox->setChecked(mvmgr->getFlagEnableMov eKeys() || mvmgr->getFlagEnableZoomKeys()); ui->enableKeysNavigationCheckBox->setChecked(mvmgr->getFlagEnableMov eKeys() || mvmgr->getFlagEnableZoomKeys());
ui->enableMouseNavigationCheckBox->setChecked(mvmgr->getFlagEnableMo useNavigation()); ui->enableMouseNavigationCheckBox->setChecked(mvmgr->getFlagEnableMo useNavigation());
connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableMoveKeys(bool))); connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableMoveKeys(bool)));
connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableZoomKeys(bool))); connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableZoomKeys(bool)));
connect(ui->enableMouseNavigationCheckBox, SIGNAL(toggled(bool)), mv mgr, SLOT(setFlagEnableMouseNavigation(bool))); connect(ui->enableMouseNavigationCheckBox, SIGNAL(toggled(bool)), mv mgr, SLOT(setFlagEnableMouseNavigation(bool)));
connect(ui->fixedDateTimeCurrentButton, SIGNAL(clicked()), this, SLO T(setFixedDateTimeToCurrent())); connect(ui->fixedDateTimeCurrentButton, SIGNAL(clicked()), this, SLO T(setFixedDateTimeToCurrent()));
skipping to change at line 200 skipping to change at line 216
connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(set DefaultViewOptions())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(set DefaultViewOptions()));
ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir()); ui->screenshotDirEdit->setText(StelFileMgr::getScreenshotDir());
connect(ui->screenshotDirEdit, SIGNAL(textChanged(QString)), this, S LOT(selectScreenshotDir(QString))); connect(ui->screenshotDirEdit, SIGNAL(textChanged(QString)), this, S LOT(selectScreenshotDir(QString)));
connect(ui->screenshotBrowseButton, SIGNAL(clicked()), this, SLOT(br owseForScreenshotDir())); connect(ui->screenshotBrowseButton, SIGNAL(clicked()), this, SLOT(br owseForScreenshotDir()));
ui->invertScreenShotColorsCheckBox->setChecked(StelMainGraphicsView: :getInstance().getFlagInvertScreenShotColors()); ui->invertScreenShotColorsCheckBox->setChecked(StelMainGraphicsView: :getInstance().getFlagInvertScreenShotColors());
connect(ui->invertScreenShotColorsCheckBox, SIGNAL(toggled(bool)), & StelMainGraphicsView::getInstance(), SLOT(setFlagInvertScreenShotColors(boo l))); connect(ui->invertScreenShotColorsCheckBox, SIGNAL(toggled(bool)), & StelMainGraphicsView::getInstance(), SLOT(setFlagInvertScreenShotColors(boo l)));
// script tab controls // script tab controls
#ifndef DISABLE_SCRIPTING
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr(); StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr();
connect(ui->scriptListWidget, SIGNAL(currentTextChanged(const QStrin g&)), this, SLOT(scriptSelectionChanged(const QString&))); connect(ui->scriptListWidget, SIGNAL(currentTextChanged(const QStrin g&)), this, SLOT(scriptSelectionChanged(const QString&)));
connect(ui->runScriptButton, SIGNAL(clicked()), this, SLOT(runScript Clicked())); connect(ui->runScriptButton, SIGNAL(clicked()), this, SLOT(runScript Clicked()));
connect(ui->stopScriptButton, SIGNAL(clicked()), this, SLOT(stopScri ptClicked())); connect(ui->stopScriptButton, SIGNAL(clicked()), this, SLOT(stopScri ptClicked()));
if (scriptMgr.scriptIsRunning()) if (scriptMgr.scriptIsRunning())
aScriptIsRunning(); aScriptIsRunning();
else else
aScriptHasStopped(); aScriptHasStopped();
connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(aScriptIsRun ning())); connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(aScriptIsRun ning()));
connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(aScriptHasSt opped())); connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(aScriptHasSt opped()));
ui->scriptListWidget->setSortingEnabled(true); ui->scriptListWidget->setSortingEnabled(true);
populateScriptsList(); populateScriptsList();
connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScrip tsList())); connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(populateScrip tsList()));
#endif
// plugins control // plugins control
connect(ui->pluginsListWidget, SIGNAL(currentTextChanged(const QStri ng&)), this, SLOT(pluginsSelectionChanged(const QString&))); connect(ui->pluginsListWidget, SIGNAL(currentTextChanged(const QStri ng&)), this, SLOT(pluginsSelectionChanged(const QString&)));
connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int))); connect(ui->pluginLoadAtStartupCheckBox, SIGNAL(stateChanged(int)), this, SLOT(loadAtStartupChanged(int)));
connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(plu ginConfigureCurrentSelection())); connect(ui->pluginConfigureButton, SIGNAL(clicked()), this, SLOT(plu ginConfigureCurrentSelection()));
populatePluginsList(); populatePluginsList();
connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetIt em *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWi dgetItem*))); connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetIt em *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWi dgetItem*)));
updateConfigLabels(); updateConfigLabels();
} }
void ConfigurationDialog::languageChanged(const QString& langName) void ConfigurationDialog::selectLanguage(const QString& langName)
{ {
QString code = StelTranslator::nativeNameToIso639_1Code(langName); QString code = StelTranslator::nativeNameToIso639_1Code(langName);
StelApp::getInstance().getLocaleMgr().setAppLanguage(code); StelApp::getInstance().getLocaleMgr().setAppLanguage(code);
StelApp::getInstance().getLocaleMgr().setSkyLanguage(code); StelApp::getInstance().getLocaleMgr().setSkyLanguage(code);
updateConfigLabels();
StelMainWindow::getInstance().initTitleI18n(); StelMainWindow::getInstance().initTitleI18n();
} }
void ConfigurationDialog::setStartupTimeMode() void ConfigurationDialog::setStartupTimeMode()
{ {
if (ui->systemTimeRadio->isChecked()) if (ui->systemTimeRadio->isChecked())
StelApp::getInstance().getCore()->setStartupTimeMode("actual "); StelApp::getInstance().getCore()->setStartupTimeMode("actual ");
else if (ui->todayRadio->isChecked()) else if (ui->todayRadio->isChecked())
StelApp::getInstance().getCore()->setStartupTimeMode("today" ); StelApp::getInstance().getCore()->setStartupTimeMode("today" );
else else
skipping to change at line 374 skipping to change at line 391
conf->setValue("astro/meteor_rate", mmgr->getZHR()); conf->setValue("astro/meteor_rate", mmgr->getZHR());
// view dialog / markings tab settings // view dialog / markings tab settings
conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimutha lGrid()); conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimutha lGrid());
conf->setValue("viewing/flag_equatorial_grid", glmgr->getFlagEquator Grid()); conf->setValue("viewing/flag_equatorial_grid", glmgr->getFlagEquator Grid());
conf->setValue("viewing/flag_equator_line", glmgr->getFlagEquatorLin e()); conf->setValue("viewing/flag_equator_line", glmgr->getFlagEquatorLin e());
conf->setValue("viewing/flag_ecliptic_line", glmgr->getFlagEclipticL ine()); conf->setValue("viewing/flag_ecliptic_line", glmgr->getFlagEclipticL ine());
conf->setValue("viewing/flag_meridian_line", glmgr->getFlagMeridianL ine()); conf->setValue("viewing/flag_meridian_line", glmgr->getFlagMeridianL ine());
conf->setValue("viewing/flag_horizon_line", glmgr->getFlagHorizonLin e()); conf->setValue("viewing/flag_horizon_line", glmgr->getFlagHorizonLin e());
conf->setValue("viewing/flag_equatorial_J2000_grid", glmgr->getFlagE quatorJ2000Grid()); conf->setValue("viewing/flag_equatorial_J2000_grid", glmgr->getFlagE quatorJ2000Grid());
conf->setValue("viewing/flag_galactic_grid", glmgr->getFlagGalacticG
rid());
conf->setValue("viewing/flag_galactic_plane_line", glmgr->getFlagGal
acticPlaneLine());
conf->setValue("viewing/flag_cardinal_points", lmgr->getFlagCardinal sPoints()); conf->setValue("viewing/flag_cardinal_points", lmgr->getFlagCardinal sPoints());
conf->setValue("viewing/flag_constellation_drawing", cmgr->getFlagLi nes()); conf->setValue("viewing/flag_constellation_drawing", cmgr->getFlagLi nes());
conf->setValue("viewing/flag_constellation_name", cmgr->getFlagLabel s()); conf->setValue("viewing/flag_constellation_name", cmgr->getFlagLabel s());
conf->setValue("viewing/flag_constellation_boundaries", cmgr->getFla gBoundaries()); conf->setValue("viewing/flag_constellation_boundaries", cmgr->getFla gBoundaries());
conf->setValue("viewing/flag_constellation_art", cmgr->getFlagArt()) ; conf->setValue("viewing/flag_constellation_art", cmgr->getFlagArt()) ;
conf->setValue("viewing/flag_constellation_isolate_selected", cmgr-> getFlagIsolateSelected()); conf->setValue("viewing/flag_constellation_isolate_selected", cmgr-> getFlagIsolateSelected());
conf->setValue("viewing/constellation_art_intensity", cmgr->getArtIn tensity()); conf->setValue("viewing/constellation_art_intensity", cmgr->getArtIn tensity());
conf->setValue("viewing/flag_night", StelApp::getInstance().getVisio nModeNight()); conf->setValue("viewing/flag_night", StelApp::getInstance().getVisio nModeNight());
conf->setValue("astro/flag_star_name", smgr->getFlagLabels()); conf->setValue("astro/flag_star_name", smgr->getFlagLabels());
conf->setValue("stars/labels_amount", smgr->getLabelsAmount()); conf->setValue("stars/labels_amount", smgr->getLabelsAmount());
skipping to change at line 453 skipping to change at line 472
conf->setValue("gui/flag_mouse_cursor_timeout", StelMainGraphicsView ::getInstance().getFlagCursorTimeout()); conf->setValue("gui/flag_mouse_cursor_timeout", StelMainGraphicsView ::getInstance().getFlagCursorTimeout());
conf->setValue("gui/mouse_cursor_timeout", StelMainGraphicsView::get Instance().getCursorTimeout()); conf->setValue("gui/mouse_cursor_timeout", StelMainGraphicsView::get Instance().getCursorTimeout());
conf->setValue("main/screenshot_dir", StelFileMgr::getScreenshotDir( )); conf->setValue("main/screenshot_dir", StelFileMgr::getScreenshotDir( ));
conf->setValue("main/invert_screenshots_colors", StelMainGraphicsVie w::getInstance().getFlagInvertScreenShotColors()); conf->setValue("main/invert_screenshots_colors", StelMainGraphicsVie w::getInstance().getFlagInvertScreenShotColors());
// full screen and window size // full screen and window size
conf->setValue("video/fullscreen", StelMainWindow::getInstance().get FullScreen()); conf->setValue("video/fullscreen", StelMainWindow::getInstance().get FullScreen());
if (!StelMainWindow::getInstance().getFullScreen()) if (!StelMainWindow::getInstance().getFullScreen())
{ {
conf->setValue("video/screen_w", StelMainWindow::getInstance StelMainWindow& mainWindow = StelMainWindow::getInstance();
().size().width()); conf->setValue("video/screen_w", mainWindow.size().width());
conf->setValue("video/screen_h", StelMainWindow::getInstance conf->setValue("video/screen_h", mainWindow.size().height())
().size().height()); ;
conf->setValue("video/screen_x", mainWindow.x());
conf->setValue("video/screen_y", mainWindow.y());
} }
// clear the restore defaults flag if it is set. // clear the restore defaults flag if it is set.
conf->setValue("main/restore_defaults", false); conf->setValue("main/restore_defaults", false);
updateConfigLabels(); updateConfigLabels();
} }
void ConfigurationDialog::updateConfigLabels() void ConfigurationDialog::updateConfigLabels()
{ {
skipping to change at line 491 skipping to change at line 513
conf->setValue("main/restore_defaults", true); conf->setValue("main/restore_defaults", true);
} }
void ConfigurationDialog::populatePluginsList() void ConfigurationDialog::populatePluginsList()
{ {
int prevSel = ui->pluginsListWidget->currentRow(); int prevSel = ui->pluginsListWidget->currentRow();
ui->pluginsListWidget->clear(); ui->pluginsListWidget->clear();
const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp:: getInstance().getModuleMgr().getPluginsList(); const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp:: getInstance().getModuleMgr().getPluginsList();
foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList) foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList)
{ {
ui->pluginsListWidget->addItem(desc.info.displayedName); QString label = q_(desc.info.displayedName);
QListWidgetItem* item = new QListWidgetItem(label);
item->setData(Qt::UserRole, desc.info.id);
ui->pluginsListWidget->addItem(item);
} }
// If we had a valid previous selection (i.e. not first time we popu late), restore it // If we had a valid previous selection (i.e. not first time we popu late), restore it
if (prevSel >= 0 && prevSel < ui->pluginsListWidget->count()) if (prevSel >= 0 && prevSel < ui->pluginsListWidget->count())
ui->pluginsListWidget->setCurrentRow(prevSel); ui->pluginsListWidget->setCurrentRow(prevSel);
else else
ui->pluginsListWidget->setCurrentRow(0); ui->pluginsListWidget->setCurrentRow(0);
} }
void ConfigurationDialog::pluginsSelectionChanged(const QString& s) void ConfigurationDialog::pluginsSelectionChanged(const QString& s)
{ {
const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp:: getInstance().getModuleMgr().getPluginsList(); const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp:: getInstance().getModuleMgr().getPluginsList();
foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList) foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList)
{ {
//BM: Localization of plug-in name and description should be if (s==q_(desc.info.displayedName))//TODO: Use ID!
done
//in the plug-in, not here. This is acceptable only as a tem
porary
//solution if someone puts the necessary strings in translat
ions.h
//so that they are included in the translation template.
if (s==desc.info.displayedName)
{ {
QString html = "<html><head></head><body>"; QString html = "<html><head></head><body>";
html += "<h2>" + q_(desc.info.displayedName) + "</h2 >"; html += "<h2>" + q_(desc.info.displayedName) + "</h2 >";
html += "<h3>" + q_("Authors") + ": " + desc.info.au thors + "</h3>"; html += "<h3>" + q_("Authors") + ": " + desc.info.au thors + "</h3>";
QString d = desc.info.description; QString d = desc.info.description;
d.replace("\n", "<br />"); d.replace("\n", "<br />");
html += "<p>" + q_(d) + "</p>"; html += "<p>" + q_(d) + "</p>";
html += "<h3>" + q_("Contact") + ": " + desc.info.co ntact + "</h3>"; html += "<h3>" + q_("Contact") + ": " + desc.info.co ntact + "</h3>";
html += "</body></html>"; html += "</body></html>";
ui->pluginsInfoBrowser->setHtml(html); ui->pluginsInfoBrowser->setHtml(html);
skipping to change at line 531 skipping to change at line 552
StelModule* pmod = StelApp::getInstance().getModuleM gr().getModule(desc.info.id, true); StelModule* pmod = StelApp::getInstance().getModuleM gr().getModule(desc.info.id, true);
if (pmod != NULL) if (pmod != NULL)
ui->pluginConfigureButton->setEnabled(pmod-> configureGui(false)); ui->pluginConfigureButton->setEnabled(pmod-> configureGui(false));
else else
ui->pluginConfigureButton->setEnabled(false) ; ui->pluginConfigureButton->setEnabled(false) ;
return; return;
} }
} }
} }
void ConfigurationDialog::pluginConfigureCurrentSelection(void) void ConfigurationDialog::pluginConfigureCurrentSelection()
{ {
QString s = ui->pluginsListWidget->currentItem()->text(); QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole
if (s.isEmpty() || s=="") ).toString();
if (id.isEmpty())
return; return;
const QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp:: StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
getInstance().getModuleMgr().getPluginsList(); const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr
.getPluginsList();
foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList) foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList)
{ {
if (s==desc.info.displayedName) if (id == desc.info.id)
{ {
StelModule* pmod = StelApp::getInstance().getModuleM gr().getModule(desc.info.id); StelModule* pmod = moduleMgr.getModule(desc.info.id) ;
if (pmod != NULL) if (pmod != NULL)
{ {
pmod->configureGui(true); pmod->configureGui(true);
} }
return; return;
} }
} }
} }
void ConfigurationDialog::loadAtStartupChanged(int state) void ConfigurationDialog::loadAtStartupChanged(int state)
{ {
if (ui->pluginsListWidget->count() <= 0) if (ui->pluginsListWidget->count() <= 0)
return; return;
QString name = ui->pluginsListWidget->currentItem()->text();
QString key; QString id = ui->pluginsListWidget->currentItem()->data(Qt::UserRole
QList<StelModuleMgr::PluginDescriptor> pluginsList = StelApp::getIns ).toString();
tance().getModuleMgr().getPluginsList(); StelModuleMgr& moduleMgr = StelApp::getInstance().getModuleMgr();
const QList<StelModuleMgr::PluginDescriptor> pluginsList = moduleMgr
.getPluginsList();
foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList) foreach (const StelModuleMgr::PluginDescriptor& desc, pluginsList)
{ {
if (desc.info.displayedName==name) if (id == desc.info.id)
key = desc.info.id; {
moduleMgr.setPluginLoadAtStartup(id, state == Qt::Ch
ecked);
break;
}
} }
if (!key.isEmpty())
StelApp::getInstance().getModuleMgr().setPluginLoadAtStartup
(key, state==Qt::Checked);
} }
#ifndef DISABLE_SCRIPTING
void ConfigurationDialog::populateScriptsList(void) void ConfigurationDialog::populateScriptsList(void)
{ {
int prevSel = ui->scriptListWidget->currentRow(); int prevSel = ui->scriptListWidget->currentRow();
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr(); StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr();
ui->scriptListWidget->clear(); ui->scriptListWidget->clear();
ui->scriptListWidget->addItems(scriptMgr.getScriptList()); ui->scriptListWidget->addItems(scriptMgr.getScriptList());
// If we had a valid previous selection (i.e. not first time we popu late), restore it // If we had a valid previous selection (i.e. not first time we popu late), restore it
if (prevSel >= 0 && prevSel < ui->scriptListWidget->count()) if (prevSel >= 0 && prevSel < ui->scriptListWidget->count())
ui->scriptListWidget->setCurrentRow(prevSel); ui->scriptListWidget->setCurrentRow(prevSel);
else else
ui->scriptListWidget->setCurrentRow(0); ui->scriptListWidget->setCurrentRow(0);
} }
void ConfigurationDialog::scriptSelectionChanged(const QString& s) void ConfigurationDialog::scriptSelectionChanged(const QString& s)
{ {
if (s.isEmpty()) if (s.isEmpty())
return; return;
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr(); StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr();
//ui->scriptInfoBrowser->document()->setDefaultStyleSheet(QString(St elApp::getInstance().getCurrentStelStyle()->htmlStyleSheet)); //ui->scriptInfoBrowser->document()->setDefaultStyleSheet(QString(St elApp::getInstance().getCurrentStelStyle()->htmlStyleSheet));
QString html = "<html><head></head><body>"; QString html = "<html><head></head><body>";
html += "<h2>" + q_(scriptMgr.getName(s)) + "</h2>"; html += "<h2>" + q_(scriptMgr.getName(s).trimmed()) + "</h2>";
html += "<h3>" + q_("Author") + ": " + scriptMgr.getAuthor(s) + "</h if (!scriptMgr.getAuthor(s).trimmed().isEmpty())
3>"; {
html += "<h3>" + q_("License") + ": " + scriptMgr.getLicense(s) + "< html += "<h3>" + q_("Author") + ": " + scriptMgr.getAuthor(s
/h3>"; ) + "</h3>";
QString d = scriptMgr.getDescription(s); }
if (!scriptMgr.getLicense(s).trimmed().isEmpty())
{
html += "<h3>" + q_("License") + ": " + scriptMgr.getLicense
(s) + "</h3>";
}
QString d = scriptMgr.getDescription(s).trimmed();
d.replace("\n", "<br />"); d.replace("\n", "<br />");
d.replace(QRegExp("\\s{2,}"), " ");
html += "<p>" + q_(d) + "</p>"; html += "<p>" + q_(d) + "</p>";
html += "</body></html>"; html += "</body></html>";
ui->scriptInfoBrowser->setHtml(html); ui->scriptInfoBrowser->setHtml(html);
} }
void ConfigurationDialog::runScriptClicked(void) void ConfigurationDialog::runScriptClicked(void)
{ {
if (ui->closeWindowAtScriptRunCheckbox->isChecked()) if (ui->closeWindowAtScriptRunCheckbox->isChecked())
this->close(); this->close();
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr(); StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr();
if (ui->scriptListWidget->currentItem()) if (ui->scriptListWidget->currentItem())
{ {
scriptMgr.runScript(ui->scriptListWidget->currentItem()->tex t()); scriptMgr.runScript(ui->scriptListWidget->currentItem()->tex t());
} }
} }
void ConfigurationDialog::stopScriptClicked(void) void ConfigurationDialog::stopScriptClicked(void)
{ {
GETSTELMODULE(LabelMgr)->deleteAllLabels(); GETSTELMODULE(LabelMgr)->deleteAllLabels();
skipping to change at line 630 skipping to change at line 661
ui->runScriptButton->setEnabled(false); ui->runScriptButton->setEnabled(false);
ui->stopScriptButton->setEnabled(true); ui->stopScriptButton->setEnabled(true);
} }
void ConfigurationDialog::aScriptHasStopped(void) void ConfigurationDialog::aScriptHasStopped(void)
{ {
ui->scriptStatusLabel->setText(q_("Running script: [none]")); ui->scriptStatusLabel->setText(q_("Running script: [none]"));
ui->runScriptButton->setEnabled(true); ui->runScriptButton->setEnabled(true);
ui->stopScriptButton->setEnabled(false); ui->stopScriptButton->setEnabled(false);
} }
#endif
void ConfigurationDialog::setFixedDateTimeToCurrent(void) void ConfigurationDialog::setFixedDateTimeToCurrent(void)
{ {
ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(StelApp: :getInstance().getCore()->getJDay())); ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(StelApp: :getInstance().getCore()->getJDay()));
ui->fixedTimeRadio->setChecked(true); ui->fixedTimeRadio->setChecked(true);
setStartupTimeMode(); setStartupTimeMode();
} }
void ConfigurationDialog::changePage(QListWidgetItem *current, QListWidgetI tem *previous) void ConfigurationDialog::changePage(QListWidgetItem *current, QListWidgetI tem *previous)
{ {
if (!current) if (!current)
current = previous; current = previous;
ui->configurationStackedWidget->setCurrentIndex(ui->stackListWidget- >row(current)); ui->configurationStackedWidget->setCurrentIndex(ui->stackListWidget- >row(current));
} }
void ConfigurationDialog::refreshStarCatalogButton() void ConfigurationDialog::resetStarCatalogControls()
{ {
const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatal ogsDescription(); const QVariantList& catalogConfig = GETSTELMODULE(StarMgr)->getCatal ogsDescription();
nextStarCatalogToDownload.clear(); nextStarCatalogToDownload.clear();
int idx=0; int idx=0;
foreach (const QVariant& catV, catalogConfig) foreach (const QVariant& catV, catalogConfig)
{ {
++idx; ++idx;
const QVariantMap& m = catV.toMap(); const QVariantMap& m = catV.toMap();
const bool checked = m.value("checked").toBool(); const bool checked = m.value("checked").toBool();
if (checked) if (checked)
continue; continue;
nextStarCatalogToDownload=m; nextStarCatalogToDownload=m;
break; break;
} }
ui->downloadCancelButton->setVisible(false); ui->downloadCancelButton->setVisible(false);
ui->downloadRetryButton->setVisible(false); ui->downloadRetryButton->setVisible(false);
if (idx == catalogConfig.size() && !hasDownloadedStarCatalog)//The s ize is 9; for "stars8", idx is 9 if (idx > catalogConfig.size() && !hasDownloadedStarCatalog)
{ {
ui->getStarsButton->setVisible(false); ui->getStarsButton->setVisible(false);
ui->downloadLabel->setText(q_("Finished downloading all star updateStarCatalogControlsText();
catalogs!"));
//BM: Doesn't this message duplicate the one below?
//This one should be something like "All available star cata
logs are installed."
return; return;
} }
ui->getStarsButton->setEnabled(true); ui->getStarsButton->setEnabled(true);
if (!nextStarCatalogToDownload.isEmpty()) if (!nextStarCatalogToDownload.isEmpty())
{ {
ui->getStarsButton->setText(q_("Get catalog %1 of %2").arg(i nextStarCatalogToDownloadIndex = idx;
dx).arg(catalogConfig.size())); starCatalogsCount = catalogConfig.size();
const QVariantList& magRange = nextStarCatalogToDownload.val updateStarCatalogControlsText();
ue("magRange").toList();
ui->downloadLabel->setText(q_("Download size: %1MB\nStar cou
nt: %2 Million\nMagnitude range: %3 - %4")
.arg(nextStarCatalogToDownload.value("sizeMb").toStr
ing())
.arg(nextStarCatalogToDownload.value("count").toStri
ng())
.arg(magRange.at(0).toString())
.arg(magRange.at(1).toString()));
ui->getStarsButton->setVisible(true); ui->getStarsButton->setVisible(true);
} }
else else
{ {
ui->downloadLabel->setText(q_("Finished downloading new star catalogs!\nRestart Stellarium to display them.")); updateStarCatalogControlsText();
ui->getStarsButton->setVisible(false); ui->getStarsButton->setVisible(false);
} }
} }
void ConfigurationDialog::updateStarCatalogControlsText()
{
if (nextStarCatalogToDownload.isEmpty())
{
//There are no more catalogs left?
if (hasDownloadedStarCatalog)
{
ui->downloadLabel->setText(q_("Finished downloading
new star catalogs!\nRestart Stellarium to display them."));
}
else
{
ui->downloadLabel->setText(q_("All available star ca
talogs have been installed."));
}
}
else
{
QString text = QString(q_("Get catalog %1 of %2"))
.arg(nextStarCatalogToDownloadIndex)
.arg(starCatalogsCount);
ui->getStarsButton->setText(text);
if (isDownloadingStarCatalog)
{
QString text = QString(q_("Downloading %1...\n(You c
an close this window.)"))
.arg(nextStarCatalogToDownload.valu
e("id").toString());
ui->downloadLabel->setText(text);
}
else
{
const QVariantList& magRange = nextStarCatalogToDown
load.value("magRange").toList();
ui->downloadLabel->setText(q_("Download size: %1MB\n
Star count: %2 Million\nMagnitude range: %3 - %4")
.arg(nextStarCatalogToDownload.value("sizeMb
").toString())
.arg(nextStarCatalogToDownload.value("count"
).toString())
.arg(magRange.first().toString())
.arg(magRange.last().toString()));
}
}
}
void ConfigurationDialog::cancelDownload(void) void ConfigurationDialog::cancelDownload(void)
{ {
Q_ASSERT(currentDownloadFile); Q_ASSERT(currentDownloadFile);
Q_ASSERT(starCatalogDownloadReply); Q_ASSERT(starCatalogDownloadReply);
qWarning() << "Aborting download"; qWarning() << "Aborting download";
starCatalogDownloadReply->abort(); starCatalogDownloadReply->abort();
} }
void ConfigurationDialog::newStarCatalogData() void ConfigurationDialog::newStarCatalogData()
{ {
skipping to change at line 714 skipping to change at line 779
Q_ASSERT(progressBar); Q_ASSERT(progressBar);
int size = starCatalogDownloadReply->bytesAvailable(); int size = starCatalogDownloadReply->bytesAvailable();
progressBar->setValue((float)progressBar->value()+(float)size/1024); progressBar->setValue((float)progressBar->value()+(float)size/1024);
currentDownloadFile->write(starCatalogDownloadReply->read(size)); currentDownloadFile->write(starCatalogDownloadReply->read(size));
} }
void ConfigurationDialog::downloadStars() void ConfigurationDialog::downloadStars()
{ {
Q_ASSERT(!nextStarCatalogToDownload.isEmpty()); Q_ASSERT(!nextStarCatalogToDownload.isEmpty());
Q_ASSERT(!isDownloadingStarCatalog);
Q_ASSERT(starCatalogDownloadReply==NULL); Q_ASSERT(starCatalogDownloadReply==NULL);
Q_ASSERT(currentDownloadFile==NULL); Q_ASSERT(currentDownloadFile==NULL);
Q_ASSERT(progressBar==NULL); Q_ASSERT(progressBar==NULL);
QString path = StelFileMgr::getUserDir()+QString("/stars/default/")+ nextStarCatalogToDownload.value("fileName").toString(); QString path = StelFileMgr::getUserDir()+QString("/stars/default/")+ nextStarCatalogToDownload.value("fileName").toString();
currentDownloadFile = new QFile(path); currentDownloadFile = new QFile(path);
if (!currentDownloadFile->open(QIODevice::WriteOnly)) if (!currentDownloadFile->open(QIODevice::WriteOnly))
{ {
qWarning() << "Can't open a writable file for storing new st ar catalog: " << path; qWarning() << "Can't open a writable file for storing new st ar catalog: " << path;
currentDownloadFile->deleteLater(); currentDownloadFile->deleteLater();
currentDownloadFile = NULL; currentDownloadFile = NULL;
ui->downloadLabel->setText(q_("Error downloading %1:\n%2").a rg(nextStarCatalogToDownload.value("id").toString()).arg(QString("Can't ope n a writable file for storing new star catalog: %1").arg(path))); ui->downloadLabel->setText(q_("Error downloading %1:\n%2").a rg(nextStarCatalogToDownload.value("id").toString()).arg(QString("Can't ope n a writable file for storing new star catalog: %1").arg(path)));
ui->downloadRetryButton->setVisible(true); ui->downloadRetryButton->setVisible(true);
return; return;
} }
ui->downloadLabel->setText(q_("Downloading %1...\n(You can close thi isDownloadingStarCatalog = true;
s window.)").arg(nextStarCatalogToDownload.value("id").toString())); updateStarCatalogControlsText();
ui->downloadCancelButton->setVisible(true); ui->downloadCancelButton->setVisible(true);
ui->downloadRetryButton->setVisible(false); ui->downloadRetryButton->setVisible(false);
ui->getStarsButton->setVisible(true); ui->getStarsButton->setVisible(true);
ui->getStarsButton->setEnabled(false); ui->getStarsButton->setEnabled(false);
QNetworkRequest req(nextStarCatalogToDownload.value("url").toString( )); QNetworkRequest req(nextStarCatalogToDownload.value("url").toString( ));
req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false) ; req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false) ;
req.setRawHeader("User-Agent", StelUtils::getApplicationName().toAsc ii()); req.setRawHeader("User-Agent", StelUtils::getApplicationName().toAsc ii());
starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessMa nager()->get(req); starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessMa nager()->get(req);
skipping to change at line 758 skipping to change at line 825
progressBar->setMaximum(nextStarCatalogToDownload.value("sizeMb").to Double()*1024); progressBar->setMaximum(nextStarCatalogToDownload.value("sizeMb").to Double()*1024);
progressBar->setVisible(true); progressBar->setVisible(true);
progressBar->setFormat(QString("%1: %p%").arg(nextStarCatalogToDownl oad.value("id").toString())); progressBar->setFormat(QString("%1: %p%").arg(nextStarCatalogToDownl oad.value("id").toString()));
} }
void ConfigurationDialog::downloadError(QNetworkReply::NetworkError) void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
{ {
Q_ASSERT(currentDownloadFile); Q_ASSERT(currentDownloadFile);
Q_ASSERT(starCatalogDownloadReply); Q_ASSERT(starCatalogDownloadReply);
isDownloadingStarCatalog = false;
qWarning() << "Error downloading file" << starCatalogDownloadReply-> url() << ": " << starCatalogDownloadReply->errorString(); qWarning() << "Error downloading file" << starCatalogDownloadReply-> url() << ": " << starCatalogDownloadReply->errorString();
ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextS tarCatalogToDownload.value("id").toString()).arg(starCatalogDownloadReply-> errorString())); ui->downloadLabel->setText(q_("Error downloading %1:\n%2").arg(nextS tarCatalogToDownload.value("id").toString()).arg(starCatalogDownloadReply-> errorString()));
ui->downloadCancelButton->setVisible(false); ui->downloadCancelButton->setVisible(false);
ui->downloadRetryButton->setVisible(true); ui->downloadRetryButton->setVisible(true);
ui->getStarsButton->setVisible(false); ui->getStarsButton->setVisible(false);
ui->getStarsButton->setEnabled(true); ui->getStarsButton->setEnabled(true);
} }
void ConfigurationDialog::downloadFinished() void ConfigurationDialog::downloadFinished()
{ {
skipping to change at line 802 skipping to change at line 870
req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
req.setRawHeader("User-Agent", StelUtils::getApplicationName ().toAscii()); req.setRawHeader("User-Agent", StelUtils::getApplicationName ().toAscii());
starCatalogDownloadReply = StelApp::getInstance().getNetwork AccessManager()->get(req); starCatalogDownloadReply = StelApp::getInstance().getNetwork AccessManager()->get(req);
starCatalogDownloadReply->setReadBufferSize(1024*1024*2); starCatalogDownloadReply->setReadBufferSize(1024*1024*2);
connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData())); connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData()));
connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished())); connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished()));
connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply ::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply ::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
return; return;
} }
isDownloadingStarCatalog = false;
currentDownloadFile->close(); currentDownloadFile->close();
currentDownloadFile->deleteLater(); currentDownloadFile->deleteLater();
currentDownloadFile = NULL; currentDownloadFile = NULL;
starCatalogDownloadReply->deleteLater(); starCatalogDownloadReply->deleteLater();
starCatalogDownloadReply = NULL; starCatalogDownloadReply = NULL;
progressBar->deleteLater(); progressBar->deleteLater();
progressBar=NULL; progressBar=NULL;
ui->downloadLabel->setText(q_("Verifying file integrity...")); ui->downloadLabel->setText(q_("Verifying file integrity..."));
if (GETSTELMODULE(StarMgr)->checkAndLoadCatalog(nextStarCatalogToDow nload)==false) if (GETSTELMODULE(StarMgr)->checkAndLoadCatalog(nextStarCatalogToDow nload)==false)
skipping to change at line 823 skipping to change at line 892
ui->getStarsButton->setVisible(false); ui->getStarsButton->setVisible(false);
ui->downloadLabel->setText(q_("Error downloading %1:\nFile i s corrupted.").arg(nextStarCatalogToDownload.value("id").toString())); ui->downloadLabel->setText(q_("Error downloading %1:\nFile i s corrupted.").arg(nextStarCatalogToDownload.value("id").toString()));
ui->downloadCancelButton->setVisible(false); ui->downloadCancelButton->setVisible(false);
ui->downloadRetryButton->setVisible(true); ui->downloadRetryButton->setVisible(true);
} }
else else
{ {
hasDownloadedStarCatalog = true; hasDownloadedStarCatalog = true;
} }
refreshStarCatalogButton(); resetStarCatalogControls();
} }
 End of changes. 46 change blocks. 
75 lines changed or deleted 146 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/