Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
authorCarl Hetherington <cth@carlh.net>
Thu, 31 Jan 2019 19:39:27 +0000 (19:39 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 31 Jan 2019 19:39:27 +0000 (19:39 +0000)
src/lib/dcpomatic_socket.h
src/lib/film.cc
src/lib/film.h
src/tools/dcpomatic.cc
src/wx/config_dialog.cc
src/wx/config_dialog.h

index 6f7c05e225e880321ef4adfb1fdcea2baec46c78..870e7315c3126fb67b67fa3b493ce2be34ee8a56 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include <boost/asio.hpp>
+#include <boost/noncopyable.hpp>
 
 /** @class Socket
  *  @brief A class to wrap a boost::asio::ip::tcp::socket with some things
index f4745d0995597d2e17a91fee185a26d187d8f2bf..e7861a032c12ce1a3688454b0febe533e827b4cb 100644 (file)
@@ -1220,6 +1220,31 @@ Film::playlist_change (ChangeType type)
 {
        signal_change (type, CONTENT);
        signal_change (type, NAME);
+
+       if (type == CHANGE_TYPE_DONE) {
+               /* Check that this change hasn't made our settings inconsistent */
+               bool change_made = false;
+               BOOST_FOREACH (shared_ptr<Content> i, content()) {
+                       shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent>(i);
+                       if (!d) {
+                               continue;
+                       }
+
+                       string why_not;
+                       if (d->reference_video() && !d->can_reference_video(shared_from_this(), why_not)) {
+                               d->set_reference_video(false);
+                               change_made = true;
+                       }
+                       if (d->reference_audio() && !d->can_reference_audio(shared_from_this(), why_not)) {
+                               d->set_reference_audio(false);
+                               change_made = true;
+                       }
+               }
+
+               if (change_made) {
+                       Message (_("DCP-o-matic had to change your settings for referring to DCPs as OV.  Please review those settings to make sure they are what you want."));
+               }
+       }
 }
 
 void
index 7fdd4d269eaa8c679002a13bdb3f81c4a8cc743b..b77ce7a7651099dfd4334381002613b824207af4 100644 (file)
@@ -334,6 +334,9 @@ public:
        /** Emitted when some property of our content has changed */
        mutable boost::signals2::signal<void (ChangeType, boost::weak_ptr<Content>, int, bool)> ContentChange;
 
+       /** Emitted when we have something important to tell the user */
+       boost::signals2::signal<void (std::string)> Message;
+
        /** Current version number of the state file */
        static int const current_state_version;
 
index 2e8a595ad206cf1fd778afab8123df15a5397f6b..db3d2205215bbe5cbaa344239ad5809a081d6221 100644 (file)
@@ -457,6 +457,7 @@ public:
                }
                if (_film) {
                        _film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1));
+                       _film->Message.connect (boost::bind(&DOMFrame::film_message, this, _1));
                }
        }
 
@@ -466,6 +467,11 @@ public:
 
 private:
 
