MeteorShowerDialog.cpp   MeteorShowerDialog.cpp 
skipping to change at line 50 skipping to change at line 50
#include "StelStyle.hpp" #include "StelStyle.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "ui_meteorShowerDialog.h" #include "ui_meteorShowerDialog.h"
MeteorShowerDialog::MeteorShowerDialog() MeteorShowerDialog::MeteorShowerDialog()
: plugin(NULL) : plugin(NULL)
, updateTimer(NULL) , updateTimer(NULL)
, treeWidget(NULL) , treeWidget(NULL)
{ {
ui = new Ui_meteorShowerDialog; ui = new Ui_meteorShowerDialog;
} }
MeteorShowerDialog::~MeteorShowerDialog() MeteorShowerDialog::~MeteorShowerDialog()
{ {
if (updateTimer) if (updateTimer)
{ {
updateTimer->stop(); updateTimer->stop();
delete updateTimer; delete updateTimer;
updateTimer = NULL; updateTimer = NULL;
} }
skipping to change at line 75 skipping to change at line 75
{ {
if (dialog) if (dialog)
{ {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
refreshUpdateValues(); refreshUpdateValues();
setAboutHtml(); setAboutHtml();
setHeaderNames(); setHeaderNames();
//Retranslate name and datatype strings //Retranslate name and datatype strings
QTreeWidgetItemIterator it(treeWidget); QTreeWidgetItemIterator it(treeWidget);
while (*it) { while (*it)
{
//Name //Name
(*it)->setText(ColumnName, q_((*it)->text(ColumnName ))); (*it)->setText(ColumnName, q_((*it)->text(ColumnName )));
//Data type //Data type
(*it)->setText(ColumnDataType, q_((*it)->text(Column DataType))); (*it)->setText(ColumnDataType, q_((*it)->text(Column DataType)));
++it; ++it;
} }
} }
} }
// Initialize the dialog widgets and connect the signals/slots // Initialize the dialog widgets and connect the signals/slots
skipping to change at line 145 skipping to change at line 146
connect(ui->displayShowMeteorShowerButton, SIGNAL(clicked(bool)), pl ugin, SLOT(setFlagShowMSButton(bool))); connect(ui->displayShowMeteorShowerButton, SIGNAL(clicked(bool)), pl ugin, SLOT(setFlagShowMSButton(bool)));
// ///////////////////////////////////////// // /////////////////////////////////////////
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()));
// Markers tab // Markers tab
refreshColorMarkers(); refreshMarkersColor();
connect(ui->changeColorARG, SIGNAL(clicked()), this, SLOT(setColorAR G())); connect(ui->changeColorARG, SIGNAL(clicked()), this, SLOT(setColorAR G()));
connect(ui->changeColorARR, SIGNAL(clicked()), this, SLOT(setColorAR R())); connect(ui->changeColorARR, SIGNAL(clicked()), this, SLOT(setColorAR R()));
connect(ui->changeColorIR, SIGNAL(clicked()), this, SLOT(setColorIR( ))); connect(ui->changeColorIR, SIGNAL(clicked()), this, SLOT(setColorIR( )));
// About tab // About tab
setAboutHtml(); setAboutHtml();
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
if (gui != NULL) if (gui != NULL)
{ {
ui->aboutTextBrowser->document()->setDefaultStyleSheet(QStri ng(gui->getStelStyle().htmlStyleSheet)); ui->aboutTextBrowser->document()->setDefaultStyleSheet(QStri ng(gui->getStelStyle().htmlStyleSheet));
skipping to change at line 317 skipping to change at line 318
ui->aboutTextBrowser->setHtml(html); ui->aboutTextBrowser->setHtml(html);
} }
void MeteorShowerDialog::refreshUpdateValues(void) void MeteorShowerDialog::refreshUpdateValues(void)
{ {
ui->lastUpdateDateTimeEdit->setDateTime(plugin->getLastUpdate()); ui->lastUpdateDateTimeEdit->setDateTime(plugin->getLastUpdate());
ui->updateFrequencySpinBox->setValue(plugin->getUpdateFrequencyHours ()); ui->updateFrequencySpinBox->setValue(plugin->getUpdateFrequencyHours ());
int secondsToUpdate = plugin->getSecondsToUpdate(); int secondsToUpdate = plugin->getSecondsToUpdate();
if (!plugin->getUpdatesEnabled()) if (!plugin->getUpdatesEnabled())
{
ui->nextUpdateLabel->setText(q_("Internet updates disabled") ); ui->nextUpdateLabel->setText(q_("Internet updates disabled") );
}
else if (plugin->getUpdateState() == MeteorShowers::Updating) else if (plugin->getUpdateState() == MeteorShowers::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 MeteorShowerDialog::setUpdateValues(int hours) void MeteorShowerDialog::setUpdateValues(int hours)
{ {
plugin->setUpdateFrequencyHours(hours); plugin->setUpdateFrequencyHours(hours);
refreshUpdateValues(); refreshUpdateValues();
} }
void MeteorShowerDialog::setUpdatesEnabled(bool checkState) void MeteorShowerDialog::setUpdatesEnabled(bool checkState)
{ {
plugin->setUpdatesEnabled(checkState); plugin->setUpdatesEnabled(checkState);
ui->updateFrequencySpinBox->setEnabled(checkState); ui->updateFrequencySpinBox->setEnabled(checkState);
ui->updateButton->setText(q_("Update now")); ui->updateButton->setText(q_("Update now"));
refreshUpdateValues(); refreshUpdateValues();
} }
void MeteorShowerDialog::updateStateReceiver(MeteorShowers::UpdateState sta te) void MeteorShowerDialog::updateStateReceiver(MeteorShowers::UpdateState sta te)
{ {
//qDebug() << "MeteorShowerDialog::updateStateReceiver got a signal" ; //qDebug() << "MeteorShowerDialog::updateStateReceiver got a signal" ;
if (state==MeteorShowers::Updating) if (state==MeteorShowers::Updating)
{
ui->nextUpdateLabel->setText(q_("Updating now...")); ui->nextUpdateLabel->setText(q_("Updating now..."));
}
else if (state==MeteorShowers::DownloadError || state==MeteorShowers ::OtherError) else if (state==MeteorShowers::DownloadError || state==MeteorShowers ::OtherError)
{ {
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 MeteorShowerDialog::updateCompleteReceiver(void) void MeteorShowerDialog::updateCompleteReceiver(void)
{ {
ui->nextUpdateLabel->setText(QString(q_("Meteor showers is updated" ))); ui->nextUpdateLabel->setText(QString(q_("Meteor showers is updated" )));
skipping to change at line 375 skipping to change at line 388
{ {
qDebug() << "MeteorShowers::restoreDefaults"; qDebug() << "MeteorShowers::restoreDefaults";
plugin->restoreDefaults(); plugin->restoreDefaults();
plugin->readSettingsFromConfig(); plugin->readSettingsFromConfig();
updateGuiFromSettings(); updateGuiFromSettings();
} }
void MeteorShowerDialog::updateGuiFromSettings(void) void MeteorShowerDialog::updateGuiFromSettings(void)
{ {
refreshUpdateValues(); refreshUpdateValues();
refreshColorMarkers(); refreshMarkersColor();
} }
void MeteorShowerDialog::saveSettings(void) void MeteorShowerDialog::saveSettings(void)
{ {
plugin->saveSettingsToConfig(); plugin->saveSettingsToConfig();
} }
void MeteorShowerDialog::updateJSON(void) void MeteorShowerDialog::updateJSON(void)
{ {
if (plugin->getUpdatesEnabled()) if (plugin->getUpdatesEnabled())
{ {
plugin->updateJSON(); plugin->updateJSON();
} }
} }
void MeteorShowerDialog::refreshColorMarkers(void) void MeteorShowerDialog::refreshMarkersColor(void)
{
setTextureColor(ui->textureARG, plugin->getColorARG());
setTextureColor(ui->textureARR, plugin->getColorARR());
setTextureColor(ui->textureIR, plugin->getColorIR());
}
void MeteorShowerDialog::setTextureColor(QLabel *texture, QColor color)
{ {
QGraphicsColorizeEffect *e = new QGraphicsColorizeEffect(texture); ui->changeColorARG->setStyleSheet("background-color:" + plugin->getC
e->setColor(color); olorARG().name() + ";");
texture->setGraphicsEffect(e); ui->changeColorARR->setStyleSheet("background-color:" + plugin->getC
olorARR().name() + ";");
ui->changeColorIR->setStyleSheet("background-color:" + plugin->getCo
lorIR().name() + ";");
} }
void MeteorShowerDialog::setColorARG() void MeteorShowerDialog::setColorARG()
{ {
QColor color = QColorDialog::getColor(plugin->getColorARG()); QColor color = QColorDialog::getColor(plugin->getColorARG());
if (color.isValid()) if (color.isValid())
{ {
setTextureColor(ui->textureARG, color); ui->changeColorARG->setStyleSheet("background-color:" + colo r.name() + ";");
plugin->setColorARG(color); plugin->setColorARG(color);
} }
} }
void MeteorShowerDialog::setColorARR() void MeteorShowerDialog::setColorARR()
{ {
QColor color = QColorDialog::getColor(plugin->getColorARR()); QColor color = QColorDialog::getColor(plugin->getColorARR());
if (color.isValid()) if (color.isValid())
{ {
setTextureColor(ui->textureARR, color); ui->changeColorARR->setStyleSheet("background-color:" + colo r.name() + ";");
plugin->setColorARR(color); plugin->setColorARR(color);
} }
} }
void MeteorShowerDialog::setColorIR() void MeteorShowerDialog::setColorIR()
{ {
QColor color = QColorDialog::getColor(plugin->getColorIR()); QColor color = QColorDialog::getColor(plugin->getColorIR());
if (color.isValid()) if (color.isValid())
{ {
setTextureColor(ui->textureIR, color); ui->changeColorIR->setStyleSheet("background-color:" + color .name() + ";");
plugin->setColorIR(color); plugin->setColorIR(color);
} }
} }
 End of changes. 21 change blocks. 
18 lines changed or deleted 27 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/