diff options
Diffstat (limited to 'library/statusHandler.h')
-rw-r--r-- | library/statusHandler.h | 41 |
1 files changed, 30 insertions, 11 deletions
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 |