summaryrefslogtreecommitdiff
path: root/src/lib/hints.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-06 19:49:37 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-06 19:49:37 +0000
commitd43434e463f5ef76ee448046ffb09ffe4b05ea8d (patch)
tree7c934d260a51fa08058d9dc8d45277aeae7d2129 /src/lib/hints.cc
parenta8ca8dd8c3838f42c1dcd86e09901275271c298e (diff)
Improve hints dialog in various ways, especially with long projects (#1439).
Diffstat (limited to 'src/lib/hints.cc')
-rw-r--r--src/lib/hints.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 185626983..d961b1a30 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -56,6 +56,7 @@ Hints::Hints (weak_ptr<const Film> film)
, _long_ccap (false)
, _overlap_ccap (false)
, _too_many_ccap_lines (false)
+ , _stop (false)
{
}
@@ -65,6 +66,10 @@ Hints::stop_thread ()
{
if (_thread) {
try {
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _stop = true;
+ }
_thread->interrupt ();
_thread->join ();
} catch (...) {
@@ -88,6 +93,7 @@ Hints::start ()
_long_ccap = false;
_overlap_ccap = false;
_too_many_ccap_lines = false;
+ _stop = false;
_thread = new boost::thread (bind(&Hints::thread, this));
}
@@ -267,8 +273,24 @@ Hints::thread ()
player->set_ignore_video ();
player->set_ignore_audio ();
player->Text.connect (bind(&Hints::text, this, _1, _2, _4));
- while (!player->pass ()) {
- bind (boost::ref(Pulse));
+
+ struct timeval last_pulse;
+ gettimeofday (&last_pulse, 0);
+
+ while (!player->pass()) {
+
+ struct timeval now;
+ gettimeofday (&now, 0);
+ if ((seconds(now) - seconds(last_pulse)) > 1) {
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_stop) {
+ break;
+ }
+ }
+ emit (bind (boost::ref(Pulse)));
+ last_pulse = now;
+ }
}
emit (bind(boost::ref(Finished)));