From b0fb46e476d37e53c721da7a6a640f84009beccb Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Fri, 11 Oct 2024 15:01:21 +0300 Subject: [PATCH] Use default theme on windows IB-8244 Signed-off-by: Raul Metsma --- Application.cpp | 1 - CMakeLists.txt | 5 ++--- cmake | 2 +- common | 2 +- idupdater.cpp | 37 +++++++++++++++++++------------------ idupdater.wxs | 2 +- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Application.cpp b/Application.cpp index b5bdf27..8e7200f 100644 --- a/Application.cpp +++ b/Application.cpp @@ -79,7 +79,6 @@ Application::Application( int &argc, char **argv ) .arg( MAJOR_VER ).arg( MINOR_VER ).arg( RELEASE_VER ).arg( BUILD_VER ) ); setOrganizationDomain(u"ria.ee"_s); setOrganizationName(u"RIA"_s); - setStyle(u"windowsvista"_s); QNetworkProxyFactory::setUseSystemConfiguration(true); } diff --git a/CMakeLists.txt b/CMakeLists.txt index 851c5b7..6f01cdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,6 @@ else() ${CMAKE_CURRENT_BINARY_DIR}/config.qrc common/Common.cpp common/Configuration.cpp - common/QPCSC.cpp common/qtsingleapplication/src/qtlocalpeer.cpp common/qtsingleapplication/src/qtsingleapplication.cpp ) @@ -134,6 +133,7 @@ else() INTERPROCEDURAL_OPTIMIZATION YES INTERPROCEDURAL_OPTIMIZATION_DEBUG NO ) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN UNICODE @@ -142,7 +142,7 @@ else() NO_CACHE ) target_link_libraries(${PROJECT_NAME} Qt6::Widgets Qt6::Network OpenSSL::Crypto - msi wintrust Crypt32 taskschd comsupp Setupapi winscard Wtsapi32 + msi wintrust Crypt32 taskschd comsupp Setupapi Wtsapi32 ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -165,7 +165,6 @@ else() -ext WixToolset.UI.wixext -bv WixUIDialogBmp=${CMAKE_SOURCE_DIR}/cmake/modules/dlgbmp.bmp -bv WixUIBannerBmp=${CMAKE_SOURCE_DIR}/cmake/modules/banner.bmp - -d MSI_VERSION=${VERSION} -d appicon=${CMAKE_SOURCE_DIR}/appicon.ico -d qt_path=${qtCore_install_prefix} -d qt_suffix=$<$:d> diff --git a/cmake b/cmake index 8ce75e6..31d9f21 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 8ce75e6057067ca51d7c619d34d88422bad201e5 +Subproject commit 31d9f21971764f98e4c04177ba3efc49fe8f98f8 diff --git a/common b/common index 8e4034f..7025c83 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 8e4034fff04708e305d0bc9df8e445d6c3ffc81f +Subproject commit 7025c836c2f6ecbbdd735c526f6983fde265ef71 diff --git a/idupdater.cpp b/idupdater.cpp index ca1832e..63935a5 100644 --- a/idupdater.cpp +++ b/idupdater.cpp @@ -21,7 +21,6 @@ #include "common/Common.h" #include "common/Configuration.h" -#include "common/QPCSC.h" #include #include @@ -41,6 +40,8 @@ #include #include +using namespace Qt::StringLiterals; + idupdaterui::idupdaterui( const QString &version, idupdater *parent ) : QWidget() { @@ -103,13 +104,13 @@ idupdater::idupdater( QObject *parent ) , version(installedVersion("{f1c4d351-269d-4bee-8cdb-6ea70c968875}")) , conf(new Configuration(this)) { - QString userAgent = QStringLiteral("%1/%2 (%3) Lang: %4 Devices: %5") + QString userAgent = "%1/%2 (%3) Lang: %4 Devices: %5"_L1 .arg(QApplication::applicationName(), QApplication::applicationVersion(), Common::applicationOs(), - QLocale().uiLanguages().first(), QPCSC::instance().drivers().join('/')); + QLocale().uiLanguages().first(), Configuration::drivers().join('/')); qDebug() << "User-Agent:" << userAgent; request.setRawHeader( "User-Agent", userAgent.toUtf8() ); connect(conf, &Configuration::finished, this, &idupdater::finished); - connect(this, &QNetworkAccessManager::sslErrors, this, [=](QNetworkReply *reply, const QList &errors){ + connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList &errors) { QList ignore; for(const QSslError &error: errors) { @@ -118,7 +119,7 @@ idupdater::idupdater( QObject *parent ) case QSslError::UnableToGetLocalIssuerCertificate: case QSslError::CertificateUntrusted: case QSslError::SelfSignedCertificateInChain: - if(trusted.contains(reply->sslConfiguration().peerCertificate())) { + if(reply->sslConfiguration().caCertificates().contains(reply->sslConfiguration().peerCertificate())) { ignore << error; break; } @@ -151,15 +152,15 @@ void idupdater::finished(bool /*changed*/, const QString &err) QJsonObject obj = conf->object(); trusted.clear(); - for(const auto &c: conf->object().value(QLatin1String("CERT-BUNDLE")).toArray()) + for(const auto array = conf->object().value("CERT-BUNDLE"_L1).toArray(); const auto &c: array) trusted.append(QSslCertificate(QByteArray::fromBase64(c.toString().toLatin1()), QSsl::Der)); - if(obj.contains(QLatin1String("UPDATER-MESSAGE-URL"))) + if(obj.contains("UPDATER-MESSAGE-URL"_L1)) { QSslConfiguration ssl = QSslConfiguration::defaultConfiguration(); - ssl.setCaCertificates({}); + ssl.setCaCertificates(trusted); auto copy = request; copy.setSslConfiguration(ssl); - copy.setUrl(obj.value(QLatin1String("UPDATER-MESSAGE-URL")).toString()); + copy.setUrl(obj.value("UPDATER-MESSAGE-URL"_L1).toString()); QNetworkReply *reply = get(copy); connect(reply, &QNetworkReply::finished, this, [this, reply]{ if(reply->error() == QNetworkReply::NoError) @@ -167,13 +168,13 @@ void idupdater::finished(bool /*changed*/, const QString &err) reply->deleteLater(); }); } - else if(obj.contains(QLatin1String("WIN-MESSAGE"))) - emit message(obj.value(QLatin1String("WIN-MESSAGE")).toString()); + else if(obj.contains("WIN-MESSAGE"_L1)) + emit message(obj.value("WIN-MESSAGE"_L1).toString()); - if(obj.contains(QLatin1String("WIN-UPGRADECODE"))) - version = installedVersion(obj.value(QLatin1String("WIN-UPGRADECODE")).toString()); - QString available = obj.value(QLatin1String("WIN-LATEST")).toString(); - request.setUrl(obj.value(QLatin1String("WIN-DOWNLOAD")).toString()); + if(obj.contains("WIN-UPGRADECODE"_L1)) + version = installedVersion(obj.value("WIN-UPGRADECODE"_L1).toString()); + QString available = obj.value("WIN-LATEST"_L1).toString(); + request.setUrl(obj.value("WIN-DOWNLOAD"_L1).toString()); qDebug() << "Installed version" << version << "available version" << available; if(!lessThanVersion(version, available)) @@ -198,11 +199,11 @@ void idupdater::finished(bool /*changed*/, const QString &err) QString idupdater::installedVersion(const QString &upgradeCode) const { QString code = upgradeCode.toUpper(); - QSettings s(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), QSettings::Registry32Format); + QSettings s(u"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"_s, QSettings::Registry32Format); for(const QString &key: s.childGroups()) { s.beginGroup(key); - if(s.value(QStringLiteral("/BundleUpgradeCode")).toString().toUpper() == code) - return s.value(QStringLiteral("/DisplayVersion")).toString(); + if(s.value(u"/BundleUpgradeCode"_s).toString().toUpper() == code) + return s.value(u"/DisplayVersion"_s).toString(); s.endGroup(); } diff --git a/idupdater.wxs b/idupdater.wxs index 738d440..7640465 100644 --- a/idupdater.wxs +++ b/idupdater.wxs @@ -19,7 +19,7 @@ + Language="1033" Version="!(bind.FileVersion.id_updater.exe)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">