Export ongoing notification with delay 1000ms to prevent quick opening and closing on fast systems

This commit is contained in:
David Kocik 2021-10-15 14:54:43 +02:00
parent 1ca24f0bd0
commit 81cb190e2f
3 changed files with 30 additions and 8 deletions

View file

@ -109,8 +109,10 @@ enum class NotificationType
// Give user advice to simplify object with big amount of triangles
// Contains ObjectID for closing when object is deleted
SimplifySuggestion,
// information about netfabb is finished repairing model (blocking proccess)
NetfabbFinished
// information about netfabb is finished repairing model (blocking proccess)
NetfabbFinished,
// Short meesage to fill space between start and finish of export
ExportOngoing
};
class NotificationManager
@ -151,6 +153,10 @@ public:
// ErrorNotificationLevel and ImportantNotificationLevel are never faded out.
void push_notification(NotificationType type, NotificationLevel level, const std::string& text, const std::string& hypertext = "",
std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>(), int timestamp = 0);
// Pushes basic_notification with delay. See push_delayed_notification_data.
void push_delayed_notification(const NotificationType type, std::function<bool(void)> condition_callback, int64_t initial_delay, int64_t delay_interval);
// Removes all notifications of type from m_waiting_notifications
void stop_delayed_notifications_of_type(const NotificationType type);
// Creates Validate Error notification with a custom text and no fade out.
void push_validate_error_notification(const std::string& text);
// Creates Slicing Error notification with a custom text and no fade out.
@ -699,10 +705,8 @@ private:
// and condition callback is success, notification is regular pushed from update function.
// Otherwise another delay interval waiting. Timestamp is 0.
// Note that notification object is constructed when being added to the waiting list, but there are no updates called on it and its timer is reset at regular push.
// Also note that no control of same notification is done during push_delayed_notification but if waiting notif fails to push, it continues waiting.
void push_delayed_notification(std::unique_ptr<NotificationManager::PopNotification> notification, std::function<bool(void)> condition_callback, int64_t initial_delay, int64_t delay_interval);
// Removes all notifications of type from m_waiting_notifications
void stop_delayed_notifications_of_type(const NotificationType type);
// Also note that no control of same notification is done during push_delayed_notification_data but if waiting notif fails to push, it continues waiting.
void push_delayed_notification_data(std::unique_ptr<NotificationManager::PopNotification> notification, std::function<bool(void)> condition_callback, int64_t initial_delay, int64_t delay_interval);
//finds older notification of same type and moves it to the end of queue. returns true if found
bool activate_existing(const NotificationManager::PopNotification* notification);
// Put the more important notifications to the bottom of the list.