why_not in can_reference can just be a string rather than a list of strings.
authorCarl Hetherington <cth@carlh.net>
Tue, 27 Mar 2018 22:28:27 +0000 (23:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 27 Mar 2018 22:28:27 +0000 (23:28 +0100)
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/wx/audio_panel.cc
src/wx/content_sub_panel.cc
src/wx/content_sub_panel.h
src/wx/subtitle_panel.cc
src/wx/video_panel.cc
test/vf_test.cc

index ad489917d65c41e6a328ec6b0dd0f37b046085e9..c4f73e2b28092c04c9ac857ded1d86fc79c43be7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -429,22 +429,22 @@ DCPContent::reel_split_points () const
 }
 
 bool
-DCPContent::can_reference (function<shared_ptr<ContentPart> (shared_ptr<const Content>)> part, string overlapping, list<string>& why_not) const
+DCPContent::can_reference (function<shared_ptr<ContentPart> (shared_ptr<const Content>)> part, string overlapping, string& why_not) const
 {
        /* We must be using the same standard as the film */
        if (_standard) {
                if (_standard.get() == dcp::INTEROP && !film()->interop()) {
-                       why_not.push_back (_("The film is set to SMPTE and this DCP is Interop."));
+                       why_not = _("The film is set to SMPTE and this DCP is Interop.");
                        return false;
                } else if (_standard.get() == dcp::SMPTE && film()->interop()) {
-                       why_not.push_back (_("The film is set to Interop and this DCP is SMPTE."));
+                       why_not = _("The film is set to Interop and this DCP is SMPTE.");
                        return false;
                }
        }
 
        /* And the same frame rate */
        if (!video_frame_rate() || (lrint(video_frame_rate().get()) != film()->video_frame_rate())) {
-               why_not.push_back (_("The film has a different frame rate to this DCP."));
+               why_not = _("The film has a different frame rate to this DCP.");
                return false;
        }
 
@@ -466,14 +466,14 @@ DCPContent::can_reference (function<shared_ptr<ContentPart> (shared_ptr<const Co
        */
        BOOST_FOREACH (DCPTimePeriod i, reel_list) {
                if (find (fr.begin(), fr.end(), i) == fr.end ()) {
-                       why_not.push_back (_("The reel lengths in the film differ from those in the DCP; set the reel mode to 'split by video content'."));
+                       why_not = _("The reel lengths in the film differ from those in the DCP; set the reel mode to 'split by video content'.");
                        return false;
                }
        }
 
        ContentList a = overlaps (film()->content(), part, position(), end());
        if (a.size() != 1 || a.front().get() != this) {
-               why_not.push_back (overlapping);
+               why_not = overlapping;
                return false;
        }
 
@@ -481,10 +481,10 @@ DCPContent::can_reference (function<shared_ptr<ContentPart> (shared_ptr<const Co
 }
 
 bool
-DCPContent::can_reference_video (list<string>& why_not) const
+DCPContent::can_reference_video (string& why_not) const
 {
        if (film()->frame_size() != video->size()) {
-               why_not.push_back (_("The video frame size in the film differs from that in the DCP."));
+               why_not = _("The video frame size in the film differs from that in the DCP.");
                return false;
        }
 
@@ -492,7 +492,7 @@ DCPContent::can_reference_video (list<string>& why_not) const
 }
 
 bool
-DCPContent::can_reference_audio (list<string>& why_not) const
+DCPContent::can_reference_audio (string& why_not) const
 {
        shared_ptr<DCPDecoder> decoder;
        try {
@@ -507,7 +507,7 @@ DCPContent::can_reference_audio (list<string>& why_not) const
 
         BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder->reels()) {
                 if (!i->main_sound()) {
-                        why_not.push_back (_("The DCP does not have sound in all reels."));
+                        why_not = _("The DCP does not have sound in all reels.");
                         return false;
                 }
         }
@@ -516,7 +516,7 @@ DCPContent::can_reference_audio (list<string>& why_not) const
 }
 
 bool
-DCPContent::can_reference_subtitle (list<string>& why_not) const
+DCPContent::can_reference_subtitle (string& why_not) const
 {
        shared_ptr<DCPDecoder> decoder;
        try {
@@ -531,7 +531,7 @@ DCPContent::can_reference_subtitle (list<string>& why_not) const
 
         BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder->reels()) {
                 if (!i->main_subtitle()) {
-                        why_not.push_back (_("The DCP does not have subtitles in all reels."));
+                        why_not = _("The DCP does not have subtitles in all reels.");
                         return false;
                 }
         }
index 892b6aa735f7cb3fc589dc416400ede1defeab90..371ec7fff2cfbc3bdcd0803536f483f29459e4c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -97,7 +97,7 @@ public:
                return _reference_video;
        }
 
-       bool can_reference_video (std::list<std::string> &) const;
+       bool can_reference_video (std::string &) const;
 
        void set_reference_audio (bool r);
 
@@ -106,7 +106,7 @@ public:
                return _reference_audio;
        }
 
-       bool can_reference_audio (std::list<std::string> &) const;
+       bool can_reference_audio (std::string &) const;
 
        void set_reference_subtitle (bool r);
 
@@ -115,7 +115,7 @@ public:
                return _reference_subtitle;
        }
 
-       bool can_reference_subtitle (std::list<std::string> &) const;
+       bool can_reference_subtitle (std::string &) const;
 
        void set_cpl (std::string id);
 
@@ -139,7 +139,7 @@ private:
        bool can_reference (
                boost::function <boost::shared_ptr<ContentPart> (boost::shared_ptr<const Content>)>,
                std::string overlapping,
-               std::list<std::string>& why_not
+               std::string& why_not
                ) const;
 
        std::string _name;
index fd63abf6ca050b9624e799db0438abb3d4be2dab..14d8db07e5798339947a882ba25817885dd97113 100644 (file)
@@ -267,7 +267,7 @@ AudioPanel::setup_sensitivity ()
                dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
        }
 
-       list<string> why_not;
+       string why_not;
        bool const can_reference = dcp && dcp->can_reference_audio (why_not);
        setup_refer_button (_reference, dcp, can_reference, why_not);
 
index e0e0cd12bbc2372a6b5f2932c06c22f9b482fac6..92eb5a32fd1fca1fc8c351a50b1ad692b77b858d 100644 (file)
@@ -42,7 +42,7 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
 }
 
 void
