Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Qt 5 support #1315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
container: ubuntu:${{ matrix.container }}
strategy:
matrix:
container: ['20.04', '22.04', '24.04', '24.10']
container: ['22.04', '24.04', '24.10']
env:
DEBIAN_FRONTEND: noninteractive
DEBFULLNAME: github-actions
Expand All @@ -71,10 +71,6 @@ jobs:
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install dependencies
if: matrix.container == '20.04'
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper pkg-config lintian ./libdigidocpp-pkg/*.deb cmake libldap2-dev gettext libpcsclite-dev libssl-dev libqt5svg5-dev qttools5-dev-tools qttools5-dev libflatbuffers-dev zlib1g-dev
- name: Install dependencies
if: matrix.container != '20.04'
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper pkg-config lintian ${UBUNTU_DEPS}
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -137,10 +133,12 @@ jobs:
runs-on: ${{ matrix.image }}
strategy:
matrix:
vcver: [143]
vcver: [143, 142]
include:
- vcver: 143
image: windows-2022
- vcver: 142
image: windows-2019
env:
VER_SUFFIX: .VS${{ matrix.vcver }}
steps:
Expand All @@ -164,7 +162,7 @@ jobs:
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: openssl zlib flatbuffers
vcpkgGitCommitId: 18b028fe785e707265fa0e35590b7537ae1d12ea
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgTriplet: x64-windows
- name: Install Qt
uses: jurplel/install-qt-action@v4
Expand All @@ -181,9 +179,6 @@ jobs:
wix extension -g add WixToolset.UI.wixext/5.0.2
- name: Build
run: |
if ($env:VCToolsRedistDir -eq $null) {
$env:VCToolsRedistDir = -join ($env:VCINSTALLDIR, "Redist\MSVC\", $env:VCToolsVersion, "\")
}
cmake "-GNinja" -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE=${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake `
"-DLibDigiDocpp_ROOT=libs/PFiles64/libdigidocpp"
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.22)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/modules/VersionInfo.cmake)
message(FATAL_ERROR "cmake submodule directory empty, did you 'git clone --recursive'?")
endif()
Expand All @@ -13,8 +13,7 @@ include( VersionInfo )

find_package(LibDigiDocpp 4.1.0 REQUIRED)
find_package( LDAP REQUIRED )
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} 5.12.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools)
find_package(Qt6 6.2.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport SvgWidgets LinguistTools)
find_package(FlatBuffers CONFIG REQUIRED NAMES FlatBuffers Flatbuffers)
find_package(ZLIB REQUIRED)

Expand Down
4 changes: 0 additions & 4 deletions client/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,11 +822,7 @@ void Application::openHelp()
void Application::parseArgs( const QString &msg )
{
QStringList params;
#if QT_VERSION > QT_VERSION_CHECK(5, 14, 0)
for(const QString &param: msg.split(QStringLiteral("\", \""), Qt::SkipEmptyParts))
#else
for(const QString &param: msg.split(QStringLiteral("\", \""), QString::SkipEmptyParts))
#endif
{
QUrl url( param, QUrl::StrictMode );
params.append(param != QLatin1String("-crypto") && !url.toLocalFile().isEmpty() ? url.toLocalFile() : param);
Expand Down
17 changes: 5 additions & 12 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
get_target_property(qtCore_install_prefix Qt6::qmake IMPORTED_LOCATION)
get_filename_component(qtCore_install_prefix ${qtCore_install_prefix} DIRECTORY)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/TSL.qrc)
set(TSL_QRC ${CMAKE_CURRENT_SOURCE_DIR}/TSL.qrc)
else()
add_executable(TSLDownload TSLDownload.cpp)
target_link_libraries(TSLDownload Qt${QT_VERSION_MAJOR}::Network)
target_link_libraries(TSLDownload Qt6::Network)
set_target_properties(TSLDownload PROPERTIES AUTOMOC OFF)
get_target_property(qtCore_install_prefix Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
get_filename_component(qtCore_install_prefix ${qtCore_install_prefix} DIRECTORY)
add_custom_command(
OUTPUT TSL.qrc
DEPENDS TSLDownload
Expand Down Expand Up @@ -69,8 +69,6 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
MainWindow.ui
PrintSheet.cpp
PrintSheet.h
QCardLock.cpp
QCardLock.h
QCryptoBackend.cpp
QCryptoBackend.h
QPCSC.cpp
Expand All @@ -96,8 +94,8 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE

target_link_libraries(${PROJECT_NAME}
qdigidoccommon
Qt${QT_VERSION_MAJOR}::PrintSupport
Qt${QT_VERSION_MAJOR}::Svg
Qt6::PrintSupport
Qt6::SvgWidgets
${LIBDIGIDOCPP_LIBRARY}
${LDAP_LIBRARIES}
$<TARGET_NAME_IF_EXISTS:flatbuffers::flatbuffers>
Expand All @@ -109,11 +107,6 @@ if(NOT BUILD_DATE)
string(TIMESTAMP BUILD_DATE "%d.%m.%Y")
endif()

if(${QT_VERSION_MAJOR} STREQUAL "6")
find_package(Qt6 COMPONENTS SvgWidgets REQUIRED)
target_link_libraries(${PROJECT_NAME} Qt6::SvgWidgets)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES
AUTOUIC ON
AUTORCC ON
Expand Down
9 changes: 1 addition & 8 deletions client/Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
#include <QtNetwork/QSslKey>

#include <openssl/aes.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/core_names.h>
#endif
#include <openssl/ec.h>
#include <openssl/err.h>
#include <openssl/evp.h>
Expand Down Expand Up @@ -168,19 +166,14 @@ QByteArray Crypto::concatKDF(QCryptographicHash::Algorithm hashAlg, const QByteA
QByteArray Crypto::curve_oid(EVP_PKEY *key)
{
QByteArray buf(50, 0);
#if OPENSSL_VERSION_NUMBER < 0x30000000L
int nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0_EC_KEY(key)));
#else
std::array<char, 64> group{};
size_t size = group.size();
if(EVP_PKEY_get_utf8_string_param(key, OSSL_PKEY_PARAM_GROUP_NAME, group.data(), group.size(), &size) != 1)
{
buf.clear();
return buf;
}
int nid = OBJ_sn2nid(group.data());
#endif
ASN1_OBJECT *obj = OBJ_nid2obj(nid);
ASN1_OBJECT *obj = OBJ_nid2obj(OBJ_sn2nid(group.data()));
if(int size = OBJ_obj2txt(buf.data(), buf.size(), obj, 1); size != NID_undef)
buf.resize(size);
else
Expand Down
6 changes: 0 additions & 6 deletions client/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#include <QtCore/QTextStream>
#include <QtNetwork/QSslCertificate>

#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
namespace Qt {
using ::hex;
}
#endif

void Diagnostics::generalInfo(QTextStream &s)
{
s << "<b>" << tr("Arguments:") << "</b> " << Application::arguments().join(' ') << "<br />"
Expand Down
22 changes: 7 additions & 15 deletions client/IKValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,12 @@
#include <QtCore/QDate>
#include <QtCore/QStringList>

inline int toInt(QStringView str) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QLocale::system().toInt(str); // QLocale, workaround for Qt 5
#else
return str.toInt();
#endif
}

QDate IKValidator::birthDate(QStringView ik)
{
if(ik.size() != 11) return {};

quint16 year = 0;
switch(toInt(ik.left(1)))
switch(ik.left(1).toInt())
{
case 1: case 2: year = 1800; break;
case 3: case 4: year = 1900; break;
Expand All @@ -45,9 +37,9 @@ QDate IKValidator::birthDate(QStringView ik)
}

QDate date(
toInt(ik.mid(1, 2)) + year,
toInt(ik.mid(3, 2)),
toInt(ik.mid(5, 2)));
ik.mid(1, 2).toInt() + year,
ik.mid(3, 2).toInt(),
ik.mid(5, 2).toInt());
return date.isValid() ? date : QDate();
}

Expand Down Expand Up @@ -80,8 +72,8 @@ bool IKValidator::isValid(QStringView ik)
int sum1 = 0, sum2 = 0;
for(int i = 0, pos1 = 1, pos2 = 3; i < 10; ++i)
{
sum1 += toInt(ik.mid(i, 1)) * pos1;
sum2 += toInt(ik.mid(i, 1)) * pos2;
sum1 += ik.mid(i, 1).toInt() * pos1;
sum2 += ik.mid(i, 1).toInt() * pos2;
pos1 = pos1 == 9 ? 1 : pos1 + 1;
pos2 = pos2 == 9 ? 1 : pos2 + 1;
}
Expand All @@ -91,7 +83,7 @@ bool IKValidator::isValid(QStringView ik)
(result = sum2 % 11) >= 10)
result = 0;

return toInt(ik.right(1)) == result;
return ik.right(1).toInt() == result;
}


Expand Down
5 changes: 0 additions & 5 deletions client/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ MainWindow::MainWindow( QWidget *parent )
ui->pageButtonGroup->setId(ui->myEid, Pages::MyEid);

connect(ui->pageButtonGroup, QOverload<QAbstractButton *, bool>::of(&QButtonGroup::buttonToggled), this, &MainWindow::clearPopups);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
connect(ui->pageButtonGroup, &QButtonGroup::idToggled, this, &MainWindow::pageSelected);
#else
connect(ui->pageButtonGroup, QOverload<QAbstractButton *, bool>::of(&QButtonGroup::buttonToggled), this,
[=](QAbstractButton *button, bool checked){ pageSelected(ui->pageButtonGroup->id(button), checked); });
#endif
ui->help->installEventFilter(new ButtonHoverFilter(QStringLiteral(":/images/icon_Abi.svg"), QStringLiteral(":/images/icon_Abi_hover.svg"), this));
ui->settings->installEventFilter(new ButtonHoverFilter(QStringLiteral(":/images/icon_Seaded.svg"), QStringLiteral(":/images/icon_Seaded_hover.svg"), this));
connect(ui->help, &QToolButton::clicked, qApp, &Application::openHelp);
Expand Down
73 changes: 0 additions & 73 deletions client/QCardLock.cpp

This file was deleted.

59 changes: 0 additions & 59 deletions client/QCardLock.h

This file was deleted.

Loading
Loading