summaryrefslogtreecommitdiff
path: root/client/netcom.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/netcom.cc')
-rw-r--r--client/netcom.cc21
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();
+
}