-ContentSubPanel::setup_refer_button (wxCheckBox* button, shared_ptr<DCPContent> dcp, bool can_reference, list<string> why_not) const
+ContentSubPanel::setup_refer_button (wxCheckBox* button, shared_ptr<DCPContent> dcp, bool can_reference, string why_not) const
 {
        button->Enable (can_reference);
 
@@ -50,10 +50,7 @@ ContentSubPanel::setup_refer_button (wxCheckBox* button, shared_ptr<DCPContent>
        if (!dcp) {
                s = _("No DCP selected.");
        } else if (!can_reference) {
-               s = _("Cannot reference this DCP.  ");
-               BOOST_FOREACH (string i, why_not) {
-                       s += std_to_wx(i) + wxT("  ");
-               }
+               s = _("Cannot reference this DCP.  ") + std_to_wx(why_not);
        }
 
        button->SetToolTip (s);
index 44d5ee1a587e6c73afa73bdcb5e8bd9cd598a372..fb22b3a22970c243c506ca8a29959f3f5835db2e 100644 (file)
@@ -42,7 +42,7 @@ public:
 
 protected:
 
-       void setup_refer_button (wxCheckBox* button, boost::shared_ptr<DCPContent> dcp, bool can_reference, std::list<std::string> why_not) const;
+       void setup_refer_button (wxCheckBox* button, boost::shared_ptr<DCPContent> dcp, bool can_reference, std::string why_not) const;
 
        ContentPanel* _parent;
        wxSizer* _sizer;
index 0b94b335fd9c4adbf1cf37be0f685b34e7119e74..5bba1ec2ca006e681248f722a42d31edc1ddbcc0 100644 (file)
@@ -275,7 +275,7 @@ SubtitlePanel::setup_sensitivity ()
                dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
        }
 
-       list<string> why_not;
+       string why_not;
        bool const can_reference = dcp && dcp->can_reference_subtitle (why_not);
        setup_refer_button (_reference, dcp, can_reference, why_not);
 
index 294dd00e10c1c069cf0b77b4625594ec25ec8e7a..5fbe518c46196318564087c45c7032069f7b75a1 100644 (file)
@@ -462,7 +462,7 @@ VideoPanel::setup_sensitivity ()
                dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
        }
 
-       list<string> why_not;
+       string why_not;
        bool const can_reference = dcp && dcp->can_reference_video (why_not);
        setup_refer_button (_reference, dcp, can_reference, why_not);
 
index 7deb5358b0ad7a1d229d6110529de200ae3d3b05..3b3077242ad57c48cac0e6196deb57e20dc66093 100644 (file)
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE (vf_test1)
 
        /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
        film->set_reel_type (REELTYPE_SINGLE);
-       list<string> why_not;
+       string why_not;
        BOOST_CHECK (!dcp->can_reference_video(why_not));
        BOOST_CHECK (!dcp->can_reference_audio(why_not));
        BOOST_CHECK (!dcp->can_reference_subtitle(why_not));