Separate readable error from technical detail in some places.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Jan 2018 22:30:43 +0000 (22:30 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Jan 2018 22:30:43 +0000 (22:30 +0000)
13 files changed:
src/tools/dcpomatic.cc
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_kdm.cc
src/tools/dcpomatic_player.cc
src/wx/config_dialog.cc
src/wx/content_menu.cc
src/wx/download_certificate_panel.cc
src/wx/film_viewer.cc
src/wx/job_view.cc
src/wx/kdm_output_panel.cc
src/wx/screen_dialog.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index b731828f4357a8d1bc0992b567fea4f1c6fe12e4..15babbb612f85e83bf2780f50513f09417797b1b 100644 (file)
@@ -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;
        }
 
index 7a4f506224716a28219b67c30307a70c0c519e04..827229e8f38066f4892efeb6abd2fe45fba6e683 100644 (file)
@@ -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())
                                                );
                                }
                        }
index b82cec2ad56d6b19a7097ec81930583f473a6bcf..866d09c70cf5eee7458c41d8fda72aab2dd82c99 100644 (file)
@@ -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;
        }
 
index 0464ce96e00bef42ba4ea06394b3834c273ed66f..a75f6b9f40d2422fde57527920c1e50f37cf4872 100644 (file)
@@ -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;
        }
 
index fb80963f4c31c37d1dc07d81085f7ab26e8ba045..4b8e44f92309342aacbd4a5d23839ed31eed43d8 100644 (file)
@@ -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()));
                }
        }
 
index 68443c0cf428fd10b0dfc3cb57ef7b1f400231df..2a91831341fc506bbd1ed739febb19db3c02c946 100644 (file)
@@ -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;
                }
index 6c01b0d3f257da5ce529aaa8a0a0377c54116814..4052e44a6e8245ff7d1bde1f146eeef9e09f5d1d 100644 (file)
@@ -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()));
        }
 }
 
index 3b6ea5b39fa4f2095ceb2b9275e57eb3ff7df092..ebd929ff9197af966dec8c786479497f4c3b03cb 100644 (file)
@@ -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 ();
index 4aa2e3c2bdd98b305b8eced6889ee72a5b85c57b..a36d6de8a56680834d2697251d49e0fd2865f5f6 100644 (file)
@@ -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
index 0b99ee465213d7da6a095aafb328e787626a2839..1a4a209ca46719602ec1c61d46034ccac0d3838d 100644 (file)
@@ -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."));
        }
index 8bf2d0e419856ddd96096bbb8f2c0c7f16a0bb35..e6c2b6dd8efbf8a4717c1da58b0812e7c7022c01 100644 (file)
@@ -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()));
        }
 }
 
index d732e03d305259d37d71b55291afb22146a53da4..e017f404de8df788a2017923704145c703d17fda 100644 (file)
@@ -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 ();
 }
index dbd8e117a476b290a80ec2354490f852aab5532b..e36a35e1e336e4c83ca0bee8354d1bc5b8b026d6 100644 (file)
@@ -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);