1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
From 0ead8bb4889977af735f4d0b578497830ee6d6f7 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Fri, 10 Jan 2025 03:43:23 +0100
Subject: [PATCH] wpa_gui: Port to Qt6
This appears to be working. Fairly straight forward. Lightly tested.
Distros are getting ready to remove Qt5, so this is somewhat important
to do.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
wpa_supplicant/wpa_gui-qt4/eventhistory.h | 2 +-
wpa_supplicant/wpa_gui-qt4/main.cpp | 8 ++++----
wpa_supplicant/wpa_gui-qt4/networkconfig.cpp | 8 ++++----
wpa_supplicant/wpa_gui-qt4/networkconfig.h | 2 +-
wpa_supplicant/wpa_gui-qt4/peers.cpp | 10 +++++-----
wpa_supplicant/wpa_gui-qt4/peers.h | 2 +-
wpa_supplicant/wpa_gui-qt4/scanresults.cpp | 2 +-
wpa_supplicant/wpa_gui-qt4/scanresults.h | 2 +-
wpa_supplicant/wpa_gui-qt4/userdatarequest.h | 2 +-
wpa_supplicant/wpa_gui-qt4/wpagui.cpp | 16 ++++++++--------
wpa_supplicant/wpa_gui-qt4/wpagui.h | 2 +-
wpa_supplicant/wpa_gui-qt4/wpamsg.h | 4 ++--
12 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/wpa_supplicant/wpa_gui-qt4/eventhistory.h b/wpa_supplicant/wpa_gui-qt4/eventhistory.h
index afd7b6346..2122ab45a 100644
--- a/wpa_supplicant/wpa_gui-qt4/eventhistory.h
+++ b/wpa_supplicant/wpa_gui-qt4/eventhistory.h
@@ -40,7 +40,7 @@ class EventHistory : public QDialog, public Ui::EventHistory
public:
EventHistory(QWidget *parent = 0, const char *name = 0,
- bool modal = false, Qt::WindowFlags fl = 0);
+ bool modal = false, Qt::WindowFlags fl = Qt::Widget);
~EventHistory();
public slots:
diff --git a/wpa_supplicant/wpa_gui-qt4/main.cpp b/wpa_supplicant/wpa_gui-qt4/main.cpp
index bbd45c6e1..d395aa135 100644
--- a/wpa_supplicant/wpa_gui-qt4/main.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/main.cpp
@@ -40,10 +40,10 @@ int main(int argc, char *argv[])
int ret;
locale = QLocale::system().name();
- resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
- if (!translator.load("wpa_gui_" + locale, resourceDir))
- translator.load("wpa_gui_" + locale, "lang");
- app.installTranslator(&translator);
+ resourceDir = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+ if (translator.load("wpa_gui_" + locale, resourceDir) ||
+ translator.load("wpa_gui_" + locale, "lang"))
+ app.installTranslator(&translator);
WpaGui w(&app);
diff --git a/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp b/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
index 2727318bc..59af84504 100644
--- a/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
@@ -37,7 +37,7 @@ NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool,
SLOT(authChanged(int)));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
connect(addButton, SIGNAL(clicked()), this, SLOT(addNetwork()));
- connect(encrSelect, SIGNAL(activated(const QString &)), this,
+ connect(encrSelect, SIGNAL(textActivated(const QString &)), this,
SLOT(encrChanged(const QString &)));
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork()));
connect(eapSelect, SIGNAL(activated(int)), this,
@@ -204,8 +204,8 @@ void NetworkConfig::addNetwork()
}
if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
- QRegExp rx("^(\\w|-)+$");
- if (rx.indexIn(idstrEdit->text()) < 0) {
+ QRegularExpression rx("^(\\w|-)+$");
+ if (!rx.match(idstrEdit->text()).hasMatch()) {
QMessageBox::warning(
this, tr("Network ID Error"),
tr("Network ID String contains non-word "
@@ -797,7 +797,7 @@ void NetworkConfig::removeNetwork()
tr("This will permanently remove the network\n"
"from the configuration. Do you really want\n"
"to remove this network?"),
- tr("Yes"), tr("No")) != 0)
+ QMessageBox::Yes, QMessageBox::No) != 0)
return;
snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
diff --git a/wpa_supplicant/wpa_gui-qt4/networkconfig.h b/wpa_supplicant/wpa_gui-qt4/networkconfig.h
index fd09dec54..a3a7d9792 100644
--- a/wpa_supplicant/wpa_gui-qt4/networkconfig.h
+++ b/wpa_supplicant/wpa_gui-qt4/networkconfig.h
@@ -20,7 +20,7 @@ class NetworkConfig : public QDialog, public Ui::NetworkConfig
public:
NetworkConfig(QWidget *parent = 0, const char *name = 0,
- bool modal = false, Qt::WindowFlags fl = 0);
+ bool modal = false, Qt::WindowFlags fl = Qt::Widget);
~NetworkConfig();
virtual void paramsFromScanResults(QTreeWidgetItem *sel);
diff --git a/wpa_supplicant/wpa_gui-qt4/peers.cpp b/wpa_supplicant/wpa_gui-qt4/peers.cpp
index 0a0b3ffcb..268aba8b3 100644
--- a/wpa_supplicant/wpa_gui-qt4/peers.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/peers.cpp
@@ -403,7 +403,7 @@ void Peers::ctx_p2p_start_group()
void Peers::add_station(QString info)
{
- QStringList lines = info.split(QRegExp("\\n"));
+ QStringList lines = info.split(QRegularExpression("\\n"));
QString name;
for (QStringList::Iterator it = lines.begin();
@@ -518,7 +518,7 @@ void Peers::add_p2p_group_client(QStandardItem * /*parent*/, QString params)
*/
QStringList items =
- params.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)"));
+ params.split(QRegularExpression(" (?=[^']*('[^']*'[^']*)*$)"));
QString addr = "";
QString name = "";
int config_methods = 0;
@@ -591,7 +591,7 @@ bool Peers::add_bss(const char *cmd)
QString ssid, bssid, flags, wps_name, pri_dev_type;
int id = -1;
- QStringList lines = bss.split(QRegExp("\\n"));
+ QStringList lines = bss.split(QRegularExpression("\\n"));
for (QStringList::Iterator it = lines.begin();
it != lines.end(); it++) {
int pos = (*it).indexOf('=') + 1;
@@ -643,7 +643,7 @@ bool Peers::add_bss(const char *cmd)
item->setData(ssid, peer_role_ssid);
model.appendRow(item);
- lines = bss.split(QRegExp("\\n"));
+ lines = bss.split(QRegularExpression("\\n"));
for (QStringList::Iterator it = lines.begin();
it != lines.end(); it++) {
if ((*it).startsWith("p2p_group_client:"))
@@ -903,7 +903,7 @@ void Peers::event_notify(WpaMsg msg)
* group_capab=0x0
*/
QStringList items =
- text.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)"));
+ text.split(QRegularExpression(" (?=[^']*('[^']*'[^']*)*$)"));
QString addr = items[1];
QString name = "";
QString pri_dev_type;
diff --git a/wpa_supplicant/wpa_gui-qt4/peers.h b/wpa_supplicant/wpa_gui-qt4/peers.h
index bb7373749..c44bba99a 100644
--- a/wpa_supplicant/wpa_gui-qt4/peers.h
+++ b/wpa_supplicant/wpa_gui-qt4/peers.h
@@ -22,7 +22,7 @@ class Peers : public QDialog, public Ui::Peers
public:
Peers(QWidget *parent = 0, const char *name = 0,
- bool modal = false, Qt::WindowFlags fl = 0);
+ bool modal = false, Qt::WindowFlags fl = Qt::Widget);
~Peers();
void setWpaGui(WpaGui *_wpagui);
void event_notify(WpaMsg msg);
diff --git a/wpa_supplicant/wpa_gui-qt4/scanresults.cpp b/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
index a2e3072fb..ba04b4f38 100644
--- a/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
@@ -77,7 +77,7 @@ void ScanResults::updateResults()
QString ssid, bssid, freq, signal, flags;
- QStringList lines = bss.split(QRegExp("\\n"));
+ QStringList lines = bss.split(QRegularExpression("\\n"));
for (QStringList::Iterator it = lines.begin();
it != lines.end(); it++) {
int pos = (*it).indexOf('=') + 1;
diff --git a/wpa_supplicant/wpa_gui-qt4/scanresults.h b/wpa_supplicant/wpa_gui-qt4/scanresults.h
index 2cddd133f..39bba90ce 100644
--- a/wpa_supplicant/wpa_gui-qt4/scanresults.h
+++ b/wpa_supplicant/wpa_gui-qt4/scanresults.h
@@ -20,7 +20,7 @@ class ScanResults : public QDialog, public Ui::ScanResults
public:
ScanResults(QWidget *parent = 0, const char *name = 0,
- bool modal = false, Qt::WindowFlags fl = 0);
+ bool modal = false, Qt::WindowFlags fl = Qt::Widget);
~ScanResults();
public slots:
diff --git a/wpa_supplicant/wpa_gui-qt4/userdatarequest.h b/wpa_supplicant/wpa_gui-qt4/userdatarequest.h
index b6d1ad2f4..3f7dccb28 100644
--- a/wpa_supplicant/wpa_gui-qt4/userdatarequest.h
+++ b/wpa_supplicant/wpa_gui-qt4/userdatarequest.h
@@ -20,7 +20,7 @@ class UserDataRequest : public QDialog, public Ui::UserDataRequest
public:
UserDataRequest(QWidget *parent = 0, const char *name = 0,
- bool modal = false, Qt::WindowFlags fl = 0);
+ bool modal = false, Qt::WindowFlags fl = Qt::Widget);
~UserDataRequest();
int setParams(WpaGui *_wpagui, const char *reqMsg);
diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
index 9404ab424..0c125d90f 100644
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -99,9 +99,9 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *,
connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect()));
connect(scanButton, SIGNAL(clicked()), this, SLOT(scan()));
connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB()));
- connect(adapterSelect, SIGNAL(activated(const QString&)), this,
+ connect(adapterSelect, SIGNAL(textActivated(const QString&)), this,
SLOT(selectAdapter(const QString&)));
- connect(networkSelect, SIGNAL(activated(const QString&)), this,
+ connect(networkSelect, SIGNAL(textActivated(const QString&)), this,
SLOT(selectNetwork(const QString&)));
connect(addNetworkButton, SIGNAL(clicked()), this, SLOT(addNetwork()));
connect(editNetworkButton, SIGNAL(clicked()), this,
@@ -1078,7 +1078,7 @@ void WpaGui::selectNetwork( const QString &sel )
char reply[10];
size_t reply_len = sizeof(reply);
- if (cmd.contains(QRegExp("^\\d+:")))
+ if (cmd.contains(QRegularExpression("^\\d+:")))
cmd.truncate(cmd.indexOf(':'));
else
cmd = "any";
@@ -1095,7 +1095,7 @@ void WpaGui::enableNetwork(const QString &sel)
char reply[10];
size_t reply_len = sizeof(reply);
- if (cmd.contains(QRegExp("^\\d+:")))
+ if (cmd.contains(QRegularExpression("^\\d+:")))
cmd.truncate(cmd.indexOf(':'));
else if (!cmd.startsWith("all")) {
debug("Invalid editNetwork '%s'",
@@ -1114,7 +1114,7 @@ void WpaGui::disableNetwork(const QString &sel)
char reply[10];
size_t reply_len = sizeof(reply);
- if (cmd.contains(QRegExp("^\\d+:")))
+ if (cmd.contains(QRegularExpression("^\\d+:")))
cmd.truncate(cmd.indexOf(':'));
else if (!cmd.startsWith("all")) {
debug("Invalid editNetwork '%s'",
@@ -1132,7 +1132,7 @@ void WpaGui::editNetwork(const QString &sel)
QString cmd(sel);
int id = -1;
- if (cmd.contains(QRegExp("^\\d+:"))) {
+ if (cmd.contains(QRegularExpression("^\\d+:"))) {
cmd.truncate(cmd.indexOf(':'));
id = cmd.toInt();
}
@@ -1204,7 +1204,7 @@ void WpaGui::removeNetwork(const QString &sel)
char reply[10];
size_t reply_len = sizeof(reply);
- if (cmd.contains(QRegExp("^\\d+:")))
+ if (cmd.contains(QRegularExpression("^\\d+:")))
cmd.truncate(cmd.indexOf(':'));
else if (!cmd.startsWith("all")) {
debug("Invalid editNetwork '%s'",
@@ -1476,7 +1476,7 @@ void WpaGui::showTrayStatus()
QString msg, status(buf);
- QStringList lines = status.split(QRegExp("\\n"));
+ QStringList lines = status.split(QRegularExpression("\\n"));
for (QStringList::Iterator it = lines.begin();
it != lines.end(); it++) {
int pos = (*it).indexOf('=') + 1;
diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.h b/wpa_supplicant/wpa_gui-qt4/wpagui.h
index f0a34c97e..898722bd9 100644
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.h
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h
@@ -49,7 +49,7 @@ public:
};
WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0,
- Qt::WindowFlags fl = 0);
+ Qt::WindowFlags fl = Qt::Widget);
~WpaGui();
virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
diff --git a/wpa_supplicant/wpa_gui-qt4/wpamsg.h b/wpa_supplicant/wpa_gui-qt4/wpamsg.h
index 8f2fcdc41..fe36e2044 100644
--- a/wpa_supplicant/wpa_gui-qt4/wpamsg.h
+++ b/wpa_supplicant/wpa_gui-qt4/wpamsg.h
@@ -10,7 +10,7 @@
#define WPAMSG_H
#include <QDateTime>
-#include <QLinkedList>
+#include <QList>
class WpaMsg {
public:
@@ -30,6 +30,6 @@ private:
QDateTime timestamp;
};
-typedef QLinkedList<WpaMsg> WpaMsgList;
+typedef QList<WpaMsg> WpaMsgList;
#endif /* WPAMSG_H */
--
2.48.0
|