diff options
| author | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-11 12:28:43 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@mailbox.org> | 2026-01-11 12:28:43 +0100 |
| commit | ccbc6a8f0836583fabd59919bd7930d7cfe1473e (patch) | |
| tree | 9b40413d853ff9cce52b6d697314b6bc4ea015e4 /src/ui | |
| parent | 6166eeda08fd1d4106afe47416a73de60700d17e (diff) | |
ui improvements
Diffstat (limited to 'src/ui')
| -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 |
3 files changed, 41 insertions, 17 deletions
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); |
