Adding support for building phonesim with Qt 6
Dear ofono maintainers,
Qt 6 is out now, and it was possible to add support for building phonesim with it without too much effort.
Unfortunately, I couldn't find a pkgconfig file for the Qt5Compat module in Qt6, so this patchset includes a port of the buildsystem to CMake,
which is the recommended buildsystem for Qt 6, which Qt now uses itself. It allows quite easily supporting Qt5 and Qt6 with not much code. Of course a change of the buildsystem might need more discussion, so obviously feel free to reject this if it doesn't fit your plans.
As a compromise, you could also just skip the patch that removes the old buildsystems, and provide two choices, but this is in my opinion unnecessary maintainance load.
Regarding testing the build with Qt 6, you can use the Qt installer from the Qt Company. Make sure to install the Qt5Compat module, as it's still needed for QTextCodec.
Since the installer installs Qt 6 to a custom prefix, it is necessary to pass it to cmake, like this:
cmake -DCMAKE_PREFIX_PATH=~/.local/Qt/6.0.1/gcc_64
(Assuming ~/.local/Qt was choosen as install destination)
Yours sincerely,
Jonah Brüchert
PATCH 1/7 Add CMake build system
--- CMakeLists.txt | 20 ++++++++++++++++++++ src/CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt
CMakeLists.txt new file +20 -0
@@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.8.12) +project(phonesim) +set(PHONESIM_VERSION 1.21) + +include(FeatureSummary) +include(GNUInstallDirs) + +find_package(Qt5 "5.10.0" REQUIRED NO_MODULE COMPONENTS Core Widgets Qml Network DBus) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) + +################# Enable C++14 ################# + +set(CMAKE_CXX_STANDARD 14) + +################# build and install ################# +add_subdirectory(src) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
src/CMakeLists.txt new file +40 -0
@@ -0,0 +1,40 @@ +set(PHONESIM_SRCS + control.cpp + controlbase.ui + qatutils.cpp + qatresult.cpp + qwsppdu.cpp + qgsmcodec.cpp + callmanager.cpp + qsimterminalresponse.cpp + qsmsmessagelist.cpp + qsmsmessage.cpp + qsimcontrolevent.cpp + conformancesimapplication.cpp + server.cpp + aidapplication.cpp + gsmitem.cpp + simauth.cpp + phonesim.cpp + qsimcommand.cpp + qsimenvelope.cpp + qcbsmessage.cpp + hardwaremanipulator.cpp + simapplication.cpp + qatresultparser.cpp + attranslator.cpp + gsmspec.cpp + main.cpp + simfilesystem.cpp + aes.c + comp128.c +) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(phonesim ${PHONESIM_SRCS}) +target_compile_definitions(phonesim PRIVATE -DVERSION=${PHONESIM_VERSION} -DQT_NO_FOREACH) +target_link_libraries(phonesim Qt5::Core Qt5::Widgets Qt5::Qml Qt5::Network Qt5::DBus) + +install(TARGETS phonesim RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES default.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/phonesim/)
--
2.29.2
PATCH 2/7 Use quotes to include local header files
In reply to Jonah Brüchert--- src/aidapplication.cpp | 4 ++-- src/callmanager.cpp | 4 ++-- src/conformancesimapplication.cpp | 2 +- src/control.h | 2 +- src/hardwaremanipulator.cpp | 14 +++++++------- src/main.cpp | 3 ++- src/phonesim.cpp | 2 +- src/phonesim.h | 2 +- src/qatresult.cpp | 2 +- src/qatresultparser.cpp | 6 +++--- src/qatutils.cpp | 6 +++--- src/qcbsmessage.cpp | 4 ++-- src/qgsmcodec.cpp | 2 +- src/qsimcommand.cpp | 8 ++++---- src/qsimcontrolevent.cpp | 4 ++-- src/qsimenvelope.cpp | 2 +- src/qsimenvelope.h | 2 +- src/qsimterminalresponse.cpp | 4 ++-- src/qsimterminalresponse.h | 2 +- src/qsmsmessage.cpp | 8 ++++---- src/qsmsmessage_p.h | 4 ++-- src/qwsppdu.cpp | 2 +- src/simapplication.cpp | 2 +- src/simapplication.h | 8 ++++---- src/simauth.cpp | 4 ++-- src/simfilesystem.cpp | 2 +- 26 files changed, 53 insertions(+), 52 deletions(-)
src/aidapplication.cpp +2 -2
@@ -2,8 +2,8 @@ #include "simfilesystem.h" #include "simauth.h" -#include <qatutils.h> -#include <qsimcontrolevent.h> +#include "qatutils.h" +#include "qsimcontrolevent.h" AidApplication::AidApplication( QObject *parent, SimXmlNode& n ) : QObject( parent )
src/callmanager.cpp +2 -2
@@ -18,8 +18,8 @@ ****************************************************************************/ #include "callmanager.h" -#include <qatutils.h> -#include <qsimcontrolevent.h> +#include "qatutils.h" +#include "qsimcontrolevent.h" CallManager::CallManager( QObject *parent ) : QObject( parent )
src/conformancesimapplication.cpp +1 -1
@@ -17,7 +17,7 @@ ****************************************************************************/ #include "simapplication.h" -#include <qatutils.h> +#include "qatutils.h" #include <qdebug.h> #include <QTextCodec> #include "qsmsmessage.h"
src/control.h +1 -1
@@ -20,12 +20,12 @@#ifndef CONTROL_H #define CONTROL_H -#include <hardwaremanipulator.h> #include <QtDBus/QtDBus> #include <QJSEngine> #include "ui_controlbase.h" #include "attranslator.h" #include "callmanager.h" +#include "hardwaremanipulator.h" class Control;
src/hardwaremanipulator.cpp +7 -7
@@ -22,13 +22,13 @@ #include <qdebug.h> #include <qbuffer.h> #include <qtimer.h> -#include <qsmsmessage.h> -#include <qcbsmessage.h> -#include <qgsmcodec.h> -#include <qwsppdu.h> -#include <qatutils.h> -#include <phonesim.h> -#include <simapplication.h> +#include "qsmsmessage.h" +#include "qcbsmessage.h" +#include "qgsmcodec.h" +#include "qwsppdu.h" +#include "qatutils.h" +#include "phonesim.h" +#include "simapplication.h" #define NIBBLE_MAX 15 #define TWO_BYTE_MAX 65535
src/main.cpp +2 -1
@@ -17,8 +17,9 @@ ** ****************************************************************************/ -#include <server.h> +#include "server.h" #include "control.h" + #include <qapplication.h> #include <qstring.h> #include <qdebug.h>
src/phonesim.cpp +1 -1
@@ -25,7 +25,7 @@ #include "callmanager.h" #include "simauth.h" #include "aidapplication.h" -#include <qatutils.h> +#include "qatutils.h" #include <qstring.h> #include <qbytearray.h>
src/phonesim.h +1 -1
@@ -31,7 +31,6 @@#include <qmap.h> #include <qtimer.h> #include <qpointer.h> -#include <qsimcontrolevent.h> #include <cstring> #include <cstdlib>
@@ -45,6 +44,7 @@#include <arpa/inet.h> #include <netinet/in.h> +#include "qsimcontrolevent.h" class SimState;class SimItem;
src/qatresult.cpp +1 -1
@@ -17,7 +17,7 @@ ** ****************************************************************************/ -#include <qatresult.h> +#include "qatresult.h" /*! \class QAtResult
src/qatresultparser.cpp +3 -3
@@ -17,9 +17,9 @@ ** ****************************************************************************/ -#include <qatresultparser.h> -#include <qatresult.h> -#include <qatutils.h> +#include "qatresultparser.h" +#include "qatresult.h" +#include "qatutils.h" /*! \class QAtResultParser
src/qatutils.cpp +3 -3
@@ -17,9 +17,9 @@ ** ****************************************************************************/ -#include <qatutils.h> -#include <qatresultparser.h> -#include <qgsmcodec.h> +#include "qatutils.h" +#include "qatresultparser.h" +#include "qgsmcodec.h" #include <qtextcodec.h> /*!
src/qcbsmessage.cpp +2 -2
@@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include <qcbsmessage.h> -#include <qatutils.h> +#include "qcbsmessage.h" +#include "qatutils.h" #include "qsmsmessage_p.h" #ifdef Q_WS_QWS #include <qtopialog.h>
src/qgsmcodec.cpp +1 -1
@@ -17,7 +17,7 @@ ** ****************************************************************************/ -#include <qgsmcodec.h> +#include "qgsmcodec.h" const unsigned short GUC = 0x10; // GSM Undefined character
src/qsimcommand.cpp +4 -4
@@ -17,10 +17,10 @@ ** ****************************************************************************/ -#include <qsimcommand.h> -#include <qatutils.h> -#include <qsmsmessage.h> -#include <qgsmcodec.h> +#include "qsimcommand.h" +#include "qatutils.h" +#include "qsmsmessage.h" +#include "qgsmcodec.h" #include <qvarlengtharray.h> static QString textToHtml(const QString& text, const QByteArray& attrs);
src/qsimcontrolevent.cpp +2 -2
@@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include <qsimcontrolevent.h> -#include <qsimcommand.h> +#include "qsimcontrolevent.h" +#include "qsimcommand.h" /*! \class QSimControlEvent
src/qsimenvelope.cpp +1 -1
@@ -17,7 +17,7 @@ ** ****************************************************************************/ -#include <qsimenvelope.h> +#include "qsimenvelope.h" /*! \class QSimEnvelope
src/qsimenvelope.h +1 -1
@@ -19,7 +19,7 @@#ifndef QSIMENVELOPE_H #define QSIMENVELOPE_H -#include <qsimcommand.h> +#include "qsimcommand.h" class QSimEnvelopePrivate;
src/qsimterminalresponse.cpp +2 -2
@@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include <qsimterminalresponse.h> -#include <qsmsmessage.h> +#include "qsimterminalresponse.h" +#include "qsmsmessage.h" /*! \class QSimTerminalResponse
src/qsimterminalresponse.h +1 -1
@@ -19,7 +19,7 @@#ifndef QSIMTERMINALRESPONSE_H #define QSIMTERMINALRESPONSE_H -#include <qsimcommand.h> +#include "qsimcommand.h" class QSimTerminalResponsePrivate;
src/qsmsmessage.cpp +4 -4
@@ -19,11 +19,11 @@ #include <cstdlib> -#include <qsmsmessage.h> -#include <qcbsmessage.h> +#include "qsmsmessage.h" +#include "qcbsmessage.h" #include "qsmsmessage_p.h" -#include <qatutils.h> -#include <qgsmcodec.h> +#include "qatutils.h" +#include "qgsmcodec.h" #ifdef Q_WS_QWS #include <qtopialog.h> #else
src/qsmsmessage_p.h +2 -2
@@ -31,8 +31,8 @@// We mean it. // -#include <qsmsmessage.h> -#include <qcbsmessage.h> +#include "qsmsmessage.h" +#include "qcbsmessage.h" // Values are their bit reprensentation (defined in GSM-03.40 Section 9) // bits 6 5 4 ( shl 4 )
src/qwsppdu.cpp +1 -1
@@ -17,7 +17,7 @@ ** ****************************************************************************/ -#include <qwsppdu.h> +#include "qwsppdu.h" #include <cstdlib> #include <netinet/in.h>
src/simapplication.cpp +1 -1
@@ -18,7 +18,7 @@ ****************************************************************************/ #include "simapplication.h" -#include <qatutils.h> +#include "qatutils.h" #include <qdebug.h> #include <QTextCodec> #include "qsmsmessage.h"
src/simapplication.h +4 -4
@@ -21,10 +21,10 @@#define SIMAPPLICATION_H #include "phonesim.h" -#include <qsimcommand.h> -#include <qsimterminalresponse.h> -#include <qsimenvelope.h> -#include <qsimcontrolevent.h> +#include "qsimcommand.h" +#include "qsimterminalresponse.h" +#include "qsimenvelope.h" +#include "qsimcontrolevent.h" class SimApplicationPrivate;
src/simauth.cpp +2 -2
@@ -16,8 +16,8 @@ ****************************************************************************/ #include "simauth.h" -#include <qatutils.h> -#include <qsimcontrolevent.h> +#include "qatutils.h" +#include "qsimcontrolevent.h" extern "C" { #include "comp128.h"
src/simfilesystem.cpp +1 -1
@@ -18,7 +18,7 @@ ****************************************************************************/ #include "simfilesystem.h" -#include <qatutils.h> +#include "qatutils.h" #include <qdebug.h> // Known files, their parent directories, and names.
--
2.29.2
Denis Kenzior
AppliedRe: [PATCH phonesim 2/7] Use quotes to include local header files
Hi Jonah,
Quoted 21 lines · Jonah Brüchert
Co-authored-by Alexander Akulich <[email protected]>--- src/aidapplication.cpp | 4 ++-- src/callmanager.cpp | 4 ++-- src/conformancesimapplication.cpp | 2 +- src/control.h | 2 +- src/hardwaremanipulator.cpp | 14 +++++++------- src/main.cpp | 3 ++- src/phonesim.cpp | 2 +- src/phonesim.h | 2 +- src/qatresult.cpp | 2 +- src/qatresultparser.cpp | 6 +++--- src/qatutils.cpp | 6 +++--- src/qcbsmessage.cpp | 4 ++-- src/qgsmcodec.cpp | 2 +- src/qsimcommand.cpp | 8 ++++---- src/qsimcontrolevent.cpp | 4 ++-- src/qsimenvelope.cpp | 2 +- src/qsimenvelope.h | 2 +- src/qsimterminalresponse.cpp | 4 ++-- src/qsimterminalresponse.h | 2 +-
Quoted 9 lines
src/qsmsmessage.cpp | 8 ++++---- src/qsmsmessage_p.h | 4 ++-- src/qwsppdu.cpp | 2 +- src/simapplication.cpp | 2 +- src/simapplication.h | 8 ++++---- src/simauth.cpp | 4 ++-- src/simfilesystem.cpp | 2 +- 26 files changed, 53 insertions(+), 52 deletions(-)
Applied, thanks.
Regards,
-Denis
PATCH 3/7 Remove autotools build system
In reply to Jonah Brüchert--- INSTALL | 236 -------------------------------------------- Makefile.am | 79 --------------- bootstrap | 3 - bootstrap-configure | 9 -- configure.ac | 49 --------- 5 files changed, 376 deletions(-) delete mode 100644 INSTALL delete mode 100644 Makefile.am delete mode 100755 bootstrap delete mode 100755 bootstrap-configure delete mode 100644 configure.ac
INSTALL deleted +0 -236
@@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. -
Makefile.am deleted +0 -79
79 lines not on this page · raw message
bootstrap deleted +0 -3
@@ -1,3 +0,0 @@ -#!/bin/sh - -aclocal && automake --add-missing --copy && autoconf
bootstrap-configure deleted +0 -9
@@ -1,9 +0,0 @@ -#!/bin/sh - -if [ -f config.status ]; then - make maintainer-clean -fi - -./bootstrap && \ - ./configure --enable-maintainer-mode \ - --prefix=/usr
configure.ac deleted +0 -49
49 lines not on this page · raw message
--
2.29.2
Re: [PATCH phonesim 3/7] Remove autotools build system
Hi Jonah,
Quoted 7 lines · Jonah Brüchert
--- INSTALL | 236 -------------------------------------------- Makefile.am | 79 --------------- bootstrap | 3 - bootstrap-configure | 9 -- configure.ac | 49 --------- 5 files changed, 376 deletions(-)
Quoted 6 lines
delete mode 100644 INSTALL
delete mode 100644 Makefile.am
delete mode 100755 bootstrap
delete mode 100755 bootstrap-configure
delete mode 100644 configure.ac
Since Marcel is the one making releases, I will let him decide whether this is something he wants to do or not.
Regards,
-Denis
PATCH 4/7 Update README
In reply to Jonah Brüchert--- README | 20 -------------------- README.md | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 README create mode 100644 README.md
README deleted +0 -20
@@ -1,20 +0,0 @@ -Phone Simulator for modem testing -********************************* - -Copyright (C) 2008-2009 Intel Corporation. All rights reserved. - - -Compilation and installation -============================ - -In order to compile phone simulator you need following software packages: - - GCC compiler - - Qt libraries - -To configure run: - ./configure --prefix=/usr - -Configure automatically searches for all required components and packages. - -To compile and install run: - make && make install
README.md new file +24 -0
@@ -0,0 +1,24 @@ +# Phone Simulator for modem testing + +Copyright (C) 2008-2009 Intel Corporation. All rights reserved. + + +Compilation and installation +---------------------------- + +In order to compile phone simulator you need following software packages: + - GCC compiler + - Qt libraries + +To configure run: + +``` +mkdir build && cd build +cmake -GNinja .. +``` + +CMake automatically detects the location of the dependencies. +To compile and install run: +``` +ninja && ninja install +```
--
2.29.2
PATCH 5/7 qwsppdu: Port QDateTime deprecations
In reply to Jonah Brüchert--- src/qwsppdu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+)
src/qwsppdu.cpp +8 -0
@@ -448,7 +448,11 @@ QDateTime QWspDateTime::fromGmtTime_t(quint32 t) */ quint32 QWspDateTime::toTime_t(const QDateTime &dt) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QDateTime st(QDate(1970, 1, 1)); +#else + QDateTime st = QDate(1970, 1, 1).startOfDay(); +#endif return st.secsTo(dt) - timeZoneDiff(); }
@@ -459,7 +463,11 @@ quint32 QWspDateTime::toTime_t(const QDateTime &dt) */ quint32 QWspDateTime::toGmtTime_t(const QDateTime &dt) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QDateTime st(QDate(1970, 1, 1)); +#else + QDateTime st = QDate(1970, 1, 1).startOfDay(); +#endif return st.secsTo(dt) - 2*timeZoneDiff(); }
--
2.29.2
Denis Kenzior
AppliedRe: [PATCH phonesim 5/7] qwsppdu: Port QDateTime deprecations
Hi Jonah,
Quoted 4 lines · Jonah Brüchert
--- src/qwsppdu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+)
Applied, thanks.
Regards,
-Denis
PATCH 6/7 Port to Qt 6
In reply to Jonah Brüchert--- CMakeLists.txt | 10 +++++++--- src/CMakeLists.txt | 6 +++++- src/control.cpp | 8 +++----- src/hardwaremanipulator.cpp | 1 - src/phonesim.cpp | 2 +- src/qsimcommand.cpp | 2 +- src/qwsppdu.cpp | 12 ++++++------ 7 files changed, 23 insertions(+), 18 deletions(-)
CMakeLists.txt +7 -3
@@ -5,14 +5,18 @@ set(PHONESIM_VERSION 1.21) include(FeatureSummary) include(GNUInstallDirs) -find_package(Qt5 "5.10.0" REQUIRED NO_MODULE COMPONENTS Core Widgets Qml Network DBus) +find_package(Qt6 "6.0.0" NO_MODULE COMPONENTS Core Widgets Qml Network DBus Core5Compat) + +if(NOT Qt6_FOUND) + find_package(Qt5 "5.10.0" REQUIRED NO_MODULE COMPONENTS Core Widgets Qml Network DBus) +endif() set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) -################# Enable C++14 ################# +################# Enable C++17 ################# -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) ################# build and install ################# add_subdirectory(src)
src/CMakeLists.txt +5 -1
@@ -34,7 +34,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) add_executable(phonesim ${PHONESIM_SRCS}) target_compile_definitions(phonesim PRIVATE -DVERSION=${PHONESIM_VERSION} -DQT_NO_FOREACH) -target_link_libraries(phonesim Qt5::Core Qt5::Widgets Qt5::Qml Qt5::Network Qt5::DBus) +if(Qt6_FOUND) + target_link_libraries(phonesim Qt6::Core Qt6::Widgets Qt6::Qml Qt6::Network Qt6::DBus Qt6::Core5Compat) +else() + target_link_libraries(phonesim Qt5::Core Qt5::Widgets Qt5::Qml Qt5::Network Qt5::DBus) +endif() install(TARGETS phonesim RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES default.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/phonesim/)
src/control.cpp +3 -5
@@ -24,7 +24,6 @@ #include <qcombobox.h> #include <qmessagebox.h> #include <qfiledialog.h> -#include <Qt> #include <qbuffer.h> #include <qtimer.h> #include <qevent.h>
@@ -337,7 +336,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 +385,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; }
@@ -700,7 +699,6 @@ QString Script::Run(const QString &name, const QDBusMessage &msg) } QTextStream stream(&scriptFile); - stream.setCodec("UTF-8"); QString contents = stream.readAll(); scriptFile.close();
src/hardwaremanipulator.cpp +0 -1
@@ -18,7 +18,6 @@ ****************************************************************************/ #include "hardwaremanipulator.h" -#include <Qt> #include <qdebug.h> #include <qbuffer.h> #include <qtimer.h>
src/phonesim.cpp +1 -1
@@ -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 ); }
src/qsimcommand.cpp +1 -1
@@ -3626,7 +3626,7 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const if ( !language().isEmpty() && language().length() == 2 ) { data += (char)0xAD; data += (char)0x02; - data += language(); + data += language().toUtf8(); } } break;
src/qwsppdu.cpp +6 -6
@@ -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.29.2
Re: [PATCH phonesim 6/7] Port to Qt 6
Hi Jonah,
Quoted 10 lines · Jonah Brüchert
--- CMakeLists.txt | 10 +++++++--- src/CMakeLists.txt | 6 +++++- src/control.cpp | 8 +++----- src/hardwaremanipulator.cpp | 1 - src/phonesim.cpp | 2 +- src/qsimcommand.cpp | 2 +- src/qwsppdu.cpp | 12 ++++++------ 7 files changed, 23 insertions(+), 18 deletions(-)
Can the code changes be made standalone, without the build-system bits?
Regards,
-Denis
PATCH 7/7 Replace uneccessary uses of QTextCodec to convert to unicode
In reply to Jonah Brüchert--- src/conformancesimapplication.cpp | 17 ++++++----------- src/simapplication.cpp | 3 +-- 2 files changed, 7 insertions(+), 13 deletions(-)
src/conformancesimapplication.cpp +6 -11
@@ -434,8 +434,7 @@ void ConformanceSimApplication::DisplayTextMenu( const QSimTerminalResponse& res cmd.setType( QSimCommand::DisplayText ); cmd.setDestinationDevice( QSimCommand::Display ); cmd.setClearAfterDelay( false ); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) ); + cmd.setText( QStringLiteral("ЗДРАВСТВУЙТЕ") ); command( cmd, this, SLOT(sendDisplayTextMenu()), QSimCommand::UCS2Strings ); }
@@ -875,8 +874,7 @@ void ConformanceSimApplication::GetInkeyMenu( const QSimTerminalResponse& resp ) cmd.setType( QSimCommand::GetInkey ); cmd.setDestinationDevice( QSimCommand::ME ); cmd.setWantDigits(true); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) ); + cmd.setText( QStringLiteral("ЗДРАВСТВУЙТЕ" )); command( cmd, this, SLOT(sendGetInkeyMenu()), QSimCommand::UCS2Strings ); }
@@ -887,8 +885,7 @@ void ConformanceSimApplication::GetInkeyMenu( const QSimTerminalResponse& resp ) cmd.setType( QSimCommand::GetInkey ); cmd.setDestinationDevice( QSimCommand::ME ); cmd.setWantDigits(true); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" + cmd.setText( QStringLiteral("ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" ) ); command( cmd, this, SLOT(sendGetInkeyMenu()),
@@ -1364,8 +1361,7 @@ void ConformanceSimApplication::GetInputMenu( const QSimTerminalResponse& resp ) cmd.setDestinationDevice( QSimCommand::ME ); cmd.setEcho( true ); cmd.setWantDigits( false ); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) ); + cmd.setText( QStringLiteral("ЗДРАВСТВУЙТЕ") ); cmd.setMinimumLength( 5 ); cmd.setMaximumLength( 5 ); command( cmd, this, SLOT(sendGetInputMenu()),
@@ -1379,10 +1375,9 @@ void ConformanceSimApplication::GetInputMenu( const QSimTerminalResponse& resp ) cmd.setDestinationDevice( QSimCommand::ME ); cmd.setEcho( true ); cmd.setWantDigits( false ); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" + cmd.setText( QStringLiteral("ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" - "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" ) ); + "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ") ); cmd.setMinimumLength( 5 ); cmd.setMaximumLength( 5 ); command( cmd, this, SLOT(sendGetInputMenu()),
src/simapplication.cpp +1 -2
@@ -1916,8 +1916,7 @@ void DemoSimApplication::USSDMenu( const QSimTerminalResponse& resp ) cmd.setType( QSimCommand::SendUSSD ); cmd.setDestinationDevice( QSimCommand::Network ); cmd.setText( "UCS2 USSD" ); - QTextCodec *codec = QTextCodec::codecForName( "utf8" ); - cmd.setNumber( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) ); + cmd.setNumber( QStringLiteral("ЗДРАВСТВУЙТЕ") ); command( cmd, this, SLOT(sendUSSDMenu()), QSimCommand::UCS2Strings ); }
--
2.29.2