diff options
author | saturneric <[email protected]> | 2024-03-02 18:48:44 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-03-02 18:48:44 +0000 |
commit | 154ebea202d64669143ee6bb33f6327d141343c3 (patch) | |
tree | 3d9a6e5cac15f6575a4c1994ba8fd3d8607bfa65 /src/module/integrated/version_checking_module/SoftwareVersion.cpp | |
parent | refactor: remove qt6 core5compat dependencies (diff) | |
download | GpgFrontend-154ebea202d64669143ee6bb33f6327d141343c3.tar.gz GpgFrontend-154ebea202d64669143ee6bb33f6327d141343c3.zip |
refactor: reduce core prebuild headers and isolate core to modules
Diffstat (limited to 'src/module/integrated/version_checking_module/SoftwareVersion.cpp')
-rw-r--r-- | src/module/integrated/version_checking_module/SoftwareVersion.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/module/integrated/version_checking_module/SoftwareVersion.cpp b/src/module/integrated/version_checking_module/SoftwareVersion.cpp index 4e1c2dfa..cd864195 100644 --- a/src/module/integrated/version_checking_module/SoftwareVersion.cpp +++ b/src/module/integrated/version_checking_module/SoftwareVersion.cpp @@ -31,6 +31,44 @@ #include <GFSDKBasic.h> #include <GFSDKExtra.h> #include <GFSDKLog.h> +#include <spdlog/spdlog.h> + +#include <QString> + +template <> +struct fmt::formatter<QString> { + // Parses format specifications. + constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } + + // Formats the QString qstr and writes it to the output. + template <typename FormatContext> + auto format(const QString& qstr, FormatContext& ctx) const + -> decltype(ctx.out()) { + // Convert QString to UTF-8 QString (to handle Unicode characters + // correctly) + QByteArray utf8_array = qstr.toUtf8(); + return fmt::format_to(ctx.out(), "{}", utf8_array.constData()); + } +}; + +template <> +struct fmt::formatter<QByteArray> { + // Parses format specifications. + constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } + + // Formats the QString qstr and writes it to the output. + template <typename FormatContext> + auto format(const QByteArray& qarray, FormatContext& ctx) const + -> decltype(ctx.out()) { + // Convert QString to UTF-8 QString (to handle Unicode characters + // correctly) + return fmt::format_to(ctx.out(), "{}", qarray.constData()); + } +}; auto SoftwareVersion::NeedUpgrade() const -> bool { GFModuleLogDebug( |