From 90fe99277f0300eb7f0b80545d6a21f94198d45f Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 12 Nov 2009 12:25:28 +0000 Subject: Improved (fixed) http communication. --- client/netcom.cc | 16 ++++++++++++---- client/netcom.h | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/netcom.cc b/client/netcom.cc index 5cbcd22..be240e2 100644 --- a/client/netcom.cc +++ b/client/netcom.cc @@ -51,7 +51,9 @@ NetCom::NetCom(QString host, quint16 port, QString user, QString cpr) this->user = user; this->cpr = cpr; - connect(&http, SIGNAL(done(bool)), this, SLOT(done(bool))); + connect(&http, SIGNAL(readyRead(const QHttpResponseHeader &)), + this, SLOT(readyRead(const QHttpResponseHeader &))); + connect(&http, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int))); #ifdef USE_SSL connect(&http, SIGNAL(sslErrors(const QList &)), @@ -161,10 +163,16 @@ void NetCom::send(QVector< Widget* > widgets, QString templ, QString macro, QStr if(qApp->activeWindow()) qApp->activeWindow()->setEnabled(true); } -void NetCom::done(bool) +void NetCom::readyRead(const QHttpResponseHeader &) { - buffer = http.readAll(); - transfering = false; + // printf("STATE: readyRead\n"); + buffer += http.readAll(); +} + +void NetCom::stateChanged(int state) +{ + // printf("STATE: %d\n", state); + if(transfering && state == QHttp::Connected) transfering = false; } #ifdef USE_SSL diff --git a/client/netcom.h b/client/netcom.h index c40f85c..f1a8766 100644 --- a/client/netcom.h +++ b/client/netcom.h @@ -48,7 +48,9 @@ public: void send(QVector< Widget* > widgets, QString templ, QString macro, QString version); public slots: - void done(bool); + void stateChanged(int state); + void readyRead(const QHttpResponseHeader &resp); + #ifdef USE_SSL void sslError(const QList &errlst); #endif -- cgit v1.2.3