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) : url(aurl), reply(NULL), netMgr(anetMgr), curr entStatus(SimbadLookupQuerying) SimbadLookupReply::SimbadLookupReply(const QString& aurl, QNetworkAccessMan ager* anetMgr, int delayMs) : url(aurl), reply(NULL), netMgr(anetMgr), curr entStatus(SimbadLookupQuerying)
{ {
// First wait before starting query. This avoids sending a query for if(delayMs <= 0)
each autocompletion letter. delayTimerCompleted();
QTimer::singleShot(delayMs, this, SLOT(delayTimerCompleted())); else
{
// First wait before starting query. This avoids sending a q
uery for each autocompletion letter.
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
reply->deleteLater(); reply->deleteLater();
reply = NULL; reply = NULL;
} }
} }
//This is provided for the correct deletion of the reply in the RemoteContr
ol plugin
void SimbadLookupReply::deleteNetworkReply()
{
if(reply)
{
disconnect(reply, SIGNAL(finished()), this, SLOT(httpQueryFi
nished()));
reply->abort();
delete reply;
reply = NULL;
}
}
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()
{ {
if (reply->error()!=QNetworkReply::NoError) if (reply->error()!=QNetworkReply::NoError)
{ {
 End of changes. 3 change blocks. 
3 lines changed or deleted 24 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/