[PATCH] Allow compiling wpa_gui-qt4 for Qt 3.x

Pavel Roskin proski at gnu.org
Tue Mar 28 22:25:19 EST 2006


This patch allows to compile wpa_gui-qt4 for Qt 3.x.  Thus, the same
source can be used for both Qt 3.x and Qt 4.x.  I think this patch could
be applied, then files from wpa_gui-qt4 could be copied over wpa_gui,
and then wpa_gui-qt4 could be removed.  I don't think wpa_gui will use
any Qt4 features any time soon, so it's better to have a single source.

Since QT_VERSION is only defined in qmake for Qt 4.x, it's sufficient to
check that it's not empty.  Better suggestions are welcome.

The patched source has been successfully compiled for Qt 3.3.5 and

Signed-off-by: Pavel Roskin <proski at gnu.org>

--- wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
+++ wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
@@ -34,10 +34,14 @@
   OBJECTS_DIR = .obj
+qtver = $$[QT_VERSION]
+isEmpty( qtver ) {
+	message(Compiling for Qt 3.x)
+	DEFINES += Q3ListViewItem=QListViewItem
+} else {
+	message(Compiling for Qt $$qtver)
+	QT += qt3support 
+	CONFIG += uic3
-#The following line was inserted by qt3to4
-QT += qt3support 
-#The following line was inserted by qt3to4
-CONFIG += uic3
--- wpa_supplicant/wpa_gui-qt4/wpamsg.h
+++ wpa_supplicant/wpa_gui-qt4/wpamsg.h
@@ -1,8 +1,16 @@
 #ifndef WPAMSG_H
 #define WPAMSG_H
+class WpaMsg;
+#if QT_VERSION >= 0x040000
 #include <QDateTime>
 #include <QLinkedList>
+typedef QLinkedList<WpaMsg> WpaMsgList;
+#include <qdatetime.h>
+typedef QValueList<WpaMsg> WpaMsgList;
 class WpaMsg {
@@ -23,6 +31,4 @@
     QDateTime timestamp;
-typedef QLinkedList<WpaMsg> WpaMsgList;
 #endif /* WPAMSG_H */

Pavel Roskin

More information about the HostAP mailing list