ExoplanetsDialog.cpp   ExoplanetsDialog.cpp 
skipping to change at line 21 skipping to change at line 21
* 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "config.h"
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <QDateTime> #include <QDateTime>
#include <QUrl> #include <QUrl>
#include <QFileDialog> #include <QFileDialog>
#include "StelApp.hpp" #include "StelApp.hpp"
#include "ui_exoplanetsDialog.h" #include "ui_exoplanetsDialog.h"
#include "ExoplanetsDialog.hpp" #include "ExoplanetsDialog.hpp"
#include "Exoplanets.hpp" #include "Exoplanets.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelStyle.hpp" #include "StelStyle.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainView.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
ExoplanetsDialog::ExoplanetsDialog() : updateTimer(NULL) ExoplanetsDialog::ExoplanetsDialog()
: ep(NULL)
, updateTimer(NULL)
{ {
ui = new Ui_exoplanetsDialog; ui = new Ui_exoplanetsDialog;
} }
ExoplanetsDialog::~ExoplanetsDialog() ExoplanetsDialog::~ExoplanetsDialog()
{ {
if (updateTimer) if (updateTimer)
{ {
updateTimer->stop(); updateTimer->stop();
delete updateTimer; delete updateTimer;
skipping to change at line 64 skipping to change at line 68
} }
void ExoplanetsDialog::retranslate() void ExoplanetsDialog::retranslate()
{ {
if (dialog) if (dialog)
{ {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
refreshUpdateValues(); refreshUpdateValues();
setAboutHtml(); setAboutHtml();
setInfoHtml(); setInfoHtml();
setWebsitesHtml();
} }
} }
// Initialize the dialog widgets and connect the signals/slots // Initialize the dialog widgets and connect the signals/slots
void ExoplanetsDialog::createDialogContent() void ExoplanetsDialog::createDialogContent()
{ {
ep = GETSTELMODULE(Exoplanets);
ui->setupUi(dialog); ui->setupUi(dialog);
ui->tabs->setCurrentIndex(0); ui->tabs->setCurrentIndex(0);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
this, SLOT(retranslate())); this, SLOT(retranslate()));
// Settings tab / updates group // Settings tab / updates group
ui->displayAtStartupCheckBox->setChecked(GETSTELMODULE(Exoplanets)-> getEnableAtStartup()); ui->displayAtStartupCheckBox->setChecked(ep->getEnableAtStartup());
connect(ui->displayAtStartupCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(setDisplayAtStartupEnabled(int))); connect(ui->displayAtStartupCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(setDisplayAtStartupEnabled(int)));
ui->displayModeCheckBox->setChecked(GETSTELMODULE(Exoplanets)->getDi splayMode()); ui->displayModeCheckBox->setChecked(ep->getDisplayMode());
connect(ui->displayModeCheckBox, SIGNAL(stateChanged(int)), this, SL OT(setDistributionEnabled(int))); connect(ui->displayModeCheckBox, SIGNAL(stateChanged(int)), this, SL OT(setDistributionEnabled(int)));
ui->displayShowExoplanetsButton->setChecked(GETSTELMODULE(Exoplanets )->getFlagShowExoplanetsButton()); ui->displayShowExoplanetsButton->setChecked(ep->getFlagShowExoplanet sButton());
connect(ui->displayShowExoplanetsButton, SIGNAL(stateChanged(int)), this, SLOT(setDisplayShowExoplanetsButton(int))); connect(ui->displayShowExoplanetsButton, SIGNAL(stateChanged(int)), this, SLOT(setDisplayShowExoplanetsButton(int)));
ui->timelineModeCheckBox->setChecked(GETSTELMODULE(Exoplanets)->getT imelineMode()); ui->timelineModeCheckBox->setChecked(ep->getTimelineMode());
connect(ui->timelineModeCheckBox, SIGNAL(stateChanged(int)), this, S LOT(setTimelineEnabled(int))); connect(ui->timelineModeCheckBox, SIGNAL(stateChanged(int)), this, S LOT(setTimelineEnabled(int)));
ui->habitableModeCheckBox->setChecked(ep->getHabitableMode());
connect(ui->habitableModeCheckBox, SIGNAL(stateChanged(int)), this,
SLOT(setHabitableEnabled(int)));
connect(ui->internetUpdatesCheckbox, SIGNAL(stateChanged(int)), this , SLOT(setUpdatesEnabled(int))); connect(ui->internetUpdatesCheckbox, SIGNAL(stateChanged(int)), this , SLOT(setUpdatesEnabled(int)));
connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateJSON() )); connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateJSON() ));
connect(GETSTELMODULE(Exoplanets), SIGNAL(updateStateChanged(Exoplan connect(ep, SIGNAL(updateStateChanged(Exoplanets::UpdateState)), thi
ets::UpdateState)), this, SLOT(updateStateReceiver(Exoplanets::UpdateState) s, SLOT(updateStateReceiver(Exoplanets::UpdateState)));
)); connect(ep, SIGNAL(jsonUpdateComplete(void)), this, SLOT(updateCompl
connect(GETSTELMODULE(Exoplanets), SIGNAL(jsonUpdateComplete(void)), eteReceiver(void)));
this, SLOT(updateCompleteReceiver(void)));
connect(ui->updateFrequencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setUpdateValues(int))); connect(ui->updateFrequencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setUpdateValues(int)));
refreshUpdateValues(); // fetch values for last updated and so on refreshUpdateValues(); // fetch values for last updated and so on
// if the state didn't change, setUpdatesEnabled will not be called, so we force it // if the state didn't change, setUpdatesEnabled will not be called, so we force it
setUpdatesEnabled(ui->internetUpdatesCheckbox->checkState()); setUpdatesEnabled(ui->internetUpdatesCheckbox->checkState());
updateTimer = new QTimer(this); updateTimer = new QTimer(this);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refreshUpdateValu es())); connect(updateTimer, SIGNAL(timeout()), this, SLOT(refreshUpdateValu es()));
updateTimer->start(7000); updateTimer->start(7000);
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(res toreDefaults())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(res toreDefaults()));
connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveSe ttings())); connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveSe ttings()));
// About & Info tabs // About & Info tabs
setAboutHtml(); setAboutHtml();
setInfoHtml(); setInfoHtml();
setWebsitesHtml();
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); if(gui!=NULL)
ui->aboutTextBrowser->document()->setDefaultStyleSheet(QString(gui-> {
getStelStyle().htmlStyleSheet)); ui->aboutTextBrowser->document()->setDefaultStyleSheet(QStri
ui->infoTextBrowser->document()->setDefaultStyleSheet(QString(gui->g ng(gui->getStelStyle().htmlStyleSheet));
etStelStyle().htmlStyleSheet)); ui->infoTextBrowser->document()->setDefaultStyleSheet(QStrin
g(gui->getStelStyle().htmlStyleSheet));
ui->websitesTextBrowser->document()->setDefaultStyleSheet(QS
tring(gui->getStelStyle().htmlStyleSheet));
}
updateGuiFromSettings(); updateGuiFromSettings();
} }
void ExoplanetsDialog::setAboutHtml(void) void ExoplanetsDialog::setAboutHtml(void)
{ {
QString html = "<html><head></head><body>"; QString html = "<html><head></head><body>";
html += "<h2>" + q_("Exoplanets Plug-in") + "</h2><table width=\"90% \">"; html += "<h2>" + q_("Exoplanets Plug-in") + "</h2><table width=\"90% \">";
html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</stron g></td><td>" + EXOPLANETS_PLUGIN_VERSION + "</td></tr>"; html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</stron g></td><td>" + EXOPLANETS_PLUGIN_VERSION + "</td></tr>";
html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Alex ander Wolf &lt;alex.v.wolf@gmail.com&gt;</td></tr></table>"; html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Alex ander Wolf &lt;alex.v.wolf@gmail.com&gt;</td></tr></table>";
html += "<p>" + QString(q_("This plugin plots the position of stars html += "<p>" + QString(q_("This plugin plots the position of stars
with exoplanets. Exoplanets data is derived from \"%1The Extrasolar Planets with exoplanets. Exoplanets data is derived from \"%1The Extrasolar Planets
Encyclopaedia%2\"")).arg("<a href=\"http://exoplanet.eu/\">").arg("</a>") Encyclopaedia%2\"")).arg("<a href=\"http://exoplanet.eu/\">").arg("</a>")
+ ".</p>"; + ". ";
html += QString(q_("The list of potential habitable exoplanets and d
ata about them were taken from \"%1The Habitable Exoplanets Catalog%3\" by
%2Planetary Habitability Laboratory%3.")).arg("<a href=\"http://phl.upr.edu
/projects/habitable-exoplanets-catalog\">").arg("<a href=\"http://phl.upr.e
du/home\">").arg("</a>") + "</p>";
html += "<p>" + q_("The current catalog contains info about %1 plane tary systems, which altogether have %2 exoplanets (including %3 potentially habitable exoplanets).").arg(ep->getCountPlanetarySystems()).arg(ep->getCo untAllExoplanets()).arg(ep->getCountHabitableExoplanets()) + "</p>";
html += "<h3>" + q_("Links") + "</h3>"; html += "<h3>" + q_("Links") + "</h3>";
html += "<p>" + QString(q_("Support is provided via the Launchpad we bsite. Be sure to put \"%1\" in the subject when posting.")).arg("Exoplane ts plugin") + "</p>"; html += "<p>" + QString(q_("Support is provided via the Launchpad we bsite. Be sure to put \"%1\" in the subject when posting.")).arg("Exoplane ts plugin") + "</p>";
html += "<p><ul>"; html += "<p><ul>";
// TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link // TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link
html += "<li>" + QString(q_("If you have a question, you can %1get a n answer here%2").arg("<a href=\"https://answers.launchpad.net/stellarium\" >")).arg("</a>") + "</li>"; html += "<li>" + QString(q_("If you have a question, you can %1get a n answer here%2").arg("<a href=\"https://answers.launchpad.net/stellarium\" >")).arg("</a>") + "</li>";
// TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link // TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link
html += "<li>" + QString(q_("Bug reports can be made %1here%2.")).ar g("<a href=\"https://bugs.launchpad.net/stellarium\">").arg("</a>") + "</li >"; html += "<li>" + QString(q_("Bug reports can be made %1here%2.")).ar g("<a href=\"https://bugs.launchpad.net/stellarium\">").arg("</a>") + "</li >";
// TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link // TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link
html += "<li>" + q_("If you would like to make a feature request, yo u can create a bug report, and set the severity to \"wishlist\".") + "</li> "; html += "<li>" + q_("If you would like to make a feature request, yo u can create a bug report, and set the severity to \"wishlist\".") + "</li> ";
// TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link // TRANSLATORS: The numbers contain the opening and closing tag of a n HTML link
html += "<li>" + q_("If you want read full information about plugin, his history and format of catalog you can %1get info here%2.").arg("<a hre f=\"http://stellarium.org/wiki/index.php/Exoplanets_plugin\">").arg("</a>") + "</li>"; html += "<li>" + q_("If you want to read full information about the plugin, its history and format of the catalog you can %1get info here%2."). arg("<a href=\"http://stellarium.org/wiki/index.php/Exoplanets_plugin\">"). arg("</a>") + "</li>";
html += "</ul></p></body></html>"; html += "</ul></p></body></html>";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); if(gui!=NULL)
QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet); {
ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleShee QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
t); ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlS
tyleSheet);
}
ui->aboutTextBrowser->setHtml(html); ui->aboutTextBrowser->setHtml(html);
} }
void ExoplanetsDialog::setInfoHtml(void) void ExoplanetsDialog::setInfoHtml(void)
{ {
QString html = "<html><head></head><body>"; QString html = "<html><head></head><body>";
html += "<h2>" + q_("Potential habitable exoplanets") + "</h2>";
html += QString("<p>%1</p>").arg(q_("This plugin can display potenti
al habitable exoplanets (orange marker) and some information about those pl
anets - habitable class, mean surface temperature and Earth Similarity Inde
x."));
html += QString("<p><b>%1</b> &mdash; %2</p>").arg(q_("Habitable Cla
ss")).arg(q_("Classifies habitable planets based on temperature: hypopsychr
oplanets (O or hP) = very cold (less −50°C); psychroplanets (P) = cold; mes
oplanets (M) = medium-temperature (0–50°C); thermoplanets (T) = hot; hypert
hermoplanets (E or hT) = very hot (above 100°C). Mesoplanets would be ideal
for complex life, whereas class O or E would only support extremophilic li
fe. Non-habitable planets are simply given the class X (or NH)."));
html += QString("<p><b>%1</b> &mdash; %2</p>").arg(q_("Mean Surface
Temperature")).arg(q_("Temperature in (°C) based on a similar terrestrial a
tmosphere to planet mass ratio and a greenhouse effect due to 1 percent of
CO2 (assuming an albedo of 0.3 in all cases)."));
html += QString("<p><b><a href='http://phl.upr.edu/projects/earth-si
milarity-index-esi'>%1</a></b> &mdash; %2</p>").arg(q_("Earth Similarity In
dex (ESI)")).arg(q_("Similarity to Earth on a scale from 0 to 1, with 1 bei
ng the most Earth-like. ESI depends on the planet's radius, density, escape
velocity, and surface temperature."));
html += "</body></html>";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui(
));
if(gui!=NULL)
{
QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
ui->infoTextBrowser->document()->setDefaultStyleSheet(htmlSt
yleSheet);
}
ui->infoTextBrowser->setHtml(html);
}
void ExoplanetsDialog::setWebsitesHtml(void)
{
QString html = "<html><head></head><body>";
html += "<h2>" + q_("General professional Web sites relevant to extr asolar planets") + "</h2><ul>"; html += "<h2>" + q_("General professional Web sites relevant to extr asolar planets") + "</h2><ul>";
html += QString("<li><a href='%1'>%2</a></li>").arg("http://codement um.org/exoplanets/").arg(q_("Exoplanets: an interactive version of XKCD 107 1")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://codement um.org/exoplanets/").arg(q_("Exoplanets: an interactive version of XKCD 107 1"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.cfa. harvard.edu/HEK/").arg(q_("HEK (The Hunt for Exomoons with Kepler)")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.cfa. harvard.edu/HEK/").arg(q_("HEK (The Hunt for Exomoons with Kepler)"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.univ ie.ac.at/adg/schwarz/multiple.html").arg(q_("Exoplanets in binaries and mul tiple systems (Richard Schwarz)")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.univ ie.ac.at/adg/schwarz/multiple.html").arg(q_("Exoplanets in binaries and mul tiple systems (Richard Schwarz)"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.iau. org/public/naming/#exoplanets").arg(q_("Naming exoplanets (IAU)")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.iau. org/public/naming/#exoplanets").arg(q_("Naming exoplanets (IAU)"));
html += QString("<li><a href='%1'>%2</a> (<em>%3</em>)</li>").arg("h ttp://voparis-exoplanet.obspm.fr/people.html").arg(q_("Some Astronomers and Groups active in extrasolar planets studies")).arg(q_("update: 16 April 20 12")); html += QString("<li><a href='%1'>%2</a> (<em>%3</em>)</li>").arg("h ttp://voparis-exoplanet.obspm.fr/people.html").arg(q_("Some Astronomers and Groups active in extrasolar planets studies")).arg(q_("update: 16 April 20 12"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://exoplane ts.org/").arg(q_("The Exoplanet Data Explorer")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://exoplane ts.org/").arg(q_("The Exoplanet Data Explorer"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.phys .unsw.edu.au/~cgt/planet/AAPS_Home.html").arg(q_("The Anglo-Australian Plan et Search")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.phys .unsw.edu.au/~cgt/planet/AAPS_Home.html").arg(q_("The Anglo-Australian Plan et Search"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.exop lanets.ch/").arg(q_("Geneva Extrasolar Planet Search Programmes")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.exop lanets.ch/").arg(q_("Geneva Extrasolar Planet Search Programmes"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://olbin.jp l.nasa.gov/").arg(q_("OLBIN (Optical Long-Baseline Interferometry News)")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://olbin.jp l.nasa.gov/").arg(q_("OLBIN (Optical Long-Baseline Interferometry News)"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://exep.jpl .nasa.gov/").arg(q_("NASA's Exoplanet Exploration Program")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://exep.jpl .nasa.gov/").arg(q_("NASA's Exoplanet Exploration Program"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.astr o.psu.edu/users/alex/pulsar_planets.htm").arg(q_("Pulsar planets")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.astr o.psu.edu/users/alex/pulsar_planets.htm").arg(q_("Pulsar planets"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://exoplane tarchive.ipac.caltech.edu/").arg(q_("The NASA Exoplanet Archive")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://exoplane tarchive.ipac.caltech.edu/").arg(q_("The NASA Exoplanet Archive"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.dtm. ciw.edu/boss/c53index.html").arg(q_("IAU Comission 53: Extrasolar Planets") ); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.dtm. ciw.edu/boss/c53index.html").arg(q_("IAU Commission 53: Extrasolar Planets" ));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.exom ol.com/").arg(q_("ExoMol")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.exom ol.com/").arg(q_("ExoMol"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.hzga llery.org/").arg(q_("The Habitable Zone Gallery")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.hzga llery.org/").arg(q_("The Habitable Zone Gallery"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://planetqu est.jpl.nasa.gov/").arg(q_("PlanetQuest - The Search for Another Earth")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://planetqu est.jpl.nasa.gov/").arg(q_("PlanetQuest - The Search for Another Earth"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.open exoplanetcatalogue.com/").arg(q_("Open Exoplanet Catalogue")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://www.open exoplanetcatalogue.com/").arg(q_("Open Exoplanet Catalogue"));
html += QString("<li><a href='%1'>%2</a></li>").arg("http://phl.upr. edu/projects/habitable-exoplanets-catalog").arg(q_("The Habitable Exoplanet s Catalog")); html += QString("<li><a href='%1'>%2</a></li>").arg("http://phl.upr. edu/projects/habitable-exoplanets-catalog").arg(q_("The Habitable Exoplanet s Catalog"));
html += "</ul></body></html>"; html += "</ul></body></html>";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); if(gui!=NULL)
QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet); {
ui->infoTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
); ui->websitesTextBrowser->document()->setDefaultStyleSheet(ht
ui->infoTextBrowser->setHtml(html); mlStyleSheet);
}
ui->websitesTextBrowser->setHtml(html);
} }
void ExoplanetsDialog::refreshUpdateValues(void) void ExoplanetsDialog::refreshUpdateValues(void)
{ {
ui->lastUpdateDateTimeEdit->setDateTime(GETSTELMODULE(Exoplanets)->g ui->lastUpdateDateTimeEdit->setDateTime(ep->getLastUpdate());
etLastUpdate()); ui->updateFrequencySpinBox->setValue(ep->getUpdateFrequencyHours());
ui->updateFrequencySpinBox->setValue(GETSTELMODULE(Exoplanets)->getU int secondsToUpdate = ep->getSecondsToUpdate();
pdateFrequencyHours()); ui->internetUpdatesCheckbox->setChecked(ep->getUpdatesEnabled());
int secondsToUpdate = GETSTELMODULE(Exoplanets)->getSecondsToUpdate( if (!ep->getUpdatesEnabled())
);
ui->internetUpdatesCheckbox->setChecked(GETSTELMODULE(Exoplanets)->g
etUpdatesEnabled());
if (!GETSTELMODULE(Exoplanets)->getUpdatesEnabled())
ui->nextUpdateLabel->setText(q_("Internet updates disabled") ); ui->nextUpdateLabel->setText(q_("Internet updates disabled") );
else if (GETSTELMODULE(Exoplanets)->getUpdateState() == Exoplanets:: Updating) else if (ep->getUpdateState() == Exoplanets::Updating)
ui->nextUpdateLabel->setText(q_("Updating now...")); ui->nextUpdateLabel->setText(q_("Updating now..."));
else if (secondsToUpdate <= 60) else if (secondsToUpdate <= 60)
ui->nextUpdateLabel->setText(q_("Next update: < 1 minute")); ui->nextUpdateLabel->setText(q_("Next update: < 1 minute"));
else if (secondsToUpdate < 3600) else if (secondsToUpdate < 3600)
ui->nextUpdateLabel->setText(QString(q_("Next update: %1 min utes")).arg((secondsToUpdate/60)+1)); ui->nextUpdateLabel->setText(QString(q_("Next update: %1 min utes")).arg((secondsToUpdate/60)+1));
else else
ui->nextUpdateLabel->setText(QString(q_("Next update: %1 hou rs")).arg((secondsToUpdate/3600)+1)); ui->nextUpdateLabel->setText(QString(q_("Next update: %1 hou rs")).arg((secondsToUpdate/3600)+1));
} }
void ExoplanetsDialog::setUpdateValues(int hours) void ExoplanetsDialog::setUpdateValues(int hours)
{ {
GETSTELMODULE(Exoplanets)->setUpdateFrequencyHours(hours); ep->setUpdateFrequencyHours(hours);
refreshUpdateValues(); refreshUpdateValues();
} }
void ExoplanetsDialog::setDistributionEnabled(int checkState) void ExoplanetsDialog::setDistributionEnabled(int checkState)
{ {
bool b = checkState != Qt::Unchecked; bool b = checkState != Qt::Unchecked;
GETSTELMODULE(Exoplanets)->setDisplayMode(b); ep->setDisplayMode(b);
} }
void ExoplanetsDialog::setTimelineEnabled(int checkState) void ExoplanetsDialog::setTimelineEnabled(int checkState)
{ {
bool b = checkState != Qt::Unchecked; bool b = checkState != Qt::Unchecked;
GETSTELMODULE(Exoplanets)->setTimelineMode(b); ep->setTimelineMode(b);
}
void ExoplanetsDialog::setHabitableEnabled(int checkState)
{
bool b = checkState != Qt::Unchecked;
ep->setHabitableMode(b);
} }
void ExoplanetsDialog::setDisplayAtStartupEnabled(int checkState) void ExoplanetsDialog::setDisplayAtStartupEnabled(int checkState)
{ {
bool b = checkState != Qt::Unchecked; bool b = checkState != Qt::Unchecked;
GETSTELMODULE(Exoplanets)->setEnableAtStartup(b); ep->setEnableAtStartup(b);
} }
void ExoplanetsDialog::setDisplayShowExoplanetsButton(int checkState) void ExoplanetsDialog::setDisplayShowExoplanetsButton(int checkState)
{ {
bool b = checkState != Qt::Unchecked; bool b = checkState != Qt::Unchecked;
GETSTELMODULE(Exoplanets)->setFlagShowExoplanetsButton(b); ep->setFlagShowExoplanetsButton(b);
} }
void ExoplanetsDialog::setUpdatesEnabled(int checkState) void ExoplanetsDialog::setUpdatesEnabled(int checkState)
{ {
bool b = checkState != Qt::Unchecked; bool b = checkState != Qt::Unchecked;
GETSTELMODULE(Exoplanets)->setUpdatesEnabled(b); ep->setUpdatesEnabled(b);
ui->updateFrequencySpinBox->setEnabled(b); ui->updateFrequencySpinBox->setEnabled(b);
if(b) if(b)
ui->updateButton->setText(q_("Update now")); ui->updateButton->setText(q_("Update now"));
else else
ui->updateButton->setText(q_("Update from files")); ui->updateButton->setText(q_("Update from files"));
refreshUpdateValues(); refreshUpdateValues();
} }
void ExoplanetsDialog::updateStateReceiver(Exoplanets::UpdateState state) void ExoplanetsDialog::updateStateReceiver(Exoplanets::UpdateState state)
skipping to change at line 252 skipping to change at line 295
ui->nextUpdateLabel->setText(q_("Update error")); ui->nextUpdateLabel->setText(q_("Update error"));
updateTimer->start(); // make sure message is displayed for a while... updateTimer->start(); // make sure message is displayed for a while...
} }
} }
void ExoplanetsDialog::updateCompleteReceiver(void) void ExoplanetsDialog::updateCompleteReceiver(void)
{ {
ui->nextUpdateLabel->setText(QString(q_("Exoplanets is updated"))); ui->nextUpdateLabel->setText(QString(q_("Exoplanets is updated")));
// display the status for another full interval before refreshing st atus // display the status for another full interval before refreshing st atus
updateTimer->start(); updateTimer->start();
ui->lastUpdateDateTimeEdit->setDateTime(GETSTELMODULE(Exoplanets)->g etLastUpdate()); ui->lastUpdateDateTimeEdit->setDateTime(ep->getLastUpdate());
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(refreshUpdateValues())) ; connect(timer, SIGNAL(timeout()), this, SLOT(refreshUpdateValues())) ;
} }
void ExoplanetsDialog::restoreDefaults(void) void ExoplanetsDialog::restoreDefaults(void)
{ {
qDebug() << "Exoplanets::restoreDefaults"; qDebug() << "Exoplanets::restoreDefaults";
GETSTELMODULE(Exoplanets)->restoreDefaults(); ep->restoreDefaults();
GETSTELMODULE(Exoplanets)->readSettingsFromConfig(); ep->loadConfiguration();
updateGuiFromSettings(); updateGuiFromSettings();
} }
void ExoplanetsDialog::updateGuiFromSettings(void) void ExoplanetsDialog::updateGuiFromSettings(void)
{ {
ui->internetUpdatesCheckbox->setChecked(GETSTELMODULE(Exoplanets)->g etUpdatesEnabled()); ui->internetUpdatesCheckbox->setChecked(ep->getUpdatesEnabled());
refreshUpdateValues(); refreshUpdateValues();
} }
void ExoplanetsDialog::saveSettings(void) void ExoplanetsDialog::saveSettings(void)
{ {
GETSTELMODULE(Exoplanets)->saveSettingsToConfig(); ep->saveConfiguration();
} }
void ExoplanetsDialog::updateJSON(void) void ExoplanetsDialog::updateJSON(void)
{ {
if(GETSTELMODULE(Exoplanets)->getUpdatesEnabled()) if(ep->getUpdatesEnabled())
{ {
GETSTELMODULE(Exoplanets)->updateJSON(); ep->updateJSON();
} }
} }
 End of changes. 34 change blocks. 
54 lines changed or deleted 116 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/