From 12d5852ffe277cb10ad91dde609f86d4b3eb51d6 Mon Sep 17 00:00:00 2001 From: saturneric Date: Sat, 27 Jul 2024 11:29:29 +0200 Subject: feat: remove dependency 'spdlog' --- src/m_ver_check/SoftwareVersion.cpp | 58 +++++++------------------------------ 1 file changed, 11 insertions(+), 47 deletions(-) (limited to 'src/m_ver_check/SoftwareVersion.cpp') diff --git a/src/m_ver_check/SoftwareVersion.cpp b/src/m_ver_check/SoftwareVersion.cpp index cd86419..a3cd933 100644 --- a/src/m_ver_check/SoftwareVersion.cpp +++ b/src/m_ver_check/SoftwareVersion.cpp @@ -31,59 +31,23 @@ #include #include #include -#include #include -template <> -struct fmt::formatter { - // 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 - 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 { - // 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 - 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()); - } -}; +#include "GFModuleCommonUtils.hpp" auto SoftwareVersion::NeedUpgrade() const -> bool { - GFModuleLogDebug( - fmt::format( - "compair version current {} latest {}, result {}", current_version, - latest_version, - GFCompareSoftwareVersion(GFModuleStrDup(current_version.toUtf8()), - GFModuleStrDup(latest_version.toUtf8()))) - .c_str()); + MLogDebug(QString("compare version current: %1 latest %2, result: %3") + .arg(current_version) + .arg(latest_version) + .arg(GFCompareSoftwareVersion( + GFModuleStrDup(current_version.toUtf8()), + GFModuleStrDup(latest_version.toUtf8())))); - GFModuleLogDebug(fmt::format("load done: {}, pre-release: {}, draft: {}", - loading_done, - latest_prerelease_version_from_remote, - latest_draft_from_remote) - .c_str()); + MLogDebug(QString("load done: %1, pre-release: %2, draft: %3") + .arg(static_cast(loading_done)) + .arg(static_cast(latest_prerelease_version_from_remote)) + .arg(static_cast(latest_draft_from_remote))); return loading_done && !latest_prerelease_version_from_remote && !latest_draft_from_remote && GFCompareSoftwareVersion(GFModuleStrDup(current_version.toUtf8()), -- cgit v1.2.3