diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-26 17:23:28 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-26 17:23:28 +0100 |
| commit | 60488d722bf29f3ff0ce3e08b90f30523a8d7b6d (patch) | |
| tree | c2e01243d8a0d970c35e250b66a66a226ab230dc /include | |
| parent | 5e06ad208e32330b662af90ce41613f5421095cb (diff) | |
loading animations and block navigation while writing to disk
Diffstat (limited to 'include')
| -rw-r--r-- | include/administration.hpp | 2 | ||||
| -rw-r--r-- | include/administration_writer.hpp | 8 | ||||
| -rw-r--r-- | include/config.hpp | 2 | ||||
| -rw-r--r-- | include/ui.hpp | 19 |
4 files changed, 12 insertions, 19 deletions
diff --git a/include/administration.hpp b/include/administration.hpp index 3fc68bd..09e0cb2 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -456,7 +456,7 @@ namespace administration { // Callback functions. // ======================= - void set_data_changed_event_callback(data_changed_event ev); + void set_administration_data_changed_event_callback(data_changed_event ev); void set_data_deleted_event_callback(data_deleted_event ev); void set_invoice_changed_event_callback(invoice_changed_event ev); void set_contact_changed_event_callback(contact_changed_event ev); diff --git a/include/administration_writer.hpp b/include/administration_writer.hpp index 6f1d602..e1a651e 100644 --- a/include/administration_writer.hpp +++ b/include/administration_writer.hpp @@ -20,8 +20,14 @@ #define ADMIN_FILE_INFO "info.xml" +typedef void (*write_completed_event)(); + namespace administration_writer { + void set_write_completed_event_callback(write_completed_event ev); + + bool is_writing(); + // Setup functions. bool create(); void destroy(); @@ -37,7 +43,7 @@ namespace administration_writer { bool save_invoice_blocking(invoice inv); // Archiving functions. - bool save_all_administration_info_blocking(); + bool save_administration_info_blocking(); bool save_all_tax_rates_blocking(); bool save_all_cost_centers_blocking(); bool save_all_async(); diff --git a/include/config.hpp b/include/config.hpp index 76b8022..05659e8 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -16,6 +16,8 @@ #pragma once +#define WRITE_DELAY_SEC 0 + #include "stdint.h" #include "imgui.h" diff --git a/include/ui.hpp b/include/ui.hpp index 88a88ec..8b3d10d 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -46,27 +46,10 @@ namespace ui { VIEW_IMPORT_REQUEST, } view_state; - typedef struct - { - bool visible; - int flash_count; - int color; - char text[STATUS_TEXT_LEN]; - float time; - bool loading; - } status; - extern ImFont* fontBold; extern ImFont* fontBig; void set_state(main_state state); - - // Status functions. - status get_status(); - void set_status_loading(bool loading); - void set_status_error(const char* txt); - void set_status(const char* txt); - void draw_status(); // Draw calls. void draw_main(); @@ -100,6 +83,8 @@ namespace ui { namespace ImGui { bool WarningIcon(float radius); + bool Button(const char* label, bool block_while_writing_to_disk, bool show_loading_indicator_while_blocked = true); + bool CheckboxX(const char* label, bool* v, bool disabled = false, bool show_loading_indicator_while_disabled = false); void InputTextWithError(const char* text, char* buffer, size_t buf_size, bool has_error); int InputTextWithAutocomplete(const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count, bool has_error); |
