From 3c414bf90d4cfcfe342c0b057b5134f72485fe32 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 12 Dec 2018 00:30:33 +0000 Subject: Fix content properties (#1428). --- src/lib/content.cc | 6 +++--- src/lib/content.h | 4 ++-- src/lib/dcp_content.cc | 2 +- src/lib/ffmpeg_content.cc | 2 +- src/lib/image_content.cc | 4 ++-- src/lib/image_content.h | 2 +- src/lib/video_mxf_content.cc | 3 ++- src/lib/video_mxf_content.h | 2 +- src/wx/content_menu.cc | 4 +++- src/wx/content_properties_dialog.cc | 4 ++-- src/wx/content_properties_dialog.h | 5 +++-- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/lib/content.cc b/src/lib/content.cc index 1e73418b6..b288580cb 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -356,10 +356,10 @@ Content::path_summary () const /** @return a list of properties that might be interesting to the user */ list -Content::user_properties () const +Content::user_properties (shared_ptr film) const { list p; - add_properties (p); + add_properties (film, p); return p; } @@ -423,7 +423,7 @@ Content::active_video_frame_rate (shared_ptr film) const } void -Content::add_properties (list& p) const +Content::add_properties (shared_ptr, list& p) const { p.push_back (UserProperty (UserProperty::GENERAL, _("Filename"), path(0).string ())); diff --git a/src/lib/content.h b/src/lib/content.h index bb66bc141..55cf4acae 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -180,7 +180,7 @@ public: _change_signals_frequent = f; } - std::list user_properties () const; + std::list user_properties (boost::shared_ptr film) const; std::string calculate_digest () const; @@ -196,7 +196,7 @@ public: protected: - virtual void add_properties (std::list &) const; + virtual void add_properties (boost::shared_ptr film, std::list &) const; /** _mutex which should be used to protect accesses, as examine * jobs can update content state in threads other than the main one. diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 419ffe69c..8a2e2050d 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -421,7 +421,7 @@ DCPContent::directories () const void DCPContent::add_properties (shared_ptr film, list& p) const { - Content::add_properties (p); + Content::add_properties (film, p); if (video) { video->add_properties (p); } diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index f4e4beba9..02d7a9ff6 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -507,7 +507,7 @@ FFmpegContent::set_default_colour_conversion () void FFmpegContent::add_properties (shared_ptr film, list& p) const { - Content::add_properties (p); + Content::add_properties (film, p); if (video) { video->add_properties (p); diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 8902798a4..1515c8b76 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -182,8 +182,8 @@ ImageContent::set_default_colour_conversion () } void -ImageContent::add_properties (list& p) const +ImageContent::add_properties (shared_ptr film, list& p) const { - Content::add_properties (p); + Content::add_properties (film, p); video->add_properties (p); } diff --git a/src/lib/image_content.h b/src/lib/image_content.h index e2a2ec366..959923a51 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -51,7 +51,7 @@ public: bool still () const; private: - void add_properties (std::list& p) const; + void add_properties (boost::shared_ptr film, std::list& p) const; boost::optional _path_to_scan; }; diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc index 9d2af1a32..436046890 100644 --- a/src/lib/video_mxf_content.cc +++ b/src/lib/video_mxf_content.cc @@ -130,7 +130,8 @@ VideoMXFContent::approximate_length () const } void -VideoMXFContent::add_properties (list& p) const +VideoMXFContent::add_properties (shared_ptr film, list& p) const { + Content::add_properties (film, p); video->add_properties (p); } diff --git a/src/lib/video_mxf_content.h b/src/lib/video_mxf_content.h index 25da0def4..27dce1fb7 100644 --- a/src/lib/video_mxf_content.h +++ b/src/lib/video_mxf_content.h @@ -41,7 +41,7 @@ public: void as_xml (xmlpp::Node* node, bool with_paths) const; DCPTime full_length (boost::shared_ptr film) const; DCPTime approximate_length () const; - void add_properties (std::list& p) const; + void add_properties (boost::shared_ptr film, std::list& p) const; static bool valid_mxf (boost::filesystem::path path); }; diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 017d2c659..19c54abcc 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -415,7 +415,9 @@ ContentMenu::ov () void ContentMenu::properties () { - ContentPropertiesDialog* d = new ContentPropertiesDialog (_parent, _content.front ()); + shared_ptr film = _film.lock (); + DCPOMATIC_ASSERT (film); + ContentPropertiesDialog* d = new ContentPropertiesDialog (_parent, film, _content.front()); d->ShowModal (); d->Destroy (); } diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index efc0e6ef1..7dcc6f8f1 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -34,11 +34,11 @@ using std::map; using boost::shared_ptr; using boost::dynamic_pointer_cast; -ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr content) +ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr film, shared_ptr content) : TableDialog (parent, _("Content Properties"), 2, 1, false) { map > grouped; - BOOST_FOREACH (UserProperty i, content->user_properties()) { + BOOST_FOREACH (UserProperty i, content->user_properties(film)) { if (grouped.find(i.category) == grouped.end()) { grouped[i.category] = list (); } diff --git a/src/wx/content_properties_dialog.h b/src/wx/content_properties_dialog.h index 92aa5c6d7..5d0cd4630 100644 --- a/src/wx/content_properties_dialog.h +++ b/src/wx/content_properties_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2016 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -25,12 +25,13 @@ #include class Content; +class Film; class UserProperty; class ContentPropertiesDialog : public TableDialog { public: - ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr content); + ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr film, boost::shared_ptr content); private: void maybe_add_group (std::map > const & groups, UserProperty::Category category); -- cgit v1.2.3