Exoplanets.cpp   Exoplanets.cpp 
skipping to change at line 79 skipping to change at line 79
{ {
Q_INIT_RESOURCE(Exoplanets); Q_INIT_RESOURCE(Exoplanets);
StelPluginInfo info; StelPluginInfo info;
info.id = "Exoplanets"; info.id = "Exoplanets";
info.displayedName = N_("Exoplanets"); info.displayedName = N_("Exoplanets");
info.authors = "Alexander Wolf"; info.authors = "Alexander Wolf";
info.contact = "alex.v.wolf@gmail.com"; info.contact = "alex.v.wolf@gmail.com";
info.description = N_("This plugin plots the position of stars with exoplanets. Exoplanets data is derived from the 'Extrasolar Planets Encyclo paedia' at exoplanet.eu"); info.description = N_("This plugin plots the position of stars with exoplanets. Exoplanets data is derived from the 'Extrasolar Planets Encyclo paedia' at exoplanet.eu");
info.version = EXOPLANETS_PLUGIN_VERSION; info.version = EXOPLANETS_PLUGIN_VERSION;
info.license = EXOPLANETS_PLUGIN_LICENSE;
return info; return info;
} }
/* /*
Constructor Constructor
*/ */
Exoplanets::Exoplanets() Exoplanets::Exoplanets()
: PSCount(0) : PSCount(0)
, EPCountAll(0) , EPCountAll(0)
, EPCountPH(0) , EPCountPH(0)
skipping to change at line 769 skipping to change at line 770
downloadMgr->get(request); downloadMgr->get(request);
updateState = Exoplanets::CompleteUpdates; updateState = Exoplanets::CompleteUpdates;
emit(updateStateChanged(updateState)); emit(updateStateChanged(updateState));
emit(jsonUpdateComplete()); emit(jsonUpdateComplete());
} }
void Exoplanets::updateDownloadComplete(QNetworkReply* reply) void Exoplanets::updateDownloadComplete(QNetworkReply* reply)
{ {
// check the download worked, and save the data to file if this is t he case. // check the download worked, and save the data to file if this is t he case.
if (reply->error() != QNetworkReply::NoError) if (reply->error() == QNetworkReply::NoError && reply->bytesAvailabl
{ e()>0)
qWarning() << "[Exoplanets] FAILED to download" << reply->ur
l() << " Error: " << reply->errorString();
}
else
{ {
// download completed successfully. // download completed successfully.
try try
{ {
QString jsonFilePath = StelFileMgr::findFile("module s/Exoplanets", StelFileMgr::Flags(StelFileMgr::Writable|StelFileMgr::Direct ory)) + "/exoplanets.json"; QString jsonFilePath = StelFileMgr::findFile("module s/Exoplanets", StelFileMgr::Flags(StelFileMgr::Writable|StelFileMgr::Direct ory)) + "/exoplanets.json";
QFile jsonFile(jsonFilePath); QFile jsonFile(jsonFilePath);
if (jsonFile.exists()) if (jsonFile.exists())
jsonFile.remove(); jsonFile.remove();
if (jsonFile.open(QIODevice::WriteOnly | QIODevice:: Text)) if (jsonFile.open(QIODevice::WriteOnly | QIODevice:: Text))
skipping to change at line 795 skipping to change at line 792
jsonFile.write(reply->readAll()); jsonFile.write(reply->readAll());
jsonFile.close(); jsonFile.close();
} }
} }
catch (std::runtime_error &e) catch (std::runtime_error &e)
{ {
qWarning() << "[Exoplanets] Cannot write JSON data t o file:" << e.what(); qWarning() << "[Exoplanets] Cannot write JSON data t o file:" << e.what();
} }
} }
else
qWarning() << "[Exoplanets] FAILED to download" << reply->ur
l() << " Error: " << reply->errorString();
if (progressBar) if (progressBar)
{ {
progressBar->setValue(100); progressBar->setValue(100);
StelApp::getInstance().removeProgressBar(progressBar); StelApp::getInstance().removeProgressBar(progressBar);
progressBar = Q_NULLPTR; progressBar = Q_NULLPTR;
} }
readJsonFile(); readJsonFile();
} }
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 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/