summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_main.cpp16
-rw-r--r--src/ui/ui_setup.cpp41
2 files changed, 56 insertions, 1 deletions
diff --git a/src/ui/ui_main.cpp b/src/ui/ui_main.cpp
index dde0882..0aad2ec 100644
--- a/src/ui/ui_main.cpp
+++ b/src/ui/ui_main.cpp
@@ -32,6 +32,7 @@ void (*drawcalls[ui::main_state::UI_END])(void) = {
ui::draw_projects,
ui::draw_settings,
ui::draw_log,
+ ui::draw_setup,
};
void (*setupcalls[ui::main_state::UI_END])(void) = {
@@ -43,6 +44,7 @@ void (*setupcalls[ui::main_state::UI_END])(void) = {
ui::setup_projects,
ui::setup_settings,
0,
+ ui::setup_setup,
};
void (*destroycalls[ui::main_state::UI_END])(void) = {
@@ -54,6 +56,7 @@ void (*destroycalls[ui::main_state::UI_END])(void) = {
0,
ui::destroy_settings,
0,
+ ui::destroy_setup,
};
void ui::set_state(ui::main_state state)
@@ -65,7 +68,18 @@ void ui::set_state(ui::main_state state)
void ui::draw_main()
{
- if (ui_state == ui::main_state::UI_END) ui::set_state(ui::main_state::UI_INVOICES);
+ if (ui_state == ui::main_state::UI_END) ui::set_state(ui::main_state::UI_SETUP);
+
+ if (ui_state == ui::main_state::UI_SETUP) {
+ ImGuiIO& io = ImGui::GetIO();
+ ImGui::SetNextWindowPos(ImVec2(0, 0));
+ ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, io.DisplaySize.y));
+
+ ImGui::Begin("AccountingMainWindow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
+ if (drawcalls[ui_state]) drawcalls[ui_state]();
+ ImGui::End();
+ return;
+ }
if (ImGui::BeginMainMenuBar())
{
diff --git a/src/ui/ui_setup.cpp b/src/ui/ui_setup.cpp
new file mode 100644
index 0000000..4f4a120
--- /dev/null
+++ b/src/ui/ui_setup.cpp
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2025 Aldrik Ramaekers <aldrik.ramaekers@gmail.com>
+*
+* Permission to use, copy, modify, and/or distribute this software for any
+* purpose with or without fee is hereby granted, provided that the above
+* copyright notice and this permission notice appear in all copies.
+*
+* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include "ui.hpp"
+#include "imgui.h"
+#include "locales.hpp"
+#include "administration_writer.hpp"
+#include "administration_reader.hpp"
+
+void ui::draw_setup()
+{
+ if (ImGui::Button("Load administration")) {
+ if (administration_reader::open_existing(NULL)) {
+ ui::set_state(ui::main_state::UI_SETTINGS);
+ ui::recreate_window_for_main_views();
+ }
+ }
+}
+
+void ui::setup_setup()
+{
+
+}
+
+void ui::destroy_setup()
+{
+
+} \ No newline at end of file