Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Slots | Public Member Functions | List of all members
NetworkClient Class Reference

Client for interacting with Engauge server. More...

#include <NetworkClient.h>

Inheritance diagram for NetworkClient:
Inheritance graph
Collaboration diagram for NetworkClient:
Collaboration graph

Public Slots

void slotFinished (QNetworkReply *)
 Cleanup after response is returned. More...
 

Public Member Functions

 NetworkClient (QObject *parent)
 Single constructor. More...
 
void uploadErrorReport (const QString &report)
 Upload the error report asynchronously. More...
 

Detailed Description

Client for interacting with Engauge server.

Definition at line 16 of file NetworkClient.h.

Constructor & Destructor Documentation

NetworkClient::NetworkClient ( QObject *  parent)

Single constructor.

Definition at line 14 of file NetworkClient.cpp.

14  :
15  QNetworkAccessManager (parent)
16 {
17  connect (this, SIGNAL (finished (QNetworkReply *)), this, SLOT (slotFinished (QNetworkReply *)));
18 }
void slotFinished(QNetworkReply *)
Cleanup after response is returned.

Member Function Documentation

void NetworkClient::slotFinished ( QNetworkReply *  reply)
slot

Cleanup after response is returned.

Definition at line 40 of file NetworkClient.cpp.

41 {
42  reply->deleteLater();
43 }
void NetworkClient::uploadErrorReport ( const QString &  report)

Upload the error report asynchronously.

Definition at line 45 of file NetworkClient.cpp.

46 {
47  QString reportClean = cleanXml (report);
48 
49  // Put report into byte array, which must persist until the finished signal
50  // is received according to QNetworkAccessManager::post documentation
51  QByteArray postData = reportClean.toLatin1();
52 
53  QNetworkRequest request (SERVER_URL);
54  request.setHeader (QNetworkRequest::ContentTypeHeader,
55  QVariant (QString ("text/xml")));
56  request.setHeader (QNetworkRequest::ContentLengthHeader,
57  QVariant (qulonglong (postData.size())));
58 
59  post(request,
60  postData);
61 }
const QString SERVER_URL("http://engaugedigitizer.net/receive_crash_report.php")

The documentation for this class was generated from the following files: