summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-02-15 10:48:51 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-02-15 10:48:51 +0100
commitc6e2322e5357736871bd6d5c1f87222fe9dac738 (patch)
tree002b0cfd719d956749e9f88ac21c6153d7c7fe23
parent985a62c8098587cb4938b9cdd09f56151777d952 (diff)
Make Qt5 compatible.
-rw-r--r--client/client.pro6
-rw-r--r--client/client.qrc2
-rw-r--r--client/collapser.cc4
-rw-r--r--client/messagebox.cc3
-rw-r--r--client/netcom.cc29
-rw-r--r--client/praxisd.cc14
6 files changed, 42 insertions, 16 deletions
diff --git a/client/client.pro b/client/client.pro
index b41c835..43f568f 100644
--- a/client/client.pro
+++ b/client/client.pro
@@ -18,6 +18,12 @@ debug {
DEFINES+=VERSION=\\\"2.2.4\\\"
+# For Qt5
+contains(QT_VERSION, ^5.*) {
+ QT += widgets
+ DEFINES += QT5
+}
+
win32 {
QMAKE_LIBDIR += lua/lib
INCLUDEPATH += lua/include
diff --git a/client/client.qrc b/client/client.qrc
index a6b43bb..eb4e932 100644
--- a/client/client.qrc
+++ b/client/client.qrc
@@ -1,6 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
-<qresource>
+<qresource prefix="">
<file>icons/icon.png</file>
<file>icons/add.png</file>
<file>icons/open.png</file>
diff --git a/client/collapser.cc b/client/collapser.cc
index abbe295..802c4a7 100644
--- a/client/collapser.cc
+++ b/client/collapser.cc
@@ -173,14 +173,14 @@ void Collapser::Placeholder::grabFrom(QWidget *w)
{
weight = 0; // Reset
- pixmap_from = grab(w, from_height, width());
+ pixmap_from = ::grab(w, from_height, width());
}
void Collapser::Placeholder::grabTo(QWidget *w)
{
weight = 0; // Reset
- pixmap_to = grab(w, to_height, width());
+ pixmap_to = ::grab(w, to_height, width());
}
void Collapser::Placeholder::setWeight(double w)
diff --git a/client/messagebox.cc b/client/messagebox.cc
index 902d2fd..a6058a6 100644
--- a/client/messagebox.cc
+++ b/client/messagebox.cc
@@ -41,7 +41,8 @@ static MessageBox::StandardButton showNewMessageBox(QWidget *parent,
MessageBox::StandardButton defaultButton)
{
QMessageBox msgBox(icon, title, text, MessageBox::NoButton, parent);
- QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&msgBox);
+ QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>();
+
Q_ASSERT(buttonBox != 0);
uint mask = MessageBox::FirstButton;
diff --git a/client/netcom.cc b/client/netcom.cc
index 9c755b5..e0c7541 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -26,18 +26,19 @@
*/
#include "netcom.h"
+#include "debug.h"
+
#include <QtNetwork>
#include <QApplication>
#include <QByteArray>
-#include <QHttp>
+//#include <QHttp>
#include <QWidget>
#include "widgets/widget.h"
-#include "debug.h"
#ifdef USE_SSL
#include <QMessageBox>
@@ -119,18 +120,21 @@ void NetCom::makeTransfer(QByteArray body, session_state_t state, QString uri)
url.setPort(request.url().port());
url.setScheme(request.url().scheme());
+#ifdef QT5
+ QUrlQuery query;
+#else
+ QUrl &query = url;
+#endif
+
switch(state) {
case ::commit:
- // request.setRawHeader("SessionCommit", "yes");
- url.addQueryItem("statechange", "commit");
+ query.addQueryItem("statechange", "commit");
break;
case ::discard:
- // request.setRawHeader("SessionDiscard", "yes");
- url.addQueryItem("statechange", "discard");
+ query.addQueryItem("statechange", "discard");
break;
case ::nocommit:
- // request.setRawHeader("SessionNoCommit", "yes");
- url.addQueryItem("statechange", "nocommit");
+ query.addQueryItem("statechange", "nocommit");
break;
default:
case ::none:
@@ -138,8 +142,13 @@ void NetCom::makeTransfer(QByteArray body, session_state_t state, QString uri)
}
url.setPath(uri);
- if(sessionid != "") url.addQueryItem("sessionid", sessionid);
- if(patientid != "") url.addQueryItem("patientid", patientid);
+ if(sessionid != "") query.addQueryItem("sessionid", sessionid);
+ if(patientid != "") query.addQueryItem("patientid", patientid);
+
+#ifdef QT5
+ url.setQuery(query);
+#endif
+
request.setUrl(url);
manager->post(request, body);
diff --git a/client/praxisd.cc b/client/praxisd.cc
index 42fdd0c..d0bb280 100644
--- a/client/praxisd.cc
+++ b/client/praxisd.cc
@@ -31,7 +31,7 @@
#include <QDomDocument>
-#include <QNetworkReply>
+#include <QtNetwork>
#define DOCAVE(x) if(element.tagName() == #x) cave.x = element.text()
static CaveVector getCaveList(QByteArray data)
@@ -315,12 +315,22 @@ void Praxisd::makeTransfer(reply_t t, QString uri,
url.setPath(uri);
+#ifdef QT5
+ QUrlQuery query;
+#else
+ QUrl &query = url;
+#endif
+
QMap<QString, QString>::iterator i = params.begin();
while(i != params.end()) {
- url.addQueryItem(i.key(), i.value());
+ query.addQueryItem(i.key(), i.value());
i++;
}
+#ifdef QT5
+ url.setQuery(query);
+#endif
+
request.setUrl(url);
QNetworkReply* r = manager->get(request);