public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH phonesim 0/3] Port to Qt6 (v2)
@ 2026-02-28  9:12 Andres Salomon
  2026-02-28  9:15 ` [PATCH phonesim 1/3] Fix compatibility with Qt6 Andres Salomon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andres Salomon @ 2026-02-28  9:12 UTC (permalink / raw)
  To: ofono; +Cc: Jonah Brüchert

From: Andres Salomon <dilinger@queued.net>

A few years ago, Jonah send patches to port Phonesim to Qt6, but only
some of them were accepted. In particular, the patches to convert the
project to CMake were not pulled in. Rather than switch to CMake, here's
a patch set that enables Qt6 within the existing Autoconf build system.

This first checks for Qt6, and will fall back to Qt5. There are still
plenty of warnings when building for Qt6 due to the Qt5 Compat module
being used, but those can be cleaned up in time.

Andres Salomon (2):
  Only call QTextStream::setCodec in Qt5
  Make configure script detect and enable Qt6 if available

Jonah Brüchert (1):
  Fix compatibility with Qt6

 configure.ac     | 26 +++++++++++++++++---------
 src/control.cpp  |  8 +++++---
 src/phonesim.cpp |  2 +-
 src/qwsppdu.cpp  | 12 ++++++------
 4 files changed, 29 insertions(+), 19 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH phonesim 1/3] Fix compatibility with Qt6
  2026-02-28  9:12 [PATCH phonesim 0/3] Port to Qt6 (v2) Andres Salomon
@ 2026-02-28  9:15 ` Andres Salomon
  2026-02-28  9:16 ` [PATCH phonesim 2/3] Only call QTextStream::setCodec in Qt5 Andres Salomon
  2026-02-28  9:17 ` [PATCH phonesim 3/3] Make configure script detect and enable Qt6 if available Andres Salomon
  2 siblings, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2026-02-28  9:15 UTC (permalink / raw)
  To: ofono; +Cc: jbb.prv

From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= <jbb.prv@gmx.de>

---
 src/control.cpp  |  6 +++---
 src/phonesim.cpp |  2 +-
 src/qwsppdu.cpp  | 12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 817a0b2..b06dbc1 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -337,7 +337,7 @@ void ControlWidget::sendSMSMessage()
         return;
     }
 
