summaryrefslogtreecommitdiff
path: root/src/ui/ui_projects.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-04 18:36:31 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-04 18:36:31 +0200
commitcd827834f9ee329c27b82d987f0d1d48a854a954 (patch)
tree3f2b63cc88f7d01ac6c55ff6c8cd5ff26dae55b5 /src/ui/ui_projects.cpp
parent83cbf0e4a142ab2c57fd4fdfc056517b7149828b (diff)
namespace importer
Diffstat (limited to 'src/ui/ui_projects.cpp')
-rw-r--r--src/ui/ui_projects.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/ui/ui_projects.cpp b/src/ui/ui_projects.cpp
index 560bc72..be0cc2a 100644
--- a/src/ui/ui_projects.cpp
+++ b/src/ui/ui_projects.cpp
@@ -22,25 +22,25 @@
#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 project selected_for_cancellation;
static project active_project;
-void ui_setup_projects()
+void ui::setup_projects()
{
- current_view_state = view_state::LIST;
+ current_view_state = ui::view_state::LIST_ALL;
active_project = administration_project_create_empty();
}
static void draw_project_form()
{
float widthAvailable = ImGui::GetContentRegionAvail().x;
- bool viewing_only = (current_view_state == view_state::VIEW);
+ bool viewing_only = (current_view_state == ui::view_state::VIEW_EXISTING);
static const char* selected_country = NULL;
if (ImGui::Button(locale::get("form.back"))) {
- current_view_state = view_state::LIST;
+ current_view_state = ui::view_state::LIST_ALL;
active_project = administration_project_create_empty();
selected_country = 0;
return;
@@ -65,15 +65,15 @@ static void draw_project_form()
// Save button
ImGui::Spacing();
if (ImGui::Button(locale::get("form.save"))) {
- if (current_view_state == view_state::CREATE) {
+ if (current_view_state == ui::view_state::CREATE) {
administration_project_add(active_project);
}
- else if (current_view_state == view_state::EDIT) {
+ else if (current_view_state == ui::view_state::EDIT_EXISTING) {
administration_project_update(active_project);
}
- current_view_state = view_state::LIST;
+ current_view_state = ui::view_state::LIST_ALL;
selected_country = 0;
active_project = administration_project_create_empty();
}
@@ -93,7 +93,7 @@ static void draw_project_list()
if (ImGui::Button(locale::get("form.create")))
{
- current_view_state = view_state::CREATE;
+ current_view_state = ui::view_state::CREATE;
active_project = administration_project_create_empty();
}
@@ -142,7 +142,7 @@ static void draw_project_list()
snprintf(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.view"), i);
if (ImGui::Button(btn_name)) {
active_project = c;
- current_view_state = view_state::VIEW;
+ current_view_state = ui::view_state::VIEW_EXISTING;
}
if (c.state == project_state::PROJECT_RUNNING)
@@ -151,7 +151,7 @@ static void draw_project_list()
snprintf(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.change"), i);
if (ImGui::Button(btn_name)) {
active_project = c;
- current_view_state = view_state::EDIT;
+ current_view_state = ui::view_state::EDIT_EXISTING;
}
ImGui::SameLine();
@@ -182,13 +182,13 @@ static void draw_project_list()
}
}
-void ui_draw_projects()
+void ui::draw_projects()
{
switch(current_view_state)
{
- case view_state::LIST: draw_project_list(); break;
- case view_state::CREATE: draw_project_form(); break;
- case view_state::EDIT: draw_project_form(); break;
- case view_state::VIEW: draw_project_form(); break;
+ case ui::view_state::LIST_ALL: draw_project_list(); break;
+ case ui::view_state::CREATE: draw_project_form(); break;
+ case ui::view_state::EDIT_EXISTING: draw_project_form(); break;
+ case ui::view_state::VIEW_EXISTING: draw_project_form(); break;
}
} \ No newline at end of file