diff options
author | deva <deva> | 2008-09-19 12:07:48 +0000 |
---|---|---|
committer | deva <deva> | 2008-09-19 12:07:48 +0000 |
commit | 3541224f0fb3d5b7b531eef45318d7e41cb51915 (patch) | |
tree | 450e6fc9d3ae57f7db7a79cfa87386e0b7b09c92 /client/netcom.cc | |
parent | eff75e9193b0e1d9175f49e003977d524c6a2d36 (diff) |
First working version of the collapser-pracro view.
Diffstat (limited to 'client/netcom.cc')
-rw-r--r-- | client/netcom.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/client/netcom.cc b/client/netcom.cc index a4d1fb3..8ff62b3 100644 --- a/client/netcom.cc +++ b/client/netcom.cc @@ -28,7 +28,7 @@ #include <QApplication> -NetCom *Global::netcom = NULL; +#include "widgets/widget.h" NetCom::NetCom(QString host, quint16 port, QString user, QString cpr) { @@ -55,7 +55,7 @@ QDomDocument NetCom::send(QString course, QString macro) QDomElement request_elem = doc.createElement("request"); request_elem.setAttribute("course", course); - request_elem.setAttribute("macro", macro); + if(macro != "") request_elem.setAttribute("macro", macro); pracro_elem.appendChild(request_elem); printf(doc.toString().toStdString().c_str()); @@ -81,7 +81,7 @@ void NetCom::readyRead() buffer.append(socket.readAll()); } -void NetCom::send(QVector< Widget* > widgets, QString macro, QString version) +void NetCom::send(QVector< Widget* > widgets, QString course, QString macro, QString version) { QDomDocument doc; @@ -96,6 +96,11 @@ void NetCom::send(QVector< Widget* > widgets, QString macro, QString version) commit_elem.setAttribute("version", version); pracro_elem.appendChild(commit_elem); + QDomElement request_elem = doc.createElement("request"); + request_elem.setAttribute("course", course); + //if(macro != "") request_elem.setAttribute("macro", macro); + pracro_elem.appendChild(request_elem); + // Iterate the different entries, and append their results to the commit string QVector< Widget* >::iterator i = widgets.begin(); while (i != widgets.end()) { @@ -112,6 +117,14 @@ void NetCom::send(QVector< Widget* > widgets, QString macro, QString version) printf(doc.toString().toStdString().c_str()); socket.write(doc.toByteArray()); - // qApp->processEvents(); socket.waitForBytesWritten(10000); + + do { + qApp->processEvents(); + } while(!res_doc.setContent(buffer)); + + buffer = ""; + + QDomElement elem = res_doc.documentElement(); + } |