summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-01-25 19:44:04 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-16 01:20:38 +0100
commit87d740bcf70fd1b5d1e25e763c0c77b8906b7361 (patch)
tree88b91ab50199000286cbc83639c4c186f49724b9
parentf0385de250d58a3bbb548f349c98f1815479f376 (diff)
Pass PlayerFrame pointer into PlaylistControls to avoid the ResetFilm signal hack.
-rw-r--r--src/wx/film_viewer.h8
-rw-r--r--src/wx/player_frame.cc13
-rw-r--r--src/wx/player_frame.h1
-rw-r--r--src/wx/playlist_controls.cc11
-rw-r--r--src/wx/playlist_controls.h18
-rw-r--r--src/wx/standard_controls.cc2
6 files changed, 28 insertions, 25 deletions
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index d7afa2182..4eebc41bc 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_FILM_VIEWER_H
+#define DCPOMATIC_FILM_VIEWER_H
+
+
/** @file src/film_viewer.h
* @brief FilmViewer class.
*/
@@ -232,3 +236,7 @@ private:
boost::signals2::scoped_connection _config_changed_connection;
};
+
+
+#endif
+
diff --git a/src/wx/player_frame.cc b/src/wx/player_frame.cc
index f88a579a5..a945a5b1d 100644
--- a/src/wx/player_frame.cc
+++ b/src/wx/player_frame.cc
@@ -219,9 +219,7 @@ PlayerFrame::PlayerFrame()
}
if (Config::instance()->player_mode() == Config::PlayerMode::DUAL) {
- auto pc = new PlaylistControls(_overall_panel, _viewer);
- _controls = pc;
- pc->ResetFilm.connect(bind(&PlayerFrame::reset_film_weak, this, _1, _2));
+ _controls = new PlaylistControls(_overall_panel, this, _viewer);
} else {
_controls = new StandardControls(_overall_panel, _viewer, false);
}
@@ -439,15 +437,6 @@ PlayerFrame::load_dcp(boost::filesystem::path dir)
void
-PlayerFrame::reset_film_weak(weak_ptr<Film> weak_film, optional<float> crop_to_ratio)
-{
- if (auto film = weak_film.lock()) {
- reset_film(film, crop_to_ratio);
- }
-}
-
-
-void
PlayerFrame::reset_film(shared_ptr<Film> film, optional<float> crop_to_ratio)
{
_film = film;
diff --git a/src/wx/player_frame.h b/src/wx/player_frame.h
index 43f3cf300..84da6b3a6 100644
--- a/src/wx/player_frame.h
+++ b/src/wx/player_frame.h
@@ -65,7 +65,6 @@ public:
void too_many_frames_dropped();
void set_decode_reduction(boost::optional<int> reduction);
void load_dcp(boost::filesystem::path dir);
- void reset_film_weak(std::weak_ptr<Film> weak_film, boost::optional<float> crop_to_ratio);
void reset_film(std::shared_ptr<Film> film = std::make_shared<Film>(boost::none), boost::optional<float> crop_to_ratio = {});
/* _film is now something new: set up to play it */
diff --git a/src/wx/playlist_controls.cc b/src/wx/playlist_controls.cc
index 1d222d7be..d0d0c1d23 100644
--- a/src/wx/playlist_controls.cc
+++ b/src/wx/playlist_controls.cc
@@ -22,6 +22,7 @@
#include "content_view.h"
#include "dcpomatic_button.h"
#include "film_viewer.h"
+#include "player_frame.h"
#include "playlist_controls.h"
#include "static_text.h"
#include "wx_util.h"
@@ -53,10 +54,12 @@ using std::string;
using std::vector;
using boost::optional;
using namespace dcpomatic;
+using namespace dcpomatic::ui;
-PlaylistControls::PlaylistControls(wxWindow* parent, FilmViewer& viewer)
+PlaylistControls::PlaylistControls(wxWindow* parent, PlayerFrame* player, FilmViewer& viewer)
: Controls(parent, viewer, false)
+ , _player(player)
, _play_button(new Button(this, _("Play")))
, _pause_button(new Button(this, _("Pause")))
, _stop_button(new Button(this, _("Stop")))
@@ -155,7 +158,7 @@ PlaylistControls::deselect_playlist()
_selected_playlist = boost::none;
_spl_view->SetItemState(selected, 0, wxLIST_STATE_SELECTED);
}
- ResetFilm(std::make_shared<Film>(optional<boost::filesystem::path>()), {});
+ _player->reset_film();
}
@@ -388,7 +391,7 @@ PlaylistControls::reset_film()
DCPOMATIC_ASSERT(_selected_playlist_position < static_cast<int>(entries.size()));
auto const entry = entries[_selected_playlist_position];
film->add_content(vector<shared_ptr<Content>>{ShowPlaylistContentStore::instance()->get(entry)});
- ResetFilm(film, entry.crop_to_ratio());
+ _player->reset_film(film, entry.crop_to_ratio());
}
@@ -434,7 +437,7 @@ PlaylistControls::viewer_finished()
} else {
/* Finished the whole SPL */
_selected_playlist_position = 0;
- ResetFilm(std::make_shared<Film>(optional<boost::filesystem::path>()), {});
+ _player->reset_film();
_play_button->Enable(true);
_pause_button->Enable(false);
}
diff --git a/src/wx/playlist_controls.h b/src/wx/playlist_controls.h
index ea9e79cf4..71f9d7f47 100644
--- a/src/wx/playlist_controls.h
+++ b/src/wx/playlist_controls.h
@@ -27,17 +27,19 @@
class DCPContent;
class ShowPlaylistList;
+namespace dcpomatic {
+namespace ui {
+
+class PlayerFrame;
+
+}
+}
+
class PlaylistControls : public Controls
{
public:
- PlaylistControls(wxWindow* parent, FilmViewer& viewer);
-
- /** This is so that we can tell our parent player to reset the film
- when we have created one from a SPL. We could call a method
- in the player's DOMFrame but we don't have that in a header.
- */
- boost::signals2::signal<void (std::weak_ptr<Film>, boost::optional<float>)> ResetFilm;
+ PlaylistControls(wxWindow* parent, dcpomatic::ui::PlayerFrame* player, FilmViewer& viewer);
void play() override;
void stop() override;
@@ -66,6 +68,8 @@ private:
boost::optional<dcp::EncryptedKDM> get_kdm_from_directory(std::shared_ptr<DCPContent> dcp);
+ dcpomatic::ui::PlayerFrame* _player;
+
wxButton* _play_button;
wxButton* _pause_button;
wxButton* _stop_button;
diff --git a/src/wx/standard_controls.cc b/src/wx/standard_controls.cc
index 942c49fc4..9126f24b4 100644
--- a/src/wx/standard_controls.cc
+++ b/src/wx/standard_controls.cc
@@ -33,7 +33,7 @@ using std::shared_ptr;
StandardControls::StandardControls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
- : Controls (parent, viewer, editor_controls)
+ : Controls(parent, viewer, editor_controls)
, _play_button (new wxToggleButton(this, wxID_ANY, _("Play")))
{
_button_sizer->Add (_play_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);