Novae.cpp   Novae.cpp 
skipping to change at line 84 skipping to change at line 84
info.description = N_("A plugin that shows some bright novae in the Milky Way galaxy."); info.description = N_("A plugin that shows some bright novae in the Milky Way galaxy.");
info.version = NOVAE_PLUGIN_VERSION; info.version = NOVAE_PLUGIN_VERSION;
return info; return info;
} }
/* /*
Constructor Constructor
*/ */
Novae::Novae() Novae::Novae()
: NovaCnt(0) : NovaCnt(0)
, texPointer(NULL) , texPointer(Q_NULLPTR)
, updateState(CompleteNoUpdates) , updateState(CompleteNoUpdates)
, downloadMgr(NULL) , downloadMgr(Q_NULLPTR)
, progressBar(NULL) , progressBar(Q_NULLPTR)
, updateTimer(NULL) , updateTimer(Q_NULLPTR)
, messageTimer(NULL) , messageTimer(Q_NULLPTR)
, updatesEnabled(false) , updatesEnabled(false)
, updateFrequencyDays(0) , updateFrequencyDays(0)
{ {
setObjectName("Novae"); setObjectName("Novae");
configDialog = new NovaeDialog(); configDialog = new NovaeDialog();
conf = StelApp::getInstance().getSettings(); conf = StelApp::getInstance().getSettings();
font.setPixelSize(StelApp::getInstance().getBaseFontSize()); font.setPixelSize(StelApp::getInstance().getBaseFontSize());
} }
/* /*
skipping to change at line 264 skipping to change at line 264
} }
StelObjectP Novae::searchByName(const QString& englishName) const StelObjectP Novae::searchByName(const QString& englishName) const
{ {
foreach(const NovaP& n, nova) foreach(const NovaP& n, nova)
{ {
if (n->getEnglishName().toUpper() == englishName.toUpper() | | n->getDesignation().toUpper() == englishName.toUpper()) if (n->getEnglishName().toUpper() == englishName.toUpper() | | n->getDesignation().toUpper() == englishName.toUpper())
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
return NULL; return Q_NULLPTR;
} }
StelObjectP Novae::searchByNameI18n(const QString& nameI18n) const StelObjectP Novae::searchByNameI18n(const QString& nameI18n) const
{ {
foreach(const NovaP& n, nova) foreach(const NovaP& n, nova)
{ {
if (n->getNameI18n().toUpper() == nameI18n.toUpper() || n->g etDesignation().toUpper() == nameI18n.toUpper()) if (n->getNameI18n().toUpper() == nameI18n.toUpper() || n->g etDesignation().toUpper() == nameI18n.toUpper())
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
return NULL; return Q_NULLPTR;
} }
QStringList Novae::listMatchingObjects(const QString& objPrefix, int maxNbI tem, bool useStartOfWords, bool inEnglish) const QStringList Novae::listMatchingObjects(const QString& objPrefix, int maxNbI tem, bool useStartOfWords, bool inEnglish) const
{ {
QStringList result; QStringList result;
if (maxNbItem <= 0) if (maxNbItem <= 0)
{ {
return result; return result;
} }
skipping to change at line 458 skipping to change at line 458
novalist.insert(novaeData.value("name").toString(), novaeDat a.value("peakJD").toDouble()); novalist.insert(novaeData.value("name").toString(), novaeDat a.value("peakJD").toDouble());
NovaCnt++; NovaCnt++;
NovaP n(new Nova(novaeData)); NovaP n(new Nova(novaeData));
if (n->initialized) if (n->initialized)
nova.append(n); nova.append(n);
} }
} }
int Novae::getJsonFileVersion(void) int Novae::getJsonFileVersion(void) const
{ {
int jsonVersion = -1; int jsonVersion = -1;
QFile novaeJsonFile(novaeJsonPath); QFile novaeJsonFile(novaeJsonPath);
if (!novaeJsonFile.open(QIODevice::ReadOnly)) if (!novaeJsonFile.open(QIODevice::ReadOnly))
{ {
qWarning() << "[Novae] cannot open" << QDir::toNativeSeparat ors(novaeJsonPath); qWarning() << "[Novae] cannot open" << QDir::toNativeSeparat ors(novaeJsonPath);
return jsonVersion; return jsonVersion;
} }
QVariantMap map; QVariantMap map;
skipping to change at line 480 skipping to change at line 480
if (map.contains("version")) if (map.contains("version"))
{ {
jsonVersion = map.value("version").toInt(); jsonVersion = map.value("version").toInt();
} }
novaeJsonFile.close(); novaeJsonFile.close();
qDebug() << "[Novae] version of the catalog:" << jsonVersion; qDebug() << "[Novae] version of the catalog:" << jsonVersion;
return jsonVersion; return jsonVersion;
} }
bool Novae::checkJsonFileFormat() bool Novae::checkJsonFileFormat() const
{ {
QFile novaeJsonFile(novaeJsonPath); QFile novaeJsonFile(novaeJsonPath);
if (!novaeJsonFile.open(QIODevice::ReadOnly)) if (!novaeJsonFile.open(QIODevice::ReadOnly))
{ {
qWarning() << "[Novae] cannot open" << QDir::toNativeSeparat ors(novaeJsonPath); qWarning() << "[Novae] cannot open" << QDir::toNativeSeparat ors(novaeJsonPath);
return false; return false;
} }
QVariantMap map; QVariantMap map;
try try
skipping to change at line 504 skipping to change at line 504
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qDebug() << "[Novae] file format is wrong! Error:" << e.what (); qDebug() << "[Novae] file format is wrong! Error:" << e.what ();
return false; return false;
} }
return true; return true;
} }
NovaP Novae::getByID(const QString& id) NovaP Novae::getByID(const QString& id) const
{ {
foreach(const NovaP& n, nova) foreach(const NovaP& n, nova)
{ {
if (n->initialized && n->designation == id) if (n->initialized && n->designation == id)
return n; return n;
} }
return NovaP(); return NovaP();
} }
bool Novae::configureGui(bool show) bool Novae::configureGui(bool show)
skipping to change at line 595 skipping to change at line 595
{ {
qDebug() << "[Novae] starting update..."; qDebug() << "[Novae] starting update...";
} }
lastUpdate = QDateTime::currentDateTime(); lastUpdate = QDateTime::currentDateTime();
conf->setValue("Novae/last_update", lastUpdate.toString(Qt::ISODate) ); conf->setValue("Novae/last_update", lastUpdate.toString(Qt::ISODate) );
updateState = Novae::Updating; updateState = Novae::Updating;
emit(updateStateChanged(updateState)); emit(updateStateChanged(updateState));
if (progressBar==NULL) if (progressBar==Q_NULLPTR)
progressBar = StelApp::getInstance().addProgressBar(); progressBar = StelApp::getInstance().addProgressBar();
progressBar->setValue(0); progressBar->setValue(0);
progressBar->setRange(0, 100); progressBar->setRange(0, 100);
progressBar->setFormat("Update novae"); progressBar->setFormat("Update novae");
QNetworkRequest request; QNetworkRequest request;
request.setUrl(QUrl(updateUrl)); request.setUrl(QUrl(updateUrl));
request.setRawHeader("User-Agent", QString("Mozilla/5.0 (Stellarium Bright Novae Plugin %1; http://stellarium.org/)").arg(NOVAE_PLUGIN_VERSION) .toUtf8()); request.setRawHeader("User-Agent", QString("Mozilla/5.0 (Stellarium Bright Novae Plugin %1; http://stellarium.org/)").arg(NOVAE_PLUGIN_VERSION) .toUtf8());
downloadMgr->get(request); downloadMgr->get(request);
skipping to change at line 645 skipping to change at line 645
jsonFile.write(reply->readAll()); jsonFile.write(reply->readAll());
jsonFile.close(); jsonFile.close();
} }
} }
} }
if (progressBar) if (progressBar)
{ {
progressBar->setValue(100); progressBar->setValue(100);
StelApp::getInstance().removeProgressBar(progressBar); StelApp::getInstance().removeProgressBar(progressBar);
progressBar = NULL; progressBar = Q_NULLPTR;
} }
readJsonFile(); readJsonFile();
} }
void Novae::displayMessage(const QString& message, const QString hexColor) void Novae::displayMessage(const QString& message, const QString hexColor)
{ {
messageIDs << GETSTELMODULE(LabelMgr)->labelScreen(message, 30, 30 + (20*messageIDs.count()), true, 16, hexColor); messageIDs << GETSTELMODULE(LabelMgr)->labelScreen(message, 30, 30 + (20*messageIDs.count()), true, 16, hexColor);
messageTimer->start(); messageTimer->start();
} }
void Novae::messageTimeout(void) void Novae::messageTimeout(void) const
{ {
foreach(int i, messageIDs) foreach(int i, messageIDs)
{ {
GETSTELMODULE(LabelMgr)->deleteLabel(i); GETSTELMODULE(LabelMgr)->deleteLabel(i);
} }
} }
QString Novae::getNovaeList() QString Novae::getNovaeList()
{ {
QString smonth[] = {q_("January"), q_("February"), q_("March"), q_(" April"), q_("May"), q_("June"), q_("July"), q_("August"), q_("September"), q_("October"), q_("November"), q_("December")}; QString smonth[] = {q_("January"), q_("February"), q_("March"), q_(" April"), q_("May"), q_("June"), q_("July"), q_("August"), q_("September"), q_("October"), q_("November"), q_("December")};
 End of changes. 10 change blocks. 
13 lines changed or deleted 13 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/