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

Use default theme on windows #94

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
1 change: 0 additions & 1 deletion Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ else()
ScheduledUpdateTask.cpp
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
${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
)
Expand All @@ -134,15 +132,15 @@ 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
CONFIG_URL="${CONFIG_URL}"
COMMON_STATIC
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)
Expand All @@ -165,7 +163,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=$<$<CONFIG:Debug>:d>
Expand Down
2 changes: 1 addition & 1 deletion cmake
2 changes: 1 addition & 1 deletion common
Submodule common updated 10 files
+0 −3 .gitmodules
+13 −6 CMakeLists.txt
+0 −120 Common.cpp
+0 −46 Common.h
+99 −8 Configuration.cpp
+3 −0 Configuration.h
+0 −486 QPCSC.cpp
+0 −131 QPCSC.h
+0 −207 QPCSC_p.h
+0 −1 cmake
40 changes: 20 additions & 20 deletions idupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

#include "idupdater.h"

#include "common/Common.h"
#include "common/Configuration.h"
#include "common/QPCSC.h"

#include <QDebug>
#include <QDir>
Expand All @@ -41,6 +39,8 @@
#include <Msi.h>
#include <Softpub.h>

using namespace Qt::StringLiterals;

idupdaterui::idupdaterui( const QString &version, idupdater *parent )
: QWidget()
{
Expand Down Expand Up @@ -103,13 +103,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")
.arg(QApplication::applicationName(), QApplication::applicationVersion(), Common::applicationOs(),
QLocale().uiLanguages().first(), QPCSC::instance().drivers().join('/'));
QString userAgent = "%1/%2 (%3) Lang: %4 Devices: %5"_L1
.arg(QApplication::applicationName(), QApplication::applicationVersion(), Configuration::applicationOs(),
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<QSslError> &errors){
connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList<QSslError> &errors) {
QList<QSslError> ignore;
for(const QSslError &error: errors)
{
Expand All @@ -118,7 +118,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;
}
Expand Down Expand Up @@ -151,29 +151,29 @@ 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)
emit message(reply->readAll());
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))
Expand All @@ -198,11 +198,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();
}

Expand Down
2 changes: 1 addition & 1 deletion idupdater.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Open-EID Updater" UpgradeCode="d3aa8bd7-e1e6-46d0-97a6-c9b87d2b830b"
Language="1033" Version="$(var.MSI_VERSION)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">
Language="1033" Version="!(bind.FileVersion.id_updater.exe)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<Icon Id="appicon.ico" SourceFile="$(var.appicon)" />
<Property Id="ARPPRODUCTICON" Value="appicon.ico" />
Expand Down
Loading