SimbadSearcher.hpp   SimbadSearcher.hpp 
skipping to change at line 27 skipping to change at line 27
*/ */
#ifndef SIMBADSEARCHER_HPP_ #ifndef SIMBADSEARCHER_HPP_
#define SIMBADSEARCHER_HPP_ #define SIMBADSEARCHER_HPP_
#include "VecMath.hpp" #include "VecMath.hpp"
#include <QObject> #include <QObject>
#include <QMap> #include <QMap>
class QNetworkReply; class QNetworkReply;
class QNetworkAccessManager;
//! @class SimbadLookupReply //! @class SimbadLookupReply
//! Contains all the information about a current simbad lookup query. //! Contains all the information about a current simbad lookup query.
//! Instances of this class are generated by the SimbadSearcher class. //! Instances of this class are generated by the SimbadSearcher class.
class SimbadLookupReply : public QObject class SimbadLookupReply : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS(SimbadLookupStatus); Q_ENUMS(SimbadLookupStatus);
public: public:
friend class SimbadSearcher; friend class SimbadSearcher;
//! Possible status for a simbad query. //! Possible status for a simbad query.
enum SimbadLookupStatus enum SimbadLookupStatus
{ {
SimbadLookupQuerying, //!< Simbad is still being q ueried. SimbadLookupQuerying, //!< Simbad is still being q ueried.
SimbadLookupErrorOccured, //!< An error occured while looking up Simbad. Call getErrorString() for a description of the error. SimbadLookupErrorOccured, //!< An error occured while looking up Simbad. Call getErrorString() for a description of the error.
SimbadLookupFinished //!< The query is over. The reply can be deleted. SimbadLookupFinished //!< The query is over. The reply can be deleted.
}; };
~SimbadLookupReply(); ~SimbadLookupReply();
//! Get the result list of matching objectName/position. //! Get the result list of matching objectName/position.
QMap<QString, Vec3d> getResults() const {return resultPositions;} QMap<QString, Vec3d> getResults() const {return resultPositions;}
//! Get the current status. //! Get the current status.
SimbadLookupStatus getCurrentStatus() const {return currentStatus;} SimbadLookupStatus getCurrentStatus() const {return currentStatus;}
skipping to change at line 67 skipping to change at line 68
//! Get the error descrition string. Return empty string if no error occured. //! Get the error descrition string. Return empty string if no error occured.
QString getErrorString() const {return errorString;} QString getErrorString() const {return errorString;}
signals: signals:
//! Triggered when the lookup status change. //! Triggered when the lookup status change.
void statusChanged(); void statusChanged();
private slots: private slots:
void httpQueryFinished(); void httpQueryFinished();
void delayTimerCompleted();
private: private:
//! Private constructor can be called by SimbadSearcher only. //! Private constructor can be called by SimbadSearcher only.
SimbadLookupReply(QNetworkReply* r); SimbadLookupReply(const QString& url, QNetworkAccessManager* mgr, in
t delayMs=500);
QString url;
//! The reply used internally. //! The reply used internally.
QNetworkReply* reply; QNetworkReply* reply;
QNetworkAccessManager* netMgr;
//! The list of resulting objectNames/Position in ICRS. //! The list of resulting objectNames/Position in ICRS.
QMap<QString, Vec3d> resultPositions; QMap<QString, Vec3d> resultPositions;
//! Current lookup status. //! Current lookup status.
SimbadLookupStatus currentStatus; SimbadLookupStatus currentStatus;
//! The error description. Empty if no errors occured. //! The error description. Empty if no errors occured.
QString errorString; QString errorString;
}; };
skipping to change at line 99 skipping to change at line 104
{ {
Q_OBJECT Q_OBJECT
public: public:
SimbadSearcher(QObject* parent); SimbadSearcher(QObject* parent);
//! Lookup in Simbad for object which have a name starting with @em objectName. //! Lookup in Simbad for object which have a name starting with @em objectName.
//! @param objectName the possibly truncated object name. //! @param objectName the possibly truncated object name.
//! @param maxNbResult the maximum number of returned result. //! @param maxNbResult the maximum number of returned result.
//! @return a new SimbadLookupReply which is owned by the caller. //! @return a new SimbadLookupReply which is owned by the caller.
SimbadLookupReply* lookup(const QString& objectName, int maxNbResult =1); SimbadLookupReply* lookup(const QString& objectName, int maxNbResult =1, int delayMs=500);
private: private:
//! The network manager used query simbad //! The network manager used query simbad
class QNetworkAccessManager* networkMgr; QNetworkAccessManager* networkMgr;
}; };
#endif /*SIMBADSEARCHER_HPP_*/ #endif /*SIMBADSEARCHER_HPP_*/
 End of changes. 7 change blocks. 
4 lines changed or deleted 10 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/