diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:03 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:57:03 +0200 |
commit | 420fb6c9b3427f65cfe24411944ee46b58cfcfb4 (patch) | |
tree | 58269ba5ee7a22d2df004f03b100cc234b8c3f14 /library/statusHandler.h | |
parent | 1.16 (diff) | |
download | FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.tar.gz FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.tar.bz2 FreeFileSync-420fb6c9b3427f65cfe24411944ee46b58cfcfb4.zip |
1.17
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 |