From 5c3a792617be3764806256020fce87af26b643c1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 19 Oct 2020 23:21:51 +0200 Subject: [PATCH] Playlist editor: save configuration when it changes. --- src/tools/dcpomatic_playlist.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc index 6a0281505..9027e7e30 100644 --- a/src/tools/dcpomatic_playlist.cc +++ b/src/tools/dcpomatic_playlist.cc @@ -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 -- 2.30.2