summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-17 17:55:54 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-17 17:55:54 +0200
commit41ddcc70f6ac27688c0a7dccc975c4b72de718e2 (patch)
treefaa8cb49befe057068769a4a08bc0b4ab2a4a882 /src/ui
parent3a3fac243c013f3d211bb5141e18c82e62deacf9 (diff)
add license
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/helpers.cpp17
-rw-r--r--src/ui/ui_contacts.cpp16
-rw-r--r--src/ui/ui_earnings.cpp16
-rw-r--r--src/ui/ui_expenses.cpp16
-rw-r--r--src/ui/ui_invoices.cpp16
-rw-r--r--src/ui/ui_log.cpp16
-rw-r--r--src/ui/ui_main.cpp94
-rw-r--r--src/ui/ui_projects.cpp16
-rw-r--r--src/ui/ui_settings.cpp16
-rw-r--r--src/ui/ui_start.cpp31
10 files changed, 180 insertions, 74 deletions
diff --git a/src/ui/helpers.cpp b/src/ui/helpers.cpp
index 0a93cf7..07302b7 100644
--- a/src/ui/helpers.cpp
+++ b/src/ui/helpers.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <tinyfiledialogs.h>
#include "ui.hpp"
@@ -6,6 +22,7 @@
#include "strops.hpp"
ImFont* fontBold;
+ImFont* fontBig;
static ui_status current_status;
diff --git a/src/ui/ui_contacts.cpp b/src/ui/ui_contacts.cpp
index cfeb08d..92dd21a 100644
--- a/src/ui/ui_contacts.cpp
+++ b/src/ui/ui_contacts.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <stdio.h>
#include <stdlib.h>
diff --git a/src/ui/ui_earnings.cpp b/src/ui/ui_earnings.cpp
index 002b2bc..82fe1af 100644
--- a/src/ui/ui_earnings.cpp
+++ b/src/ui/ui_earnings.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <stdio.h>
#include <stdlib.h>
diff --git a/src/ui/ui_expenses.cpp b/src/ui/ui_expenses.cpp
index d1259a8..b195442 100644
--- a/src/ui/ui_expenses.cpp
+++ b/src/ui/ui_expenses.cpp
@@ -1,3 +1,19 @@
+/*
+* 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.
+*/
+
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp
index 5ec9297..c3c6b8c 100644
--- a/src/ui/ui_invoices.cpp
+++ b/src/ui/ui_invoices.cpp
@@ -1,3 +1,19 @@
+/*
+* 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.
+*/
+
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
diff --git a/src/ui/ui_log.cpp b/src/ui/ui_log.cpp
index 4943548..da0d29d 100644
--- a/src/ui/ui_log.cpp
+++ b/src/ui/ui_log.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <stdio.h>
#include "ui.hpp"
diff --git a/src/ui/ui_main.cpp b/src/ui/ui_main.cpp
index 3405a7e..45b787b 100644
--- a/src/ui/ui_main.cpp
+++ b/src/ui/ui_main.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 "administration.hpp"
@@ -16,7 +32,6 @@ void (*drawcalls[main_state::UI_END])(void) = {
ui_draw_projects,
ui_draw_settings,
ui_draw_log,
- ui_draw_start,
};
void (*setupcalls[main_state::UI_END])(void) = {
@@ -28,7 +43,6 @@ void (*setupcalls[main_state::UI_END])(void) = {
ui_setup_projects,
ui_setup_settings,
0,
- 0,
};
void (*destroycalls[main_state::UI_END])(void) = {
@@ -40,7 +54,6 @@ void (*destroycalls[main_state::UI_END])(void) = {
0,
ui_destroy_settings,
0,
- 0,
};
void ui_set_state(main_state state)
@@ -52,7 +65,7 @@ void ui_set_state(main_state state)
void ui_draw_main()
{
- if (ui_state == main_state::UI_END) ui_set_state(main_state::UI_START);
+ if (ui_state == main_state::UI_END) ui_set_state(main_state::UI_INVOICES);
// @localize
if (ImGui::BeginMainMenuBar())
@@ -61,6 +74,7 @@ void ui_draw_main()
{
if (ImGui::MenuItem("New")) { administration_reader_open_new(); }
if (ImGui::MenuItem("Open")) { administration_reader_open_existing(NULL); }
+ if (ImGui::MenuItem("Save")) { administration_reader_save_new(); }
ImGui::EndMenu();
}
@@ -81,49 +95,43 @@ void ui_draw_main()
ImGui::SetNextWindowPos(ImVec2(0, menuBarHeight));
ImGui::SetNextWindowSize(ImVec2(sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight));
- if (ui_state != main_state::UI_START) {
- // Side panel
- ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
- ImGui::Begin("SidePanel", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
+ // Side panel
+ ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
+ ImGui::Begin("SidePanel", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
+ {
+ // Navigation buttons with custom styling
+ ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); // Transparent background
+ ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); // Reduce spacing between buttons
+ ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 0.0f));
+
+ float buttonWidth = sidePanelWidth;
+
+ if (ImGui::Button(localize("nav.invoices"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_INVOICES);
+ if (ImGui::Button(localize("nav.expenses"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_EXPENSES);
+ if (ImGui::Button(localize("nav.contacts"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_CONTACTS);
+
+ static bool reports_opened = true;
+ if (ImGui::Button(localize("nav.reports"), ImVec2(buttonWidth, 24))) reports_opened = !reports_opened;
+ if (reports_opened)
{
- // Navigation buttons with custom styling
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); // Transparent background
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); // Reduce spacing between buttons
- ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 0.0f));
-
- float buttonWidth = sidePanelWidth;
-
- if (ImGui::Button(localize("nav.invoices"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_INVOICES);
- if (ImGui::Button(localize("nav.expenses"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_EXPENSES);
- if (ImGui::Button(localize("nav.contacts"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_CONTACTS);
-
- static bool reports_opened = true;
- if (ImGui::Button(localize("nav.reports"), ImVec2(buttonWidth, 24))) reports_opened = !reports_opened;
- if (reports_opened)
- {
- ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f));
- if (ImGui::Button(localize("nav.reports.results"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_REPORT_RESULTS);
- if (ImGui::Button(localize("nav.reports.tax"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_REPORT_TAX);
- ImGui::PopStyleVar();
- }
-
- if (ImGui::Button(localize("nav.projects"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_PROJECTS);
- if (ImGui::Button(localize("nav.settings"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_SETTINGS);
-
- ImGui::PopStyleColor(1);
- ImGui::PopStyleVar(3);
+ ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(20.0f, 0.0f));
+ if (ImGui::Button(localize("nav.reports.results"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_REPORT_RESULTS);
+ if (ImGui::Button(localize("nav.reports.tax"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_REPORT_TAX);
+ ImGui::PopStyleVar();
}
- ImGui::End();
- ImGui::PopStyleVar();
- ImGui::SetNextWindowPos(ImVec2(sidePanelWidth, menuBarHeight));
- ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x - sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight));
- }
- else {
- ImGui::SetNextWindowPos(ImVec2(0, 0));
- ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, io.DisplaySize.y - statusBarHeight));
+ if (ImGui::Button(localize("nav.projects"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_PROJECTS);
+ if (ImGui::Button(localize("nav.settings"), ImVec2(buttonWidth, 24))) ui_set_state(main_state::UI_SETTINGS);
+
+ ImGui::PopStyleColor(1);
+ ImGui::PopStyleVar(3);
}
+ ImGui::End();
+ ImGui::PopStyleVar();
+
+ ImGui::SetNextWindowPos(ImVec2(sidePanelWidth, menuBarHeight));
+ ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x - sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight));
// Main content
ImGui::Begin("AccountingMainWindow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
diff --git a/src/ui/ui_projects.cpp b/src/ui/ui_projects.cpp
index 16d04b1..dddf881 100644
--- a/src/ui/ui_projects.cpp
+++ b/src/ui/ui_projects.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <stdio.h>
#include "ui.hpp"
diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp
index 4812502..892e580 100644
--- a/src/ui/ui_settings.cpp
+++ b/src/ui/ui_settings.cpp
@@ -1,3 +1,19 @@
+/*
+* 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 <stdlib.h>
#include <stdio.h>
diff --git a/src/ui/ui_start.cpp b/src/ui/ui_start.cpp
deleted file mode 100644
index 90326f5..0000000
--- a/src/ui/ui_start.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "ui.hpp"
-#include "imgui.h"
-#include "administration.hpp"
-#include "locales.hpp"
-#include "tinyfiledialogs.h"
-#include "administration_writer.hpp"
-#include "administration_reader.hpp"
-
-void ui_draw_start()
-{
- ImVec2 windowSize = ImGui::GetContentRegionAvail();
- ImVec2 buttonSize(windowSize.x * 0.5f, windowSize.y);
-
- ImGui::Columns(2, nullptr, false);
- if (ImGui::Button("Create", buttonSize))
- {
- if (administration_reader_open_new()) {
- ui_set_state(main_state::UI_SETTINGS);
- }
- }
-
- ImGui::NextColumn();
- if (ImGui::Button("Load", buttonSize))
- {
- if (administration_reader_open_existing(NULL)) {
- ui_set_state(main_state::UI_INVOICES);
- }
- }
-
- ImGui::Columns(1);
-} \ No newline at end of file