summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-23 10:39:20 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-23 10:39:20 +0100
commit2cb5f05397b115bda11d8f86a62a3f30d8e2ea71 (patch)
treed2498ee3f6f63a8692dd44a68577a4ceae4deae9 /src
parent93d6bd98279b2c912daffa2c91484121085d8dca (diff)
Disable player controls when there is no content.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc27
-rw-r--r--src/wx/film_viewer.h5
2 files changed, 31 insertions, 1 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 96e20a281..f2f6ba23d 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -114,6 +114,8 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
JobManager::instance()->ActiveJobsChanged.connect (
bind (&FilmViewer::active_jobs_changed, this, _1)
);
+
+ setup_sensitivity ();
}
void
@@ -142,8 +144,10 @@ FilmViewer::set_film (shared_ptr<Film> f)
return;
}
+ _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));
+
_player->set_approximate_size ();
- _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
+ _player_connection = _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
calculate_sizes ();
get (_position, _last_get_accurate);
@@ -402,3 +406,24 @@ FilmViewer::player_changed (bool frequent)
calculate_sizes ();
get (_position, _last_get_accurate);
}
+
+void
+FilmViewer::setup_sensitivity ()
+{
+ bool const c = !_film->content().empty ();
+ _slider->Enable (c);
+ _back_button->Enable (c);
+ _forward_button->Enable (c);
+ _play_button->Enable (c);
+ _outline_content->Enable (c);
+ _frame_number->Enable (c);
+ _timecode->Enable (c);
+}
+
+void
+FilmViewer::film_changed (Film::Property p)
+{
+ if (p == Film::CONTENT) {
+ setup_sensitivity ();
+ }
+}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 930937596..0235d225f 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -55,6 +55,8 @@ private:
void set_position_text ();
void get (DCPTime, bool);
void refresh_panel ();
+ void setup_sensitivity ();
+ void film_changed (Film::Property);
boost::shared_ptr<Film> _film;
boost::shared_ptr<Player> _player;
@@ -84,4 +86,7 @@ private:
* can get the same one that we got last time.
*/
bool _last_get_accurate;
+
+ boost::signals2::scoped_connection _film_connection;
+ boost::signals2::scoped_connection _player_connection;
};