diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-04 18:36:31 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-04 18:36:31 +0200 |
| commit | cd827834f9ee329c27b82d987f0d1d48a854a954 (patch) | |
| tree | 3f2b63cc88f7d01ac6c55ff6c8cd5ff26dae55b5 /src/ui/ui_contacts.cpp | |
| parent | 83cbf0e4a142ab2c57fd4fdfc056517b7149828b (diff) | |
namespace importer
Diffstat (limited to 'src/ui/ui_contacts.cpp')
| -rw-r--r-- | src/ui/ui_contacts.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/ui/ui_contacts.cpp b/src/ui/ui_contacts.cpp index e282374..c205c87 100644 --- a/src/ui/ui_contacts.cpp +++ b/src/ui/ui_contacts.cpp @@ -25,12 +25,12 @@ #include "administration_writer.hpp" #include "locales.hpp" -static view_state current_view_state = view_state::LIST; +static ui::view_state current_view_state = ui::view_state::LIST_ALL; static contact selected_for_removal; static contact active_contact; -void ui_draw_address_form(address* buffer, a_err last_err) +void draw_address_form(address* buffer, a_err last_err) { ImGui::FormInputTextWithErrorHint(locale::get("contact.form.address1"), buffer->address1, IM_ARRAYSIZE(buffer->address1), last_err & A_ERR_MISSING_ADDRESS1); ImGui::FormInputTextWithErrorHint(locale::get("contact.form.address2"), buffer->address2, IM_ARRAYSIZE(buffer->address2), 0); @@ -41,9 +41,9 @@ void ui_draw_address_form(address* buffer, a_err last_err) ImGui::FormCountryCombo(buffer->country_code, IM_ARRAYSIZE(buffer->country_code)); } -void ui_setup_contacts() +void ui::setup_contacts() { - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; active_contact = active_contact = administration_contact_create_empty(); memset(&selected_for_removal, 0, sizeof(contact)); } @@ -61,7 +61,7 @@ void draw_addressee_form_ex(delivery_info* buffer, bool viewing_only = false) ImGui::FormInputTextWithErrorHint(locale::get("contact.form.fullname"), buffer->name, IM_ARRAYSIZE(buffer->name), last_err & A_ERR_MISSING_NAME); - ui_draw_address_form(&buffer->address, last_err); + draw_address_form(&buffer->address, last_err); if (viewing_only) ImGui::EndDisabled(); ImGui::PopID(); @@ -81,7 +81,7 @@ void draw_contact_form_ex(contact* buffer, bool viewing_only = false, bool with_ if (with_autocomplete) ImGui::FormContactAutocomplete(buffer, last_err & A_ERR_MISSING_NAME); else ImGui::FormInputTextWithErrorHint(locale::get("contact.form.fullname"), buffer->name, IM_ARRAYSIZE(buffer->name), last_err & A_ERR_MISSING_NAME); - ui_draw_address_form(&buffer->address, last_err); + draw_address_form(&buffer->address, last_err); ImGui::FormContactTypeCombo(&buffer->type); @@ -115,7 +115,7 @@ static void draw_contact_list() // Table header controls: create button and pagination. if (ImGui::Button(locale::get("form.create"))) { - current_view_state = view_state::CREATE; + current_view_state = ui::view_state::CREATE; active_contact = administration_contact_create_empty(); } @@ -166,7 +166,7 @@ static void draw_contact_list() snprintf(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.view"), i); if (ImGui::Button(btn_name)) { active_contact = c; - current_view_state = view_state::VIEW; + current_view_state = ui::view_state::VIEW_EXISTING; } ImGui::SameLine(); @@ -174,7 +174,7 @@ static void draw_contact_list() snprintf(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.change"), i); if (ImGui::Button(btn_name)) { active_contact = c; - current_view_state = view_state::EDIT; + current_view_state = ui::view_state::EDIT_EXISTING; } ImGui::SameLine(); @@ -205,10 +205,10 @@ static void draw_contact_list() } } -static void ui_draw_contacts_create() +static void draw_contacts_create() { if (ImGui::Button(locale::get("form.back"))) { - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; } draw_contact_form(&active_contact); @@ -220,15 +220,15 @@ static void ui_draw_contacts_create() ImGui::Spacing(); if (ImGui::Button(locale::get("form.save"))) { administration_contact_add(active_contact); - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; } if (!can_save) ImGui::EndDisabled(); } -static void ui_draw_contacts_update() +static void draw_contacts_update() { if (ImGui::Button(locale::get("form.back"))) { - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; } draw_contact_form(&active_contact); @@ -240,22 +240,22 @@ static void ui_draw_contacts_update() ImGui::Spacing(); if (ImGui::Button(locale::get("form.save"))) { administration_contact_update(active_contact); - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; } if (!can_save) ImGui::EndDisabled(); } -void ui_draw_contacts() +void ui::draw_contacts() { switch(current_view_state) { - case view_state::LIST: draw_contact_list(); break; - case view_state::CREATE: ui_draw_contacts_create(); break; - case view_state::EDIT: ui_draw_contacts_update(); break; + case ui::view_state::LIST_ALL: draw_contact_list(); break; + case ui::view_state::CREATE: draw_contacts_create(); break; + case ui::view_state::EDIT_EXISTING: draw_contacts_update(); break; - case view_state::VIEW: + case ui::view_state::VIEW_EXISTING: if (ImGui::Button(locale::get("form.back"))) { - current_view_state = view_state::LIST; + current_view_state = ui::view_state::LIST_ALL; } draw_contact_form(&active_contact, true); |
