ConfigurationDialog.cpp   ConfigurationDialog.cpp 
skipping to change at line 52 skipping to change at line 52
#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"
#include "StelScriptMgr.hpp" #include "StelScriptMgr.hpp"
#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 <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
ConfigurationDialog::ConfigurationDialog(StelGui* agui) : starCatalogDownlo adReply(NULL), currentDownloadFile(NULL), progressBar(NULL), 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;
} }
ConfigurationDialog::~ConfigurationDialog() ConfigurationDialog::~ConfigurationDialog()
{ {
delete ui; delete ui;
} }
void ConfigurationDialog::languageChanged() void ConfigurationDialog::languageChanged()
{ {
if (dialog) if (dialog)
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
//Script information
//(trigger re-displaying the description of the current item)
scriptSelectionChanged(ui->scriptListWidget->currentItem()->text());
//Plug-in information
//(the same trick)
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(Mat4d()); const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000);
StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( ); StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( );
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
ui->setupUi(dialog); ui->setupUi(dialog);
// 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())) ;
skipping to change at line 333 skipping to change at line 343
StarMgr* smgr = GETSTELMODULE(StarMgr); StarMgr* smgr = GETSTELMODULE(StarMgr);
Q_ASSERT(smgr); Q_ASSERT(smgr);
NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr); NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
Q_ASSERT(nmgr); Q_ASSERT(nmgr);
GridLinesMgr* glmgr = GETSTELMODULE(GridLinesMgr); GridLinesMgr* glmgr = GETSTELMODULE(GridLinesMgr);
Q_ASSERT(glmgr); Q_ASSERT(glmgr);
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
Q_ASSERT(mvmgr); Q_ASSERT(mvmgr);
StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( ); StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( );
Q_ASSERT(nav); Q_ASSERT(nav);
const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(Mat4d()); const StelProjectorP proj = StelApp::getInstance().getCore()->getPro jection(StelCore::FrameJ2000);
Q_ASSERT(proj); Q_ASSERT(proj);
// view dialog / sky tab settings // view dialog / sky tab settings
conf->setValue("stars/absolute_scale", skyd->getAbsoluteStarScale()) ; conf->setValue("stars/absolute_scale", skyd->getAbsoluteStarScale()) ;
conf->setValue("stars/relative_scale", skyd->getRelativeStarScale()) ; conf->setValue("stars/relative_scale", skyd->getRelativeStarScale()) ;
conf->setValue("stars/flag_star_twinkle", skyd->getFlagTwinkle()); conf->setValue("stars/flag_star_twinkle", skyd->getFlagTwinkle());
conf->setValue("stars/star_twinkle_amount", skyd->getTwinkleAmount() ); conf->setValue("stars/star_twinkle_amount", skyd->getTwinkleAmount() );
conf->setValue("viewing/use_luminance_adaptation", skyd->getFlagLumi nanceAdaptation()); conf->setValue("viewing/use_luminance_adaptation", skyd->getFlagLumi nanceAdaptation());
conf->setValue("astro/flag_planets", ssmgr->getFlagPlanets()); conf->setValue("astro/flag_planets", ssmgr->getFlagPlanets());
conf->setValue("astro/flag_planets_hints", ssmgr->getFlagHints()); conf->setValue("astro/flag_planets_hints", ssmgr->getFlagHints());
skipping to change at line 363 skipping to change at line 373
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_equatorial_J2000_grid", glmgr->getFlagE quatorJ2000Grid()); conf->setValue("viewing/flag_equatorial_J2000_grid", glmgr->getFlagE quatorJ2000Grid());
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("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());
conf->setValue("astro/flag_planets_labels", ssmgr->getFlagLabels()); conf->setValue("astro/flag_planets_labels", ssmgr->getFlagLabels());
conf->setValue("astro/labels_amount", ssmgr->getLabelsAmount()); conf->setValue("astro/labels_amount", ssmgr->getLabelsAmount());
conf->setValue("astro/nebula_hints_amount", nmgr->getHintsAmount()); conf->setValue("astro/nebula_hints_amount", nmgr->getHintsAmount());
conf->setValue("astro/flag_nebula_name", nmgr->getFlagHints()); conf->setValue("astro/flag_nebula_name", nmgr->getFlagHints());
conf->setValue("projection/type", StelApp::getInstance().getCore()-> getCurrentProjectionTypeKey()); conf->setValue("projection/type", StelApp::getInstance().getCore()-> getCurrentProjectionTypeKey());
// view dialog / landscape tab settings // view dialog / landscape tab settings
lmgr->setDefaultLandscapeID(lmgr->getCurrentLandscapeID()); lmgr->setDefaultLandscapeID(lmgr->getCurrentLandscapeID());
skipping to change at line 486 skipping to change at line 497
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
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) if (s==desc.info.displayedName)
{ {
QString html = "<html><head></head><body>"; QString html = "<html><head></head><body>";
html += "<h2>" + 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>" + 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);
ui->pluginLoadAtStartupCheckBox->setChecked(desc.loa dAtStartup); ui->pluginLoadAtStartupCheckBox->setChecked(desc.loa dAtStartup);
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;
skipping to change at line 565 skipping to change at line 580
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>" + scriptMgr.getName(s) + "</h2>"; html += "<h2>" + q_(scriptMgr.getName(s)) + "</h2>";
html += "<h3>" + q_("Author") + ": " + scriptMgr.getAuthor(s) + "</h 3>"; html += "<h3>" + q_("Author") + ": " + scriptMgr.getAuthor(s) + "</h 3>";
html += "<h3>" + q_("License") + ": " + scriptMgr.getLicense(s) + "< /h3>"; html += "<h3>" + q_("License") + ": " + scriptMgr.getLicense(s) + "< /h3>";
QString d = scriptMgr.getDescription(s); QString d = scriptMgr.getDescription(s);
d.replace("\n", "<br />"); d.replace("\n", "<br />");
html += "<p>" + 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())
{ {
ui->runScriptButton->setEnabled(false);
ui->stopScriptButton->setEnabled(true);
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();
GETSTELMODULE(ScreenImageMgr)->deleteAllImages(); GETSTELMODULE(ScreenImageMgr)->deleteAllImages();
StelMainGraphicsView::getInstance().getScriptMgr().stopScript(); StelMainGraphicsView::getInstance().getScriptMgr().stopScript();
} }
skipping to change at line 643 skipping to change at line 656
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()) if (idx == catalogConfig.size() && !hasDownloadedStarCatalog)//The s ize is 9; for "stars8", idx is 9
{ {
ui->getStarsButton->setVisible(false); ui->getStarsButton->setVisible(false);
ui->downloadLabel->setText(q_("Finished downloading all star catalogs!")); ui->downloadLabel->setText(q_("Finished downloading all star 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 dx).arg(catalogConfig.size())); ui->getStarsButton->setText(q_("Get catalog %1 of %2").arg(i dx).arg(catalogConfig.size()));
const QVariantList& magRange = nextStarCatalogToDownload.val ue("magRange").toList(); const QVariantList& magRange = nextStarCatalogToDownload.val ue("magRange").toList();
ui->downloadLabel->setText(q_("Download size: %1MB\nStar cou nt: %2 Million\nMagnitude range: %3 - %4") 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("sizeMb").toStr ing())
skipping to change at line 730 skipping to change at line 745
connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(dow nloadFinished())); connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(dow nloadFinished()));
connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::Networ kError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(starCatalogDownloadReply, SIGNAL(error(QNetworkReply::Networ kError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
progressBar = StelApp::getInstance().getGui()->addProgressBar(); progressBar = StelApp::getInstance().getGui()->addProgressBar();
progressBar->setValue(0); progressBar->setValue(0);
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 code) void ConfigurationDialog::downloadError(QNetworkReply::NetworkError)
{ {
Q_ASSERT(currentDownloadFile); Q_ASSERT(currentDownloadFile);
Q_ASSERT(starCatalogDownloadReply); Q_ASSERT(starCatalogDownloadReply);
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);
skipping to change at line 795 skipping to change at line 810
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)
{ {
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
{
hasDownloadedStarCatalog = true;
}
refreshStarCatalogButton(); refreshStarCatalogButton();
} }
 End of changes. 17 change blocks. 
11 lines changed or deleted 35 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/