summaryrefslogtreecommitdiff
path: root/src/progress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/progress.cpp')
-rw-r--r--src/progress.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/progress.cpp b/src/progress.cpp
index ac34afd07..208f681a6 100644
--- a/src/progress.cpp
+++ b/src/progress.cpp
@@ -15,6 +15,7 @@
/** Are we in a modal progress or not? */
bool _in_modal_progress = false;
+bool _first_in_modal_loop = false;
/** Rights for the performing work. */
ThreadMutex *_modal_progress_work_mutex = ThreadMutex::New();
/** Rights for the painting. */
@@ -22,9 +23,23 @@ ThreadMutex *_modal_progress_paint_mutex = ThreadMutex::New();
/**
* Set the modal progress state.
+ * @note Makes IsFirstModalProgressLoop return true for the next call.
* @param state The new state; are we modal or not?
*/
void SetModalProgress(bool state)
{
_in_modal_progress = state;
+ _first_in_modal_loop = true;
+}
+
+/**
+ * Check whether this is the first modal progress loop.
+ * @note Set by SetModalProgress, unset by calling this method.
+ * @return True if this is the first loop.
+ */
+bool IsFirstModalProgressLoop()
+{
+ bool ret = _first_in_modal_loop;
+ _first_in_modal_loop = false;
+ return ret;
}