SimbadSearcher.cpp   SimbadSearcher.cpp 
skipping to change at line 30 skipping to change at line 30
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
SimbadLookupReply::SimbadLookupReply(const QString& aurl, QNetworkAccessMan ager* anetMgr, int delayMs) SimbadLookupReply::SimbadLookupReply(const QString& aurl, QNetworkAccessMan ager* anetMgr, int delayMs)
: url(aurl) : url(aurl)
, reply(NULL) , reply(Q_NULLPTR)
, netMgr(anetMgr) , netMgr(anetMgr)
, currentStatus(SimbadLookupQuerying) , currentStatus(SimbadLookupQuerying)
{ {
if(delayMs <= 0) if(delayMs <= 0)
delayTimerCompleted(); delayTimerCompleted();
else else
{ {
// First wait before starting query. This avoids sending a q uery for each autocompletion letter. // First wait before starting query. This avoids sending a q uery for each autocompletion letter.
QTimer::singleShot(delayMs, this, SLOT(delayTimerCompleted() )); QTimer::singleShot(delayMs, this, SLOT(delayTimerCompleted() ));
} }
} }
SimbadLookupReply::~SimbadLookupReply() SimbadLookupReply::~SimbadLookupReply()
{ {
if (reply) if (reply)
{ {
disconnect(reply, SIGNAL(finished()), this, SLOT(httpQueryFi nished())); disconnect(reply, SIGNAL(finished()), this, SLOT(httpQueryFi nished()));
reply->abort(); reply->abort();
//do not use delete here //do not use delete here
reply->deleteLater(); reply->deleteLater();
reply = NULL; reply = Q_NULLPTR;
} }
} }
//This is provided for the correct deletion of the reply in the RemoteContr ol plugin //This is provided for the correct deletion of the reply in the RemoteContr ol plugin
void SimbadLookupReply::deleteNetworkReply() void SimbadLookupReply::deleteNetworkReply()
{ {
if(reply) if(reply)
{ {
disconnect(reply, SIGNAL(finished()), this, SLOT(httpQueryFi nished())); disconnect(reply, SIGNAL(finished()), this, SLOT(httpQueryFi nished()));
reply->abort(); reply->abort();
delete reply; delete reply;
reply = NULL; reply = Q_NULLPTR;
} }
} }
void SimbadLookupReply::delayTimerCompleted() void SimbadLookupReply::delayTimerCompleted()
{ {
reply = netMgr->get(QNetworkRequest(url)); reply = netMgr->get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()), this, SLOT(httpQueryFinished())); connect(reply, SIGNAL(finished()), this, SLOT(httpQueryFinished()));
} }
void SimbadLookupReply::httpQueryFinished() void SimbadLookupReply::httpQueryFinished()
skipping to change at line 179 skipping to change at line 179
{ {
// Create the Simbad query // Create the Simbad query
QString url(serverUrl); QString url(serverUrl);
QString query = "format object \"%COO(d;A D)\\n%IDLIST(1)\"\n"; QString query = "format object \"%COO(d;A D)\\n%IDLIST(1)\"\n";
query += QString("set epoch J2000\nset limit %1\n query id ").arg(ma xNbResult); query += QString("set epoch J2000\nset limit %1\n query id ").arg(ma xNbResult);
query += objectName; query += objectName;
QByteArray ba = QUrl::toPercentEncoding(query, "", ""); QByteArray ba = QUrl::toPercentEncoding(query, "", "");
url += "simbad/sim-script?script="; url += "simbad/sim-script?script=";
url += ba.constData(); url += ba.constData();
if (networkMgr->networkAccessible()==QNetworkAccessManager::Accessib return new SimbadLookupReply(url, networkMgr, delayMs);
le)
return new SimbadLookupReply(url, networkMgr, delayMs);
else
return NULL;
} }
 End of changes. 4 change blocks. 
8 lines changed or deleted 4 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/