diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-18 09:10:08 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-18 09:10:08 +0200 |
| commit | e5e059538bbbf1993df854bd95e9bbf4bb1d7aaa (patch) | |
| tree | b0949aef3ec22172b6b3eab8dd409c9d3f118a37 /src | |
| parent | 0dc33a4dd49eb560e98b24090969fd618a4c6198 (diff) | |
remove country list from config
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/imgui_extensions.cpp | 17 | ||||
| -rw-r--r-- | src/ui/ui_main.cpp | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 0bfd5c8..797da9d 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -3,6 +3,7 @@ #include "memops.hpp" #include "config.hpp" #include "locales.hpp" +#include "countries.hpp" #include "administration.hpp" #include "tinyfiledialogs.h" @@ -51,7 +52,7 @@ namespace ImGui { const char *filterPatterns[] = { "*.pdf" }; const char *file = tinyfd_openFileDialog( - "Choose a file", // dialog title // @locale::get + "Choose a file", // dialog title // @localize NULL, // default path 1, // number of filter patterns filterPatterns, // filter patterns array @@ -74,7 +75,7 @@ namespace ImGui result = true; } ImGui::SameLine(); - ImGui::TextWrapped("Selected: %s", buffer); // @locale::get + ImGui::TextWrapped("Selected: %s", buffer); // @localize } @@ -88,16 +89,16 @@ namespace ImGui ImGui::SetNextItemWidth(widthAvailable*0.5f); const char* countries[30]; - for (int x = 0; x < config::country_count; x++) + for (int x = 0; x < country::get_count(); x++) { char locale_str[20]; - strops::format(locale_str, 20, "country.%s", config::country_codes[x]); + strops::format(locale_str, 20, "country.%s", country::get_code_by_index(x)); countries[x] = locale::get(locale_str); } - for (int i = 0; i < config::country_count; i++) + for (int i = 0; i < country::get_count(); i++) { - if (strcmp(config::country_codes[i], buffer) == 0) + if (strcmp(country::get_code_by_index(i), buffer) == 0) { selected_country = countries[i]; break; @@ -113,7 +114,7 @@ namespace ImGui if (ImGui::BeginCombo(locale::get("contact.form.country"), selected_country)) { - for (int n = 0; n < config::country_count; n++) + for (int n = 0; n < country::get_count(); n++) { bool is_selected = (selected_country == countries[n]); if (ImGui::Selectable(countries[n], is_selected)) { @@ -134,7 +135,7 @@ namespace ImGui } if (selected_country_index != -1) { - strops::copy(buffer, config::country_codes[selected_country_index], buf_size); + strops::copy(buffer, country::get_code_by_index(selected_country_index), buf_size); } } diff --git a/src/ui/ui_main.cpp b/src/ui/ui_main.cpp index cf30840..84dab1b 100644 --- a/src/ui/ui_main.cpp +++ b/src/ui/ui_main.cpp @@ -112,7 +112,7 @@ void ui::draw_main() if (ImGui::Button(locale::get("nav.contacts"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_CONTACTS); static bool reports_opened = true; - if (ImGui::Button(locale::get("nav.reports"), ImVec2(buttonWidth, 24))) reports_opened = !reports_opened; + ImGui::Button(locale::get("nav.reports"), ImVec2(buttonWidth, 24)); if (reports_opened) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f)); |
