From f4b4ccbbea5e354af838cb0682390dac412c2441 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 25 Apr 2023 15:22:06 +0200 Subject: [PATCH] Revert "Remove fmt dependency" This reverts commit 8efdf7b6fe86bd9561453a4650c5c66e1fcb49d0. --- misc/kima2.desktop | 6 +++--- src/core/CMakeLists.txt | 6 +++--- src/core/database.cpp | 4 ++-- src/core/utils.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/misc/kima2.desktop b/misc/kima2.desktop index d3c56cd..004ab5f 100644 --- a/misc/kima2.desktop +++ b/misc/kima2.desktop @@ -3,9 +3,9 @@ Type=Application Name=KIMA2 GenericName=Cash Point Program GenericName[de]=Kassenprogramm -Comment=A small cash point program for children’s stuff markets -Comment[de]=Ein kleines Kassenprogramm für Kindersachenmärkte +Comment=A small cash point program +Comment[de]=Ein kleines Kassenprogramm Exec=kima2 Icon=kima2 Categories=Office; -Terminal=false + diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a1ba242..58b9abf 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -7,7 +7,7 @@ find_package(SQLite3 REQUIRED) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -#find_package(fmt) +find_package(fmt) set(CORE_SOURCES database.cpp @@ -27,10 +27,10 @@ set(CORE_SOURCES add_library(core STATIC ${CORE_SOURCES}) target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include) if (WIN32) - target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads) + target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads fmt::fmt) target_link_libraries(core PRIVATE bcrypt) else() - target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads) + target_link_libraries(core PRIVATE sqlite3 nlohmann_json::nlohmann_json Threads::Threads fmt::fmt) endif() target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) diff --git a/src/core/database.cpp b/src/core/database.cpp index d6b7384..863bc5d 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ void Database::newDb() fs::path destPath = sourcePath.parent_path() / sourcePath.stem(); auto chronoTime = std::chrono::system_clock::now(); - std::string timeString = std::format("{0:%FT%H-%M-%S}", chronoTime); + std::string timeString = fmt::format("{0:%FT%H-%M-%S}", chronoTime); destPath += std::string("_") += timeString += ".db"; diff --git a/src/core/utils.cpp b/src/core/utils.cpp index c329036..75242f3 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -2,12 +2,14 @@ #include #include -#include +#include #include #include #include +using namespace fmt; + std::string formatCentAsEuroString(const int cent, int width) { /*std::stringstream currStream; @@ -30,7 +32,7 @@ std::string formatCentAsEuroString(const int cent, int width) #else std::locale myLocale{"de_DE.utf8"}; #endif - return std::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width); + return fmt::format(myLocale, "{:{}.2Lf} €", cent / 100.0L, width); } std::string <rim(std::string &str, const std::string &chars)