refactor!: Rewrite of the old notification service (#2866)

The main goal was improving the readability of the original code however some ugliness remains.

- Swapped from pointer singleton to instance singleton
- Actually make use of the alpha logic that used to be present
- Added a counter to notifications to indicate if something is being spammed
- Notification timeouts reset if they're sent to the queue again
This commit is contained in:
Andreas Maerten
2024-03-23 00:04:49 +01:00
committed by GitHub
parent 313bfa24b3
commit cba19d0c33
99 changed files with 459 additions and 359 deletions

View File

@ -251,7 +251,7 @@ namespace lua::gui
// Shows a message to the user with the given title and message.
static void show_message(const std::string& title, const std::string& message)
{
big::g_notification_service->push(title, message);
big::g_notification_service.push(title, message);
}
// Lua API: Function
@ -262,7 +262,7 @@ namespace lua::gui
// Shows a warning to the user with the given title and message.
static void show_warning(const std::string& title, const std::string& message)
{
big::g_notification_service->push_warning(title, message);
big::g_notification_service.push_warning(title, message);
}
// Lua API: Function
@ -273,7 +273,7 @@ namespace lua::gui
// Shows an error to the user with the given title and message.
static void show_error(const std::string& title, const std::string& message)
{
big::g_notification_service->push_error(title, message);
big::g_notification_service.push_error(title, message);
}
// Lua API: Function
@ -373,4 +373,4 @@ namespace lua::gui
tab_ut["add_input_string"] = &tab::add_input_string;
tab_ut["add_imgui"] = &tab::add_imgui;
}
}
}