summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_batch.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-04 11:13:38 +0100
committerCarl Hetherington <cth@carlh.net>2018-06-04 11:13:38 +0100
commitab1c8a67afba072b1c29f0c3c34aa9779643e66a (patch)
tree605b85098b25c61741694de6da8aab3b186d3cce /src/tools/dcpomatic_batch.cc
parentb551048b6562c0697f8b748a2f0907dbd3d8fb96 (diff)
parentd2ee8239585be648ac63e560cb9cd363352ff11c (diff)
Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
Diffstat (limited to 'src/tools/dcpomatic_batch.cc')
-rw-r--r--src/tools/dcpomatic_batch.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index f6197b1e2..6d4490ad7 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -101,6 +101,8 @@ public:
setup_menu (bar);
SetMenuBar (bar);
+ Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1));
+
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_add_film, this), ID_file_add_film);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_quit, this), wxID_EXIT);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
@@ -238,6 +240,36 @@ private:
c->Destroy ();
}
+ void config_changed (Config::Property what)
+ {
+ /* Instantly save any config changes when using the DCP-o-matic GUI */
+ if (what == Config::CINEMAS) {
+ try {
+ Config::instance()->write_cinemas();
+ } catch (exception& e) {
+ error_dialog (
+ this,
+ wxString::Format (
+ _("Could not write to cinemas file at %s. Your changes have not been saved."),
+ std_to_wx (Config::instance()->cinemas_file().string()).data()
+ )
+ );
+ }
+ } else {
+ try {
+ Config::instance()->write_config();
+ } catch (exception& e) {
+ error_dialog (
+ this,
+ wxString::Format (
+ _("Could not write to config file at %s. Your changes have not been saved."),
+ std_to_wx (Config::instance()->cinemas_file().string()).data()
+ )
+ );
+ }
+ }
+ }
+
boost::optional<boost::filesystem::path> _last_parent;
wxSizer* _sizer;
wxPreferencesEditor* _config_dialog;