Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

138 refactored #153

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions src/languages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum class Key {
Continue,
Continue_del,
Devices_found,
Device_List,
Usr_curnt_wave,
Wv_from_file,
WvForms_warning,
Expand Down Expand Up @@ -75,11 +76,11 @@ enum class Key {
Enter_mileage,
Battery_measure,
Attitude,
German,
x_axis_label,
y_axis_label,
Record_Data,
Ready,
FontSize,
SettingsText,
Saving
German
};

inline const std::map<Key, const char *> englishLan{
Expand Down Expand Up @@ -120,7 +121,8 @@ inline const std::map<Key, const char *> englishLan{
{Key::Stop, "Stop"},
{Key::Continue, "Continue"},
{Key::Continue_del, "Continue Deletion?"},
{Key::Devices_found, "Devices found:"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a colon at the end to indicate a list.

{Key::Devices_found, "Devices found"},
{Key::Device_List, "Devices List"},
{Key::Usr_curnt_wave, "User Current Waveform"},
{Key::Wv_from_file, "Waveform From File"},
{Key::WvForms_warning, "Waveforms Warning! "},
Expand Down Expand Up @@ -153,14 +155,14 @@ inline const std::map<Key, const char *> englishLan{
{Key::Enter_mileage, "Enter Mileage"},
{Key::Battery_measure, "Battery measurement"},
{Key::Attitude, "Attitude"},
{Key::German, "German"},
{Key::x_axis_label, "x [Seconds]"},
{Key::y_axis_label, "y [Volts]"},
{Key::Record_Data, "Recording the data"},
{Key::Ready, "Ready"},
{Key::FontSize, "Fontsize"},
{Key::SettingsText, "Set your personal settings for the software"},
{Key::Saving, "saving ..."}};

{Key::German, "German"}};

inline const std::map<Key, const char *> germanLan{
{Key::Device_List, "Geräteliste"},
{Key::Known_Car, "Fahrzeugauswahl"},
{Key::New_Car, "Neues Fahrzeug"},
{Key::Additional_Information, "Weiterführende Information"},
Expand Down Expand Up @@ -199,10 +201,10 @@ inline const std::map<Key, const char *> germanLan{
{Key::Stop, "Stoppen"},
{Key::Continue, "Weiter"},
{Key::Continue_del, "Mit dem Löschen fortfahren?"},
{Key::Devices_found, "Geräte gefunden:"},
{Key::Usr_curnt_wave, "Aktuelle Wellenform des Benutzers"},
{Key::Wv_from_file, "Wellenform aus Datei"},
{Key::WvForms_warning, "Warnung!"},
{Key::Devices_found, "Geräte"},
{Key::Usr_curnt_wave, "Aktuelle Wellenform Des Benutzers"},
{Key::Wv_from_file, "Wellenform Aus Datei"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

{Key::WvForms_warning, "Warnung vor Wellenformen!"},
{Key::No_wave_made, "Es wurden keine Wellenformen erstellt!"},
{Key::Wrong_file_warning, "Warnung vor falscher Datei!"},
{Key::Wrong_file_type, "Falscher Dateityp! Versuchen Sie es erneut!"},
Expand Down Expand Up @@ -232,11 +234,10 @@ inline const std::map<Key, const char *> germanLan{
{Key::Enter_mileage, "Geben Sie den Kilometerstand ein"},
{Key::Battery_measure, "Batteriemessung"},
{Key::Attitude, "Einstellung"},
{Key::German, "Deutsch"},
{Key::Ready, "Bereit"},
{Key::FontSize, "Schriftgröße"},
{Key::SettingsText, "Legen sie hier ihre persönlichen Einstellungen fest"},
{Key::Saving, "speichern ..."}};
{Key::x_axis_label, "x [Sekunden]"},
{Key::y_axis_label, "y [Volt]"},
{Key::Record_Data, "Datenaufnahme"},
{Key::Ready, "bereit"}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All messages in both English and German languages start with a capital letter, hence "Bereit" seems more appropriate.


inline auto appLanguage = englishLan;
#endif
#endif
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
if (ImGui::BeginPopupModal(appLanguage[Key::Reset_q], nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SetItemDefaultFocus();
ImGui::Text(appLanguage[Key::Measure_not_saved]);

Check warning on line 75 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-latest-C++ CI

format not a string literal and no format arguments [-Wformat-security]
if (ImGui::Button(appLanguage[Key::Continue_del])) {
rstSettings();
ImGui::CloseCurrentPopup();
Expand Down Expand Up @@ -164,12 +164,12 @@
if (EngItr != englishLan.end() && GrmItr != germanLan.end()) {
titles[0] = (std::string)EngItr->second + "###ID";
titles[1] = (std::string)GrmItr->second + "###ID";
ImGui::OpenPopup(titles[title].c_str());

Check warning on line 167 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-latest-C++ CI

conversion to ‘std::vector<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >::size_type’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
} else
fmt::println("Settings values not found.");
open_settings = false;
}
if (ImGui::BeginPopupModal(titles[title].c_str(), nullptr,

Check warning on line 172 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-latest-C++ CI

conversion to ‘std::vector<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >::size_type’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SetItemDefaultFocus();
popup_settings(config, configpath, title);
Expand All @@ -187,15 +187,15 @@
ImGui::BeginChild("Record Data", {0.f, windowSize.y * 0.62f},
ImGuiChildFlags_Border);

addPlots("Recording the data", flagPaused, [&xmax_paused](double x_max) {
addPlots(appLanguage[Key::Record_Data], flagPaused, [&xmax_paused](double x_max) {
if (!flagPaused) {
ImPlot::SetupAxes("x [Data points]", "y [ADC Value]",
ImPlot::SetupAxes(appLanguage[Key::x_axis_label], appLanguage[Key::y_axis_label],
ImPlotAxisFlags_AutoFit, ImPlotAxisFlags_AutoFit);
ImPlot::SetupAxisLimits(ImAxis_X1, x_max - 7500, x_max + 7500,
ImGuiCond_Always);
} else {
xmax_paused = x_max;
ImPlot::SetupAxes("x [Seconds]", "y [Volts]");
ImPlot::SetupAxes(appLanguage[Key::x_axis_label], appLanguage[Key::y_axis_label]);
ImPlot::SetupAxesLimits(0, 10, -10, 200);
ImPlot::SetupAxisTicks(ImAxis_Y1, -10, 200, 22, nullptr, true);
ImPlot::SetupLegend(ImPlotLocation_NorthEast);
Expand All @@ -211,7 +211,7 @@
ImGui::BeginChild("Devicelist");
ImGui::Dummy({windowSize.x * .36f, 0.f});
ImGui::SameLine();
ImGui::Text(appLanguage[Key::Devices_found]);

Check warning on line 214 in src/main.cpp

View workflow job for this annotation

GitHub Actions / ubuntu-latest-C++ CI

format not a string literal and no format arguments [-Wformat-security]
devicesList();
ImGui::EndChild(); // end child "Devicelist"
ImGui::EndChild(); // end child "Right Side"
Expand Down
Loading