From 420fb6c9b3427f65cfe24411944ee46b58cfcfb4 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 16:57:03 +0200 Subject: 1.17 --- library/statusHandler.h | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'library/statusHandler.h') diff --git a/library/statusHandler.h b/library/statusHandler.h index 208a2df8..11517efb 100644 --- a/library/statusHandler.h +++ b/library/statusHandler.h @@ -50,19 +50,11 @@ public: //this method is triggered repeatedly by requestUiRefresh() and can be used to refresh the ui by dispatching pending events virtual void forceUiRefresh() = 0; - void requestUiRefresh(bool asyncProcessActive = false) - { - if (updateUiIsAllowed()) //test if specific time span between ui updates is over - forceUiRefresh(); - if (abortRequested && !asyncProcessActive) - abortThisProcess(); //abort can be triggered by requestAbortion() - } + void requestUiRefresh(bool allowAbort = true); //opportunity to abort must be implemented in a frequently executed method like requestUiRefresh() + void requestAbortion(); //does NOT call abortThisProcess immediately, but when appropriate (e.g. async. processes finished) + bool abortIsRequested(); - void requestAbortion() //opportunity to abort must be implemented in a frequently executed method like requestUiRefresh() - { //currently used by the UI status information screen, when button "Abort is pressed" - abortRequested = true; - } //error handling: virtual ErrorHandler::Response reportError(const Zstring& errorMessage) = 0; //recoverable error situation @@ -76,4 +68,31 @@ protected: }; + +//############################################################################## +inline +void StatusHandler::requestUiRefresh(bool allowAbort) +{ + if (updateUiIsAllowed()) //test if specific time span between ui updates is over + forceUiRefresh(); + + if (abortRequested && allowAbort) + abortThisProcess(); //abort can be triggered by requestAbortion() +} + + +inline +void StatusHandler::requestAbortion() +{ + abortRequested = true; +} + + +inline +bool StatusHandler::abortIsRequested() +{ + return abortRequested; +} + + #endif // STATUSHANDLER_H_INCLUDED -- cgit