diff options
Diffstat (limited to 'src/tools/dcpomatic.cc')
| -rw-r--r-- | src/tools/dcpomatic.cc | 773 |
1 files changed, 390 insertions, 383 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 691841bbc..4c1221d60 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -107,6 +107,7 @@ LIBDCP_DISABLE_WARNINGS #include <wx/cmdline.h> #include <wx/generic/aboutdlgg.h> #include <wx/preferences.h> +#include <wx/progdlg.h> #include <wx/splash.h> #include <wx/stdpaths.h> #include <wx/wxhtml.h> @@ -153,10 +154,10 @@ using namespace boost::placeholders; class FilmChangedClosingDialog { public: - explicit FilmChangedClosingDialog (string name) + explicit FilmChangedClosingDialog(string name) : _dialog( nullptr, - wxString::Format(_("Save changes to film \"%s\" before closing?"), std_to_wx (name).data()), + wxString::Format(_("Save changes to film \"%s\" before closing?"), std_to_wx(name).data()), /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current /// project (Film) has been changed since it was last saved. _("Film changed"), @@ -168,7 +169,7 @@ public: ); } - int run () + int run() { return _dialog.ShowModal(); } @@ -181,10 +182,10 @@ private: class FilmChangedDuplicatingDialog { public: - explicit FilmChangedDuplicatingDialog (string name) + explicit FilmChangedDuplicatingDialog(string name) : _dialog( nullptr, - wxString::Format(_("Save changes to film \"%s\" before duplicating?"), std_to_wx (name).data()), + wxString::Format(_("Save changes to film \"%s\" before duplicating?"), std_to_wx(name).data()), /// TRANSLATORS: this is the heading for a dialog box, which tells the user that the current /// project (Film) has been changed since it was last saved. _("Film changed"), @@ -196,7 +197,7 @@ public: ); } - int run () + int run() { return _dialog.ShowModal(); } @@ -310,8 +311,8 @@ private: class DOMFrame : public wxFrame { public: - explicit DOMFrame (wxString const& title) - : wxFrame (nullptr, -1, title) + explicit DOMFrame(wxString const& title) + : wxFrame(nullptr, -1, title) /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. */ @@ -320,11 +321,11 @@ public: , _film_viewer(_right_panel, false) { auto bar = new wxMenuBar; - setup_menu (bar); - SetMenuBar (bar); + setup_menu(bar); + SetMenuBar(bar); #ifdef DCPOMATIC_WINDOWS - SetIcon (wxIcon (std_to_wx ("id"))); + SetIcon(wxIcon(std_to_wx("id"))); #endif _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this, _1)); @@ -332,46 +333,46 @@ public: _analytics_message_connection = Analytics::instance()->Message.connect(boost::bind(&DOMFrame::analytics_message, this, _1, _2)); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_new, this), ID_file_new); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_save, this), ID_file_save); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_save_as_template, this), ID_file_save_as_template); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_duplicate, this), ID_file_duplicate); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_duplicate_and_open, this), ID_file_duplicate_and_open); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_close, this), ID_file_close); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_history, this, _1), ID_file_history, ID_file_history + HISTORY_SIZE); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_copy, this), ID_edit_copy); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_paste, this), ID_edit_paste); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_select_all, this), ID_edit_select_all); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_make_dcp, this), ID_jobs_make_dcp); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_make_kdms, this), ID_jobs_make_kdms); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_make_dkdms, this), ID_jobs_make_dkdms); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_make_dcp_batch, this), ID_jobs_make_dcp_batch); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_make_self_dkdm, this), ID_jobs_make_self_dkdm); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_export_video_file, this), ID_jobs_export_video_file); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_export_subtitles, this), ID_jobs_export_subtitles); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_send_dcp_to_tms, this), ID_jobs_send_dcp_to_tms); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_show_dcp, this), ID_jobs_show_dcp); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::jobs_open_dcp_in_player, this), ID_jobs_open_dcp_in_player); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_closed_captions, this), ID_view_closed_captions); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_video_waveform, this), ID_view_video_waveform); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_version_file, this), ID_tools_version_file); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_hints, this), ID_tools_hints); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_encoding_servers, this), ID_tools_encoding_servers); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_manage_templates, this), ID_tools_manage_templates); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_check_for_updates, this), ID_tools_check_for_updates); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_system_information, this),ID_tools_system_information); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_restore_default_preferences, this), ID_tools_restore_default_preferences); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_export_preferences, this), ID_tools_export_preferences); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_import_preferences, this), ID_tools_import_preferences); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_user_manual, this), ID_help_user_manual); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_report_a_problem, this), ID_help_report_a_problem); - - Bind (wxEVT_CLOSE_WINDOW, boost::bind (&DOMFrame::close, this, _1)); - Bind (wxEVT_SHOW, boost::bind (&DOMFrame::show, this, _1)); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_new, this), ID_file_new); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_open, this), ID_file_open); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_save, this), ID_file_save); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_save_as_template, this), ID_file_save_as_template); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_duplicate, this), ID_file_duplicate); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_duplicate_and_open, this), ID_file_duplicate_and_open); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_close, this), ID_file_close); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_history, this, _1), ID_file_history, ID_file_history + HISTORY_SIZE); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::file_exit, this), wxID_EXIT); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::edit_copy, this), ID_edit_copy); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::edit_paste, this), ID_edit_paste); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::edit_select_all, this), ID_edit_select_all); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::edit_preferences, this), wxID_PREFERENCES); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_make_dcp, this), ID_jobs_make_dcp); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_make_kdms, this), ID_jobs_make_kdms); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_make_dkdms, this), ID_jobs_make_dkdms); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_make_dcp_batch, this), ID_jobs_make_dcp_batch); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_make_self_dkdm, this), ID_jobs_make_self_dkdm); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_export_video_file, this), ID_jobs_export_video_file); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_export_subtitles, this), ID_jobs_export_subtitles); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_send_dcp_to_tms, this), ID_jobs_send_dcp_to_tms); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_show_dcp, this), ID_jobs_show_dcp); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::jobs_open_dcp_in_player, this), ID_jobs_open_dcp_in_player); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::view_closed_captions, this), ID_view_closed_captions); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::view_video_waveform, this), ID_view_video_waveform); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_version_file, this), ID_tools_version_file); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_hints, this), ID_tools_hints); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_encoding_servers, this), ID_tools_encoding_servers); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_manage_templates, this), ID_tools_manage_templates); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_check_for_updates, this), ID_tools_check_for_updates); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_system_information, this),ID_tools_system_information); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_restore_default_preferences, this), ID_tools_restore_default_preferences); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_export_preferences, this), ID_tools_export_preferences); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::tools_import_preferences, this), ID_tools_import_preferences); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::help_about, this), wxID_ABOUT); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::help_user_manual, this), ID_help_user_manual); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::help_report_a_problem, this), ID_help_report_a_problem); + + Bind(wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1)); + Bind(wxEVT_SHOW, boost::bind(&DOMFrame::show, this, _1)); auto left_panel = new wxPanel(_splitter, wxID_ANY); @@ -386,27 +387,27 @@ public: _controls->set_film(_film_viewer.film()); auto job_manager_view = new JobManagerView(_right_panel, false); - auto right_sizer = new wxBoxSizer (wxVERTICAL); + auto right_sizer = new wxBoxSizer(wxVERTICAL); right_sizer->Add(_film_viewer.panel(), 2, wxEXPAND | wxALL, 6); - right_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6); - right_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL, 6); + right_sizer->Add(_controls, 0, wxEXPAND | wxALL, 6); + right_sizer->Add(job_manager_view, 1, wxEXPAND | wxALL, 6); _right_panel->SetSizer(right_sizer); _splitter->SplitVertically(left_panel, _right_panel, Config::instance()->main_divider_sash_position().get_value_or(left_panel->GetSize().GetWidth() + 8)); - set_menu_sensitivity (); + set_menu_sensitivity(); - _film_editor->content_panel()->SelectionChanged.connect (boost::bind (&DOMFrame::set_menu_sensitivity, this)); - set_title (); + _film_editor->content_panel()->SelectionChanged.connect(boost::bind(&DOMFrame::set_menu_sensitivity, this)); + set_title(); JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&DOMFrame::active_jobs_changed, this)); UpdateChecker::instance()->StateChanged.connect(boost::bind(&DOMFrame::update_checker_state_changed, this)); - FocusManager::instance()->SetFocus.connect (boost::bind (&DOMFrame::remove_accelerators, this)); - FocusManager::instance()->KillFocus.connect (boost::bind (&DOMFrame::add_accelerators, this)); - add_accelerators (); + FocusManager::instance()->SetFocus.connect(boost::bind(&DOMFrame::remove_accelerators, this)); + FocusManager::instance()->KillFocus.connect(boost::bind(&DOMFrame::add_accelerators, this)); + add_accelerators(); } ~DOMFrame() @@ -415,7 +416,7 @@ public: _video_waveform_dialog.reset(); } - void add_accelerators () + void add_accelerators() { #ifdef __WXOSX__ int accelerators = 7; @@ -424,63 +425,63 @@ public: #endif std::vector<wxAcceleratorEntry> accel(accelerators); /* [Shortcut] Ctrl+A:Add file(s) to the film */ - accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file); + accel[0].Set(wxACCEL_CTRL, static_cast<int>('A'), ID_add_file); /* [Shortcut] Delete:Remove selected content from film */ - accel[1].Set (wxACCEL_NORMAL, WXK_DELETE, ID_remove); + accel[1].Set(wxACCEL_NORMAL, WXK_DELETE, ID_remove); /* [Shortcut] Space:Start/stop playback */ - accel[2].Set (wxACCEL_NORMAL, WXK_SPACE, ID_start_stop); + accel[2].Set(wxACCEL_NORMAL, WXK_SPACE, ID_start_stop); /* [Shortcut] Ctrl+T:Open timeline window */ - accel[3].Set (wxACCEL_CTRL, static_cast<int>('T'), ID_timeline); + accel[3].Set(wxACCEL_CTRL, static_cast<int>('T'), ID_timeline); /* [Shortcut] Left arrow:Move back one frame */ - accel[4].Set (wxACCEL_NORMAL, WXK_LEFT, ID_back_frame); + accel[4].Set(wxACCEL_NORMAL, WXK_LEFT, ID_back_frame); /* [Shortcut] Right arrow:Move forward one frame */ - accel[5].Set (wxACCEL_NORMAL, WXK_RIGHT, ID_forward_frame); + accel[5].Set(wxACCEL_NORMAL, WXK_RIGHT, ID_forward_frame); #ifdef __WXOSX__ - accel[6].Set (wxACCEL_CTRL, static_cast<int>('W'), ID_file_close); + accel[6].Set(wxACCEL_CTRL, static_cast<int>('W'), ID_file_close); #endif - Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::remove_clicked, this, _1), ID_remove); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::start_stop_pressed, this), ID_start_stop); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::timeline_pressed, this), ID_timeline); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::back_frame, this), ID_back_frame); - Bind (wxEVT_MENU, boost::bind (&DOMFrame::forward_frame, this), ID_forward_frame); - wxAcceleratorTable accel_table (accelerators, accel.data()); - SetAcceleratorTable (accel_table); + Bind(wxEVT_MENU, boost::bind(&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::remove_clicked, this, _1), ID_remove); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::start_stop_pressed, this), ID_start_stop); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::timeline_pressed, this), ID_timeline); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::back_frame, this), ID_back_frame); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::forward_frame, this), ID_forward_frame); + wxAcceleratorTable accel_table(accelerators, accel.data()); + SetAcceleratorTable(accel_table); } - void remove_accelerators () + void remove_accelerators() { - SetAcceleratorTable (wxAcceleratorTable ()); + SetAcceleratorTable(wxAcceleratorTable()); } - void remove_clicked (wxCommandEvent& ev) + void remove_clicked(wxCommandEvent& ev) { - if (_film_editor->content_panel()->remove_clicked (true)) { - ev.Skip (); + if (_film_editor->content_panel()->remove_clicked(true)) { + ev.Skip(); } } /** Make a new film in the given path, using template_name as a template * (or the default template if it's empty). */ - void new_film (boost::filesystem::path path, optional<string> template_name) + void new_film(boost::filesystem::path path, optional<string> template_name) { auto film = make_shared<Film>(path); film->use_template(template_name); - film->set_name (path.filename().generic_string()); - film->write_metadata (); - set_film (film); + film->set_name(path.filename().generic_string()); + film->write_metadata(); + set_film(film); } - void load_film (boost::filesystem::path file) + void load_film(boost::filesystem::path file) try { auto film = make_shared<Film>(file); - auto const notes = film->read_metadata (); + auto const notes = film->read_metadata(); film->read_ui_state(); if (film->state_version() == 4) { - error_dialog ( + error_dialog( 0, _("This film was created with an old version of DVD-o-matic and may not load correctly " "in this version. Please check the film's settings carefully.") @@ -488,53 +489,53 @@ public: } for (auto i: notes) { - error_dialog (0, std_to_wx(i)); + error_dialog(0, std_to_wx(i)); } - set_film (film); + set_film(film); JobManager::instance()->add(make_shared<CheckContentJob>(film)); } catch (FileNotFoundError& e) { auto const dir = e.file().parent_path(); if (dcp::filesystem::exists(dir / "ASSETMAP") || dcp::filesystem::exists(dir / "ASSETMAP.xml")) { - error_dialog ( + error_dialog( this, variant::wx::insert_dcpomatic(_("Could not open this folder as a %s project.")), variant::wx::insert_dcpomatic( _("It looks like you are trying to open a DCP. File -> Open is for loading %s projects, not DCPs. " "To import a DCP, create a new project with File -> New and then click the \"Add DCP...\" button.")) ); } else { - auto const p = std_to_wx(file.string ()); - error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what())); + auto const p = std_to_wx(file.string()); + error_dialog(this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what())); } } catch (std::exception& e) { - auto const p = std_to_wx (file.string()); - error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what())); + auto const p = std_to_wx(file.string()); + error_dialog(this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what())); } - void set_film (shared_ptr<Film> film) + void set_film(shared_ptr<Film> film) { _film = film; _film_viewer.set_film(_film); _film_editor->set_film(_film); - _controls->set_film (_film); + _controls->set_film(_film); _video_waveform_dialog.reset(); - set_menu_sensitivity (); + set_menu_sensitivity(); if (_film && _film->directory()) { - Config::instance()->add_to_history (_film->directory().get()); + Config::instance()->add_to_history(_film->directory().get()); } if (_film) { - _film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1)); - _film->Message.connect (boost::bind(&DOMFrame::film_message, this, _1)); - _film->DirtyChange.connect (boost::bind(&DOMFrame::set_title, this)); - dcpomatic_log = _film->log (); + _film->Change.connect(boost::bind(&DOMFrame::film_change, this, _1)); + _film->Message.connect(boost::bind(&DOMFrame::film_message, this, _1)); + _film->DirtyChange.connect(boost::bind(&DOMFrame::set_title, this)); + dcpomatic_log = _film->log(); } - set_title (); + set_title(); } - shared_ptr<Film> film () const { + shared_ptr<Film> film() const { return _film; } @@ -543,7 +544,7 @@ private: void show (wxShowEvent& ev) { if (ev.IsShown() && !_first_shown_called) { - _film_editor->first_shown (); + _film_editor->first_shown(); _first_shown_called = true; #ifdef DCPOMATIC_WORKAROUND_MUTTER signal_manager->when_idle([this]() { Maximize(); }); @@ -551,19 +552,19 @@ private: } } - void film_message (string m) + void film_message(string m) { - message_dialog (this, std_to_wx(m)); + message_dialog(this, std_to_wx(m)); } - void film_change (ChangeType type) + void film_change(ChangeType type) { if (type == ChangeType::DONE) { - set_menu_sensitivity (); + set_menu_sensitivity(); } } - void file_new () + void file_new() { FilmNameLocationDialog dialog(this, _("New Film"), true); int const r = dialog.ShowModal(); @@ -587,23 +588,23 @@ private: wxString message = _("Could not create folder to store film."); message += char_to_wx(" "); if (!found_bad_chars.empty()) { - message += wxString::Format (_("Try removing the %s characters from your folder name."), std_to_wx(found_bad_chars).data()); + message += wxString::Format(_("Try removing the %s characters from your folder name."), std_to_wx(found_bad_chars).data()); } else { message += variant::wx::insert_dcpomatic(_("Please check that you do not have Windows controlled folder access enabled for %s.")); } - error_dialog (this, message, std_to_wx(e.what())); + error_dialog(this, message, std_to_wx(e.what())); #else - error_dialog (this, _("Could not create folder to store film."), std_to_wx(e.what())); + error_dialog(this, _("Could not create folder to store film."), std_to_wx(e.what())); #endif } } - void file_open () + void file_open() { wxDirDialog dialog( this, _("Select film to open"), - std_to_wx (Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()), + std_to_wx(Config::instance()->default_directory_or(wx_to_std(wxStandardPaths::Get().GetDocumentsDir())).string()), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST ); @@ -611,7 +612,7 @@ private: while (true) { r = dialog.ShowModal(); if (r == wxID_OK && dialog.GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { - error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); + error_dialog(this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); } else { break; } @@ -622,16 +623,16 @@ private: } } - void file_save () + void file_save() { try { - _film->write_metadata (); + _film->write_metadata(); } catch (exception& e) { error_dialog(this, _("Could not save project."), std_to_wx(e.what())); } } - void file_save_as_template () + void file_save_as_template() { SaveTemplateDialog dialog(this); if (dialog.ShowModal() == wxID_OK) { @@ -647,13 +648,16 @@ private: } } - void file_duplicate () + void file_duplicate() { FilmNameLocationDialog dialog(this, _("Duplicate Film"), false); if (dialog.ShowModal() == wxID_OK && dialog.check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) { auto film = make_shared<Film>(dialog.path()); - film->copy_from (_film); + wxProgressDialog progress(variant::wx::dcpomatic(), _("Duplicating film")); + film->copy_from(_film, [&progress](float value) { + progress.Update(value * 100); + }); film->set_name(dialog.path().filename().generic_string()); try { film->write_metadata(); @@ -663,26 +667,29 @@ private: } } - void file_duplicate_and_open () + void file_duplicate_and_open() { FilmNameLocationDialog dialog(this, _("Duplicate Film"), false); if (dialog.ShowModal() == wxID_OK && dialog.check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) { auto film = make_shared<Film>(dialog.path()); - film->copy_from (_film); + wxProgressDialog progress(variant::wx::dcpomatic(), _("Duplicating film")); + film->copy_from(_film, [&progress](float value) { + progress.Update(value * 100); + }); film->set_name(dialog.path().filename().generic_string()); try { - film->write_metadata (); - set_film (film); + film->write_metadata(); + set_film(film); } catch (exception& e) { error_dialog(this, _("Could not duplicate project."), std_to_wx(e.what())); } } } - void file_close () + void file_close() { - if (_film && _film->dirty ()) { + if (_film && _film->dirty()) { FilmChangedClosingDialog dialog(_film->name()); switch (dialog.run()) { case wxID_NO: @@ -690,7 +697,7 @@ private: break; case wxID_YES: /* Save and carry on to close */ - _film->write_metadata (); + _film->write_metadata(); break; case wxID_CANCEL: /* Stop */ @@ -698,25 +705,25 @@ private: } } - set_film (shared_ptr<Film>()); + set_film(shared_ptr<Film>()); } - void file_history (wxCommandEvent& event) + void file_history(wxCommandEvent& event) { - auto history = Config::instance()->history (); + auto history = Config::instance()->history(); int n = event.GetId() - ID_file_history; - if (n >= 0 && n < static_cast<int> (history.size ()) && maybe_save_then_delete_film<FilmChangedClosingDialog>()) { - load_film (history[n]); + if (n >= 0 && n < static_cast<int>(history.size()) && maybe_save_then_delete_film<FilmChangedClosingDialog>()) { + load_film(history[n]); } } - void file_exit () + void file_exit() { /* false here allows the close handler to veto the close request */ - Close (false); + Close(false); } - void edit_copy () + void edit_copy() { auto const sel = _film_editor->content_panel()->selected(); if (sel.size() == 1) { @@ -724,7 +731,7 @@ private: } } - void edit_paste () + void edit_paste() { if (!_clipboard) { return; @@ -737,19 +744,19 @@ private: for (auto i: _film_editor->content_panel()->selected()) { if (dialog.video() && i->video) { - DCPOMATIC_ASSERT (_clipboard->video); - i->video->take_settings_from (_clipboard->video); + DCPOMATIC_ASSERT(_clipboard->video); + i->video->take_settings_from(_clipboard->video); } if (dialog.audio() && i->audio) { - DCPOMATIC_ASSERT (_clipboard->audio); - i->audio->take_settings_from (_clipboard->audio); + DCPOMATIC_ASSERT(_clipboard->audio); + i->audio->take_settings_from(_clipboard->audio); } if (dialog.text()) { - auto j = i->text.begin (); - auto k = _clipboard->text.begin (); + auto j = i->text.begin(); + auto k = _clipboard->text.begin(); while (j != i->text.end() && k != _clipboard->text.end()) { - (*j)->take_settings_from (*k); + (*j)->take_settings_from(*k); ++j; ++k; } @@ -757,20 +764,20 @@ private: } } - void edit_select_all () + void edit_select_all() { _film_editor->content_panel()->select_all(); } - void edit_preferences () + void edit_preferences() { if (!_config_dialog) { - _config_dialog = create_full_config_dialog (); + _config_dialog = create_full_config_dialog(); } - _config_dialog->Show (this); + _config_dialog->Show(this); } - void tools_restore_default_preferences () + void tools_restore_default_preferences() { wxMessageDialog dialog( nullptr, @@ -780,11 +787,11 @@ private: ); if (dialog.ShowModal() == wxID_YES) { - Config::restore_defaults (); + Config::restore_defaults(); } } - void tools_export_preferences () + void tools_export_preferences() { FileDialog dialog( this, _("Specify ZIP file"), char_to_wx("ZIP files (*.zip)|*.zip"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, "Preferences", string("dcpomatic_config.zip") @@ -827,14 +834,14 @@ private: Config::instance()->load_from_zip(dialog.path(), action); } - void jobs_make_dcp () + void jobs_make_dcp() { double required; double available; if (!_film->should_be_enough_disk_space(required, available)) { auto const message = wxString::Format(_("The DCP for this film will take up about %.1f GB, and the disk that you are using only has %.1f GB available. Do you want to continue anyway?"), required, available); - if (!confirm_dialog (this, message)) { + if (!confirm_dialog(this, message)) { return; } } @@ -846,8 +853,8 @@ private: } } - if (_film->encrypted ()) { - NagDialog::maybe_nag ( + if (_film->encrypted()) { + NagDialog::maybe_nag( this, Config::NAG_ENCRYPTED_METADATA, _("You are making an encrypted DCP. It will not be possible to make KDMs for this DCP unless you have copies of " @@ -858,9 +865,9 @@ private: } /* Remove any existing DCP if the user agrees */ - auto const dcp_dir = _film->dir (_film->dcp_name(), false); + auto const dcp_dir = _film->dir(_film->dcp_name(), false); if (dcp::filesystem::exists(dcp_dir)) { - if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) { + if (!confirm_dialog(this, wxString::Format(_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) { return; } @@ -872,37 +879,37 @@ private: /* 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. */ - _film->write_metadata (); - make_dcp (_film, TranscodeJob::ChangedBehaviour::EXAMINE_THEN_STOP); + _film->write_metadata(); + make_dcp(_film, TranscodeJob::ChangedBehaviour::EXAMINE_THEN_STOP); } catch (BadSettingError& e) { - error_dialog (this, wxString::Format (_("Bad setting for %s."), std_to_wx(e.setting()).data()), std_to_wx(e.what())); + error_dialog(this, wxString::Format(_("Bad setting for %s."), std_to_wx(e.setting()).data()), std_to_wx(e.what())); } catch (std::exception& e) { - error_dialog (this, wxString::Format (_("Could not make DCP.")), std_to_wx(e.what())); + error_dialog(this, wxString::Format(_("Could not make DCP.")), std_to_wx(e.what())); } } - void jobs_make_kdms () + void jobs_make_kdms() { if (!_film) { return; } _kdm_dialog.reset(this, _film); - _kdm_dialog->Show (); + _kdm_dialog->Show(); } - void jobs_make_dkdms () + void jobs_make_dkdms() { if (!_film) { return; } _dkdm_dialog.reset(this, _film); - _dkdm_dialog->Show (); + _dkdm_dialog->Show(); } /** @return false if we succeeded, true if not */ - bool send_to_other_tool (int port, function<void()> start, string message) + bool send_to_other_tool(int port, function<void()> start, string message) { /* i = 0; try to connect via socket i = 1; try again, and then try to start the tool @@ -910,30 +917,30 @@ private: */ for (int i = 0; i < 8; ++i) { try { - Socket socket (5); + Socket socket(5); socket.connect("127.0.0.1", port); - DCPOMATIC_ASSERT (_film->directory ()); - socket.write (message.length() + 1); - socket.write ((uint8_t *) message.c_str(), message.length() + 1); + DCPOMATIC_ASSERT(_film->directory()); + socket.write(message.length() + 1); + socket.write((uint8_t *) message.c_str(), message.length() + 1); /* OK\0 */ uint8_t ok[3]; - socket.read (ok, 3); + socket.read(ok, 3); return false; } catch (exception& e) { } if (i == 1) { - start (); + start(); } - dcpomatic_sleep_seconds (1); + dcpomatic_sleep_seconds(1); } return true; } - void jobs_make_dcp_batch () + void jobs_make_dcp_batch() { if (!_film) { return; @@ -946,33 +953,33 @@ private: } } - _film->write_metadata (); + _film->write_metadata(); - if (send_to_other_tool (BATCH_JOB_PORT, &start_batch_converter, _film->directory()->string())) { + if (send_to_other_tool(BATCH_JOB_PORT, &start_batch_converter, _film->directory()->string())) { #ifdef DCPOMATIC_OSX - error_dialog (this, _("Could not start the batch converter. You may need to download it from dcpomatic.com.")); + error_dialog(this, _("Could not start the batch converter. You may need to download it from dcpomatic.com.")); #else - error_dialog (this, _("Could not find batch converter.")); + error_dialog(this, _("Could not find batch converter.")); #endif } } - void jobs_open_dcp_in_player () + void jobs_open_dcp_in_player() { if (!_film) { return; } - if (send_to_other_tool (PLAYER_PLAY_PORT, &start_player, _film->dir(_film->dcp_name(false)).string())) { + if (send_to_other_tool(PLAYER_PLAY_PORT, &start_player, _film->dir(_film->dcp_name(false)).string())) { #ifdef DCPOMATIC_OSX - error_dialog (this, _("Could not start the player. You may need to download it from dcpomatic.com.")); + error_dialog(this, _("Could not start the player. You may need to download it from dcpomatic.com.")); #else - error_dialog (this, _("Could not find player.")); + error_dialog(this, _("Could not find player.")); #endif } } - void jobs_make_self_dkdm () + void jobs_make_self_dkdm() { if (!_film) { return; @@ -983,10 +990,10 @@ private: return; } - NagDialog::maybe_nag ( + NagDialog::maybe_nag( this, Config::NAG_DKDM_CONFIG, - wxString::Format ( + wxString::Format( _("You are making a DKDM which is encrypted by a private key held in" "\n\n<tt>%s</tt>\n\nIt is <span weight=\"bold\" size=\"larger\">VITALLY IMPORTANT</span> " "that you <span weight=\"bold\" size=\"larger\">BACK UP THIS FILE</span> since if it is lost " @@ -995,10 +1002,10 @@ private: ); - dcp::LocalTime from (Config::instance()->signer_chain()->leaf().not_before()); - from.add_days (1); - dcp::LocalTime to (Config::instance()->signer_chain()->leaf().not_after()); - to.add_days (-1); + dcp::LocalTime from(Config::instance()->signer_chain()->leaf().not_before()); + from.add_days(1); + dcp::LocalTime to(Config::instance()->signer_chain()->leaf().not_after()); + to.add_days(-1); auto signer = Config::instance()->signer_chain(); if (!signer->valid()) { @@ -1013,22 +1020,22 @@ private: if (dialog.internal()) { auto dkdms = Config::instance()->dkdms(); dkdms->add(make_shared<DKDM>(kdm)); - Config::instance()->changed (); + Config::instance()->changed(); } else { auto path = dialog.directory() / (_film->dcp_name(false) + "_DKDM.xml"); kdm.as_xml(path); } } catch (dcp::NotEncryptedError& e) { - error_dialog (this, _("CPL's content is not encrypted.")); + error_dialog(this, _("CPL's content is not encrypted.")); } catch (exception& e) { error_dialog(this, std_to_wx(e.what())); } catch (...) { - error_dialog (this, _("An unknown exception occurred.")); + error_dialog(this, _("An unknown exception occurred.")); } } - void jobs_export_video_file () + void jobs_export_video_file() { ExportVideoFileDialog dialog(this, _film->isdcf_name(true)); if (dialog.ShowModal() != wxID_OK) { @@ -1047,15 +1054,15 @@ private: } auto job = make_shared<TranscodeJob>(_film, TranscodeJob::ChangedBehaviour::EXAMINE_THEN_STOP); - job->set_encoder ( + job->set_encoder( make_shared<FFmpegFilmEncoder>( _film, job, dialog.path(), dialog.format(), dialog.mixdown_to_stereo(), dialog.split_reels(), dialog.split_streams(), dialog.x264_crf()) ); - JobManager::instance()->add (job); + JobManager::instance()->add(job); } - void jobs_export_subtitles () + void jobs_export_subtitles() { ExportSubtitlesDialog dialog(this, _film->reels().size(), _film->interop()); if (dialog.ShowModal() != wxID_OK) { @@ -1077,40 +1084,40 @@ private: } - void jobs_send_dcp_to_tms () + void jobs_send_dcp_to_tms() { - _film->send_dcp_to_tms (); + _film->send_dcp_to_tms(); } - void jobs_show_dcp () + void jobs_show_dcp() { - DCPOMATIC_ASSERT (_film->directory ()); + DCPOMATIC_ASSERT(_film->directory()); if (show_in_file_manager(_film->directory().get(), _film->dir(_film->dcp_name(false)))) { - error_dialog (this, _("Could not show DCP.")); + error_dialog(this, _("Could not show DCP.")); } } - void view_closed_captions () + void view_closed_captions() { - _film_viewer.show_closed_captions (); + _film_viewer.show_closed_captions(); } - void view_video_waveform () + void view_video_waveform() { if (!_video_waveform_dialog) { _video_waveform_dialog.reset(this, _film, _film_viewer); } - _video_waveform_dialog->Show (); + _video_waveform_dialog->Show(); } - void tools_system_information () + void tools_system_information() { if (!_system_information_dialog) { - _system_information_dialog = new SystemInformationDialog (this, _film_viewer); + _system_information_dialog = new SystemInformationDialog(this, _film_viewer); } - _system_information_dialog->Show (); + _system_information_dialog->Show(); } void tools_version_file() @@ -1124,40 +1131,40 @@ private: _dcp_referencing_dialog->Show(); } - void tools_hints () + void tools_hints() { if (!_hints_dialog) { - _hints_dialog = new HintsDialog (this, _film, true); + _hints_dialog = new HintsDialog(this, _film, true); } - _hints_dialog->Show (); + _hints_dialog->Show(); } - void tools_encoding_servers () + void tools_encoding_servers() { if (!_servers_list_dialog) { - _servers_list_dialog = new ServersListDialog (this); + _servers_list_dialog = new ServersListDialog(this); } - _servers_list_dialog->Show (); + _servers_list_dialog->Show(); } - void tools_manage_templates () + void tools_manage_templates() { if (!_templates_dialog) { _templates_dialog.reset(this); } - _templates_dialog->Show (); + _templates_dialog->Show(); } - void tools_check_for_updates () + void tools_check_for_updates() { _update_news_requested = true; UpdateChecker::instance()->run(); } - void help_about () + void help_about() { AboutDialog dialog(this); dialog.ShowModal(); @@ -1168,7 +1175,7 @@ private: wxLaunchDefaultBrowser(std_to_wx("https://dcpomatic.com/manual")); } - void help_report_a_problem () + void help_report_a_problem() { ReportProblemDialog dialog(this, _film); if (dialog.ShowModal() == wxID_OK) { @@ -1176,9 +1183,9 @@ private: } } - bool should_close () + bool should_close() { - if (!JobManager::instance()->work_to_do ()) { + if (!JobManager::instance()->work_to_do()) { return true; } @@ -1192,14 +1199,14 @@ private: return dialog.ShowModal() == wxID_YES; } - void close (wxCloseEvent& ev) + void close(wxCloseEvent& ev) { - if (!should_close ()) { - ev.Veto (); + if (!should_close()) { + ev.Veto(); return; } - if (_film && _film->dirty ()) { + if (_film && _film->dirty()) { FilmChangedClosingDialog dialog(_film->name()); switch (dialog.run()) { case wxID_NO: @@ -1207,11 +1214,11 @@ private: break; case wxID_YES: /* Save and carry on to close */ - _film->write_metadata (); + _film->write_metadata(); break; case wxID_CANCEL: /* Veto the event and stop */ - ev.Veto (); + ev.Veto(); return; } } @@ -1220,15 +1227,15 @@ private: cause the File menu to be altered, which itself will be deleted around now (without, as far as I can see, any way for us to find out). */ - _config_changed_connection.disconnect (); + _config_changed_connection.disconnect(); /* Also stop hearing about analytics-related stuff */ - _analytics_message_connection.disconnect (); + _analytics_message_connection.disconnect(); FontConfig::drop(); - ev.Skip (); - JobManager::drop (); + ev.Skip(); + JobManager::drop(); } void active_jobs_changed() @@ -1240,16 +1247,16 @@ private: signal_manager->when_idle(boost::bind(&DOMFrame::set_menu_sensitivity, this)); } - void set_menu_sensitivity () + void set_menu_sensitivity() { - auto jobs = JobManager::instance()->get (); + auto jobs = JobManager::instance()->get(); auto const dcp_creation = std::any_of( jobs.begin(), jobs.end(), [](shared_ptr<const Job> job) { return dynamic_pointer_cast<const DCPTranscodeJob>(job) && !job->finished(); }); - bool const have_cpl = _film && !_film->cpls().empty (); + bool const have_cpl = _film && !_film->cpls().empty(); bool const have_single_selected_content = _film_editor->content_panel()->selected().size() == 1; bool const have_selected_content = !_film_editor->content_panel()->selected().empty(); bool const have_selected_video_content = !_film_editor->content_panel()->selected_video().empty(); @@ -1301,7 +1308,7 @@ private: enabled = false; } - j.first->Enable (enabled); + j.first->Enable(enabled); } } @@ -1309,7 +1316,7 @@ private: * should continue, false to abort it. */ template <class T> - bool maybe_save_film () + bool maybe_save_film() { if (!_film) { return true; @@ -1338,131 +1345,131 @@ private: } template <class T> - bool maybe_save_then_delete_film () + bool maybe_save_then_delete_film() { - bool const r = maybe_save_film<T> (); + bool const r = maybe_save_film<T>(); if (r) { - _film.reset (); + _film.reset(); } return r; } - void add_item (wxMenu* menu, wxString text, int id, int sens) + void add_item(wxMenu* menu, wxString text, int id, int sens) { - auto item = menu->Append (id, text); - menu_items.insert (make_pair (item, sens)); + auto item = menu->Append(id, text); + menu_items.insert(make_pair(item, sens)); } - void setup_menu (wxMenuBar* m) + void setup_menu(wxMenuBar* m) { _file_menu = new wxMenu; /* [Shortcut] Ctrl+N:New film */ - add_item (_file_menu, _("New...\tCtrl-N"), ID_file_new, ALWAYS); + add_item(_file_menu, _("New...\tCtrl-N"), ID_file_new, ALWAYS); /* [Shortcut] Ctrl+O:Open existing film */ - add_item (_file_menu, _("&Open...\tCtrl-O"), ID_file_open, ALWAYS); - _file_menu->AppendSeparator (); + add_item(_file_menu, _("&Open...\tCtrl-O"), ID_file_open, ALWAYS); + _file_menu->AppendSeparator(); /* [Shortcut] Ctrl+S:Save current film */ - add_item (_file_menu, _("&Save\tCtrl-S"), ID_file_save, NEEDS_FILM); - _file_menu->AppendSeparator (); - add_item (_file_menu, _("Save as &template..."), ID_file_save_as_template, NEEDS_FILM); - add_item (_file_menu, _("Duplicate..."), ID_file_duplicate, NEEDS_FILM); - add_item (_file_menu, _("Duplicate and open..."), ID_file_duplicate_and_open, NEEDS_FILM); + add_item(_file_menu, _("&Save\tCtrl-S"), ID_file_save, NEEDS_FILM); + _file_menu->AppendSeparator(); + add_item(_file_menu, _("Save as &template..."), ID_file_save_as_template, NEEDS_FILM); + add_item(_file_menu, _("Duplicate..."), ID_file_duplicate, NEEDS_FILM); + add_item(_file_menu, _("Duplicate and open..."), ID_file_duplicate_and_open, NEEDS_FILM); _history_position = _file_menu->GetMenuItems().GetCount(); - _file_menu->AppendSeparator (); + _file_menu->AppendSeparator(); /* [Shortcut] Ctrl+W:Close current film */ - add_item (_file_menu, _("&Close\tCtrl-W"), ID_file_close, NEEDS_FILM); + add_item(_file_menu, _("&Close\tCtrl-W"), ID_file_close, NEEDS_FILM); #ifndef __WXOSX__ - _file_menu->AppendSeparator (); + _file_menu->AppendSeparator(); #endif #ifdef __WXOSX__ - add_item (_file_menu, _("&Exit"), wxID_EXIT, ALWAYS); + add_item(_file_menu, _("&Exit"), wxID_EXIT, ALWAYS); #else - add_item (_file_menu, _("&Quit"), wxID_EXIT, ALWAYS); + add_item(_file_menu, _("&Quit"), wxID_EXIT, ALWAYS); #endif auto edit = new wxMenu; /* [Shortcut] Ctrl+C:Copy settings from currently selected content */ - add_item (edit, _("Copy settings\tCtrl-C"), ID_edit_copy, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SINGLE_SELECTED_CONTENT); + add_item(edit, _("Copy settings\tCtrl-C"), ID_edit_copy, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SINGLE_SELECTED_CONTENT); /* [Shortcut] Ctrl+V:Paste settings into currently selected content */ - add_item (edit, _("Paste settings...\tCtrl-V"), ID_edit_paste, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SELECTED_CONTENT | NEEDS_CLIPBOARD); - edit->AppendSeparator (); + add_item(edit, _("Paste settings...\tCtrl-V"), ID_edit_paste, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SELECTED_CONTENT | NEEDS_CLIPBOARD); + edit->AppendSeparator(); /* [Shortcut] Shift+Ctrl+A:Select all content */ - add_item (edit, _("Select all\tShift-Ctrl-A"), ID_edit_select_all, NEEDS_FILM); + add_item(edit, _("Select all\tShift-Ctrl-A"), ID_edit_select_all, NEEDS_FILM); #ifdef __WXOSX__ add_item(_file_menu, _("&Preferences...\tCtrl-,"), wxID_PREFERENCES, ALWAYS); #else - edit->AppendSeparator (); + edit->AppendSeparator(); /* [Shortcut] Ctrl+P:Open preferences window */ - add_item (edit, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS); + add_item(edit, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS); #endif auto jobs_menu = new wxMenu; /* [Shortcut] Ctrl+M:Make DCP */ - add_item (jobs_menu, _("&Make DCP\tCtrl-M"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION); + add_item(jobs_menu, _("&Make DCP\tCtrl-M"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION); /* [Shortcut] Ctrl+B:Make DCP in the batch converter*/ - add_item (jobs_menu, _("Make DCP in &batch converter\tCtrl-B"), ID_jobs_make_dcp_batch, NEEDS_FILM | NOT_DURING_DCP_CREATION); - jobs_menu->AppendSeparator (); + add_item(jobs_menu, _("Make DCP in &batch converter\tCtrl-B"), ID_jobs_make_dcp_batch, NEEDS_FILM | NOT_DURING_DCP_CREATION); + jobs_menu->AppendSeparator(); /* [Shortcut] Ctrl+K:Make KDMs */ - add_item (jobs_menu, _("Make &KDMs...\tCtrl-K"), ID_jobs_make_kdms, NEEDS_FILM); + add_item(jobs_menu, _("Make &KDMs...\tCtrl-K"), ID_jobs_make_kdms, NEEDS_FILM); /* [Shortcut] Ctrl+D:Make DKDMs */ - add_item (jobs_menu, _("Make &DKDMs...\tCtrl-D"), ID_jobs_make_dkdms, NEEDS_FILM); + add_item(jobs_menu, _("Make &DKDMs...\tCtrl-D"), ID_jobs_make_dkdms, NEEDS_FILM); add_item(jobs_menu, variant::wx::insert_dcpomatic(_("Make DKDM for %s...")), ID_jobs_make_self_dkdm, NEEDS_FILM | NEEDS_ENCRYPTION); - jobs_menu->AppendSeparator (); + jobs_menu->AppendSeparator(); /* [Shortcut] Ctrl+E:Export video file */ - add_item (jobs_menu, _("Export video file...\tCtrl-E"), ID_jobs_export_video_file, NEEDS_FILM); - add_item (jobs_menu, _("Export subtitles...\tShift-Ctrl-E"), ID_jobs_export_subtitles, NEEDS_FILM); - jobs_menu->AppendSeparator (); - add_item (jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); + add_item(jobs_menu, _("Export video file...\tCtrl-E"), ID_jobs_export_video_file, NEEDS_FILM); + add_item(jobs_menu, _("Export subtitles...\tShift-Ctrl-E"), ID_jobs_export_subtitles, NEEDS_FILM); + jobs_menu->AppendSeparator(); + add_item(jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); #if defined(DCPOMATIC_OSX) - add_item (jobs_menu, _("S&how DCP in Finder"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); + add_item(jobs_menu, _("S&how DCP in Finder"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); #elif defined(DCPOMATIC_WINDOWS) - add_item (jobs_menu, _("S&how DCP in Explorer"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); + add_item(jobs_menu, _("S&how DCP in Explorer"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); #else - add_item (jobs_menu, _("S&how DCP in Files"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); + add_item(jobs_menu, _("S&how DCP in Files"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); #endif - add_item (jobs_menu, _("Open DCP in &player"), ID_jobs_open_dcp_in_player, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); + add_item(jobs_menu, _("Open DCP in &player"), ID_jobs_open_dcp_in_player, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL); auto view = new wxMenu; - add_item (view, _("Closed captions..."), ID_view_closed_captions, NEEDS_FILM); - add_item (view, _("Video waveform..."), ID_view_video_waveform, NEEDS_FILM); + add_item(view, _("Closed captions..."), ID_view_closed_captions, NEEDS_FILM); + add_item(view, _("Video waveform..."), ID_view_video_waveform, NEEDS_FILM); auto tools = new wxMenu; - add_item (tools, _("Version File (VF)..."), ID_tools_version_file, NEEDS_FILM | NEEDS_DCP_CONTENT); - add_item (tools, _("Hints..."), ID_tools_hints, NEEDS_FILM); - add_item (tools, _("Encoding servers..."), ID_tools_encoding_servers, 0); - add_item (tools, _("Manage templates..."), ID_tools_manage_templates, 0); - add_item (tools, _("Check for updates"), ID_tools_check_for_updates, 0); - add_item (tools, _("System information..."), ID_tools_system_information, 0); - tools->AppendSeparator (); - add_item (tools, _("Restore default preferences"), ID_tools_restore_default_preferences, ALWAYS); - tools->AppendSeparator (); - add_item (tools, _("Export preferences..."), ID_tools_export_preferences, ALWAYS); - add_item (tools, _("Import preferences..."), ID_tools_import_preferences, ALWAYS); + add_item(tools, _("Version File (VF)..."), ID_tools_version_file, NEEDS_FILM | NEEDS_DCP_CONTENT); + add_item(tools, _("Hints..."), ID_tools_hints, NEEDS_FILM); + add_item(tools, _("Encoding servers..."), ID_tools_encoding_servers, 0); + add_item(tools, _("Manage templates..."), ID_tools_manage_templates, 0); + add_item(tools, _("Check for updates"), ID_tools_check_for_updates, 0); + add_item(tools, _("System information..."), ID_tools_system_information, 0); + tools->AppendSeparator(); + add_item(tools, _("Restore default preferences"), ID_tools_restore_default_preferences, ALWAYS); + tools->AppendSeparator(); + add_item(tools, _("Export preferences..."), ID_tools_export_preferences, ALWAYS); + add_item(tools, _("Import preferences..."), ID_tools_import_preferences, ALWAYS); wxMenu* help = new wxMenu; #ifdef __WXOSX__ add_item(help, variant::wx::insert_dcpomatic(_("About %s")), wxID_ABOUT, ALWAYS); #else - add_item (help, _("About"), wxID_ABOUT, ALWAYS); + add_item(help, _("About"), wxID_ABOUT, ALWAYS); #endif add_item(help, _("User manual..."), ID_help_user_manual, ALWAYS); if (variant::show_report_a_problem()) { add_item(help, _("Report a problem..."), ID_help_report_a_problem, ALWAYS); } - m->Append (_file_menu, _("&File")); - m->Append (edit, _("&Edit")); - m->Append (jobs_menu, _("&Jobs")); - m->Append (view, _("&View")); - m->Append (tools, _("&Tools")); - m->Append (help, _("&Help")); + m->Append(_file_menu, _("&File")); + m->Append(edit, _("&Edit")); + m->Append(jobs_menu, _("&Jobs")); + m->Append(view, _("&View")); + m->Append(tools, _("&Tools")); + m->Append(help, _("&Help")); } void config_changed(Config::Property what) @@ -1471,21 +1478,21 @@ private: try { Config::instance()->write_config(); } catch (exception& e) { - error_dialog ( + error_dialog( this, - wxString::Format ( + wxString::Format( _("Could not write to config file at %s. Your changes have not been saved."), - std_to_wx (Config::instance()->cinemas_file().string()).data() + std_to_wx(Config::instance()->cinemas_file().string()).data() ) ); } for (int i = 0; i < _history_items; ++i) { - delete _file_menu->Remove (ID_file_history + i); + delete _file_menu->Remove(ID_file_history + i); } if (_history_separator) { - _file_menu->Remove (_history_separator); + _file_menu->Remove(_history_separator); } delete _history_separator; _history_separator = 0; @@ -1493,11 +1500,11 @@ private: int pos = _history_position; /* Clear out non-existent history items before we re-build the menu */ - Config::instance()->clean_history (); + Config::instance()->clean_history(); auto history = Config::instance()->history(); - if (!history.empty ()) { - _history_separator = _file_menu->InsertSeparator (pos++); + if (!history.empty()) { + _history_separator = _file_menu->InsertSeparator(pos++); } for (size_t i = 0; i < history.size(); ++i) { @@ -1507,12 +1514,12 @@ private: } else { s = history[i].string(); } - _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s)); + _file_menu->Insert(pos++, ID_file_history + i, std_to_wx(s)); } - _history_items = history.size (); + _history_items = history.size(); - dcpomatic_log->set_types (Config::instance()->log_types()); + dcpomatic_log->set_types(Config::instance()->log_types()); #ifdef DCPOMATIC_GROK if (what == Config::GROK) { @@ -1523,9 +1530,9 @@ private: #endif } - void update_checker_state_changed () + void update_checker_state_changed() { - auto uc = UpdateChecker::instance (); + auto uc = UpdateChecker::instance(); bool const announce = _update_news_requested || @@ -1550,7 +1557,7 @@ private: _update_news_requested = false; } - void start_stop_pressed () + void start_stop_pressed() { if (_film_viewer.playing()) { _film_viewer.stop(); @@ -1559,28 +1566,28 @@ private: } } - void timeline_pressed () + void timeline_pressed() { - _film_editor->content_panel()->timeline_clicked (); + _film_editor->content_panel()->timeline_clicked(); } - void back_frame () + void back_frame() { _film_viewer.seek_by(-_film_viewer.one_video_frame(), true); } - void forward_frame () + void forward_frame() { _film_viewer.seek_by(_film_viewer.one_video_frame(), true); } - void analytics_message (string title, string html) + void analytics_message(string title, string html) { HTMLDialog dialog(this, std_to_wx(title), std_to_wx(html)); dialog.ShowModal(); } - void set_title () + void set_title() { auto s = variant::dcpomatic(); if (_film) { @@ -1592,7 +1599,7 @@ private: } } - SetTitle (std_to_wx(s)); + SetTitle(std_to_wx(s)); } FilmEditor* _film_editor; @@ -1629,7 +1636,7 @@ static const wxCmdLineEntryDesc command_line_description[] = { { wxCMD_LINE_SWITCH, "v", "version", "show version", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_OPTION, "", "config", "directory containing config.xml and cinemas.xml", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } + { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType(0), 0 } }; @@ -1639,18 +1646,18 @@ static const wxCmdLineEntryDesc command_line_description[] = { class App : public wxApp { public: - App () - : wxApp () + App() + : wxApp() { - dcpomatic_setup_path_encoding (); + dcpomatic_setup_path_encoding(); #ifdef DCPOMATIC_LINUX - XInitThreads (); + XInitThreads(); #endif } private: - bool OnInit () override + bool OnInit() override { try { @@ -1673,12 +1680,12 @@ private: cout << variant::insert_dcpomatic("{} is starting.") << "\n"; } #endif - wxInitAllImageHandlers (); + wxInitAllImageHandlers(); Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1)); - Config::Warning.connect (boost::bind (&App::config_warning, this, _1)); + Config::Warning.connect(boost::bind(&App::config_warning, this, _1)); - _splash = maybe_show_splash (); + _splash = maybe_show_splash(); SetAppName(variant::wx::dcpomatic()); @@ -1687,12 +1694,12 @@ private: } #ifdef DCPOMATIC_LINUX - unsetenv ("UBUNTU_MENUPROXY"); + unsetenv("UBUNTU_MENUPROXY"); #endif #ifdef DCPOMATIC_OSX - dcpomatic_sleep_seconds (1); - make_foreground_application (); + dcpomatic_sleep_seconds(1); + make_foreground_application(); #endif /* Enable i18n; this will create a Config object @@ -1706,28 +1713,28 @@ private: /* Set things up, including filters etc. which will now be internationalised correctly. */ - dcpomatic_setup (); + dcpomatic_setup(); /* Force the configuration to be re-loaded correctly next time it is needed. */ - Config::drop (); + Config::drop(); /* We only look out for bad configuration from here on, as before dcpomatic_setup() we haven't got OpenSSL ready so there will be incorrect certificate chain validity errors. */ - Config::Bad.connect (boost::bind(&App::config_bad, this, _1)); + Config::Bad.connect(boost::bind(&App::config_bad, this, _1)); - signal_manager = new wxSignalManager (this); + signal_manager = new wxSignalManager(this); _frame = new DOMFrame(variant::wx::dcpomatic()); - SetTopWindow (_frame); - _frame->Maximize (); - close_splash (); + SetTopWindow(_frame); + _frame->Maximize(); + close_splash(); - if (running_32_on_64 ()) { - NagDialog::maybe_nag ( + if (running_32_on_64()) { + NagDialog::maybe_nag( _frame, Config::NAG_32_ON_64, wxString::Format( _("You are running the 32-bit version of %s on a 64-bit version of Windows. " @@ -1740,34 +1747,34 @@ private: false); } - _frame->Show (); + _frame->Show(); - Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1)); + Bind(wxEVT_IDLE, boost::bind(&App::idle, this, _1)); if (!_film_to_load.empty() && dcp::filesystem::is_directory(_film_to_load)) { try { - _frame->load_film (_film_to_load); + _frame->load_film(_film_to_load); } catch (exception& e) { - error_dialog (nullptr, std_to_wx(fmt::format(wx_to_std(_("Could not load film {} ({})")), _film_to_load)), std_to_wx(e.what())); + error_dialog(nullptr, std_to_wx(fmt::format(wx_to_std(_("Could not load film {} ({})")), _film_to_load)), std_to_wx(e.what())); } } - if (!_film_to_create.empty ()) { - _frame->new_film (_film_to_create, optional<string>()); + if (!_film_to_create.empty()) { + _frame->new_film(_film_to_create, optional<string>()); if (!_content_to_add.empty()) { _frame->film()->examine_and_add_content(content_factory(_content_to_add)); } - if (!_dcp_to_add.empty ()) { + if (!_dcp_to_add.empty()) { _frame->film()->examine_and_add_content({make_shared<DCPContent>(_dcp_to_add)}); } } - Bind (wxEVT_TIMER, boost::bind (&App::check, this)); - _timer.reset (new wxTimer (this)); - _timer->Start (1000); + Bind(wxEVT_TIMER, boost::bind(&App::check, this)); + _timer.reset(new wxTimer(this)); + _timer->Start(1000); - if (Config::instance()->check_for_updates ()) { - UpdateChecker::instance()->run (); + if (Config::instance()->check_for_updates()) { + UpdateChecker::instance()->run(); } if (auto release_notes = find_release_notes(gui_is_dark())) { @@ -1790,51 +1797,51 @@ private: return true; } - void OnInitCmdLine (wxCmdLineParser& parser) override + void OnInitCmdLine(wxCmdLineParser& parser) override { - parser.SetDesc (command_line_description); + parser.SetDesc(command_line_description); parser.SetSwitchChars(char_to_wx("-")); } - bool OnCmdLineParsed (wxCmdLineParser& parser) override + bool OnCmdLineParsed(wxCmdLineParser& parser) override { if (parser.Found(char_to_wx("version"))) { cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; - exit (EXIT_SUCCESS); + exit(EXIT_SUCCESS); } if (parser.GetParamCount() > 0) { if (parser.Found(char_to_wx("new"))) { - _film_to_create = wx_to_std (parser.GetParam (0)); + _film_to_create = wx_to_std(parser.GetParam(0)); } else { - _film_to_load = wx_to_std (parser.GetParam (0)); + _film_to_load = wx_to_std(parser.GetParam(0)); } } wxString content; if (parser.Found(char_to_wx("content"), &content)) { - _content_to_add = wx_to_std (content); + _content_to_add = wx_to_std(content); } wxString dcp; if (parser.Found(char_to_wx("dcp"), &dcp)) { - _dcp_to_add = wx_to_std (dcp); + _dcp_to_add = wx_to_std(dcp); } wxString config; if (parser.Found(char_to_wx("config"), &config)) { - State::override_path = wx_to_std (config); + State::override_path = wx_to_std(config); } return true; } - void report_exception () + void report_exception() { try { throw; } catch (FileError& e) { - error_dialog ( + error_dialog( nullptr, wxString::Format( _("An exception occurred: %s (%s)\n\n%s"), @@ -1844,7 +1851,7 @@ private: ) ); } catch (boost::filesystem::filesystem_error& e) { - error_dialog ( + error_dialog( nullptr, wxString::Format( _("An exception occurred: %s (%s) (%s)\n\n%s"), @@ -1855,7 +1862,7 @@ private: ) ); } catch (exception& e) { - error_dialog ( + error_dialog( nullptr, wxString::Format( _("An exception occurred: %s.\n\n%s"), @@ -1869,34 +1876,34 @@ private: } /* An unhandled exception has occurred inside the main event loop */ - bool OnExceptionInMainLoop () override + bool OnExceptionInMainLoop() override { - report_exception (); + report_exception(); /* This will terminate the program */ return false; } - void OnUnhandledException () override + void OnUnhandledException() override { - report_exception (); + report_exception(); } - void idle (wxIdleEvent& ev) + void idle(wxIdleEvent& ev) { - signal_manager->ui_idle (); - ev.Skip (); + signal_manager->ui_idle(); + ev.Skip(); } - void check () + void check() { try { - EncodeServerFinder::instance()->rethrow (); + EncodeServerFinder::instance()->rethrow(); } catch (exception& e) { - error_dialog (0, std_to_wx (e.what ())); + error_dialog(0, std_to_wx(e.what())); } } - void close_splash () + void close_splash() { if (_splash) { _splash->Destroy(); @@ -1904,17 +1911,17 @@ private: } } - void config_failed_to_load (Config::LoadFailure what) + void config_failed_to_load(Config::LoadFailure what) { report_config_load_failure(_frame, what); } - void config_warning (string m) + void config_warning(string m) { - message_dialog (_frame, std_to_wx(m)); + message_dialog(_frame, std_to_wx(m)); } - bool config_bad (Config::BadReason reason) + bool config_bad(Config::BadReason reason) { /* Destroy the splash screen here, as otherwise bad things seem to happen (for reasons unknown) when we open our recreate dialog, close it, *then* try to Destroy the splash (the Destroy fails). @@ -1971,7 +1978,7 @@ private: variant::wx::insert_dcpomatic(_("Close %s")) ); if (dialog.ShowModal() != wxID_OK) { - exit (EXIT_FAILURE); + exit(EXIT_FAILURE); } return true; } @@ -1990,7 +1997,7 @@ private: variant::wx::insert_dcpomatic(_("Close %s")) ); if (dialog.ShowModal() != wxID_OK) { - exit (EXIT_FAILURE); + exit(EXIT_FAILURE); } return true; } @@ -2012,7 +2019,7 @@ private: return dialog.ShowModal() == wxID_OK; } default: - DCPOMATIC_ASSERT (false); + DCPOMATIC_ASSERT(false); } } @@ -2026,4 +2033,4 @@ private: }; -IMPLEMENT_APP (App) +IMPLEMENT_APP(App) |
