diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-05-28 11:24:54 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-28 11:24:54 +0200 |
| commit | 04b34b7139407e3afa241939bc5416cf1bf06aef (patch) | |
| tree | d54d13ab1190a93d2e462422630be9a5586958f6 /src | |
| parent | b9d1f711143ddb18245170b309e2395560cebe0a (diff) | |
Add some useful command-line options to dcpomatic2_disk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_disk.cc | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index 784dc4a81..f495ecc41 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -38,6 +38,7 @@ #include "lib/util.h" #include "lib/version.h" #include "lib/warnings.h" +#include <wx/cmdline.h> #include <wx/wx.h> DCPOMATIC_DISABLE_WARNINGS #include <boost/process.hpp> @@ -179,6 +180,12 @@ public: dcpomatic_sleep_seconds (1); } + void set_dcp (boost::filesystem::path dcp) + { + _dcp_path = dcp; + _dcp_name->SetLabel (std_to_wx(dcp.filename().string())); + } + private: void sized (wxSizeEvent& ev) { @@ -236,8 +243,7 @@ private: return; } - _dcp_path = path; - _dcp_name->SetLabel (std_to_wx(_dcp_path->filename().string())); + set_dcp (path); setup_sensitivity (); } @@ -393,11 +399,18 @@ private: }; +static const wxCmdLineEntryDesc command_line_description[] = { + { wxCMD_LINE_OPTION, "d", "dcp", "DCP to write", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_SWITCH, "s", "sure", "skip alpha test warnings", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } +}; + + class App : public wxApp { public: App () - : _frame (0) + : _frame (nullptr) {} bool OnInit () @@ -441,18 +454,24 @@ public: */ Config::drop (); - auto warning = new DiskWarningDialog (); - warning->ShowModal (); - if (!warning->confirmed()) { - return false; + if (!_skip_alpha_check) { + auto warning = new DiskWarningDialog (); + warning->ShowModal (); + if (!warning->confirmed()) { + return false; + } + warning->Destroy (); } - warning->Destroy (); _frame = new DOMFrame (_("DCP-o-matic Disk Writer")); SetTopWindow (_frame); _frame->Show (); + if (_dcp_to_write) { + _frame->set_dcp (*_dcp_to_write); + } + signal_manager = new wxSignalManager (this); Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1)); } @@ -465,6 +484,24 @@ public: return true; } + void OnInitCmdLine (wxCmdLineParser& parser) + { + parser.SetDesc (command_line_description); + parser.SetSwitchChars (wxT ("-")); + } + + bool OnCmdLineParsed (wxCmdLineParser& parser) + { + _skip_alpha_check = parser.Found(wxT("sure")); + + wxString dcp; + if (parser.Found(wxT("dcp"), &dcp)) { + _dcp_to_write = wx_to_std (dcp); + } + + return true; + } + void config_failed_to_load () { message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create.")); @@ -520,6 +557,8 @@ public: } DOMFrame* _frame; + bool _skip_alpha_check = false; + boost::optional<boost::filesystem::path> _dcp_to_write; }; IMPLEMENT_APP (App) |