-    if (ui->leSMSServiceCenter->text().isEmpty() || ui->leSMSServiceCenter->text().contains(QRegExp("\\D"))) {
+    if (ui->leSMSServiceCenter->text().isEmpty() || ui->leSMSServiceCenter->text().contains(QRegularExpression(R"(\D)"))) {
         p->warning(tr("Invalid Service Center"),
                 tr("Service Center must not be empty and contain "
                    "only digits"));
@@ -386,14 +386,14 @@ void ControlWidget::selectFile()
 void ControlWidget::sendSMSDatagram()
 {
     QString dstPortStr = ui->leDstPort->text();
-    if ( dstPortStr.contains(QRegExp("\\D")) ) {
+    if ( dstPortStr.contains(QRegularExpression(R"(\D)")) ) {
         p->warning(tr("Invalid Port"), tr("Port number can contain only digits" ));
         return;
     }
     int dst = dstPortStr.toInt();
 
     QString srcPortStr = ui->leSrcPort->text();
-    if ( srcPortStr.contains(QRegExp("\\D")) ) {
+    if ( srcPortStr.contains(QRegularExpression(R"(\D)")) ) {
         p->warning(tr("Invalid Port"), tr("Port number can contain only digits" ));
         return;
     }
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 89d5e9d..1b826ed 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -346,7 +346,7 @@ bool SimChat::command( const QString& cmd )
         else {
             int index = value.indexOf( "${*}" );
             if ( index != -1 ) {
-                if ( wild.length() > 0 && wild[wild.length() - 1] == 0x1A ) {
+                if ( wild.length() > 0 && wild[wild.length() - 1] == QChar(0x1A) ) {
                     // Strip the terminating ^Z from SMS PDU's.
                     wild = wild.left( wild.length() - 1 );
                 }
diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index d636b5c..9798374 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -707,7 +707,7 @@ QString QWspPduDecoder::decodeTextString()
     if (o == '\"')
         o = decodeOctet();
     while (o != 0 && !dev->atEnd()) {
-        str += o;
+        str += QChar(o);
         o = decodeOctet();
     }
 
@@ -722,7 +722,7 @@ QString QWspPduDecoder::decodeTextBlock(int length)
 {
     QString result;
     for(int i = 0; i < length; ++i)
-        result += decodeOctet();
+        result += QChar(decodeOctet());
     return result;
 }
 
@@ -815,7 +815,7 @@ QString QWspPduDecoder::decodeContentType()
             // Extension-Media
             o = decodeOctet();
             while (o != 0) {
-                type += o;
+                type += QChar(o);
                 o = decodeOctet();
             }
         }
@@ -838,7 +838,7 @@ QString QWspPduDecoder::decodeContentType()
         // Constrained-encoding = Extension-Media
         o = decodeOctet();
         while (o != 0) {
-            type += o;
+            type += QChar(o);
             o = decodeOctet();
         }
     }
@@ -988,13 +988,13 @@ QString QWspPduDecoder::decodeParameter()
         p = decodeTokenText() + "=";
         octet = peekOctet();
         if (octet <= 31 || octet & 0x80) {
-            p += decodeInteger();
+            p += QChar(decodeInteger());
         } else {
             // Extension-Media
             p += '\"';
             octet = decodeOctet();
             while (octet != 0 && !dev->atEnd()) {
-                p += octet;
+                p += QChar(octet);
                 octet = decodeOctet();
             }
             p += '\"';
-- 
2.51.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH phonesim 2/3] Only call QTextStream::setCodec in Qt5
  2026-02-28  9:12 [PATCH phonesim 0/3] Port to Qt6 (v2) Andres Salomon
  2026-02-28  9:15 ` [PATCH phonesim 1/3] Fix compatibility with Qt6 Andres Salomon
@ 2026-02-28  9:16 ` Andres Salomon
  2026-02-28  9:17 ` [PATCH phonesim 3/3] Make configure script detect and enable Qt6 if available Andres Salomon
  2 siblings, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2026-02-28  9:16 UTC (permalink / raw)
  To: ofono; +Cc: jbb.prv

From: Andres Salomon <dilinger@queued.net>

Qt6 defaults to UTF8, and setCodec was removed.
---
 src/control.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/control.cpp b/src/control.cpp
index b06dbc1..66a65ef 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -700,7 +700,9 @@ QString Script::Run(const QString &name, const QDBusMessage &msg)
     }
 
     QTextStream stream(&scriptFile);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
     stream.setCodec("UTF-8");
+#endif
     QString contents = stream.readAll();
     scriptFile.close();
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH phonesim 3/3] Make configure script detect and enable Qt6 if available
  2026-02-28  9:12 [PATCH phonesim 0/3] Port to Qt6 (v2) Andres Salomon
  2026-02-28  9:15 ` [PATCH phonesim 1/3] Fix compatibility with Qt6 Andres Salomon
  2026-02-28  9:16 ` [PATCH phonesim 2/3] Only call QTextStream::setCodec in Qt5 Andres Salomon
@ 2026-02-28  9:17 ` Andres Salomon
  2 siblings, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2026-02-28  9:17 UTC (permalink / raw)
  To: ofono; +Cc: jbb.prv

From: Andres Salomon <dilinger@queued.net>

We also bump the C++ standard up to C++17.
---
 configure.ac | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index ec40d8c..fd8d9fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,17 +26,25 @@ AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],
 	fi
 ])
 
-PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Qml Qt5DBus [Qt5Widgets >= 5.10],
-				dummy=yes, AC_MSG_ERROR(Qt5 is required))
+PKG_CHECK_MODULES(QT6, Qt6Core Qt6Gui Qt6Xml Qt6Network Qt6Qml Qt6DBus Qt6Core5Compat [Qt6Widgets >= 6.0.0], AC_SUBST(QT6_ENABLED, "yes"),
+	[PKG_CHECK_MODULES(QT5, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Qml Qt5DBus [Qt5Widgets >= 5.10], dummy=yes, AC_MSG_ERROR(Qt5 is required))]
+)
 
 # Needed for qOverload
-CXXFLAGS="$CXXFLAGS --std=gnu++14"
-
-AC_SUBST(QT_CFLAGS)
-AC_SUBST(QT_LIBS)
-
-AC_MSG_CHECKING(for Qt5 host_bins)
-PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt5Core, host_bins)
+CXXFLAGS="$CXXFLAGS --std=gnu++17"
+
+AC_SUBST(QT_CFLAGS, "${QT5_CFLAGS} ${QT6_CFLAGS}")
+AC_SUBST(QT_LIBS, "${QT6_LIBS} ${QT5_LIBS}")
+
+AS_IF([test "x$QT6_ENABLED" = "xyes"], [
+	# Try for Qt6
+	AC_MSG_CHECKING(for Qt6 host_bins)
+	PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt6Core, libexecdir)
+], [
+	# Try for Qt5
+	AC_MSG_CHECKING(for Qt5 host_bins)
+	PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt5Core, host_bins)
+])
 AC_SUBST(QMAKE_PATH_HOST_BINS)
 AC_MSG_RESULT($QMAKE_PATH_HOST_BINS)
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-28  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28  9:12 [PATCH phonesim 0/3] Port to Qt6 (v2) Andres Salomon
2026-02-28  9:15 ` [PATCH phonesim 1/3] Fix compatibility with Qt6 Andres Salomon
2026-02-28  9:16 ` [PATCH phonesim 2/3] Only call QTextStream::setCodec in Qt5 Andres Salomon
2026-02-28  9:17 ` [PATCH phonesim 3/3] Make configure script detect and enable Qt6 if available Andres Salomon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox