From eb0d0baf4f628b7f3df409ab65b42ec1e45f6647 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Thu, 12 Jan 2023 13:18:45 +0200 Subject: [PATCH] Set minimum supported Qt 5.12 (#1147) IB-7398 Signed-off-by: Raul Metsma Signed-off-by: Raul Metsma --- CMakeLists.txt | 7 ++----- client/Application.cpp | 29 +++++++---------------------- client/Application_mac.mm | 20 +++++++------------- client/main.cpp | 16 ---------------- client/widgets/ComboBox.h | 2 ++ common | 2 +- 6 files changed, 19 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 486394341..d6c2fac2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,4 @@ -cmake_minimum_required(VERSION 3.10) -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(qdigidoc4 VERSION 4.3.0) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) @@ -15,7 +12,7 @@ find_package( PKCS11 ) find_package(LibDigiDocpp 3.14.11 REQUIRED) find_package( LDAP REQUIRED ) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} 5.9.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools) +find_package(Qt${QT_VERSION_MAJOR} 5.12.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools) set_env( TSL_URL "https://ec.europa.eu/tools/lotl/eu-lotl.xml" CACHE STRING "TSL trust list primary URL" ) set_env( TSL_INCLUDE "EE" CACHE STRING "TSL list include in binary" ) diff --git a/client/Application.cpp b/client/Application.cpp index 2baa26611..47e779f2b 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -268,7 +268,7 @@ class DigidocConf final: public digidoc::XmlConfCurrent s.remove(QStringLiteral("TSA-URL")); // Cleanup user conf if it is default url QList list; for(const QJsonValue &cert: obj.value(QStringLiteral("CERT-BUNDLE")).toArray()) - list << QSslCertificate(QByteArray::fromBase64(cert.toString().toLatin1()), QSsl::Der); + list.append(QSslCertificate(QByteArray::fromBase64(cert.toString().toLatin1()), QSsl::Der)); QSslConfiguration ssl = QSslConfiguration::defaultConfiguration(); ssl.setCaCertificates(list); QSslConfiguration::setDefaultConfiguration(ssl); @@ -326,11 +326,13 @@ Application::Application( int &argc, char **argv ) #endif , d(new Private) { +#ifdef CONFIG_URL d->conf = new Configuration(this); connect(d->conf, &Configuration::updateReminder, [&](bool /* expired */, const QString & /* title */, const QString &message){ WarningDialog(message, qApp->activeWindow()).exec(); }); +#endif qRegisterMetaType("TokenData"); qRegisterMetaType("QSmartCardData"); @@ -404,10 +406,8 @@ Application::Application( int &argc, char **argv ) tl.remove(); QFile::copy(":/TSL/" + file, tl.fileName()); tl.setPermissions(QFile::Permissions(0x6444)); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) if(tl.open(QFile::Append)) tl.setFileTime(tslTime, QFileDevice::FileModificationTime); -#endif } } @@ -530,7 +530,7 @@ void Application::activate( QWidget *w ) #ifdef Q_OS_WIN void Application::addTempFile(const QString &file) { - d->tempFiles << file; + d->tempFiles.append(file); } #endif @@ -623,7 +623,7 @@ QVariant Application::confValue( ConfParameter parameter, const QVariant &value { std::vector v = cert; if(!v.empty()) - list << QSslCertificate(QByteArray::fromRawData((const char*)v.data(), int(v.size())), QSsl::Der); + list.append(QSslCertificate(QByteArray::fromRawData((const char*)v.data(), int(v.size())), QSsl::Der)); } return QVariant::fromValue(list); } @@ -983,8 +983,6 @@ void Application::openHelp() void Application::parseArgs( const QString &msg ) { QStringList params; - - #if QT_VERSION > QT_VERSION_CHECK(5, 14, 0) for(const QString ¶m: msg.split(QStringLiteral("\", \""), Qt::SkipEmptyParts)) #else @@ -992,7 +990,7 @@ void Application::parseArgs( const QString &msg ) #endif { QUrl url( param, QUrl::StrictMode ); - params << (param != QLatin1String("-crypto") && !url.toLocalFile().isEmpty() ? url.toLocalFile() : param); + params.append(param != QLatin1String("-crypto") && !url.toLocalFile().isEmpty() ? url.toLocalFile() : param); } parseArgs( params ); } @@ -1118,20 +1116,7 @@ void Application::showClient(const QStringList ¶ms, bool crypto, bool sign, #ifdef Q_OS_LINUX else { -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - QScreen *screen = [w]() -> QScreen* { - for (const QScreen *screen : QGuiApplication::screens()) { - for (QScreen *sibling : screen->virtualSiblings()) { - if (sibling->geometry().contains(w->pos())) - return sibling; - } - } - return nullptr; - }(); -#else - QScreen *screen = QGuiApplication::screenAt(w->pos()); -#endif - if(screen) + if(QScreen *screen = QGuiApplication::screenAt(w->pos())) w->move(screen->availableGeometry().center() - w->frameGeometry().adjusted(0, 0, 10, 40).center()); } #endif diff --git a/client/Application_mac.mm b/client/Application_mac.mm index 95d63e5b1..f5f075156 100644 --- a/client/Application_mac.mm +++ b/client/Application_mac.mm @@ -25,12 +25,6 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) -namespace Qt { -using ::endl; -} -#endif - @implementation NSApplication (ApplicationObjC) - (void)appReopen:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent @@ -46,7 +40,7 @@ - (void)openClient:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr Q_UNUSED(error) QStringList result; for( NSString *filename in [pboard propertyListForType:NSFilenamesPboardType] ) - result << QString::fromNSString(filename).normalized(QString::NormalizationForm_C); + result.append(QString::fromNSString(filename).normalized(QString::NormalizationForm_C)); QMetaObject::invokeMethod( qApp, "showClient", Q_ARG(QStringList,result) ); } @@ -56,7 +50,7 @@ - (void)signClient:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr Q_UNUSED(error) QStringList result; for(NSString *filename in [pboard propertyListForType:NSFilenamesPboardType]) - result << QString::fromNSString(filename).normalized(QString::NormalizationForm_C); + result.append(QString::fromNSString(filename).normalized(QString::NormalizationForm_C)); QMetaObject::invokeMethod(qApp, "showClient", Q_ARG(QStringList,result), Q_ARG(bool,false), Q_ARG(bool,true)); } @@ -66,7 +60,7 @@ - (void)openCrypto:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr Q_UNUSED(error) QStringList result; for( NSString *filename in [pboard propertyListForType:NSFilenamesPboardType] ) - result << QString::fromNSString(filename).normalized(QString::NormalizationForm_C); + result.append(QString::fromNSString(filename).normalized(QString::NormalizationForm_C)); QMetaObject::invokeMethod( qApp, "showClient", Q_ARG(QStringList,result), Q_ARG(bool,true) ); } @end @@ -121,8 +115,8 @@ - (void)openCrypto:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr else if([appUrl.path rangeOfString:@"Entourage"].location != NSNotFound) { s << "on run" << Qt::endl - << "set vattachment to \"" << q.queryItemValue("attachment") << "\"" << Qt::endl - << "set vsubject to \"" << q.queryItemValue("subject") << "\"" << Qt::endl + << "set vattachment to \"" << q.queryItemValue(QStringLiteral("attachment")) << "\"" << Qt::endl + << "set vsubject to \"" << q.queryItemValue(QStringLiteral("subject")) << "\"" << Qt::endl << "tell application \"Microsoft Entourage\"" << Qt::endl << "set vmessage to make new outgoing message with properties" << Qt::endl << "{subject:vsubject, attachments:vattachment}" << Qt::endl @@ -134,8 +128,8 @@ - (void)openCrypto:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr else if([appUrl.path rangeOfString:@"Outlook"].location != NSNotFound) { s << "on run" << Qt::endl - << "set vattachment to \"" << q.queryItemValue("attachment") << "\" as POSIX file" << Qt::endl - << "set vsubject to \"" << q.queryItemValue("subject") << "\"" << Qt::endl + << "set vattachment to \"" << q.queryItemValue(QStringLiteral("attachment")) << "\" as POSIX file" << Qt::endl + << "set vsubject to \"" << q.queryItemValue(QStringLiteral("subject")) << "\"" << Qt::endl << "tell application \"Microsoft Outlook\"" << Qt::endl << "activate" << Qt::endl << "set vmessage to make new outgoing message with properties {subject:vsubject}" << Qt::endl diff --git a/client/main.cpp b/client/main.cpp index 4c2e08461..9652f63aa 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -24,27 +24,11 @@ #include #include -#ifdef Q_OS_WIN32 -#include -#include -#endif - int main( int argc, char *argv[] ) { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); -#ifdef Q_OS_WIN32 - SetProcessDPIAware(); - HDC screen = GetDC(nullptr); - qreal dpix = GetDeviceCaps(screen, LOGPIXELSX); - qreal dpiy = GetDeviceCaps(screen, LOGPIXELSY); - qreal scale = dpiy / qreal(96); - qputenv("QT_SCALE_FACTOR", QByteArray::number(scale)); - ReleaseDC(nullptr, screen); - qDebug() << "Current DPI x: " << dpix << " y: " << dpiy << " setting scale:" << scale; -#else QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); -#endif #endif for(int i = 1; i < argc; ++i) diff --git a/client/widgets/ComboBox.h b/client/widgets/ComboBox.h index 90081a7c7..95d48b99a 100644 --- a/client/widgets/ComboBox.h +++ b/client/widgets/ComboBox.h @@ -17,6 +17,8 @@ * */ +#pragma once + #include class ComboBox: public QComboBox diff --git a/common b/common index 254b3ceed..a84bdde01 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 254b3ceedfecff91508a098d3055287178624a80 +Subproject commit a84bdde01027c3562d1aa1a344bd1d3cc69d2916