Allow specification of video bit rate separately for J2K and MPEG2.
[dcpomatic.git] / src / tools / dcpomatic_disk.cc
index 595ff21c549a5baa898e404452d20c285ead9a6a..cd07f935d227f4793c4b37da0cecd8042181fce5 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/wx_util.h"
 #include "wx/wx_signal_manager.h"
 #include "wx/wx_util.h"
+#include "wx/wx_variant.h"
 #include "lib/config.h"
 #include "lib/constants.h"
 #include "lib/copy_to_drive_job.h"
@@ -43,6 +44,7 @@
 #include <dcp/filesystem.h>
 #include <dcp/warnings.h>
 #include <wx/cmdline.h>
+#include <wx/progdlg.h>
 #include <wx/wx.h>
 LIBDCP_DISABLE_WARNINGS
 #include <boost/process.hpp>
@@ -130,7 +132,7 @@ public:
                auto grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
 
                int r = 0;
-               add_label_to_sizer (grid, overall_panel, _("DCP"), true, wxGBPosition(r, 0));
+               add_label_to_sizer(grid, overall_panel, _("DCPs"), true, wxGBPosition(r, 0));
                auto dcp_sizer = new wxBoxSizer (wxHORIZONTAL);
                auto dcps = new EditableList<boost::filesystem::path, DirDialogWrapper>(
                        overall_panel,
@@ -149,9 +151,9 @@ public:
                add_label_to_sizer (grid, overall_panel, _("Drive"), true, wxGBPosition(r, 0));
                auto drive_sizer = new wxBoxSizer (wxHORIZONTAL);
                _drive = new wxChoice (overall_panel, wxID_ANY);
-               drive_sizer->Add (_drive, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+               drive_sizer->Add(_drive, 1, wxTOP, 2);
                _drive_refresh = new wxButton (overall_panel, wxID_ANY, _("Refresh"));
-               drive_sizer->Add (_drive_refresh, 0);
+               drive_sizer->Add(_drive_refresh, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
                grid->Add (drive_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
                ++r;
 
@@ -159,7 +161,7 @@ public:
                grid->Add (_jobs, wxGBPosition(r, 0), wxGBSpan(6, 2), wxEXPAND);
                r += 6;
 
-               _copy = new wxButton (overall_panel, wxID_ANY, _("Copy DCP"));
+               _copy = new wxButton(overall_panel, wxID_ANY, _("Copy DCPs"));
                grid->Add (_copy, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
                ++r;
 
@@ -172,7 +174,7 @@ public:
                _sizer->Add (grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
                overall_panel->SetSizer (_sizer);
                Fit ();
-               SetSize (1024, GetSize().GetHeight() + 32);
+               SetSize(768, GetSize().GetHeight() + 32);
 
                /* XXX: this is a hack, but I expect we'll need logs and I'm not sure if there's
                 * a better place to put them.
@@ -181,7 +183,17 @@ public:
                dcpomatic_log->set_types (dcpomatic_log->types() | LogEntry::TYPE_DISK);
                LOG_DISK("dcpomatic_disk %1 started", dcpomatic_git_commit);
 
-               drive_refresh ();
+               {
+                       int constexpr seconds_to_look = 3;
+                       wxProgressDialog find_drives_progress(_("Disk Writer"), _("Finding disks"), seconds_to_look * 4, this);
+                       for (auto i = 0; i < seconds_to_look * 4; ++i) {
+                               if (!find_drives_progress.Update(i)) {
+                                       break;
+                               }
+                               drive_refresh();
+                               dcpomatic_sleep_milliseconds(250);
+                       }
+               }
 
                Bind (wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1));
                Bind (wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1));
@@ -314,7 +326,7 @@ private:
 #if defined(DCPOMATIC_WINDOWS)
                        auto m = make_wx<MessageDialog>(
                                this,
-                               _("DCP-o-matic Disk Writer"),
+                               variant::wx::dcpomatic_disk_writer(),
                                _("Do you see a 'User Account Control' dialogue asking about dcpomatic2_disk_writer.exe?  If so, click 'Yes', then try again.")
                                );
                        m->ShowModal ();
@@ -322,8 +334,8 @@ private:
 #elif defined(DCPOMATIC_OSX)
                        auto m = make_wx<MessageDialog>(
                                this,
-                               _("DCP-o-matic Disk Writer"),
-                               _("Did you install the DCP-o-matic Disk Writer.pkg from the .dmg?  Please check and try again.")
+                               variant::wx::dcpomatic_disk_writer(),
+                               variant::wx::insert_dcpomatic(_("Did you install the %s Disk Writer.pkg from the .dmg?  Please check and try again."))
                                );
                        m->ShowModal ();
                        return;
@@ -355,7 +367,7 @@ private:
                        if (!reply || reply->type() != DiskWriterBackEndResponse::Type::OK) {
                                auto m = make_wx<MessageDialog>(
                                                this,
-                                               _("DCP-o-matic Disk Writer"),
+                                               variant::wx::dcpomatic_disk_writer(),
                                                wxString::Format(
                                                        _("The drive %s could not be unmounted.\nClose any application that is using it, then try again. (%s)"),
                                                        std_to_wx(drive.description()),
@@ -443,7 +455,7 @@ public:
                        Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
                        Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
 
-                       SetAppName (_("DCP-o-matic Disk Writer"));
+                       SetAppName(variant::wx::dcpomatic_disk_writer());
 
                        if (!wxApp::OnInit()) {
                                return false;
@@ -484,12 +496,17 @@ public:
                                        return false;
                                }
                                if (!warning->confirmed()) {
-                                       message_dialog(nullptr, _("You did not correctly confirm that you read the warning that was just shown.  DCP-o-matic Disk Writer will close now.  Please try again."));
+                                       message_dialog(
+                                               nullptr,
+                                               variant::wx::insert_dcpomatic_disk_writer(
+                                                       _("You did not correctly confirm that you read the warning that was just shown.  %s will close now.  Please try again.")
+                                                       )
+                                               );
                                        return false;
                                }
                        }
 
-                       _frame = new DOMFrame (_("DCP-o-matic Disk Writer"));
+                       _frame = new DOMFrame(variant::wx::dcpomatic_disk_writer());
                        SetTopWindow (_frame);
 
                        _frame->Show ();
@@ -503,7 +520,7 @@ public:
                }
                catch (exception& e)
                {
-                       error_dialog (0, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
+                       error_dialog(nullptr, wxString::Format(_("%s could not start"), variant::wx::dcpomatic_disk_writer()), std_to_wx(e.what()));
                        return false;
                }