Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2010-06-02 00:21:40 +0400
committerDamien Plisson <damien.plisson@yahoo.fr>2010-06-02 00:21:40 +0400
commit3f326354b8b09c2f08b114b4030e49bbbfa693af (patch)
treef7e619791d39fb7ae7e4cc69c3b44a72eb8a2f4e /source/blender/windowmanager/intern/wm_jobs.c
parent66e3a6e0efd782c09bd94dd22313558f3b91240b (diff)
Progress indicator in the application icon
Displays a global progress indicator in the application icon reflecting the total progress of all running jobs. Currently fully implemented on OSX (Cocoa). On other OSes that do not allow to redraw the app icon, this can be implemented as a [x%] display in the app title, so to appear in the taskbar. Thanks to Matt for the windowmanager wrapper.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_jobs.c')
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index a92a3d746ad..e7df703ba79 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -381,6 +381,9 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
{
wmJob *steve= wm->jobs.first, *stevenext;
+ float total_progress= 0.f;
+ float jobs_progress=0;
+
for(; steve; steve= stevenext) {
stevenext= steve->next;
@@ -434,6 +437,10 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
BLI_remlink(&wm->jobs, steve);
MEM_freeN(steve);
}
+ } else if (steve->flag & WM_JOB_PROGRESS) {
+ /* accumulate global progress for running jobs */
+ jobs_progress++;
+ total_progress += steve->progress;
}
}
else if(steve->suspended) {
@@ -441,5 +448,13 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
}
}
}
+
+ /* if there are running jobs, set the global progress indicator */
+ if (jobs_progress > 0) {
+ float progress = total_progress / (float)jobs_progress;
+ WM_progress_set(wm->winactive, progress);
+ } else {
+ WM_progress_clear(wm->winactive);
+ }
}