Playlist editor: save configuration when it changes.
authorCarl Hetherington <cth@carlh.net>
Mon, 19 Oct 2020 21:21:51 +0000 (23:21 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 19 Oct 2020 21:21:51 +0000 (23:21 +0200)
src/tools/dcpomatic_playlist.cc

index 6a0281505b793a91799ea5bd9f5c5d35ead9d446..9027e7e30eb04ae61d7712d61bd9deb970191770 100644 (file)
@@ -476,6 +476,8 @@ public:
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
+
+               _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this));
        }
 
 private:
@@ -548,10 +550,28 @@ private:
                m->Append (help, _("&Help"));
        }
 
+
+       void config_changed ()
+       {
+               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()
+                                       )
+                               );
+               }
+       }
+
+
        ContentDialog* _content_dialog;
        PlaylistList* _playlist_list;
        PlaylistContent* _playlist_content;
        wxPreferencesEditor* _config_dialog;
+       boost::signals2::scoped_connection _config_changed_connection;
 };
 
 /** @class App