Show hints before make DCP (#823).
authorCarl Hetherington <cth@carlh.net>
Thu, 7 Jul 2016 23:13:00 +0000 (00:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 8 Jul 2016 00:52:16 +0000 (01:52 +0100)
ChangeLog
src/lib/config.cc
src/lib/config.h
src/tools/dcpomatic.cc
src/wx/hints_dialog.cc
src/wx/hints_dialog.h

index 2268d78fd860a8ba65b4c686cd135f6661a4ba3b..a4d35e7daccc03ac98b4c325a741b8ce066c84bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-07-08  Carl Hetherington  <cth@carlh.net>
 
+       * Show hints before making DCP / sending to batch
+       converter (#823).
+
        * Allow import of some more types of DNxHR file.
 
        * Support shadow in subtitles (#911).
index 891d832a24c6575a6e4b1130bb149334416e673b..91966eefb323e04ceeab951ead1da994065a90fd 100644 (file)
@@ -106,6 +106,7 @@ Config::set_defaults ()
        _win32_console = false;
 #endif
        _cinemas_file = path ("cinemas.xml");
+       _show_hints_before_make_dcp = true;
 
        _allowed_dcp_frame_rates.clear ();
        _allowed_dcp_frame_rates.push_back (24);
@@ -297,6 +298,7 @@ Config::read ()
        }
 
        _cinemas_file = f.optional_string_child("CinemasFile").get_value_or (path ("cinemas.xml").string ());
+       _show_hints_before_make_dcp = f.optional_bool_child("ShowHintsBeforeMakeDCP").get_value_or (true);
 
        /* Replace any cinemas from config.xml with those from the configured file */
        if (boost::filesystem::exists (_cinemas_file)) {
@@ -449,6 +451,7 @@ Config::write_config_xml () const
        }
 
        root->add_child("CinemasFile")->add_child_text (_cinemas_file.string());
+       root->add_child("ShowHintsBeforeMakeDCP")->add_child_text (_show_hints_before_make_dcp ? "1" : "0");
 
        try {
                doc.write_to_file_formatted (path("config.xml").string ());
index 1ffcfdb9881831f90de4e98d5f3c7c4196c87eba..feaac8390842b902559ea3d90e86f7e0156f7d5e 100644 (file)
@@ -262,6 +262,10 @@ public:
                return _cinemas_file;
        }
 
+       bool show_hints_before_make_dcp () const {
+               return _show_hints_before_make_dcp;
+       }
+
        /** @param n New number of local encoding threads */
        void set_num_local_encoding_threads (int n) {
                maybe_set (_num_local_encoding_threads, n);
@@ -466,6 +470,10 @@ public:
 
        void set_cinemas_file (boost::filesystem::path file);
 
+       void set_show_hints_before_make_dcp (bool s) {
+               maybe_set (_show_hints_before_make_dcp, s);
+       }
+
        void clear_history () {
                _history.clear ();
                changed ();
@@ -572,6 +580,7 @@ private:
        std::vector<boost::filesystem::path> _history;
        std::vector<dcp::EncryptedKDM> _dkdms;
        boost::filesystem::path _cinemas_file;
+       bool _show_hints_before_make_dcp;
 
        /** Singleton instance, or 0 */
        static Config* _instance;
index 6b1d4d260dc3b044252ed5423502d3ca98541f2c..f3146428216ce3d90e2a88076dc282f689768224 100644 (file)
@@ -58,6 +58,7 @@
 #include "lib/compose.hpp"
 #include "lib/cinema_kdms.h"
 #include "lib/dcpomatic_socket.h"
+#include "lib/hints.h"
 #include <dcp/exceptions.h>
 #include <wx/generic/aboutdlgg.h>
 #include <wx/stdpaths.h>
@@ -455,6 +456,15 @@ private:
                        }
                }
 
+               if (!get_hints(_film).empty() && Config::instance()->show_hints_before_make_dcp()) {
+                       HintsDialog* hints = new HintsDialog (this, _film, false);
+                       int const r = hints->ShowModal();
+                       hints->Destroy ();
+                       if (r == wxID_CANCEL) {
+                               return;
+                       }
+               }
+
                try {
                        /* It seems to make sense to auto-save metadata here, since the make DCP may last
                           a long time, and crashes/power failures are moderately likely.
@@ -517,6 +527,15 @@ private:
                        return;
                }
 
+               if (!get_hints(_film).empty() && Config::instance()->show_hints_before_make_dcp()) {
+                       HintsDialog* hints = new HintsDialog (this, _film, false);
+                       int const r = hints->ShowModal();
+                       hints->Destroy ();
+                       if (r == wxID_CANCEL) {
+                               return;
+                       }
+               }
+
                _film->write_metadata ();
 
                /* i = 0; try to connect via socket
@@ -663,7 +682,7 @@ private:
        void tools_hints ()
        {
                if (!_hints_dialog) {
-                       _hints_dialog = new HintsDialog (this, _film);
+                       _hints_dialog = new HintsDialog (this, _film, true);
                }
 
                _hints_dialog->Show ();
index f45eda0f7e453e5160f1687bb0f16f32b76b638f..cb971a671a02f9d82ca1eae733d977acc1e43b1d 100644 (file)
@@ -22,6 +22,7 @@
 #include "wx_util.h"
 #include "lib/film.h"
 #include "lib/hints.h"
+#include "lib/config.h"
 #include <wx/richtext/richtextctrl.h>
 #include <boost/foreach.hpp>
 
@@ -32,7 +33,7 @@ using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 
-HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> film)
+HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> film, bool ok)
        : wxDialog (parent, wxID_ANY, _("Hints"))
        , _film (film)
 {
@@ -40,11 +41,23 @@ HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> film)
        _text = new wxRichTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300), wxRE_READONLY);
        sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
-       if (buttons) {
-               sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       if (!ok) {
+               wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show hints again"));
+               sizer->Add (b, 0, wxALL, 6);
+               b->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, bind (&HintsDialog::shut_up, this, _1));
        }
 
+       wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer (0);
+       sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
+       if (ok) {
+               buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
+       } else {
+               buttons->SetAffirmativeButton (new wxButton (this, wxID_OK, _("Make DCP anyway")));
+               buttons->SetNegativeButton (new wxButton (this, wxID_CANCEL, _("Go back")));
+       }
+
+       buttons->Realize ();
+
        SetSizer (sizer);
        sizer->Layout ();
        sizer->SetSizeHints (this);
@@ -83,3 +96,9 @@ HintsDialog::film_changed ()
                _text->EndSymbolBullet ();
        }
 }
+
+void
+HintsDialog::shut_up (wxCommandEvent& ev)
+{
+       Config::instance()->set_show_hints_before_make_dcp (!ev.IsChecked());
+}
index 72530c0bd7262425b102fc6933c36afa7cef9245..c02cc8c85b0e196f71610e0718fe957f9b5594f6 100644 (file)
@@ -28,10 +28,11 @@ class Film;
 class HintsDialog : public wxDialog
 {
 public:
-       HintsDialog (wxWindow* parent, boost::weak_ptr<Film>);
+       HintsDialog (wxWindow* parent, boost::weak_ptr<Film>, bool ok);
 
 private:
        void film_changed ();
+       void shut_up (wxCommandEvent& ev);
 
        boost::weak_ptr<Film> _film;
        wxRichTextCtrl* _text;