From e2b0779c7cce366c8c10c5b543ff59b9dabc3ffc Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Fri, 12 Nov 2021 15:31:48 +0100 Subject: [PATCH] Fix regex escapes --- GlosSIConfig/ExeImageProvider.h | 3 +- GlosSIConfig/Resource.rc | 72 +++++++++++++++++++++++++++++++-- GlosSIConfig/UIModel.cpp | 6 +-- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/GlosSIConfig/ExeImageProvider.h b/GlosSIConfig/ExeImageProvider.h index d83dbe1..f712896 100644 --- a/GlosSIConfig/ExeImageProvider.h +++ b/GlosSIConfig/ExeImageProvider.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include class ExeImageProvider : public QQuickImageProvider { public: ExeImageProvider() @@ -11,7 +12,7 @@ class ExeImageProvider : public QQuickImageProvider { QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override { HICON icon = 0; - std::wstring path = id.toStdWString(); + std::wstring path = QString(id).replace(QRegularExpression(("\\%5C")), "\\").toStdWString(); icon = (HICON)LoadImage( 0, path.data(), diff --git a/GlosSIConfig/Resource.rc b/GlosSIConfig/Resource.rc index 22b9c84..66cfd26 100644 --- a/GlosSIConfig/Resource.rc +++ b/GlosSIConfig/Resource.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,1,003000346323 - PRODUCTVERSION 0,0,1,003000346323 + FILEVERSION 0,0,2,006008097710 + PRODUCTVERSION 0,0,2,006008097710 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "FileDescription", "GlosSI - Config" - VALUE "FileVersion", "0.0.1.0-3-ga346323" + VALUE "FileVersion", "0.0.2.0-6-g8d9771f" VALUE "InternalName", "GlosSIConfig" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "OriginalFilename", "GlosSIConfig.exe" VALUE "ProductName", "GlosSi" - VALUE "ProductVersion", "0.0.1.0-3-ga346323" + VALUE "ProductVersion", "0.0.2.0-6-g8d9771f" END END BLOCK "VarFileInfo" @@ -230,6 +230,70 @@ END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GlosSIConfig/UIModel.cpp b/GlosSIConfig/UIModel.cpp index 67e2f9c..a9c42bd 100644 --- a/GlosSIConfig/UIModel.cpp +++ b/GlosSIConfig/UIModel.cpp @@ -82,7 +82,7 @@ void UIModel::readConfigs() json["maxFps"] = filejson["window"]["maxFps"]; json["scale"] = filejson["window"]["scale"]; - json["name"] = QString(name).replace(QRegularExpression("\.json"), ""); + json["name"] = QString(name).replace(QRegularExpression("\\.json"), ""); targets_.append(json.toVariantMap()); }); @@ -178,7 +178,7 @@ bool UIModel::addToSteam(QVariant shortcut) vdfshortcut.icon.value = "\"" + ( is_windows_ - ? QString(maybeLaunchPath).replace(QRegularExpression("\/"), "\\").toStdString() + ? QString(maybeLaunchPath).replace(QRegularExpression("\\/"), "\\").toStdString() : maybeLaunchPath.toStdString() ) + "\""; } @@ -186,7 +186,7 @@ bool UIModel::addToSteam(QVariant shortcut) vdfshortcut.icon.value = "\"" + ( is_windows_ - ? QString(maybeIcon).replace(QRegularExpression("\/"), "\\").toStdString() + ? QString(maybeIcon).replace(QRegularExpression("\\/"), "\\").toStdString() : maybeIcon.toStdString() ) + "\""; }