Add export button for cinemas XML (#1319).
authorCarl Hetherington <cth@carlh.net>
Sat, 7 Jul 2018 20:16:41 +0000 (21:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 7 Jul 2018 20:16:41 +0000 (21:16 +0100)
ChangeLog
src/wx/full_config_dialog.cc

index eb7df83..0ea7016 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-07-07  Carl Hetherington  <cth@carlh.net>
 
+       * Add export buton for cinemas XML file (#1319).
+
        * Give better errors when incorrect KDMs are used (#1326).
 
 2018-07-06  Carl Hetherington  <cth@carlh.net>
index c371239..1ea0740 100644 (file)
@@ -103,6 +103,8 @@ private:
                add_label_to_sizer (table, _panel, _("Cinema and screen database file"), true, wxGBPosition (r, 0));
                _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml", true);
                table->Add (_cinemas_file, wxGBPosition (r, 1));
+               wxButton* export_cinemas = new wxButton (_panel, wxID_ANY, _("Export..."));
+               table->Add (export_cinemas, wxGBPosition (r, 2));
                ++r;
 
                add_play_sound_controls (table, r);
@@ -140,6 +142,7 @@ private:
                _master_encoding_threads->Bind (wxEVT_SPINCTRL, boost::bind (&FullGeneralPage::master_encoding_threads_changed, this));
                _server_encoding_threads->SetRange (1, 128);
                _server_encoding_threads->Bind (wxEVT_SPINCTRL, boost::bind (&FullGeneralPage::server_encoding_threads_changed, this));
+               export_cinemas->Bind (wxEVT_BUTTON, boost::bind (&FullGeneralPage::export_cinemas_file, this));
 
 #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
                _analyse_ebur128->Bind (wxEVT_CHECKBOX, boost::bind (&FullGeneralPage::analyse_ebur128_changed, this));
@@ -168,6 +171,19 @@ private:
                GeneralPage::config_changed ();
        }
 
+       void export_cinemas_file ()
+       {
+               wxFileDialog* d = new wxFileDialog (
+                       _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml"),
+                       wxFD_SAVE | wxFD_OVERWRITE_PROMPT
+                );
+
+               if (d->ShowModal () == wxID_OK) {
+                       boost::filesystem::copy_file (Config::instance()->cinemas_file(), path_from_file_dialog (d, "xml"));
+               }
+               d->Destroy ();
+       }
+
 
 #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG
        void analyse_ebur128_changed ()