2 Copyright (C) 2015-2019 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "wx/full_config_dialog.h"
22 #include "wx/about_dialog.h"
23 #include "wx/report_problem_dialog.h"
24 #include "wx/file_picker_ctrl.h"
25 #include "wx/wx_util.h"
26 #include "wx/wx_signal_manager.h"
27 #include "wx/screens_panel.h"
28 #include "wx/kdm_timing_panel.h"
29 #include "wx/kdm_output_panel.h"
30 #include "wx/job_view_dialog.h"
31 #include "wx/file_dialog_wrapper.h"
32 #include "wx/new_dkdm_folder_dialog.h"
33 #include "wx/editable_list.h"
34 #include "wx/static_text.h"
35 #include "wx/dcpomatic_button.h"
36 #include "wx/nag_dialog.h"
37 #include "lib/config.h"
39 #include "lib/screen.h"
40 #include "lib/job_manager.h"
41 #include "lib/kdm_with_metadata.h"
42 #include "lib/exceptions.h"
43 #include "lib/send_kdm_email_job.h"
44 #include "lib/compose.hpp"
45 #include "lib/cinema.h"
46 #include "lib/dkdm_wrapper.h"
47 #include "lib/cross.h"
48 #ifdef DCPOMATIC_VARIANT_SWAROOP
49 #include "lib/decrypted_ecinema_kdm.h"
51 #include <dcp/encrypted_kdm.h>
52 #include <dcp/decrypted_kdm.h>
53 #include <dcp/exceptions.h>
55 #include <wx/preferences.h>
56 #include <wx/splash.h>
57 #include <wx/filepicker.h>
59 #include <ApplicationServices/ApplicationServices.h>
61 #include <boost/bind.hpp>
62 #include <boost/foreach.hpp>
74 using boost::shared_ptr;
76 using boost::optional;
78 using boost::dynamic_pointer_cast;
79 using namespace dcpomatic;
82 ID_help_report_a_problem = 1,
85 class DOMFrame : public wxFrame
88 explicit DOMFrame (wxString const & title)
89 : wxFrame (0, -1, title)
93 #if defined(DCPOMATIC_WINDOWS)
94 if (Config::instance()->win32_console ()) {
97 HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
98 int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT);
99 FILE* hf_out = _fdopen(hCrt, "w");
100 setvbuf(hf_out, NULL, _IONBF, 1);
103 HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
104 hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT);
105 FILE* hf_in = _fdopen(hCrt, "r");
106 setvbuf(hf_in, NULL, _IONBF, 128);
109 std::cout << "DCP-o-matic KDM creator is starting." << "\n";
113 wxMenuBar* bar = new wxMenuBar;
117 Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
118 Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
119 Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT);
120 Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_report_a_problem, this), ID_help_report_a_problem);
122 /* Use a panel as the only child of the Frame so that we avoid
123 the dark-grey background on Windows.
125 wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
126 wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
128 wxBoxSizer* horizontal = new wxBoxSizer (wxHORIZONTAL);
129 wxBoxSizer* left = new wxBoxSizer (wxVERTICAL);
130 wxBoxSizer* right = new wxBoxSizer (wxVERTICAL);
132 horizontal->Add (left, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP * 2);
133 horizontal->Add (right, 1, wxEXPAND);
135 wxFont subheading_font (*wxNORMAL_FONT);
136 subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
138 wxStaticText* h = new StaticText (overall_panel, _("Screens"));
139 h->SetFont (subheading_font);
140 left->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
141 _screens = new ScreensPanel (overall_panel);
142 left->Add (_screens, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
144 /// TRANSLATORS: translate the word "Timing" here; do not include the "KDM|" prefix
145 h = new StaticText (overall_panel, S_("KDM|Timing"));
146 h->SetFont (subheading_font);
147 right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2);
148 _timing = new KDMTimingPanel (overall_panel);
149 right->Add (_timing, 0, wxALL, DCPOMATIC_SIZER_Y_GAP);
151 h = new StaticText (overall_panel, _("DKDM"));
152 h->SetFont (subheading_font);
153 right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
154 wxBoxSizer* dkdm_sizer = new wxBoxSizer (wxHORIZONTAL);
155 _dkdm = new wxTreeCtrl (
156 overall_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT
158 dkdm_sizer->Add (_dkdm, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
159 wxBoxSizer* dkdm_buttons = new wxBoxSizer(wxVERTICAL);
160 _add_dkdm = new Button (overall_panel, _("Add..."));
161 dkdm_buttons->Add (_add_dkdm, 0, wxALL | wxEXPAND, DCPOMATIC_BUTTON_STACK_GAP);
162 _add_dkdm_folder = new Button (overall_panel, _("Add folder..."));
163 dkdm_buttons->Add (_add_dkdm_folder, 0, wxALL | wxEXPAND, DCPOMATIC_BUTTON_STACK_GAP);
164 _remove_dkdm = new Button (overall_panel, _("Remove"));
165 dkdm_buttons->Add (_remove_dkdm, 0, wxALL | wxEXPAND, DCPOMATIC_BUTTON_STACK_GAP);
166 _export_dkdm = new Button (overall_panel, _("Export..."));
167 dkdm_buttons->Add (_export_dkdm, 0, wxALL | wxEXPAND, DCPOMATIC_BUTTON_STACK_GAP);
168 dkdm_sizer->Add (dkdm_buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
169 right->Add (dkdm_sizer, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
171 add_dkdm_view (Config::instance()->dkdms());
173 h = new StaticText (overall_panel, _("Output"));
174 h->SetFont (subheading_font);
175 right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
176 /* XXX: hard-coded non-interop here */
177 _output = new KDMOutputPanel (overall_panel, false);
178 right->Add (_output, 0, wxALL, DCPOMATIC_SIZER_Y_GAP);
180 _create = new Button (overall_panel, _("Create KDMs"));
181 right->Add (_create, 0, wxALL, DCPOMATIC_SIZER_GAP);
183 main_sizer->Add (horizontal, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
184 overall_panel->SetSizer (main_sizer);
186 /* Instantly save any config changes when using a DCP-o-matic GUI */
187 Config::instance()->Changed.connect (boost::bind (&Config::write, Config::instance ()));
189 _screens->ScreensChanged.connect (boost::bind (&DOMFrame::setup_sensitivity, this));
190 _create->Bind (wxEVT_BUTTON, bind (&DOMFrame::create_kdms, this));
191 _dkdm->Bind (wxEVT_TREE_SEL_CHANGED, boost::bind (&DOMFrame::setup_sensitivity, this));
192 _dkdm->Bind (wxEVT_TREE_BEGIN_DRAG, boost::bind (&DOMFrame::dkdm_begin_drag, this, _1));
193 _dkdm->Bind (wxEVT_TREE_END_DRAG, boost::bind (&DOMFrame::dkdm_end_drag, this, _1));
194 _add_dkdm->Bind (wxEVT_BUTTON, bind (&DOMFrame::add_dkdm_clicked, this));
195 _add_dkdm_folder->Bind (wxEVT_BUTTON, bind (&DOMFrame::add_dkdm_folder_clicked, this));
196 _remove_dkdm->Bind (wxEVT_BUTTON, bind (&DOMFrame::remove_dkdm_clicked, this));
197 _export_dkdm->Bind (wxEVT_BUTTON, bind (&DOMFrame::export_dkdm_clicked, this));
199 setup_sensitivity ();
205 /* false here allows the close handler to veto the close request */
209 void edit_preferences ()
211 if (!_config_dialog) {
212 _config_dialog = create_full_config_dialog ();
214 _config_dialog->Show (this);
219 AboutDialog* d = new AboutDialog (this);
224 void help_report_a_problem ()
226 ReportProblemDialog* d = new ReportProblemDialog (this, shared_ptr<Film> ());
227 if (d->ShowModal () == wxID_OK) {
233 void setup_menu (wxMenuBar* m)
235 wxMenu* file = new wxMenu;
238 file->Append (wxID_EXIT, _("&Exit"));
240 file->Append (wxID_EXIT, _("&Quit"));
244 file->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
246 wxMenu* edit = new wxMenu;
247 edit->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
250 wxMenu* help = new wxMenu;
252 help->Append (wxID_ABOUT, _("About DCP-o-matic"));
254 help->Append (wxID_ABOUT, _("About"));
256 help->Append (ID_help_report_a_problem, _("Report a problem..."));
258 m->Append (file, _("&File"));
260 m->Append (edit, _("&Edit"));
262 m->Append (help, _("&Help"));
265 bool confirm_overwrite (boost::filesystem::path path)
267 return confirm_dialog (
269 wxString::Format (_("File %s already exists. Do you want to overwrite it?"), std_to_wx(path.string()).data())
273 /** @id if not 0 this is filled in with the wxTreeItemId of the selection */
274 shared_ptr<DKDMBase> selected_dkdm (wxTreeItemId* id = 0) const
276 wxArrayTreeItemIds selections;
277 _dkdm->GetSelections (selections);
278 if (selections.GetCount() != 1) {
282 return shared_ptr<DKDMBase> ();
289 DKDMMap::const_iterator i = _dkdm_id.find (selections[0]);
290 if (i == _dkdm_id.end()) {
291 return shared_ptr<DKDMBase> ();
300 shared_ptr<DKDMBase> dkdm_base = selected_dkdm ();
305 list<KDMWithMetadataPtr> screen_kdms;
308 #ifdef DCPOMATIC_VARIANT_SWAROOP
309 shared_ptr<ECinemaDKDM> ecinema_dkdm = boost::dynamic_pointer_cast<ECinemaDKDM> (dkdm_base);
311 DecryptedECinemaKDM decrypted (ecinema_dkdm->dkdm(), Config::instance()->decryption_chain()->key().get());
312 title = decrypted.name ();
314 BOOST_FOREACH (shared_ptr<Screen> i, _screens->screens()) {
320 DecryptedECinemaKDM kdm (
324 dcp::LocalTime (_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
325 dcp::LocalTime (_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute())
328 dcp::NameFormat::Map name_values;
329 name_values['c'] = i->cinema->name;
330 name_values['s'] = i->name;
333 screen_kdms.push_back (
335 new ECinemaKDMWithMetadata(name_values, i->cinema, kdm.encrypt(i->recipient.get()))
342 shared_ptr<DKDM> dkdm = boost::dynamic_pointer_cast<DKDM> (dkdm_base);
345 /* Decrypt the DKDM */
346 dcp::DecryptedKDM decrypted (dkdm->dkdm(), Config::instance()->decryption_chain()->key().get());
347 title = decrypted.content_title_text ();
349 /* This is the signer for our new KDMs */
350 shared_ptr<const dcp::CertificateChain> signer = Config::instance()->signer_chain ();
351 if (!signer->valid ()) {
352 throw InvalidSignerError ();
355 BOOST_FOREACH (shared_ptr<Screen> i, _screens->screens()) {
361 /* Make an empty KDM */
362 dcp::DecryptedKDM kdm (
363 dcp::LocalTime (_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
364 dcp::LocalTime (_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
365 decrypted.annotation_text().get_value_or (""),
366 decrypted.content_title_text(),
367 dcp::LocalTime().as_string()
370 /* Add keys from the DKDM */
371 BOOST_FOREACH (dcp::DecryptedKDMKey const & j, decrypted.keys()) {
375 dcp::NameFormat::Map name_values;
376 name_values['c'] = i->cinema->name;
377 name_values['s'] = i->name;
380 screen_kdms.push_back (
382 new DCPKDMWithMetadata(
386 signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(),
387 !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
395 if (screen_kdms.empty()) {
399 pair<shared_ptr<Job>, int> result = _output->make (
400 screen_kdms, title, _timing, bind (&DOMFrame::confirm_overwrite, this, _1)
404 JobManager::instance()->add (result.first);
406 _job_view->Destroy ();
409 _job_view = new JobViewDialog (this, _("Send KDM emails"), result.first);
410 _job_view->ShowModal ();
413 if (result.second > 0) {
414 /* XXX: proper plural form support in wxWidgets? */
415 wxString s = result.second == 1 ? _("%d KDM written to %s") : _("%d KDMs written to %s");
418 wxString::Format (s, result.second, std_to_wx(_output->directory().string()).data())
421 } catch (dcp::NotEncryptedError& e) {
422 error_dialog (this, _("CPL's content is not encrypted."));
423 } catch (exception& e) {
424 error_dialog (this, std_to_wx(e.what()));
426 error_dialog (this, _("An unknown exception occurred."));
430 void setup_sensitivity ()
432 _screens->setup_sensitivity ();
433 _output->setup_sensitivity ();
434 wxArrayTreeItemIds sel;
435 _dkdm->GetSelections (sel);
436 shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup>(selected_dkdm());
437 shared_ptr<DKDM> dkdm = dynamic_pointer_cast<DKDM>(selected_dkdm());
438 _create->Enable (!_screens->screens().empty() && sel.GetCount() > 0);
439 _remove_dkdm->Enable (sel.GetCount() > 0 && (!group || group->name() != "root"));
440 _export_dkdm->Enable (sel.GetCount() > 0 && dkdm);
443 void dkdm_begin_drag (wxTreeEvent& ev)
448 void dkdm_end_drag (wxTreeEvent& ev)
450 DKDMMap::iterator from = _dkdm_id.find (_dkdm->GetSelection ());
451 DKDMMap::iterator to = _dkdm_id.find (ev.GetItem ());
452 if (from == _dkdm_id.end() || to == _dkdm_id.end() || from->first == to->first) {
456 shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (to->second);
458 group = to->second->parent();
461 DCPOMATIC_ASSERT (group);
462 DCPOMATIC_ASSERT (from->second->parent ());
464 from->second->parent()->remove (from->second);
465 add_dkdm_model (from->second, group, dynamic_pointer_cast<DKDM>(to->second));
467 _dkdm->Delete (from->first);
468 _dkdm_id.erase (from->first);
469 add_dkdm_view (from->second, dynamic_pointer_cast<DKDM>(to->second) ? to->first : optional<wxTreeItemId>());
472 void add_dkdm_clicked ()
474 wxFileDialog* d = new wxFileDialog (this, _("Select DKDM file"));
475 if (d->ShowModal() == wxID_OK) {
476 shared_ptr<const dcp::CertificateChain> chain = Config::instance()->decryption_chain();
477 DCPOMATIC_ASSERT (chain->key());
479 #ifdef DCPOMATIC_VARIANT_SWAROOP
481 cxml::Document test_doc;
482 string const xml_string = dcp::file_to_string (wx_to_std(d->GetPath()), MAX_KDM_SIZE);
483 test_doc.read_string (xml_string);
484 if (test_doc.root_name() == "ECinemaSecurityMessage") {
485 EncryptedECinemaKDM ekdm(xml_string);
486 /* Decrypt the DKDM to make sure that we can */
487 DecryptedECinemaKDM dkdm(ekdm, chain->key().get());
489 shared_ptr<DKDMBase> new_dkdm(new ECinemaDKDM(ekdm));
490 shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (selected_dkdm());
492 group = Config::instance()->dkdms();
494 add_dkdm_model (new_dkdm, group);
495 add_dkdm_view (new_dkdm);
499 } catch (KDMError& e) {
501 this, "Could not read file as a KDM. Perhaps it is badly formatted, created with the wrong certificate, or not a KDM at all.",
506 } catch (dcp::MiscError& e) {
509 _("Could not read file as a KDM. It is much too large. Make sure you are loading a DKDM (XML) file."),
518 dcp::EncryptedKDM ekdm(dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE));
519 /* Decrypt the DKDM to make sure that we can */
520 dcp::DecryptedKDM dkdm(ekdm, chain->key().get());
522 shared_ptr<DKDMBase> new_dkdm(new DKDM(ekdm));
523 shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (selected_dkdm ());
525 group = Config::instance()->dkdms ();
527 add_dkdm_model (new_dkdm, group);
528 add_dkdm_view (new_dkdm);
529 } catch (dcp::KDMFormatError& e) {
532 _("Could not read file as a KDM. Perhaps it is badly formatted, or not a KDM at all."),
536 } catch (dcp::KDMDecryptionError &) {
539 _("Could not decrypt the DKDM. Perhaps it was not created with the correct certificate.")
541 } catch (dcp::MiscError& e) {
544 _("Could not read file as a KDM. It is much too large. Make sure you are loading a DKDM (XML) file."),
552 void add_dkdm_folder_clicked ()
554 NewDKDMFolderDialog* d = new NewDKDMFolderDialog (this);
555 if (d->ShowModal() == wxID_OK) {
556 shared_ptr<DKDMBase> new_dkdm (new DKDMGroup (wx_to_std (d->get ())));
557 shared_ptr<DKDMGroup> parent = dynamic_pointer_cast<DKDMGroup> (selected_dkdm ());
559 parent = Config::instance()->dkdms ();
561 add_dkdm_model (new_dkdm, parent);
562 add_dkdm_view (new_dkdm);
567 /** @param dkdm Thing to add.
568 * @param parent Parent group, or 0.
570 void add_dkdm_view (shared_ptr<DKDMBase> base, optional<wxTreeItemId> previous = optional<wxTreeItemId>())
572 if (!base->parent()) {
573 /* This is the root group */
574 _dkdm_id[_dkdm->AddRoot("root")] = base;
576 /* Add base to the view */
579 added = _dkdm->InsertItem(dkdm_to_id(base->parent()), *previous, std_to_wx(base->name()));
581 added = _dkdm->AppendItem(dkdm_to_id(base->parent()), std_to_wx(base->name()));
583 _dkdm_id[added] = base;
587 shared_ptr<DKDMGroup> g = dynamic_pointer_cast<DKDMGroup> (base);
589 BOOST_FOREACH (shared_ptr<DKDMBase> i, g->children()) {
595 /** @param group Group to add dkdm to */
596 void add_dkdm_model (shared_ptr<DKDMBase> dkdm, shared_ptr<DKDMGroup> group, shared_ptr<DKDM> previous = shared_ptr<DKDM> ())
598 group->add (dkdm, previous);
599 /* We're messing with a Config-owned object here, so tell it that something has changed.
602 Config::instance()->changed ();
605 wxTreeItemId dkdm_to_id (shared_ptr<DKDMBase> dkdm)
607 for (DKDMMap::iterator i = _dkdm_id.begin(); i != _dkdm_id.end(); ++i) {
608 if (i->second == dkdm) {
612 DCPOMATIC_ASSERT (false);
615 void remove_dkdm_clicked ()
617 shared_ptr<DKDMBase> removed = selected_dkdm ();
622 if (NagDialog::maybe_nag (
623 this, Config::NAG_DELETE_DKDM,
624 _("You are about to remove a DKDM. This will make it impossible to decrypt the DCP that the DKDM was made for, and it cannot be undone. "
630 _dkdm->Delete (dkdm_to_id (removed));
631 shared_ptr<DKDMGroup> dkdms = Config::instance()->dkdms ();
632 dkdms->remove (removed);
633 Config::instance()->changed ();
636 void export_dkdm_clicked ()
638 shared_ptr<DKDMBase> removed = selected_dkdm ();
643 shared_ptr<DKDM> dkdm = dynamic_pointer_cast<DKDM>(removed);
648 wxFileDialog* d = new wxFileDialog (
649 this, _("Select DKDM File"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"),
650 wxFD_SAVE | wxFD_OVERWRITE_PROMPT
653 if (d->ShowModal() == wxID_OK) {
654 dkdm->dkdm().as_xml(wx_to_std(d->GetPath()));
659 wxPreferencesEditor* _config_dialog;
660 ScreensPanel* _screens;
661 KDMTimingPanel* _timing;
663 typedef std::map<wxTreeItemId, boost::shared_ptr<DKDMBase> > DKDMMap;
666 wxButton* _add_dkdm_folder;
667 wxButton* _remove_dkdm;
668 wxButton* _export_dkdm;
670 KDMOutputPanel* _output;
671 JobViewDialog* _job_view;
675 * @brief The magic App class for wxWidgets.
677 class App : public wxApp
689 wxSplashScreen* splash = 0;
692 wxInitAllImageHandlers ();
694 Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
695 Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
697 splash = maybe_show_splash ();
699 SetAppName (_("DCP-o-matic KDM Creator"));
701 if (!wxApp::OnInit()) {
705 #ifdef DCPOMATIC_LINUX
706 unsetenv ("UBUNTU_MENUPROXY");
710 ProcessSerialNumber serial;
711 GetCurrentProcess (&serial);
712 TransformProcessType (&serial, kProcessTransformToForegroundApplication);
715 dcpomatic_setup_path_encoding ();
717 /* Enable i18n; this will create a Config object
718 to look for a force-configured language. This Config
719 object will be wrong, however, because dcpomatic_setup
720 hasn't yet been called and there aren't any filters etc.
723 dcpomatic_setup_i18n ();
725 /* Set things up, including filters etc.
726 which will now be internationalised correctly.
730 /* Force the configuration to be re-loaded correctly next
735 _frame = new DOMFrame (_("DCP-o-matic KDM Creator"));
736 SetTopWindow (_frame);
744 signal_manager = new wxSignalManager (this);
745 Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
752 error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what()));
758 /* An unhandled exception has occurred inside the main event loop */
759 bool OnExceptionInMainLoop ()
763 } catch (FileError& e) {
767 _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
768 std_to_wx (e.what()),
769 std_to_wx (e.file().string().c_str ())
772 } catch (exception& e) {
776 _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM,
777 std_to_wx (e.what ())
781 error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM);
784 /* This will terminate the program */
788 void OnUnhandledException ()
790 error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM);
795 signal_manager->ui_idle ();
798 void config_failed_to_load ()
800 message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
803 void config_warning (string m)
805 message_dialog (_frame, std_to_wx (m));