diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-12-19 14:27:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-19 14:27:11 +0100 |
| commit | 127ba4071318ed2bee545bf983792ece369b5111 (patch) | |
| tree | 4077b00c773972a7401e2864b198597f33db5491 /src/tools | |
| parent | d36d580b7e38cfc2f3189c178ca6553aea921b28 (diff) | |
White space: dcpomatic_disk.cc, upmixer_a_test.cc, vf_test.cc
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_disk.cc | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index b8d451c23..6c8d1a0f6 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -80,8 +80,8 @@ enum { class DirDialogWrapper : public wxDirDialog { public: - DirDialogWrapper (wxWindow* parent) - : wxDirDialog (parent, _("Choose a DCP folder"), {}, wxDD_DIR_MUST_EXIST) + DirDialogWrapper(wxWindow* parent) + : wxDirDialog(parent, _("Choose a DCP folder"), {}, wxDD_DIR_MUST_EXIST) { } @@ -90,14 +90,14 @@ public: { auto const dcp = boost::filesystem::path(wx_to_std(GetPath())); if (!dcp::filesystem::exists(dcp / "ASSETMAP") && !dcp::filesystem::exists(dcp / "ASSETMAP.xml")) { - error_dialog (nullptr, _("No ASSETMAP or ASSETMAP.xml found in this folder. Please choose a DCP folder.")); + error_dialog(nullptr, _("No ASSETMAP or ASSETMAP.xml found in this folder. Please choose a DCP folder.")); return {}; } return { dcp }; } - void set (boost::filesystem::path) + void set(boost::filesystem::path) { /* Not used */ } @@ -107,33 +107,33 @@ public: class DOMFrame : public wxFrame { public: - explicit DOMFrame (wxString const & title) - : wxFrame (nullptr, wxID_ANY, title) - , _nanomsg (true) - , _sizer (new wxBoxSizer(wxVERTICAL)) + explicit DOMFrame(wxString const & title) + : wxFrame(nullptr, wxID_ANY, title) + , _nanomsg(true) + , _sizer(new wxBoxSizer(wxVERTICAL)) { #ifdef DCPOMATIC_OSX auto bar = new wxMenuBar; auto tools = new wxMenu; tools->Append(ID_tools_uninstall, _("Uninstall...")); bar->Append(tools, _("Tools")); - SetMenuBar (bar); - Bind (wxEVT_MENU, boost::bind(&DOMFrame::uninstall, this), ID_tools_uninstall); + SetMenuBar(bar); + Bind(wxEVT_MENU, boost::bind(&DOMFrame::uninstall, this), ID_tools_uninstall); #endif /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. */ - auto overall_panel = new wxPanel (this); - auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (overall_panel, 1, wxEXPAND); - SetSizer (s); + auto overall_panel = new wxPanel(this); + auto s = new wxBoxSizer(wxHORIZONTAL); + s->Add(overall_panel, 1, wxEXPAND); + SetSizer(s); - auto grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto grid = new wxGridBagSizer(DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); int r = 0; add_label_to_sizer(grid, overall_panel, _("DCPs"), true, wxGBPosition(r, 0)); - auto dcp_sizer = new wxBoxSizer (wxHORIZONTAL); + auto dcp_sizer = new wxBoxSizer(wxHORIZONTAL); auto dcps = new EditableList<boost::filesystem::path, DirDialogWrapper>( overall_panel, { EditableListColumn(_("DCP"), 300, true) }, @@ -148,39 +148,39 @@ public: grid->Add(dcp_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); ++r; - 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); + 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, wxTOP, 2); - _drive_refresh = new wxButton (overall_panel, wxID_ANY, _("Refresh")); + _drive_refresh = new wxButton(overall_panel, wxID_ANY, _("Refresh")); drive_sizer->Add(_drive_refresh, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP); - grid->Add (drive_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); + grid->Add(drive_sizer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); ++r; - _jobs = new JobManagerView (overall_panel, false); - grid->Add (_jobs, wxGBPosition(r, 0), wxGBSpan(6, 2), wxEXPAND); + _jobs = new JobManagerView(overall_panel, false); + grid->Add(_jobs, wxGBPosition(r, 0), wxGBSpan(6, 2), wxEXPAND); r += 6; _copy = new wxButton(overall_panel, wxID_ANY, _("Copy DCPs")); - grid->Add (_copy, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND); + grid->Add(_copy, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND); ++r; - grid->AddGrowableCol (1); + grid->AddGrowableCol(1); - _copy->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::copy, this)); - _drive->Bind (wxEVT_CHOICE, boost::bind(&DOMFrame::setup_sensitivity, this)); - _drive_refresh->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::drive_refresh, this)); + _copy->Bind(wxEVT_BUTTON, boost::bind(&DOMFrame::copy, this)); + _drive->Bind(wxEVT_CHOICE, boost::bind(&DOMFrame::setup_sensitivity, this)); + _drive_refresh->Bind(wxEVT_BUTTON, boost::bind(&DOMFrame::drive_refresh, this)); - _sizer->Add (grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER); - overall_panel->SetSizer (_sizer); - Fit (); + _sizer->Add(grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER); + overall_panel->SetSizer(_sizer); + Fit(); SetSize(768, GetSize().GetHeight() + 96); /* 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. */ dcpomatic_log = make_shared<FileLog>(State::write_path("disk.log")); - dcpomatic_log->set_types (dcpomatic_log->types() | LogEntry::TYPE_DISK); + dcpomatic_log->set_types(dcpomatic_log->types() | LogEntry::TYPE_DISK); LOG_DISK("dcpomatic_disk {} started", dcpomatic_git_commit); { @@ -195,15 +195,15 @@ public: } } - Bind (wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1)); - Bind (wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1)); + Bind(wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1)); + Bind(wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1)); JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&DOMFrame::setup_sensitivity, this)); #ifdef DCPOMATIC_WINDOWS /* We must use ::shell here, it seems, to avoid error code 740 (related to privilege escalation) */ LOG_DISK("Starting writer process {}", disk_writer_path().string()); - _writer = new boost::process::child (disk_writer_path(), boost::process::shell, boost::process::windows::hide); + _writer = new boost::process::child(disk_writer_path(), boost::process::shell, boost::process::windows::hide); #endif #ifdef DCPOMATIC_LINUX @@ -212,7 +212,7 @@ public: } else { LOG_DISK("Starting writer process {}", disk_writer_path().string()); #ifdef DCPOMATIC_BOOST_PROCESS_V1 - _writer = new boost::process::child (disk_writer_path()); + _writer = new boost::process::child(disk_writer_path()); #else _writer = new boost::process::v2::process(_context, disk_writer_path(), {}); #endif @@ -221,20 +221,20 @@ public: #ifdef DCPOMATIC_OSX LOG_DISK("Sending notification to writer daemon"); - notify_post ("com.dcpomatic.disk.writer.start"); + notify_post("com.dcpomatic.disk.writer.start"); #endif } - ~DOMFrame () + ~DOMFrame() { _nanomsg.send(DISK_WRITER_QUIT "\n", 2000); /* This seems really horrible but it's suggested by the examples on nanomsg.org, so... * Without this the quit is not received (at least sometimes) causing #2018. */ - dcpomatic_sleep_seconds (1); + dcpomatic_sleep_seconds(1); } - void set_dcp_paths (vector<boost::filesystem::path> dcps) + void set_dcp_paths(vector<boost::filesystem::path> dcps) { _dcp_paths = dcps; setup_sensitivity(); @@ -246,10 +246,10 @@ private: return _dcp_paths; } - void sized (wxSizeEvent& ev) + void sized(wxSizeEvent& ev) { - _sizer->Layout (); - ev.Skip (); + _sizer->Layout(); + ev.Skip(); } @@ -261,7 +261,7 @@ private: #endif - bool should_close () + bool should_close() { if (!JobManager::instance()->work_to_do()) { return true; @@ -278,28 +278,28 @@ private: } - void close (wxCloseEvent& ev) + void close(wxCloseEvent& ev) { if (!should_close()) { - ev.Veto (); + ev.Veto(); return; } - ev.Skip (); - JobManager::drop (); + ev.Skip(); + JobManager::drop(); } - void copy () + void copy() { /* Check that the selected drive still exists and update its properties if so */ - drive_refresh (); + drive_refresh(); if (_drive->GetSelection() == wxNOT_FOUND) { - error_dialog (this, _("The disk you selected is no longer available. Please choose another.")); + error_dialog(this, _("The disk you selected is no longer available. Please choose another.")); return; } - DCPOMATIC_ASSERT (_drive->GetSelection() != wxNOT_FOUND); - DCPOMATIC_ASSERT (!_dcp_paths.empty()); + DCPOMATIC_ASSERT(_drive->GetSelection() != wxNOT_FOUND); + DCPOMATIC_ASSERT(!_dcp_paths.empty()); auto ping = [this](int attempt) { if (_nanomsg.send(DISK_WRITER_PING "\n", 1000)) { @@ -314,7 +314,7 @@ private: } else { LOG_DISK("Could not send ping to writer (attempt {})", attempt); } - dcpomatic_sleep_seconds (1); + dcpomatic_sleep_seconds(1); return false; }; @@ -344,8 +344,8 @@ private: dialog.ShowModal(); return; #else - LOG_DISK ("Failed to ping writer"); - throw CommunicationFailedError (); + LOG_DISK("Failed to ping writer"); + throw CommunicationFailedError(); #endif } @@ -360,11 +360,11 @@ private: LOG_DISK("Sending unmount request to disk writer for {}", drive.as_xml()); if (!_nanomsg.send(DISK_WRITER_UNMOUNT "\n", 2000)) { LOG_DISK("Failed to send unmount request."); - throw CommunicationFailedError (); + throw CommunicationFailedError(); } if (!_nanomsg.send(drive.as_xml(), 2000)) { LOG_DISK("Failed to send drive for unmount request."); - throw CommunicationFailedError (); + throw CommunicationFailedError(); } /* The reply may have to wait for the user to authenticate, so let's wait a while */ auto const reply = DiskWriterBackEndResponse::read_from_nanomsg(_nanomsg, 30000); @@ -394,20 +394,20 @@ private: } JobManager::instance()->add(make_shared<CopyToDriveJob>(_dcp_paths, _drives[_drive->GetSelection()], _nanomsg)); - setup_sensitivity (); + setup_sensitivity(); } - void drive_refresh () + void drive_refresh() { - int const sel = _drive->GetSelection (); + int const sel = _drive->GetSelection(); wxString current; if (sel != wxNOT_FOUND) { - current = _drive->GetString (sel); + current = _drive->GetString(sel); } - _drive->Clear (); + _drive->Clear(); int re_select = wxNOT_FOUND; int j = 0; - _drives = Drive::get (); + _drives = Drive::get(); for (auto i: _drives) { auto const s = std_to_wx(i.description()); if (s == current) { @@ -416,13 +416,13 @@ private: _drive->Append(s); ++j; } - _drive->SetSelection (re_select); - setup_sensitivity (); + _drive->SetSelection(re_select); + setup_sensitivity(); } - void setup_sensitivity () + void setup_sensitivity() { - _copy->Enable (!_dcp_paths.empty() && _drive->GetSelection() != wxNOT_FOUND && !JobManager::instance()->work_to_do()); + _copy->Enable(!_dcp_paths.empty() && _drive->GetSelection() != wxNOT_FOUND && !JobManager::instance()->work_to_do()); } wxChoice* _drive; @@ -447,22 +447,22 @@ 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 } + { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType(0), 0 } }; class App : public wxApp { public: - App () - : _frame (nullptr) + App() + : _frame(nullptr) {} - bool OnInit () override + bool OnInit() override { try { - Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this)); - Config::Warning.connect (boost::bind (&App::config_warning, this, _1)); + Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this)); + Config::Warning.connect(boost::bind(&App::config_warning, this, _1)); SetAppName(variant::wx::dcpomatic_disk_writer()); @@ -471,15 +471,15 @@ public: } #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 - dcpomatic_setup_path_encoding (); + dcpomatic_setup_path_encoding(); /* Enable i18n; this will create a Config object to look for a force-configured language. This Config @@ -492,24 +492,24 @@ public: /* 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(); _frame = new DOMFrame(variant::wx::dcpomatic_disk_writer()); - SetTopWindow (_frame); + SetTopWindow(_frame); - _frame->Show (); + _frame->Show(); if (_dcp_to_write) { _frame->set_dcp_paths({*_dcp_to_write}); } - signal_manager = new wxSignalManager (this); - Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1)); + signal_manager = new wxSignalManager(this); + Bind(wxEVT_IDLE, boost::bind(&App::idle, this, _1)); } catch (exception& e) { @@ -520,46 +520,46 @@ public: 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 { wxString dcp; if (parser.Found(char_to_wx("dcp"), &dcp)) { - _dcp_to_write = wx_to_std (dcp); + _dcp_to_write = wx_to_std(dcp); } return true; } - void config_failed_to_load () + 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.")); + message_dialog(_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create.")); } - void config_warning (string m) + void config_warning(string m) { - message_dialog (_frame, std_to_wx(m)); + message_dialog(_frame, std_to_wx(m)); } - void idle (wxIdleEvent& ev) + void idle(wxIdleEvent& ev) { - signal_manager->ui_idle (); - ev.Skip (); + signal_manager->ui_idle(); + ev.Skip(); } - void report_exception () + void report_exception() { try { throw; } catch (FileError& e) { - error_dialog ( + error_dialog( 0, - wxString::Format ( + wxString::Format( _("An exception occurred: %s (%s)\n\n%s"), std_to_wx(e.what()), std_to_wx(e.file().string().c_str()), @@ -567,9 +567,9 @@ public: ) ); } catch (exception& e) { - error_dialog ( + error_dialog( 0, - wxString::Format ( + wxString::Format( _("An exception occurred: %s.\n\n%s"), std_to_wx(e.what()), dcpomatic::wx::report_problem() @@ -580,20 +580,20 @@ public: } } - 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(); } DOMFrame* _frame; boost::optional<boost::filesystem::path> _dcp_to_write; }; -IMPLEMENT_APP (App) +IMPLEMENT_APP(App) |
