diff options
| author | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-03 15:38:13 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-03 15:38:13 +0100 |
| commit | 66a918a4621f1ecb828e68eac94fdb34852e9570 (patch) | |
| tree | 48a4bd4b3545a8379ffb74cd79b03243dcb4629f /src/ui/ui_main.cpp | |
| parent | 83a9739b3aff75cf767db687bd531fa5283e0e72 (diff) | |
ui improvements
Diffstat (limited to 'src/ui/ui_main.cpp')
| -rw-r--r-- | src/ui/ui_main.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/ui/ui_main.cpp b/src/ui/ui_main.cpp index 67d678f..dde0882 100644 --- a/src/ui/ui_main.cpp +++ b/src/ui/ui_main.cpp @@ -71,8 +71,14 @@ void ui::draw_main() { if (ImGui::BeginMenu(locale::get("ui.menu.file"))) { - if (ImGui::MenuItem(locale::get("ui.menu.file.new"))) { administration_reader::open_new(); } - if (ImGui::MenuItem(locale::get("ui.menu.file.open"))) { administration_reader::open_existing(NULL); } + if (ImGui::MenuItem(locale::get("ui.menu.file.new"))) { + administration_reader::open_new(); + ui::set_state(ui::main_state::UI_SETTINGS); + } + if (ImGui::MenuItem(locale::get("ui.menu.file.open"))) { + administration_reader::open_existing(NULL); + ui::set_state(ui::main_state::UI_SETTINGS); + } ImGui::EndMenu(); } @@ -105,21 +111,26 @@ void ui::draw_main() float buttonWidth = sidePanelWidth; - if (ImGui::Button(locale::get("nav.invoices"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_INVOICES); - if (ImGui::Button(locale::get("nav.expenses"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_EXPENSES); - if (ImGui::Button(locale::get("nav.contacts"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_CONTACTS); - - static bool reports_opened = true; - ImGui::Button(locale::get("nav.reports"), ImVec2(buttonWidth, 24)); - if (reports_opened) - { - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f)); - if (ImGui::Button(locale::get("nav.reports.results"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_REPORT_RESULTS); - if (ImGui::Button(locale::get("nav.reports.tax"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_REPORT_TAX); - ImGui::PopStyleVar(); + if (administration::company_info_is_valid()) { + if (ImGui::Button(locale::get("nav.invoices"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_INVOICES); + if (ImGui::Button(locale::get("nav.expenses"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_EXPENSES); + if (ImGui::Button(locale::get("nav.contacts"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_CONTACTS); + + static bool reports_opened = true; + ImGui::Button(locale::get("nav.reports"), ImVec2(buttonWidth, 24)); + if (reports_opened) + { + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f)); + if (ImGui::Button(locale::get("nav.reports.results"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_REPORT_RESULTS); + if (ImGui::Button(locale::get("nav.reports.tax"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_REPORT_TAX); + ImGui::PopStyleVar(); + } + + if (ImGui::Button(locale::get("nav.projects"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_PROJECTS); + } + else { + if (ui_state != ui::main_state::UI_SETTINGS) ui::set_state(ui::main_state::UI_SETTINGS); } - - if (ImGui::Button(locale::get("nav.projects"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_PROJECTS); if (ImGui::Button(locale::get("nav.settings"), ImVec2(buttonWidth, 24))) ui::set_state(ui::main_state::UI_SETTINGS); ImGui::PopStyleColor(1); |