+       void film_message (string m)
+       {
+               message_dialog (this, std_to_wx(m));
+       }
+
        void film_change (ChangeType type)
        {
                if (type == CHANGE_TYPE_DONE) {
index 8b6d215a2759bc37f3fbc68415ebfe3be01ba822..13a4056708b9978a614bfdc3fc5a955cd097ae1f 100644 (file)
@@ -408,6 +408,8 @@ CertificateChainEditor::CertificateChainEditor (
        _button_sizer = new wxBoxSizer (wxHORIZONTAL);
        _remake_certificates = new Button (this, _("Re-make certificates and key..."));
        _button_sizer->Add (_remake_certificates, 1, wxRIGHT, border);
+       _export_chain = new Button (this, _("Export chain..."));
+       _button_sizer->Add (_export_chain, 1, wxRIGHT, border);
        table->Add (_button_sizer, wxGBPosition (r, 0), wxGBSpan (1, 4));
        ++r;
 
@@ -424,6 +426,7 @@ CertificateChainEditor::CertificateChainEditor (
        _certificates->Bind        (wxEVT_LIST_ITEM_SELECTED,   bind (&CertificateChainEditor::update_sensitivity, this));
        _certificates->Bind        (wxEVT_LIST_ITEM_DESELECTED, bind (&CertificateChainEditor::update_sensitivity, this));
        _remake_certificates->Bind (wxEVT_BUTTON,       bind (&CertificateChainEditor::remake_certificates, this));
+       _export_chain->Bind        (wxEVT_BUTTON,       bind (&CertificateChainEditor::export_chain, this));
        _import_private_key->Bind  (wxEVT_BUTTON,       bind (&CertificateChainEditor::import_private_key, this));
        _export_private_key->Bind  (wxEVT_BUTTON,       bind (&CertificateChainEditor::export_private_key, this));
 
@@ -542,6 +545,29 @@ CertificateChainEditor::export_certificate ()
        d->Destroy ();
 }
 
+void
+CertificateChainEditor::export_chain ()
+{
+       wxFileDialog* d = new wxFileDialog (
+               this, _("Select Chain File"), wxEmptyString, wxEmptyString, wxT("PEM files (*.pem)|*.pem"),
+               wxFD_SAVE | wxFD_OVERWRITE_PROMPT
+               );
+
+       if (d->ShowModal () == wxID_OK) {
+               boost::filesystem::path path (wx_to_std(d->GetPath()));
+               FILE* f = fopen_boost (path, "w");
+               if (!f) {
+                       throw OpenFileError (path, errno, false);
+               }
+
+               string const s = _get()->chain();
+               checked_fwrite (s.c_str(), s.length(), f, path);
+               fclose (f);
+       }
+
+       d->Destroy ();
+}
+
 void
 CertificateChainEditor::update_certificate_list ()
 {
@@ -737,8 +763,6 @@ KeysPage::setup ()
 
        wxButton* export_decryption_certificate = new Button (_panel, _("Export KDM decryption certificate..."));
        sizer->Add (export_decryption_certificate, 0, wxLEFT, _border);
-       wxButton* export_decryption_chain = new Button (_panel, _("Export KDM decryption chain..."));
-       sizer->Add (export_decryption_chain, 0, wxLEFT, _border);
        wxButton* export_settings = new Button (_panel, _("Export all KDM decryption settings..."));
        sizer->Add (export_settings, 0, wxLEFT, _border);
        wxButton* import_settings = new Button (_panel, _("Import all KDM decryption settings..."));
@@ -747,7 +771,6 @@ KeysPage::setup ()
        sizer->Add (decryption_advanced, 0, wxALL, _border);
 
        export_decryption_certificate->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_certificate, this));
-       export_decryption_chain->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain, this));
        export_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain_and_key, this));
        import_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::import_decryption_chain_and_key, this));
        decryption_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::decryption_advanced, this));
@@ -867,28 +890,6 @@ KeysPage::nag_remake_decryption_chain ()
                );
 }
 
-void
-KeysPage::export_decryption_chain ()
-{
-       wxFileDialog* d = new wxFileDialog (
-               _panel, _("Select Chain File"), wxEmptyString, _("dcpomatic_kdm_decryption_chain.pem"), wxT ("PEM files (*.pem)|*.pem"),
-               wxFD_SAVE | wxFD_OVERWRITE_PROMPT
-               );
-
-       if (d->ShowModal () == wxID_OK) {
-               boost::filesystem::path path (wx_to_std(d->GetPath()));
-               FILE* f = fopen_boost (path, "w");
-               if (!f) {
-                       throw OpenFileError (path, errno, false);
-               }
-
-               string const s = Config::instance()->decryption_chain()->chain();
-               checked_fwrite (s.c_str(), s.length(), f, path);
-               fclose (f);
-       }
-       d->Destroy ();
-}
-
 void
 KeysPage::export_decryption_certificate ()
 {
index 3b8762d8b073238f7d01b9908a9344ffcbeef657..896b463d819d01af0c889035bc41559f90b9ef6a 100644 (file)
@@ -135,6 +135,7 @@ private:
        void update_private_key ();
        void import_private_key ();
        void export_private_key ();
+       void export_chain ();
 
        wxListCtrl* _certificates;
        wxButton* _add_certificate;
@@ -144,6 +145,7 @@ private:
        wxStaticText* _private_key;
        wxButton* _import_private_key;
        wxButton* _export_private_key;
+       wxButton* _export_chain;
        wxStaticText* _private_key_bad;
        wxSizer* _sizer;
        wxBoxSizer* _button_sizer;
@@ -173,7 +175,6 @@ private:
        void setup ();
 
        void export_decryption_certificate ();
-       void export_decryption_chain ();
        void config_changed () {}
        bool nag_remake_decryption_chain ();
        void decryption_advanced ();