| 6 | const int NETWORK_TIMEOUT_SECS = 60; |
| 7 | |
| 8 | WizAutoTimeOutEventLoop::WizAutoTimeOutEventLoop(QNetworkReply* pReply, QObject *parent /*= 0*/) |
| 9 | : QEventLoop(parent) |
| 10 | , m_error(QNetworkReply::NoError) |
| 11 | , m_timeOut(false) |
| 12 | , m_timeOutSeconds(NETWORK_TIMEOUT_SECS) |
| 13 | , m_downloadBytes(0) |
| 14 | , m_lastDownloadBytes(0) |
| 15 | , m_uploadBytes(0) |
| 16 | , m_lastUploadBytes(0) |
| 17 | , m_reply(pReply) |
| 18 | , m_finished(false) |
| 19 | { |
| 20 | m_url = pReply->request().url(); |
| 21 | connect(pReply, SIGNAL(finished()), SLOT(on_replyFinished())); |
| 22 | connect(pReply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(on_replyError(QNetworkReply::NetworkError))); |
| 23 | connect(pReply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(on_downloadProgress(qint64,qint64))); |
| 24 | connect(pReply, SIGNAL(uploadProgress(qint64,qint64)), SLOT(on_uploadProgress(qint64,qint64))); |
| 25 | connect(&m_timer, SIGNAL(timeout()), SLOT(on_timeOut())); |
| 26 | } |
| 27 | |
| 28 | WizAutoTimeOutEventLoop::~WizAutoTimeOutEventLoop() |
| 29 | { |