From e26a5c0729af98a76018d23f3ad34206598d4dd6 Mon Sep 17 00:00:00 2001 From: AKMaily Date: Fri, 20 Sep 2024 12:52:26 +0200 Subject: [PATCH] Measurement as name of saved file testing --- src/look_up_saves.hpp | 17 +++++++++-------- src/saves_popup.cpp | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/look_up_saves.hpp b/src/look_up_saves.hpp index 3d01b85c..dd2ac72a 100644 --- a/src/look_up_saves.hpp +++ b/src/look_up_saves.hpp @@ -34,16 +34,17 @@ inline std::string getSubdirectoriesInFolder(nlohmann::json language, vins[i] = strdup(subdirectories[i].c_str()); if (isTxtInptFieldsEmpty) { - const std::string newcar = appLanguage[Key::New_Car]; + ImGui::InputText(appLanguage[Key::Measurement], scantype, 255); ImGui::Separator(); ImGui::NewLine(); ImGui::Text(appLanguage[Key::Additional_Information]); ImGui::NewLine(); - + + const std::string newcar = appLanguage[Key::New_Car]; + ImGui::Combo(appLanguage[Key::Known_Car], &selectedOption, vins, static_cast(subdirectories.size())); - ImGui::InputText(appLanguage[Key::Measurement], scantype, 255); if (selectedOption == 0) { ImGui::InputText("Fin/Vin", inputvin, 19, ImGuiInputTextFlags_CharsUppercase | @@ -56,6 +57,10 @@ inline std::string getSubdirectoriesInFolder(nlohmann::json language, // Using vins (char* array) with ImGui }else { + ImGui::InputText(appLanguage[Key::Measurement], scantype, 255); + ImGui::Separator(); + ImGui::Text(appLanguage[Key::Additional_Information]); + ImGui::NewLine(); ImGui::Combo(appLanguage[Key::Known_Car], &selectedOption, vins, static_cast(subdirectories.size())); @@ -65,11 +70,7 @@ inline std::string getSubdirectoriesInFolder(nlohmann::json language, } static char VIN[18]; const std::string newcar = appLanguage[Key::New_Car]; - - ImGui::Separator(); - ImGui::Text(appLanguage[Key::Additional_Information]); - ImGui::NewLine(); - ImGui::InputText(appLanguage[Key::Measurement], scantype, 255); + ImGui::InputText(appLanguage[Key::Mileage], mileage, 10); } } diff --git a/src/saves_popup.cpp b/src/saves_popup.cpp index 751f1d11..e686047b 100644 --- a/src/saves_popup.cpp +++ b/src/saves_popup.cpp @@ -165,11 +165,11 @@ void saves_popup(nlohmann::json const &config, nlohmann::json const &language, // ############# End popup // make a .csv file name - auto mkFileName = [&](const std::string &name) { + auto mkFileName = [&](const std::string &name, const std::string &measurement) { now = std::chrono::system_clock::now(); now_time_t = std::chrono::system_clock::to_time_t(now); now_tm = *std::gmtime(&now_time_t); - std::string filename{fmt::format("{}-{:%Y-%m-%dT%H-%M}.csv", name, now)}; + std::string filename{fmt::format("{}-{}-{:%Y-%m-%dT%H-%M}.csv", name, measurement, now)}; return filename; }; @@ -240,7 +240,7 @@ void saves_popup(nlohmann::json const &config, nlohmann::json const &language, // measurement saving preparation if device is checked if (dvcCheckedArr[i].b) { fs::path path; - auto filename = mkFileName(fmt::format("device{}", i + 1)); + auto filename = mkFileName(fmt::format("device{}", i + 1), scantype); if (hasSelectedPathArr[i].b) { path = mkdir(true, selectedPathArr[i], "", filename); hasSelectedPathArr[i].b = false;