diff --git a/config/config.json b/config/config.json index 8542d399..d49ac4f9 100644 --- a/config/config.json +++ b/config/config.json @@ -6,6 +6,7 @@ "input2": "scan_type", "url": "https://postapi.aw4null.de/v1/uploadFile/" }, + "helplink": "https://www.autowerkstatt40.org/", "github": { "url": { "config": "https://raw.githubusercontent.com/skunkforce/omniview/master/config/config.json", @@ -110,7 +111,7 @@ } }, "font": "comicsans", - "minscale": 0.5, + "minscale": 1, "scale": 1.9999998807907104 }, "title": "Omniview 0.5", diff --git a/languages/Deutsch.json b/languages/Deutsch.json index 77f8a3f4..096de3e8 100644 --- a/languages/Deutsch.json +++ b/languages/Deutsch.json @@ -4,6 +4,7 @@ "height": "Höhe ", "width": "Breite" }, + "helplink": "Klicken Sie auf den Button um zur Hilfeseite zu gelangen", "input": { "fin": { "label": "Fin/Vin", diff --git a/src/apihandler.hpp b/src/apihandler.hpp index 4381d37a..13baec87 100644 --- a/src/apihandler.hpp +++ b/src/apihandler.hpp @@ -6,8 +6,9 @@ #include #include -inline std::string send_to_api(nlohmann::json const &config, std::string const &file, - std::string const &vin, std::string const &scantype) { +inline std::string send_to_api(nlohmann::json const &config, + std::string const &file, std::string const &vin, + std::string const &scantype) { std::string api_message = "empty"; CURL *curl; CURLcode res; @@ -70,10 +71,12 @@ inline std::string send_to_api(nlohmann::json const &config, std::string const & return api_message; } -inline std::string send_to_api(nlohmann::json const &config, std::string const &file, - std::string const &vin, std::string const &scantype, - nlohmann::json const &additionalData) { +inline std::string send_to_api(nlohmann::json const &config, + std::string const &file, std::string const &vin, + std::string const &scantype, + nlohmann::json const &additionalData) { std::string api_message = "empty"; + CURL *curl; CURLcode res; diff --git a/src/create_training_data.hpp b/src/create_training_data.hpp index fdb72d96..49fc645e 100644 --- a/src/create_training_data.hpp +++ b/src/create_training_data.hpp @@ -143,6 +143,7 @@ static void selected_vcds_data(nlohmann::json const &config, metadata["kommentar"] = comment; metadata["laufleistung"] = mileage; + api_message = send_to_api( config, path1, inputvin, load_json(language, "measuretype", "vcds"), metadata); @@ -194,6 +195,7 @@ inline void selected_battery_measurement( ImVec2(load_json(config, "button")))) { metadata["kommentar"] = comment; metadata["laufleistung"] = mileage; + api_message = send_to_api( config, path1, inputvin, load_json(language, "measuretype", "battery"), metadata); @@ -306,6 +308,7 @@ static void selected_compression_data( if (ImGui::Button(load_json(language, "button", "send").c_str(), ImVec2(load_json(config, "button")))) { + // Api muss angepasst werden und die funktion send to api ebenso metadata["z1"] = z1; metadata["z2"] = z2; @@ -319,6 +322,7 @@ static void selected_compression_data( load_json(language, "measuretype", "compression"), metadata); metadata["zündung"] = "aktiviert"; + api_message += send_to_api( config, path2, inputvin, load_json(language, "measuretype", "compression"), @@ -342,7 +346,7 @@ inline void popup_create_training_data_select(nlohmann::json const &config, static std::string mileage = ""; static std::string comment = ""; static nlohmann::json metadata; - static std::string api_message = " "; + std::string api_message = " "; ImGui::SetItemDefaultFocus(); show_standart_input(language, metadata, inputvin, mileage, comment); ImGui::SameLine(); diff --git a/src/main.cpp b/src/main.cpp index 6a086a85..6bd3438a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include "apihandler.hpp" #include "create_training_data.hpp" #include "get_from_github.hpp" + #include "jasonhandler.hpp" #include "settingspopup.hpp" #include @@ -124,6 +125,7 @@ int main() { if(std::filesystem::exists(configpath)) { fmt::print("found config.json\n\r"); + } else { fmt::print("Did not find config.json.\n Download from Github\n\r"); update_config_from_github(); @@ -132,6 +134,7 @@ int main() { if(std::filesystem::exists(load_json(config, ("languagepath")))) { fmt::print("found language: {}\n\r", load_json(config, ("language"))); + } else { fmt::print( "Did not find {}.\n Download from Github\n\r", @@ -295,31 +298,45 @@ int main() { } } - ImGui::EndMenu(); - } - if(ImGui::MenuItem( - load_json(language, "menubar", "menu", "settings").c_str())) - { - open_settings = true; - } + + + ImGui::EndMenu(); + } + if (ImGui::MenuItem( + load_json(language, "menubar", "menu", "settings") + .c_str())) { + open_settings = true; + } + + if (ImGui::MenuItem( + load_json(language, "menubar", "menu", "reset") + .c_str())) { + sampler.reset(); + captureData.clear(); + } + ImGui::EndMenu(); + } + /* + if (ImGui::BeginMenu( + load_json(language, "menubar", "view", "label") + .c_str())) { + ImGui::EndMenu(); + }*/ + + if (ImGui::BeginMenu( + load_json(language, "menubar", "help", "label") + .c_str())) { + if (ImGui::MenuItem(load_json(config, "helplink").c_str())) { + system(("start " + load_json(config, "helplink")).c_str()); + } + + ImGui::EndMenu(); + } - if(ImGui::MenuItem( - load_json(language, "menubar", "menu", "reset").c_str())) - { - sampler.reset(); - captureData.clear(); - } - ImGui::EndMenu(); - } - if(ImGui::BeginMenu(load_json(language, "menubar", "view", "label").c_str())) { - ImGui::EndMenu(); - } - if(ImGui::BeginMenu(load_json(language, "menubar", "help", "label").c_str())) { - ImGui::EndMenu(); - } - mainMenuBarSize = ImGui::GetItemRectSize(); - ImGui::EndMainMenuBar(); + mainMenuBarSize = ImGui::GetItemRectSize(); + ImGui::EndMainMenuBar(); + // ############################ Live Capture // ############################## ImGui::BeginChild("Live Capture", ImVec2(-1, 620)); @@ -353,6 +370,7 @@ int main() { optimal_buttonstripe_height = (ImGui::GetTextLineHeightWithSpacing() * 1.1); } else { optimal_buttonstripe_height = load_json(config, "button", "sizey") * 1.1; + } ImGui::BeginChild( "Buttonstripe", @@ -587,6 +605,7 @@ int main() { ImGui::EndPopup(); } + // ############################ Devicelist // ############################## ImGui::BeginChild("Devicelist", ImVec2(-1, 0)); diff --git a/src/settingspopup.hpp b/src/settingspopup.hpp index 84564939..828e6bcb 100644 --- a/src/settingspopup.hpp +++ b/src/settingspopup.hpp @@ -14,7 +14,7 @@ static void popup_settings(nlohmann::json &config, nlohmann::json &language, newconfig = config; } if (fontscale < load_json(newconfig, "text", "minscale")) { - fontscale = load_json(newconfig, "text", "scale"); + fontscale = load_json(newconfig, "text", "minscale"); } ImGuiIO &io = ImGui::GetIO(); io.FontGlobalScale = fontscale;