Fix insensitive subtitle controls after adding a VF.
authorCarl Hetherington <cth@carlh.net>
Thu, 5 Jan 2017 16:39:52 +0000 (16:39 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 Jan 2017 16:39:52 +0000 (16:39 +0000)
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/wx/subtitle_panel.cc

index 2eead3ee00d38be0212c411a7c695bfab771a0a5..b5c1e647c105409a8bca7370d3a9de508eb166de 100644 (file)
@@ -60,6 +60,7 @@ int const DCPContentProperty::REFERENCE_VIDEO    = 602;
 int const DCPContentProperty::REFERENCE_AUDIO    = 603;
 int const DCPContentProperty::REFERENCE_SUBTITLE = 604;
 int const DCPContentProperty::NAME               = 605;
+int const DCPContentProperty::HAS_SUBTITLES      = 606;
 
 DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
@@ -143,6 +144,7 @@ DCPContent::examine (shared_ptr<Job> job)
        bool const needed_assets = needs_assets ();
        bool const needed_kdm = needs_kdm ();
        string const old_name = name ();
+       bool had_subtitles = static_cast<bool> (subtitle);
 
        job->set_progress_unknown ();
        Content::examine (job);
@@ -163,12 +165,16 @@ DCPContent::examine (shared_ptr<Job> job)
 
        signal_changed (AudioContentProperty::STREAMS);
 
+       bool has_subtitles = false;
        {
                boost::mutex::scoped_lock lm (_mutex);
                _name = examiner->name ();
                if (examiner->has_subtitles ()) {
                        subtitle.reset (new SubtitleContent (this));
+               } else {
+                       subtitle.reset ();
                }
+               has_subtitles = static_cast<bool> (subtitle);
                _encrypted = examiner->encrypted ();
                _needs_assets = examiner->needs_assets ();
                _kdm_valid = examiner->kdm_valid ();
@@ -178,6 +184,10 @@ DCPContent::examine (shared_ptr<Job> job)
                _reel_lengths = examiner->reel_lengths ();
        }
 
+       if (had_subtitles != has_subtitles) {
+               signal_changed (DCPContentProperty::HAS_SUBTITLES);
+       }
+
        if (needed_assets != needs_assets ()) {
                signal_changed (DCPContentProperty::NEEDS_ASSETS);
        }
index ae8efa65e5e8378dbd0df524d090960265e3e13b..18d198fe89cbe3514bdbf26ff1d30ae14012b0be 100644 (file)
@@ -38,6 +38,7 @@ public:
        static int const REFERENCE_AUDIO;
        static int const REFERENCE_SUBTITLE;
        static int const NAME;
+       static int const HAS_SUBTITLES;
 };
 
 class ContentPart;
index 91e2847dd0a8138527ea088098ccfd0c46048141..810cdf488b0c06121dcfadfeea037be017f34234 100644 (file)
@@ -224,6 +224,8 @@ SubtitlePanel::film_content_changed (int property)
                        checked_set (_reference, false);
                }
 
+               setup_sensitivity ();
+       } else if (property == DCPContentProperty::HAS_SUBTITLES) {
                setup_sensitivity ();
        }
 }