Fix play button behaviour.
authorCarl Hetherington <cth@carlh.net>
Mon, 10 Sep 2018 22:47:57 +0000 (23:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Sep 2018 10:58:15 +0000 (11:58 +0100)
src/wx/control_film_viewer.cc
src/wx/control_film_viewer.h
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 69b2b5b..739b027 100644 (file)
@@ -96,6 +96,8 @@ ControlFilmViewer::ControlFilmViewer (wxWindow* parent, bool outline_content, bo
 
        _viewer->ImageChanged.connect (boost::bind(&ControlFilmViewer::image_changed, this, _1));
        _viewer->PositionChanged.connect (boost::bind(&ControlFilmViewer::position_changed, this));
+       _viewer->Started.connect (boost::bind(&ControlFilmViewer::started, this));
+       _viewer->Stopped.connect (boost::bind(&ControlFilmViewer::stopped, this));
 
        set_film (shared_ptr<Film> ());
 
@@ -107,6 +109,18 @@ ControlFilmViewer::ControlFilmViewer (wxWindow* parent, bool outline_content, bo
 }
 
 void
+ControlFilmViewer::started ()
+{
+       _play_button->SetValue (true);
+}
+
+void
+ControlFilmViewer::stopped ()
+{
+       _play_button->SetValue (false);
+}
+
+void
 ControlFilmViewer::position_changed ()
 {
        update_position_label ();
@@ -380,14 +394,12 @@ ControlFilmViewer::show_closed_captions ()
 void
 ControlFilmViewer::start ()
 {
-       _play_button->SetValue (true);
        _viewer->start ();
 }
 
 bool
 ControlFilmViewer::stop ()
 {
-       _play_button->SetValue (false);
        return _viewer->stop ();
 }
 
index b3ad701..cef5cb5 100644 (file)
@@ -58,6 +58,8 @@ private:
        void outline_content_changed ();
        void eye_changed ();
        void position_changed ();
+       void started ();
+       void stopped ();
 
        boost::shared_ptr<Film> _film;
        boost::shared_ptr<FilmViewer> _viewer;
index b7e4144..85b0eff 100644 (file)
@@ -411,6 +411,7 @@ FilmViewer::start ()
        _playing = true;
        _dropped = 0;
        timer ();
+       Started ();
 }
 
 bool
@@ -426,6 +427,7 @@ FilmViewer::stop ()
        }
 
        _playing = false;
+       Stopped ();
        return true;
 }
 
index c68b6ad..d080c79 100644 (file)
@@ -95,6 +95,8 @@ public:
 
        boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
        boost::signals2::signal<void ()> PositionChanged;
+       boost::signals2::signal<void ()> Started;
+       boost::signals2::signal<void ()> Stopped;
 
 private:
        void paint_panel ();