X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_kdm.cc;h=7a8d7cf349d532749ba69b8cfaf217d7bc232d41;hp=ee5e454579bfda8812f6b2e324437dd5a4c59401;hb=25eb7aa723af004162fc7f95995df250c4e4571b;hpb=e573f4fa173608dcb7ca23f543b49d5be26a8226 diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index ee5e45457..7a8d7cf34 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -19,43 +19,45 @@ */ -#include "wx/full_config_dialog.h" #include "wx/about_dialog.h" -#include "wx/report_problem_dialog.h" +#include "wx/dcpomatic_button.h" +#include "wx/editable_list.h" #include "wx/file_picker_ctrl.h" -#include "wx/wx_util.h" -#include "wx/wx_signal_manager.h" -#include "wx/screens_panel.h" -#include "wx/kdm_timing_panel.h" -#include "wx/kdm_output_panel.h" +#include "wx/full_config_dialog.h" #include "wx/job_view_dialog.h" -#include "wx/file_dialog_wrapper.h" +#include "wx/kdm_output_panel.h" +#include "wx/kdm_timing_panel.h" +#include "wx/nag_dialog.h" #include "wx/new_dkdm_folder_dialog.h" -#include "wx/editable_list.h" +#include "wx/report_problem_dialog.h" +#include "wx/screens_panel.h" #include "wx/static_text.h" -#include "wx/dcpomatic_button.h" -#include "wx/nag_dialog.h" +#include "wx/wx_signal_manager.h" +#include "wx/wx_util.h" +#include "lib/cinema.h" +#include "lib/compose.hpp" #include "lib/config.h" -#include "lib/util.h" -#include "lib/screen.h" +#include "lib/cross.h" +#include "lib/dcpomatic_log.h" +#include "lib/dkdm_wrapper.h" +#include "lib/exceptions.h" +#include "lib/file_log.h" #include "lib/job_manager.h" #include "lib/kdm_with_metadata.h" -#include "lib/exceptions.h" +#include "lib/screen.h" #include "lib/send_kdm_email_job.h" -#include "lib/compose.hpp" -#include "lib/cinema.h" -#include "lib/dkdm_wrapper.h" -#include "lib/cross.h" +#include "lib/util.h" #include #include #include -#include "lib/warnings.h" -DCPOMATIC_DISABLE_WARNINGS -#include +#include +LIBDCP_DISABLE_WARNINGS +#include #include #include -#include -DCPOMATIC_ENABLE_WARNINGS +#include +#include +LIBDCP_ENABLE_WARNINGS #ifdef __WXOSX__ #include #endif @@ -68,11 +70,12 @@ DCPOMATIC_ENABLE_WARNINGS using std::exception; using std::list; -using std::string; -using std::vector; -using std::pair; +using std::make_shared; using std::map; +using std::pair; using std::shared_ptr; +using std::string; +using std::vector; using boost::bind; using boost::optional; using boost::ref; @@ -92,7 +95,7 @@ class DOMFrame : public wxFrame { public: explicit DOMFrame (wxString const & title) - : wxFrame (0, -1, title) + : wxFrame (nullptr, -1, title) , _config_dialog (nullptr) , _job_view (nullptr) { @@ -179,8 +182,7 @@ public: h = new StaticText (overall_panel, _("Output")); h->SetFont (subheading_font); right->Add (h, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - /* XXX: hard-coded non-interop here */ - _output = new KDMOutputPanel (overall_panel, false); + _output = new KDMOutputPanel (overall_panel); right->Add (_output, 0, wxALL, DCPOMATIC_SIZER_Y_GAP); _create = new Button (overall_panel, _("Create KDMs")); @@ -203,6 +205,8 @@ public: _export_dkdm->Bind (wxEVT_BUTTON, bind (&DOMFrame::export_dkdm_clicked, this)); setup_sensitivity (); + + dcpomatic_log = make_shared(State::write_path("kdm.log")); } private: @@ -338,7 +342,7 @@ private: begin, end, decrypted.annotation_text().get_value_or (""), - decrypted.content_title_text(), + title, dcp::LocalTime().as_string() ); @@ -361,11 +365,7 @@ private: name_values['i'] = encrypted.cpl_id (); /* Encrypt */ - kdms.push_back ( - KDMWithMetadataPtr( - new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) - ) - ); + kdms.push_back (make_shared(name_values, i->cinema.get(), i->cinema->emails, encrypted)); } } @@ -410,9 +410,9 @@ private: _output->setup_sensitivity (); wxArrayTreeItemIds sel; _dkdm->GetSelections (sel); - shared_ptr group = dynamic_pointer_cast(selected_dkdm()); - shared_ptr dkdm = dynamic_pointer_cast(selected_dkdm()); - _create->Enable (!_screens->screens().empty() && sel.GetCount() > 0); + auto group = dynamic_pointer_cast(selected_dkdm()); + auto dkdm = dynamic_pointer_cast(selected_dkdm()); + _create->Enable (!_screens->screens().empty() && sel.GetCount() > 0 && dkdm); _remove_dkdm->Enable (sel.GetCount() > 0 && (!group || group->name() != "root")); _export_dkdm->Enable (sel.GetCount() > 0 && dkdm); } @@ -458,8 +458,8 @@ private: /* Decrypt the DKDM to make sure that we can */ dcp::DecryptedKDM dkdm(ekdm, chain->key().get()); - shared_ptr new_dkdm(new DKDM(ekdm)); - auto group = dynamic_pointer_cast (selected_dkdm ()); + auto new_dkdm = make_shared(ekdm); + auto group = dynamic_pointer_cast (selected_dkdm()); if (!group) { group = Config::instance()->dkdms (); } @@ -492,8 +492,8 @@ private: { auto d = new NewDKDMFolderDialog (this); if (d->ShowModal() == wxID_OK) { - shared_ptr new_dkdm (new DKDMGroup (wx_to_std (d->get ()))); - auto parent = dynamic_pointer_cast (selected_dkdm ()); + auto new_dkdm = make_shared(wx_to_std(d->get())); + auto parent = dynamic_pointer_cast(selected_dkdm()); if (!parent) { parent = Config::instance()->dkdms (); } @@ -610,6 +610,7 @@ private: JobViewDialog* _job_view; }; + /** @class App * @brief The magic App class for wxWidgets. */ @@ -618,12 +619,12 @@ class App : public wxApp public: App () : wxApp () - , _frame (0) + , _frame (nullptr) {} private: - bool OnInit () + bool OnInit () override { wxSplashScreen* splash = nullptr; @@ -674,7 +675,7 @@ private: _frame->Maximize (); if (splash) { splash->Destroy (); - splash = 0; + splash = nullptr; } _frame->Show (); @@ -693,7 +694,7 @@ private: } /* An unhandled exception has occurred inside the main event loop */ - bool OnExceptionInMainLoop () + bool OnExceptionInMainLoop () override { try { throw; @@ -708,10 +709,10 @@ private: ); } catch (exception& e) { error_dialog ( - 0, + nullptr, wxString::Format ( _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM, - std_to_wx (e.what ()) + std_to_wx(e.what()) ) ); } catch (...) { @@ -722,9 +723,9 @@ private: return false; } - void OnUnhandledException () + void OnUnhandledException () override { - error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); + error_dialog (nullptr, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); } void idle () @@ -739,7 +740,7 @@ private: void config_warning (string m) { - message_dialog (_frame, std_to_wx (m)); + message_dialog (_frame, std_to_wx(m)); } DOMFrame* _frame;