summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-12 22:30:43 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-12 22:30:43 +0000
commitf1dbcec7552052856369631e77c5eb160badd619 (patch)
tree6fa9d8f36fe525fc32e8e88e8ae703d756fc1b43 /src
parent49281333410c321e616c5d3cfd4308e21d0c9cb4 (diff)
Separate readable error from technical detail in some places.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic.cc14
-rw-r--r--src/tools/dcpomatic_batch.cc11
-rw-r--r--src/tools/dcpomatic_kdm.cc10
-rw-r--r--src/tools/dcpomatic_player.cc6
-rw-r--r--src/wx/config_dialog.cc6
-rw-r--r--src/wx/content_menu.cc2
-rw-r--r--src/wx/download_certificate_panel.cc2
-rw-r--r--src/wx/film_viewer.cc2
-rw-r--r--src/wx/job_view.cc2
-rw-r--r--src/wx/kdm_output_panel.cc2
-rw-r--r--src/wx/screen_dialog.cc2
-rw-r--r--src/wx/wx_util.cc6
-rw-r--r--src/wx/wx_util.h2
13 files changed, 33 insertions, 34 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index b731828f4..15babbb61 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -386,7 +386,7 @@ public:
catch (std::exception& e) {
wxString p = std_to_wx (file.string ());
wxCharBuffer b = p.ToUTF8 ();
- error_dialog (this, wxString::Format (_("Could not open film at %s (%s)"), p.data(), std_to_wx (e.what()).data()));
+ 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)
@@ -627,9 +627,9 @@ private:
_film->write_metadata ();
_film->make_dcp ();
} catch (BadSettingError& e) {
- error_dialog (this, wxString::Format (_("Bad setting for %s (%s)"), std_to_wx(e.setting()).data(), std_to_wx(e.what()).data()));
+ 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: %s."), std_to_wx(e.what()).data()));
+ error_dialog (this, wxString::Format (_("Could not make DCP.")), std_to_wx(e.what()));
}
}
@@ -800,14 +800,14 @@ private:
if (WEXITSTATUS (r) == 0) {
r = system (String::compose("nautilus \"%1\"", _film->directory()->string()).c_str());
if (WEXITSTATUS (r)) {
- error_dialog (this, _("Could not show DCP (could not run nautilus)"));
+ error_dialog (this, _("Could not show DCP."), _("Could not run nautilus"));
}
} else {
int r = system ("which konqueror");
if (WEXITSTATUS (r) == 0) {
r = system (String::compose ("konqueror \"%1\"", _film->directory()->string()).c_str());
if (WEXITSTATUS (r)) {
- error_dialog (this, _("Could not show DCP (could not run konqueror)"));
+ error_dialog (this, _("Could not show DCP"), _("Could not run konqueror"));
}
}
}
@@ -1285,7 +1285,7 @@ private:
try {
_frame->load_film (_film_to_load);
} catch (exception& e) {
- error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), _film_to_load, e.what())));
+ error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what()));
}
}
@@ -1316,7 +1316,7 @@ private:
}
catch (exception& e)
{
- error_dialog (0, wxString::Format ("DCP-o-matic could not start: %s", e.what ()));
+ error_dialog (0, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
return true;
}
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index 7a4f50622..827229e8f 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -137,7 +137,7 @@ public:
} catch (std::exception& e) {
wxString p = std_to_wx (path.string ());
wxCharBuffer b = p.ToUTF8 ();
- error_dialog (this, wxString::Format (_("Could not open film at %s (%s)"), p.data(), std_to_wx (e.what()).data()));
+ error_dialog (this, wxString::Format (_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
}
}
@@ -337,12 +337,9 @@ class App : public wxApp
film->make_dcp ();
} catch (exception& e) {
error_dialog (
- 0, std_to_wx (
- String::compose (
- wx_to_std (_("Could not load film %1 (%2)")), i.string(),
- e.what()
- )
- )
+ 0,
+ std_to_wx (String::compose (wx_to_std (_("Could not load film %1")), i.string())),
+ std_to_wx(e.what())
);
}
}
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index b82cec2ad..866d09c70 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -356,7 +356,7 @@ private:
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
- error_dialog (this, e.what ());
+ error_dialog (this, std_to_wx(e.what()));
} catch (...) {
error_dialog (this, _("An unknown exception occurred."));
}
@@ -423,10 +423,8 @@ private:
} catch (dcp::KDMFormatError& e) {
error_dialog (
this,
- wxString::Format (
- _("Could not read file as a KDM. Perhaps it is badly formatted, or not a KDM at all.\n\n%s"),
- std_to_wx(e.what()).data()
- )
+ _("Could not read file as a KDM. Perhaps it is badly formatted, or not a KDM at all."),
+ std_to_wx(e.what())
);
return;
} catch (dcp::KDMDecryptionError) {
@@ -603,7 +601,7 @@ private:
}
catch (exception& e)
{
- error_dialog (0, wxString::Format ("DCP-o-matic could not start: %s", e.what ()));
+ error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what()));
return true;
}
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 0464ce96e..a75f6b9f4 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -291,7 +291,7 @@ private:
dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)));
dcp->examine (shared_ptr<Job>());
} catch (exception& e) {
- error_dialog (this, wxString::Format (_("Could not load KDM (%s)"), std_to_wx(e.what())));
+ error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));
d->Destroy ();
return;
}
@@ -482,7 +482,7 @@ private:
try {
_frame->load_dcp (_dcp_to_load);
} catch (exception& e) {
- error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load DCP %1 (%2)")), _dcp_to_load, e.what())));
+ error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load DCP %1.")), _dcp_to_load)), std_to_wx(e.what()));
}
}
@@ -496,7 +496,7 @@ private:
}
catch (exception& e)
{
- error_dialog (0, wxString::Format ("DCP-o-matic Player could not start: %s", std_to_wx(e.what())));
+ error_dialog (0, _("DCP-o-matic Player could not start."), std_to_wx(e.what()));
return true;
}
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index fb80963f4..4b8e44f92 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -455,7 +455,7 @@ CertificateChainEditor::add_certificate ()
try {
extra = c.read_string (dcp::file_to_string (wx_to_std (d->GetPath ())));
} catch (boost::filesystem::filesystem_error& e) {
- error_dialog (this, wxString::Format (_("Could not import certificate (%s)"), d->GetPath().data()));
+ error_dialog (this, _("Could not import certificate (%s)"), d->GetPath());
d->Destroy ();
return;
}
@@ -481,7 +481,7 @@ CertificateChainEditor::add_certificate ()
update_certificate_list ();
}
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
+ error_dialog (this, _("Could not read certificate file."), std_to_wx(e.what()));
}
}
@@ -675,7 +675,7 @@ CertificateChainEditor::import_private_key ()
_set (chain);
update_private_key ();
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
+ error_dialog (this, _("Could not read certificate file."), std_to_wx(e.what()));
}
}
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index 68443c0cf..2a9183134 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -377,7 +377,7 @@ ContentMenu::kdm ()
try {
dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)));
} catch (exception& e) {
- error_dialog (_parent, wxString::Format (_("Could not load KDM (%s)"), e.what ()));
+ error_dialog (_parent, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));
d->Destroy ();
return;
}
diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc
index 6c01b0d3f..4052e44a6 100644
--- a/src/wx/download_certificate_panel.cc
+++ b/src/wx/download_certificate_panel.cc
@@ -53,7 +53,7 @@ DownloadCertificatePanel::load (boost::filesystem::path file)
try {
_certificate = dcp::Certificate (dcp::file_to_string (file));
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), std_to_wx(e.what()).data()));
+ error_dialog (this, _("Could not read certificate file."), std_to_wx(e.what()));
}
}
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 3b6ea5b39..ebd929ff9 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -770,7 +770,7 @@ FilmViewer::config_changed (Config::Property p)
#endif
error_dialog (
this,
- wxString::Format (_("Could not set up audio output (%s). There will be no audio during the preview."), e.what())
+ _("Could not set up audio output. There will be no audio during the preview."), std_to_wx(e.what())
);
}
recreate_butler ();
diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc
index 4aa2e3c2b..a36d6de8a 100644
--- a/src/wx/job_view.cc
+++ b/src/wx/job_view.cc
@@ -125,7 +125,7 @@ JobView::details_clicked (wxCommandEvent &)
{
string s = _job->error_summary();
s[0] = toupper (s[0]);
- error_dialog (_parent, std_to_wx (String::compose ("%1.\n\n%2", s, _job->error_details())));
+ error_dialog (_parent, std_to_wx(s), std_to_wx(_job->error_details()));
}
void
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
index 0b99ee465..1a4a209ca 100644
--- a/src/wx/kdm_output_panel.cc
+++ b/src/wx/kdm_output_panel.cc
@@ -287,7 +287,7 @@ KDMOutputPanel::make (
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
- error_dialog (this, e.what ());
+ error_dialog (this, std_to_wx(e.what()));
} catch (...) {
error_dialog (this, _("An unknown exception occurred."));
}
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index 8bf2d0e41..e6c2b6dd8 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -155,7 +155,7 @@ ScreenDialog::load_recipient (boost::filesystem::path file)
dcp::CertificateChain c (dcp::file_to_string (file));
set_recipient (c.leaf ());
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), std_to_wx(e.what()).data()));
+ error_dialog (this, wxString::Format (_("Could not read certificate file.")), std_to_wx(e.what()));
}
}
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index d732e03d3..e017f404d 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -85,11 +85,15 @@ add_label_to_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool, wxGBPositi
/** Pop up an error dialogue box.
* @param parent Parent.
* @param m Message.
+ * @param e Extended message.
*/
void
-error_dialog (wxWindow* parent, wxString m)
+error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
{
wxMessageDialog* d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR);
+ if (e) {
+ d->SetExtendedMessage (*e);
+ }
d->ShowModal ();
d->Destroy ();
}
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index dbd8e117a..e36a35e1e 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -69,7 +69,7 @@ class wxSplashScreen;
*/
#define S_(x) context_translation(x)
-extern void error_dialog (wxWindow *, wxString);
+extern void error_dialog (wxWindow *, wxString, boost::optional<wxString> e = boost::optional<wxString>());
extern void message_dialog (wxWindow *, wxString);
extern bool confirm_dialog (wxWindow *, wxString);
extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0);