diff options
| -rw-r--r-- | include/config.hpp | 4 | ||||
| -rw-r--r-- | include/ui.hpp | 10 | ||||
| -rw-r--r-- | libs/imgui/imgui.cpp | 8 | ||||
| -rw-r--r-- | libs/imgui/imgui.h | 2 | ||||
| -rwxr-xr-x | run_linux64.sh | 2 | ||||
| -rw-r--r-- | src/ui/imgui_extensions.cpp | 31 | ||||
| -rw-r--r-- | src/ui/ui_expenses.cpp | 10 | ||||
| -rw-r--r-- | src/ui/ui_invoices.cpp | 17 |
8 files changed, 55 insertions, 29 deletions
diff --git a/include/config.hpp b/include/config.hpp index 93b226a..fb1d304 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -31,8 +31,8 @@ #define u64 uint64_t #define SIMULATE_EMAIL 1 -#define SIMULATE_SLOW_DISK 0 -#define SIMULATE_WRITE_FAILURE 1 +#define SIMULATE_SLOW_DISK 1 +#define SIMULATE_WRITE_FAILURE 0 #define PROGRAM_VERSION "0.1.0" // major.minor.patch diff --git a/include/ui.hpp b/include/ui.hpp index d59ef4e..fe380c8 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -88,6 +88,16 @@ namespace ui { } +enum ImGuiCol_Extensions +{ + ImGuiCol_Extensions_Start = ImGuiCol_COUNT, + + ImGuiCol_LoadingIndicatorBg, + ImGuiCol_LoadingIndicatorFg, + ImGuiCol_OrderItemTableRowFinal, + ImGuiCol_OrderItemTableRowCurrency, +}; + namespace ImGui { void StyleCustom(); diff --git a/libs/imgui/imgui.cpp b/libs/imgui/imgui.cpp index dd13cc1..d3d82d4 100644 --- a/libs/imgui/imgui.cpp +++ b/libs/imgui/imgui.cpp @@ -16677,14 +16677,6 @@ void ImGui::DebugBreakButtonTooltip(bool keyboard_only, const char* description_ EndTooltip(); } -void ImGui::LoadingIndicatorCircleSmall() -{ - float radius = 10.0f; - const ImVec4 col = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - const ImVec4 bg = ImGui::GetStyleColorVec4(ImGuiCol_Button); - ImGui::LoadingIndicatorCircle(radius, bg, col, 6, 4.0f); -} - // From https://github.com/ocornut/imgui/issues/1901#issuecomment-444929973 void ImGui::LoadingIndicatorCircle(const float indicator_radius, const ImVec4& main_color, const ImVec4& backdrop_color, diff --git a/libs/imgui/imgui.h b/libs/imgui/imgui.h index ad874ab..bfe7b0f 100644 --- a/libs/imgui/imgui.h +++ b/libs/imgui/imgui.h @@ -2300,7 +2300,7 @@ struct ImGuiStyle float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. // Colors - ImVec4 Colors[ImGuiCol_COUNT]; + ImVec4 Colors[ImGuiCol_COUNT + 50]; // Behaviors // (It is possible to modify those fields mid-frame if specific behavior need it, unlike e.g. configuration fields in ImGuiIO) diff --git a/run_linux64.sh b/run_linux64.sh index 8d7cefc..42027f2 100755 --- a/run_linux64.sh +++ b/run_linux64.sh @@ -11,7 +11,7 @@ SOURCES=$(find src -type f \( -name "*.cpp" \) ! -path "src/countries/*") # Compiler flags. LIBS="-lstdc++ -lglfw -lGL -lm -lssl -lcrypto" -FLAGS="-Wall -Wno-changes-meaning -ggdb -Wfatal-errors" +FLAGS="-Wall -ggdb -Wfatal-errors" DEFINITIONS="-D_DATE_=\"$DATE\"" INCLUDE_DIRS="-Ilibs/openssl-3.6.0-beta1/x64/include -Ilibs/ -Iinclude" diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 03d4a44..2c13546 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -36,6 +36,14 @@ namespace ui { namespace ImGui { + void LoadingIndicatorCircleSmall() + { + float radius = 10.0f; + const ImVec4 col = ImGui::GetStyleColorVec4(ImGuiCol_LoadingIndicatorFg); + const ImVec4 bg = ImGui::GetStyleColorVec4(ImGuiCol_LoadingIndicatorBg); + ImGui::LoadingIndicatorCircle(radius, bg, col, 6, 4.0f); + } + bool CheckboxX(const char* label, bool* v, bool disabled, bool show_loading_indicator_while_disabled) { bool result = false; @@ -56,10 +64,7 @@ namespace ImGui ImVec2 center = ImVec2((p_min.x + p_max.x) * 0.5f - radius, (p_min.y + p_max.y) * 0.5f - radius); ImGui::SetCursorScreenPos(ImVec2(center.x, center.y)); - - const ImVec4 col = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - const ImVec4 bg = ImGui::GetStyleColorVec4(ImGuiCol_Button); - ImGui::LoadingIndicatorCircle(radius, bg, col, 6, 4.0f); + ImGui::LoadingIndicatorCircleSmall(); } if (disabled) ImGui::EndDisabled(); @@ -117,10 +122,7 @@ namespace ImGui ImVec2 center = ImVec2((p_min.x + p_max.x) * 0.5f - radius, (p_min.y + p_max.y) * 0.5f - radius); ImGui::SetCursorScreenPos(ImVec2(center.x, center.y)); - - const ImVec4 col = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - const ImVec4 bg = ImGui::GetStyleColorVec4(ImGuiCol_Button); - ImGui::LoadingIndicatorCircle(radius, bg, col, 6, 4.0f); + ImGui::LoadingIndicatorCircleSmall(); ImGui::EndDisabled(); ImGui::SetCursorScreenPos(oldPos); @@ -897,7 +899,6 @@ namespace ImGui ImVec4* colors = style->Colors; - //colors[ImGuiCol_Border] = ColorConvertU32ToFloat4(IM_COL32(210, 210, 210, 255)); colors[ImGuiCol_Text] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY800); // text on hovered controls is gray900 colors[ImGuiCol_TextDisabled] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY500); colors[ImGuiCol_WindowBg] = ColorConvertU32ToFloat4(IM_COL32(239, 240, 241, 255)); @@ -922,21 +923,27 @@ namespace ImGui colors[ImGuiCol_Button] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY75); // match default button to Spectrum's 'Action Button'. colors[ImGuiCol_ButtonHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY50); colors[ImGuiCol_ButtonActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY200); + + // Loading indicators + colors[ImGuiCol_LoadingIndicatorBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE700); + colors[ImGuiCol_LoadingIndicatorFg] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE700); + // Tables colors[ImGuiCol_TableHeaderBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); colors[ImGuiCol_Header] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); colors[ImGuiCol_HeaderHovered] = ImVec4(0.78f, 0.87f, 0.98f, 0.5f); colors[ImGuiCol_HeaderActive] = colors[ImGuiCol_TableHeaderBg]; - colors[ImGuiCol_TableRowBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY100); colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); - - colors[ImGuiCol_Separator] = colors[ImGuiCol_Border]; + colors[ImGuiCol_OrderItemTableRowFinal] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY200); + colors[ImGuiCol_OrderItemTableRowCurrency] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); colors[ImGuiCol_SeparatorHovered] = colors[ImGuiCol_Border]; colors[ImGuiCol_SeparatorActive] = colors[ImGuiCol_Border]; colors[ImGuiCol_TableBorderStrong] = colors[ImGuiCol_Border]; colors[ImGuiCol_TableBorderLight] = colors[ImGuiCol_Border]; + + colors[ImGuiCol_Separator] = colors[ImGuiCol_Border]; colors[ImGuiCol_ResizeGrip] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY400); colors[ImGuiCol_ResizeGripHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY600); diff --git a/src/ui/ui_expenses.cpp b/src/ui/ui_expenses.cpp index 35adea0..168517f 100644 --- a/src/ui/ui_expenses.cpp +++ b/src/ui/ui_expenses.cpp @@ -105,18 +105,24 @@ static void draw_expense_form(invoice* buffer, bool viewing_only = false) ImGui::SameLine(); ImGui::Text(locale::get("invoice.form.deliveredat")); + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->document.original_path)) { buffer->document.copy_path[0] = 0; } + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::Text(locale::get("invoice.form.billinginformation")); ImGui::ContactForm(&buffer->customer, false, true, false); + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::Text(locale::get("invoice.form.supplier")); ImGui::ContactForm(&buffer->supplier, false, true, false); @@ -127,11 +133,15 @@ static void draw_expense_form(invoice* buffer, bool viewing_only = false) ImGui::Text(locale::get("invoice.form.shippinginformation")); ImGui::DeliveryInfoForm(&buffer->addressee, 0); } + + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::ProjectDropdown(buffer->project_id); ImGui::CostCenterDropdown(buffer->cost_center_id); + ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp index 72c4964..7356207 100644 --- a/src/ui/ui_invoices.cpp +++ b/src/ui/ui_invoices.cpp @@ -74,11 +74,11 @@ void draw_invoice_items_form(invoice* invoice, bool outgoing, bool viewing_only if (ImGui::BeginTable("TableBillingItems", 9, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) { - ImGui::TableSetupColumn("##actions", ImGuiTableColumnFlags_WidthFixed, 20); - ImGui::TableSetupColumn(locale::get("invoice.table.amount"), ImGuiTableColumnFlags_WidthFixed, 80); + ImGui::TableSetupColumn("##actions", ImGuiTableColumnFlags_WidthFixed, 30); + ImGui::TableSetupColumn(locale::get("invoice.table.amount"), ImGuiTableColumnFlags_WidthFixed, 110); ImGui::TableSetupColumn(locale::get("invoice.table.description")); ImGui::TableSetupColumn(locale::get("invoice.table.price"), ImGuiTableColumnFlags_WidthFixed, 100); - ImGui::TableSetupColumn(locale::get("invoice.table.discount"), ImGuiTableColumnFlags_WidthFixed, 110); + ImGui::TableSetupColumn(locale::get("invoice.table.discount"), ImGuiTableColumnFlags_WidthFixed, 130); ImGui::TableSetupColumn(locale::get("invoice.table.net"), ImGuiTableColumnFlags_WidthFixed, 100); ImGui::TableSetupColumn(locale::get("invoice.table.tax%"), ImGuiTableColumnFlags_WidthFixed, 120); ImGui::TableSetupColumn(locale::get("invoice.table.tax"), ImGuiTableColumnFlags_WidthFixed, 100); @@ -146,7 +146,7 @@ void draw_invoice_items_form(invoice* invoice, bool outgoing, bool viewing_only } ImGui::TableNextRow(); - ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(70, 70, 70, 255)); + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ImGui::GetColorU32(ImGuiCol_OrderItemTableRowFinal)); ImGui::TableSetColumnIndex(5); ImGui::Text("%.2f %s", invoice->orig_net, invoice->currency); @@ -159,7 +159,7 @@ void draw_invoice_items_form(invoice* invoice, bool outgoing, bool viewing_only if (!strops::equals(invoice->currency, administration::get_default_currency())) { ImGui::TableNextRow(); - ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(50, 50, 50, 255)); + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ImGui::GetColorU32(ImGuiCol_OrderItemTableRowCurrency)); ImGui::TableSetColumnIndex(2); ImGui::Text("%s %s", locale::get("invoice.form.finalSettlement"), administration::get_default_currency()); @@ -221,13 +221,17 @@ static void draw_invoice_form(invoice* buffer, bool viewing_only = false) ImGui::SameLine(); ImGui::Text(locale::get("invoice.form.deliveredat")); + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->document.original_path)) { buffer->document.copy_path[0] = 0; } + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::Text(locale::get("invoice.form.billinginformation")); ImGui::ContactForm(&buffer->customer, false, true, false); @@ -238,7 +242,10 @@ static void draw_invoice_form(invoice* buffer, bool viewing_only = false) ImGui::Text(locale::get("invoice.form.shippinginformation")); ImGui::DeliveryInfoForm(&buffer->addressee, 0); } + + ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::ProjectDropdown(buffer->project_id); |
