Skip to content

Commit

Permalink
Merge pull request #20 from skunkforce/ds/feedback
Browse files Browse the repository at this point in the history
Ds/feedback
  • Loading branch information
dennispelle authored Sep 21, 2023
2 parents 2beb5bc + 845c9d8 commit d560886
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 31 deletions.
3 changes: 2 additions & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -110,7 +111,7 @@
}
},
"font": "comicsans",
"minscale": 0.5,
"minscale": 1,
"scale": 1.9999998807907104
},
"title": "Omniview 0.5",
Expand Down
1 change: 1 addition & 0 deletions languages/Deutsch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 8 additions & 5 deletions src/apihandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>

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;
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion src/create_training_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>(language, "measuretype", "vcds"), metadata);
Expand Down Expand Up @@ -194,6 +195,7 @@ inline void selected_battery_measurement(
ImVec2(load_json<Size>(config, "button")))) {
metadata["kommentar"] = comment;
metadata["laufleistung"] = mileage;

api_message = send_to_api(
config, path1, inputvin,
load_json<std::string>(language, "measuretype", "battery"), metadata);
Expand Down Expand Up @@ -306,6 +308,7 @@ static void selected_compression_data(

if (ImGui::Button(load_json<std::string>(language, "button", "send").c_str(),
ImVec2(load_json<Size>(config, "button")))) {

// Api muss angepasst werden und die funktion send to api ebenso
metadata["z1"] = z1;
metadata["z2"] = z2;
Expand All @@ -319,6 +322,7 @@ static void selected_compression_data(
load_json<std::string>(language, "measuretype", "compression"),
metadata);
metadata["zündung"] = "aktiviert";

api_message += send_to_api(
config, path2, inputvin,
load_json<std::string>(language, "measuretype", "compression"),
Expand All @@ -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();
Expand Down
65 changes: 42 additions & 23 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "apihandler.hpp"
#include "create_training_data.hpp"
#include "get_from_github.hpp"

#include "jasonhandler.hpp"
#include "settingspopup.hpp"
#include <ImGuiInstance/ImGuiInstance.hpp>
Expand Down Expand Up @@ -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();
Expand All @@ -132,6 +134,7 @@ int main() {
if(std::filesystem::exists(load_json<std::string>(config, ("languagepath")))) {
fmt::print("found language: {}\n\r", load_json<std::string>(config, ("language")));


} else {
fmt::print(
"Did not find {}.\n Download from Github\n\r",
Expand Down Expand Up @@ -295,31 +298,45 @@ int main() {
}
}

ImGui::EndMenu();
}
if(ImGui::MenuItem(
load_json<std::string>(language, "menubar", "menu", "settings").c_str()))
{
open_settings = true;
}


ImGui::EndMenu();
}
if (ImGui::MenuItem(
load_json<std::string>(language, "menubar", "menu", "settings")
.c_str())) {
open_settings = true;
}

if (ImGui::MenuItem(
load_json<std::string>(language, "menubar", "menu", "reset")
.c_str())) {
sampler.reset();
captureData.clear();
}
ImGui::EndMenu();
}
/*
if (ImGui::BeginMenu(
load_json<std::string>(language, "menubar", "view", "label")
.c_str())) {
ImGui::EndMenu();
}*/

if (ImGui::BeginMenu(
load_json<std::string>(language, "menubar", "help", "label")
.c_str())) {
if (ImGui::MenuItem(load_json<std::string>(config, "helplink").c_str())) {
system(("start " + load_json<std::string>(config, "helplink")).c_str());
}

ImGui::EndMenu();
}

if(ImGui::MenuItem(
load_json<std::string>(language, "menubar", "menu", "reset").c_str()))
{
sampler.reset();
captureData.clear();
}
ImGui::EndMenu();
}
if(ImGui::BeginMenu(load_json<std::string>(language, "menubar", "view", "label").c_str())) {
ImGui::EndMenu();
}
if(ImGui::BeginMenu(load_json<std::string>(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));
Expand Down Expand Up @@ -353,6 +370,7 @@ int main() {
optimal_buttonstripe_height = (ImGui::GetTextLineHeightWithSpacing() * 1.1);
} else {
optimal_buttonstripe_height = load_json<float>(config, "button", "sizey") * 1.1;

}
ImGui::BeginChild(
"Buttonstripe",
Expand Down Expand Up @@ -587,6 +605,7 @@ int main() {
ImGui::EndPopup();
}


// ############################ Devicelist
// ##############################
ImGui::BeginChild("Devicelist", ImVec2(-1, 0));
Expand Down
2 changes: 1 addition & 1 deletion src/settingspopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static void popup_settings(nlohmann::json &config, nlohmann::json &language,
newconfig = config;
}
if (fontscale < load_json<float>(newconfig, "text", "minscale")) {
fontscale = load_json<float>(newconfig, "text", "scale");
fontscale = load_json<float>(newconfig, "text", "minscale");
}
ImGuiIO &io = ImGui::GetIO();
io.FontGlobalScale = fontscale;
Expand Down

0 comments on commit d560886

Please sign in to comment.