Novae.cpp   Novae.cpp 
skipping to change at line 76 skipping to change at line 76
{ {
Q_INIT_RESOURCE(Novae); Q_INIT_RESOURCE(Novae);
StelPluginInfo info; StelPluginInfo info;
info.id = "Novae"; info.id = "Novae";
info.displayedName = N_("Bright Novae"); info.displayedName = N_("Bright Novae");
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_("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;
info.license = NOVAE_PLUGIN_LICENSE;
return info; return info;
} }
/* /*
Constructor Constructor
*/ */
Novae::Novae() Novae::Novae()
: NovaCnt(0) : NovaCnt(0)
, texPointer(Q_NULLPTR) , texPointer(Q_NULLPTR)
, updateState(CompleteNoUpdates) , updateState(CompleteNoUpdates)
skipping to change at line 615 skipping to change at line 616
downloadMgr->get(request); downloadMgr->get(request);
updateState = Novae::CompleteUpdates; updateState = Novae::CompleteUpdates;
emit(updateStateChanged(updateState)); emit(updateStateChanged(updateState));
emit(jsonUpdateComplete()); emit(jsonUpdateComplete());
} }
void Novae::updateDownloadComplete(QNetworkReply* reply) void Novae::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() << "[Novae] FAILED to download" << reply->url() <
< " Error: " << reply->errorString();
}
else
{ {
// download completed successfully. // download completed successfully.
QString jsonFilePath = StelFileMgr::findFile("modules/Novae" , StelFileMgr::Flags(StelFileMgr::Writable|StelFileMgr::Directory)) + "/nov ae.json"; QString jsonFilePath = StelFileMgr::findFile("modules/Novae" , StelFileMgr::Flags(StelFileMgr::Writable|StelFileMgr::Directory)) + "/nov ae.json";
if (jsonFilePath.isEmpty()) if (jsonFilePath.isEmpty())
{ {
qWarning() << "[Novae] cannot write JSON data to fil e"; qWarning() << "[Novae] cannot write JSON data to fil e";
} }
else else
{ {
QFile jsonFile(jsonFilePath); QFile jsonFile(jsonFilePath);
if (jsonFile.exists()) if (jsonFile.exists())
jsonFile.remove(); jsonFile.remove();
if(jsonFile.open(QIODevice::WriteOnly | QIODevice::T ext)) if(jsonFile.open(QIODevice::WriteOnly | QIODevice::T ext))
{ {
jsonFile.write(reply->readAll()); jsonFile.write(reply->readAll());
jsonFile.close(); jsonFile.close();
} }
} }
} }
else
qWarning() << "[Novae] FAILED to download" << reply->url() <
< " 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/