summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-18 00:14:50 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-18 00:14:50 +0000
commit3b03f47d632d2a1da25aab689a59ad5701e7d63c (patch)
tree2ce178eefeca99c3cfc8d8099eebe2a9885eb90c /src
parentcf42297fb317e27633c58dc34beb88425c4bf0ef (diff)
Disable viewer slider when we are examining content.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc27
-rw-r--r--src/wx/film_viewer.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index ae6d38560..891d1671b 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -33,6 +33,7 @@
#include "lib/image.h"
#include "lib/scaler.h"
#include "lib/exceptions.h"
+#include "lib/examine_content_job.h"
#include "film_viewer.h"
#include "wx_util.h"
#include "video_decoder.h"
@@ -41,6 +42,7 @@ using std::string;
using std::pair;
using std::max;
using std::cout;
+using std::list;
using boost::shared_ptr;
FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
@@ -76,6 +78,10 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
_timer.Bind (wxEVT_TIMER, &FilmViewer::timer, this);
set_film (_film);
+
+ JobManager::instance()->ActiveJobsChanged.connect (
+ bind (&FilmViewer::active_jobs_changed, this, _1)
+ );
}
void
@@ -331,3 +337,24 @@ FilmViewer::get_frame ()
error_dialog (this, String::compose ("Could not decode video for view (%1)", e.what()));
}
}
+
+void
+FilmViewer::active_jobs_changed (bool a)
+{
+ if (a) {
+ list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
+ list<shared_ptr<Job> >::iterator i = jobs.begin ();
+ while (i != jobs.end() && boost::dynamic_pointer_cast<ExamineContentJob> (*i) == 0) {
+ ++i;
+ }
+
+ if (i == jobs.end() || (*i)->finished()) {
+ /* no examine content job running, so we're ok to use the viewer */
+ a = false;
+ }
+ }
+
+ _slider->Enable (!a);
+ _play_button->Enable (!a);
+}
+
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 2d0e17fa2..5a791a8e2 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -56,6 +56,7 @@ private:
void seek_and_update (SourceFrame);
void raw_to_display ();
void get_frame ();
+ void active_jobs_changed (bool);
boost::shared_ptr<Film> _film;