summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-09-04 21:26:03 +0200
committerCarl Hetherington <cth@carlh.net>2022-09-05 23:52:03 +0200
commitf5bd787fb71466a6187050086b2890b9b0ac9294 (patch)
tree816de528eccb8fd252910647ffa2138d65c34468 /src
parent8afad10c394462c66f68ac00698da38c5b0b8721 (diff)
Tidy up code to report failures to load config in the UI.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic.cc6
-rw-r--r--src/tools/dcpomatic_batch.cc6
-rw-r--r--src/tools/dcpomatic_combiner.cc6
-rw-r--r--src/tools/dcpomatic_kdm.cc6
-rw-r--r--src/tools/dcpomatic_server.cc6
-rw-r--r--src/wx/wx_util.cc24
-rw-r--r--src/wx/wx_util.h3
7 files changed, 41 insertions, 16 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 57fad5a0a..772d90050 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -1606,7 +1606,7 @@ private:
try {
wxInitAllImageHandlers ();
- Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
_splash = maybe_show_splash ();
@@ -1828,9 +1828,9 @@ private:
}
}
- void config_failed_to_load ()
+ void config_failed_to_load (Config::LoadFailure what)
{
- message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ report_config_load_failure(_frame, what);
}
void config_warning (string m)
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index 79f1b39fa..dcda39fd8 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -401,7 +401,7 @@ class App : public wxApp
SetAppName (_("DCP-o-matic Batch Converter"));
is_batch_converter = true;
- Config::FailedToLoad.connect (boost::bind(&App::config_failed_to_load, this));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
Config::Warning.connect (boost::bind(&App::config_warning, this, _1));
auto splash = maybe_show_splash ();
@@ -488,9 +488,9 @@ class App : public wxApp
return true;
}
- void config_failed_to_load ()
+ void config_failed_to_load(Config::LoadFailure what)
{
- message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ report_config_load_failure(_frame, what);
}
void config_warning (string m)
diff --git a/src/tools/dcpomatic_combiner.cc b/src/tools/dcpomatic_combiner.cc
index 2ef58bb85..e773e4a37 100644
--- a/src/tools/dcpomatic_combiner.cc
+++ b/src/tools/dcpomatic_combiner.cc
@@ -210,7 +210,7 @@ public:
bool OnInit () override
{
try {
- Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
SetAppName (_("DCP-o-matic Combiner"));
@@ -264,9 +264,9 @@ public:
return true;
}
- void config_failed_to_load ()
+ void config_failed_to_load(Config::LoadFailure what)
{
- message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ report_config_load_failure(_frame, what);
}
void config_warning (string m)
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 62955142a..f877ad21f 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -645,7 +645,7 @@ private:
try {
wxInitAllImageHandlers ();
- Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
splash = maybe_show_splash ();
@@ -747,9 +747,9 @@ private:
signal_manager->ui_idle ();
}
- void config_failed_to_load ()
+ void config_failed_to_load(Config::LoadFailure what)
{
- message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ report_config_load_failure(_frame, what);
}
void config_warning (string m)
diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc
index fe70ec6f7..e5e3a7e5a 100644
--- a/src/tools/dcpomatic_server.cc
+++ b/src/tools/dcpomatic_server.cc
@@ -287,7 +287,7 @@ private:
server_log->set_types (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
dcpomatic_log = server_log;
- Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+ Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
auto splash = maybe_show_splash ();
@@ -361,9 +361,9 @@ private:
signal_manager->ui_idle ();
}
- void config_failed_to_load ()
+ void config_failed_to_load(Config::LoadFailure what)
{
- message_dialog (nullptr, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ report_config_load_failure(nullptr, what);
}
void config_warning (string m)
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index e94f3e512..d02eb3ca5 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -700,3 +700,27 @@ search_ctrl_height ()
#endif
}
+
+void
+report_config_load_failure(wxWindow* parent, Config::LoadFailure what)
+{
+ switch (what) {
+ case Config::LoadFailure::CONFIG:
+ message_dialog(parent, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ break;
+ case Config::LoadFailure::CINEMAS:
+ message_dialog(
+ parent,
+ _(wxString::Format("The cinemas list for creating KDMs (cinemas.xml) failed to load. Please check the numbered backup files in %s",
+ std_to_wx(Config::instance()->cinemas_file().parent_path().string())))
+ );
+ break;
+ case Config::LoadFailure::DKDM_RECIPIENTS:
+ message_dialog(
+ parent,
+ _(wxString::Format("The recipients list for creating DKDMs (dkdm_recipients.xml) failed to load. Please check the numbered backup files in %s",
+ std_to_wx(Config::instance()->dkdm_recipients_file().parent_path().string())))
+ );
+ break;
+ }
+}
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index 14f203688..fb1a3a001 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -28,6 +28,7 @@
#define DCPOMATIC_WX_UTIL_H
+#include "lib/config.h"
#include "lib/dcpomatic_time.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -122,7 +123,7 @@ extern wxSize small_button_size (wxWindow* parent, wxString text);
extern bool gui_is_dark ();
extern double dpi_scale_factor (wxWindow* window);
extern int search_ctrl_height ();
-
+extern void report_config_load_failure(wxWindow* parent, Config::LoadFailure what);
struct Offset
{