Rev | Line | |
---|
[1372] | 1 | #ifndef BNCNETQUERY_H
|
---|
| 2 | #define BNCNETQUERY_H
|
---|
| 3 |
|
---|
| 4 | #include <QtNetwork>
|
---|
| 5 | #include "bncconst.h"
|
---|
| 6 |
|
---|
| 7 | class bncNetQuery : public QObject {
|
---|
| 8 | Q_OBJECT
|
---|
| 9 |
|
---|
| 10 | public:
|
---|
[1374] | 11 | enum queryStatus {init, running, finished, error};
|
---|
| 12 |
|
---|
[1372] | 13 | bncNetQuery();
|
---|
| 14 | ~bncNetQuery();
|
---|
| 15 |
|
---|
[1374] | 16 | void waitForRequestResult(const QUrl& url, QByteArray& outData);
|
---|
| 17 | void startRequest(const QUrl& url);
|
---|
| 18 | void waitForReadyRead(QByteArray& outData);
|
---|
| 19 |
|
---|
| 20 | queryStatus status() const {return _status;}
|
---|
| 21 |
|
---|
[1372] | 22 | signals:
|
---|
| 23 | void newMessage(QByteArray msg, bool showOnScreen);
|
---|
| 24 |
|
---|
| 25 | private slots:
|
---|
[1373] | 26 | void slotError(QNetworkReply::NetworkError);
|
---|
| 27 | void slotReadyRead();
|
---|
| 28 | void slotFinished();
|
---|
[1372] | 29 |
|
---|
| 30 | private:
|
---|
[1374] | 31 | void startRequest(const QUrl& url, bool full);
|
---|
[1372] | 32 |
|
---|
| 33 | QNetworkAccessManager* _manager;
|
---|
| 34 | QNetworkReply* _reply;
|
---|
| 35 | QEventLoop* _eventLoop;
|
---|
[1374] | 36 | queryStatus _status;
|
---|
[1372] | 37 | };
|
---|
| 38 |
|
---|
| 39 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.