diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-07-01 15:50:14 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-07-01 15:50:14 +0100 |
| commit | 8c0414a0dec9f444a80fc30c7be3bc82188446d4 (patch) | |
| tree | da037c499dcd9d16715ab6617e18ee5067d89d5a | |
| parent | 106bde1d2c9246fc62c8f37f560701abf0e80c51 (diff) | |
swaroop: write position file every 2 minutes; tweak play sensitivityv2.15.9
on finishing a SPL; deselected playlist if stop is clicked.
| -rw-r--r-- | src/wx/swaroop_controls.cc | 27 | ||||
| -rw-r--r-- | src/wx/swaroop_controls.h | 1 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/wx/swaroop_controls.cc b/src/wx/swaroop_controls.cc index 925fcb5e7..34241078b 100644 --- a/src/wx/swaroop_controls.cc +++ b/src/wx/swaroop_controls.cc @@ -158,7 +158,8 @@ SwaroopControls::check_restart () void SwaroopControls::viewer_position_changed () { - if (!_selected_playlist || !_viewer->playing() || _viewer->position().get() % DCPTime::HZ) { + /* Write position every two minutes if we're playing */ + if (!_selected_playlist || !_viewer->playing() || _viewer->position().get() % (2 * 60 * DCPTime::HZ)) { return; } @@ -186,6 +187,7 @@ SwaroopControls::started () _viewer->set_background_image (false); } +/** Called when the viewer finishes a single piece of content, or it is explicitly stopped */ void SwaroopControls::stopped () { @@ -195,6 +197,16 @@ SwaroopControls::stopped () } void +SwaroopControls::deselect_playlist () +{ + long int const selected = _spl_view->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + if (selected != -1) { + _selected_playlist = boost::none; + _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED); + } +} + +void SwaroopControls::decrement_allowed_shows () { if (_selected_playlist) { @@ -243,6 +255,7 @@ SwaroopControls::stop_clicked () } _viewer->set_background_image (true); decrement_allowed_shows (); + deselect_playlist (); } bool @@ -434,8 +447,7 @@ SwaroopControls::spl_selection_changed () if (_playlists[selected].missing()) { error_dialog (this, "This playlist cannot be loaded as some content is missing."); - _selected_playlist = boost::none; - _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED); + deselect_playlist (); return; } @@ -479,8 +491,7 @@ SwaroopControls::select_playlist (int selected, int position) if (dcp->needs_kdm()) { /* We didn't get a KDM for this */ error_dialog (this, "This playlist cannot be loaded as a KDM is missing."); - _selected_playlist = boost::none; - _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED); + deselect_playlist (); return; } } @@ -496,8 +507,7 @@ SwaroopControls::select_playlist (int selected, int position) } } else { error_dialog (this, "This playlist cannot be loaded as a KDM is missing."); - _selected_playlist = boost::none; - _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED); + deselect_playlist (); return; } } @@ -589,7 +599,8 @@ SwaroopControls::viewer_finished () _selected_playlist_position = 0; _viewer->set_background_image (true); ResetFilm (shared_ptr<Film>(new Film(optional<boost::filesystem::path>()))); - stopped (); decrement_allowed_shows (); + _play_button->Enable (true); + _pause_button->Enable (false); } } diff --git a/src/wx/swaroop_controls.h b/src/wx/swaroop_controls.h index 10919b767..d8d39d4a0 100644 --- a/src/wx/swaroop_controls.h +++ b/src/wx/swaroop_controls.h @@ -60,6 +60,7 @@ private: bool can_do_previous (); bool can_do_next (); void decrement_allowed_shows (); + void deselect_playlist (); boost::optional<dcp::EncryptedKDM> get_kdm_from_url (boost::shared_ptr<DCPContent> dcp); boost::optional<dcp::EncryptedKDM> get_kdm_from_directory (boost::shared_ptr<DCPContent> dcp); |
