Add Version File dialog.
[dcpomatic.git] / src / wx / full_config_dialog.cc
index 4dff7b5bf780cb9916f78e55dcc614e65307335d..c24871f39203279c23f3d4ac28206034af3aa65a 100644 (file)
@@ -45,6 +45,9 @@
 #include "send_test_email_dialog.h"
 #include "server_dialog.h"
 #include "static_text.h"
+#ifdef DCPOMATIC_GROK
+#include "grok/gpu_config_panel.h"
+#endif
 #include "wx_util.h"
 #include "lib/config.h"
 #include "lib/cross.h"
@@ -57,6 +60,7 @@
 #include "lib/util.h"
 #include <dcp/certificate_chain.h>
 #include <dcp/exceptions.h>
+#include <dcp/filesystem.h>
 #include <dcp/locale_convert.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
@@ -114,12 +118,12 @@ private:
                ++r;
 
                add_label_to_sizer (table, _panel, _("Configuration file"), true, wxGBPosition (r, 0));
-               _config_file = new FilePickerCtrl (_panel, _("Select configuration file"), "*.xml", true, false);
+               _config_file = new FilePickerCtrl(_panel, _("Select configuration file"), "*.xml", true, false, "ConfigFilePath");
                table->Add (_config_file, wxGBPosition (r, 1));
                ++r;
 
                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, false);
+               _cinemas_file = new FilePickerCtrl(_panel, _("Select cinema and screen database file"), "*.xml", true, false, "CinemaDatabasePath");
                table->Add (_cinemas_file, wxGBPosition (r, 1));
                auto export_cinemas = new Button (_panel, _("Export..."));
                table->Add (export_cinemas, wxGBPosition (r, 2));
@@ -186,7 +190,7 @@ private:
                 );
 
                if (dialog.ShowModal() == wxID_OK) {
-                       boost::filesystem::copy_file(Config::instance()->cinemas_file(), wx_to_std(dialog.GetPath()), boost::filesystem::copy_option::overwrite_if_exists);
+                       dcp::filesystem::copy_file(Config::instance()->cinemas_file(), wx_to_std(dialog.GetPath()), boost::filesystem::copy_option::overwrite_if_exists);
                }
        }
 
@@ -215,13 +219,13 @@ private:
        void config_file_changed ()
        {
                auto config = Config::instance();
-               boost::filesystem::path new_file = wx_to_std(_config_file->GetPath());
-               if (new_file == config->config_read_file()) {
+               auto const new_file = _config_file->path();
+               if (!new_file || *new_file == config->config_read_file()) {
                        return;
                }
                bool copy_and_link = true;
-               if (boost::filesystem::exists(new_file)) {
-                       ConfigMoveDialog dialog(_panel, new_file);
+               if (dcp::filesystem::exists(*new_file)) {
+                       ConfigMoveDialog dialog(_panel, *new_file);
                        if (dialog.ShowModal() == wxID_OK) {
                                copy_and_link = false;
                        }
@@ -230,16 +234,18 @@ private:
                if (copy_and_link) {
                        config->write ();
                        if (new_file != config->config_read_file()) {
-                               config->copy_and_link (new_file);
+                               config->copy_and_link(*new_file);
                        }
                } else {
-                       config->link (new_file);
+                       config->link(*new_file);
                }
        }
 
        void cinemas_file_changed ()
        {
-               Config::instance()->set_cinemas_file (wx_to_std (_cinemas_file->GetPath ()));
+               if (auto path = _cinemas_file->path()) {
+                       Config::instance()->set_cinemas_file(*path);
+               }
        }
 
        void default_add_file_location_changed()
@@ -1517,16 +1523,20 @@ private:
 
                {
                        add_label_to_sizer(table, _panel, _("Maximum JPEG2000 bandwidth"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer(wxHORIZONTAL);
+                       auto s = new wxBoxSizer(wxHORIZONTAL);
                        _maximum_j2k_bandwidth = new wxSpinCtrl(_panel);
                        s->Add(_maximum_j2k_bandwidth, 1);
                        add_label_to_sizer(s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxALIGN_CENTRE_VERTICAL);
                        table->Add(s, 1);
                }
 
-               _allow_any_dcp_frame_rate = new CheckBox(_panel, _("Allow any DCP frame rate"));
-               table->Add(_allow_any_dcp_frame_rate, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
-               table->AddSpacer(0);
+               auto checkbox = [this, table](wxString name, CheckBox*& variable) {
+                       variable = new CheckBox(_panel, name);
+                       table->Add(variable, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
+                       table->AddSpacer(0);
+               };
+
+               checkbox(_("Allow any DCP frame rate"),  _allow_any_dcp_frame_rate);
 
                _allow_any_container = new CheckBox(_panel, _("Allow full-frame and non-standard container ratios"));
                table->Add(_allow_any_container, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
@@ -1538,13 +1548,17 @@ private:
                table->Add(restart, 1, wxALIGN_CENTRE_VERTICAL | wxBOTTOM, DCPOMATIC_CHECKBOX_BOTTOM_PAD);
                restart->SetFont(font);
 
-               _allow_96khz_audio = new CheckBox(_panel, _("Allow creation of DCPs with 96kHz audio"));
-               table->Add(_allow_96khz_audio, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
-               table->AddSpacer (0);
+               checkbox(_("Allow creation of DCPs with 96kHz audio"), _allow_96khz_audio);
+               checkbox(_("Allow mapping to all audio channels"), _use_all_audio_channels);
+               checkbox(_("Allow use of SMPTE Bv2.0"), _allow_smpte_bv20);
 
-               _use_all_audio_channels = new CheckBox(_panel, _("Allow mapping to all audio channels"));
-               table->Add(_use_all_audio_channels, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP);
-               table->AddSpacer(0);
+               {
+                       add_label_to_sizer(table, _panel, _("ISDCF name part length"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+                       auto s = new wxBoxSizer(wxHORIZONTAL);
+                       _isdcf_name_part_length = new wxSpinCtrl(_panel);
+                       s->Add(_isdcf_name_part_length, 1);
+                       table->Add(s, 1);
+               }
 
                _maximum_j2k_bandwidth->SetRange(1, 1000);
                _maximum_j2k_bandwidth->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::maximum_j2k_bandwidth_changed, this));
@@ -1552,6 +1566,9 @@ private:
                _allow_any_container->bind(&NonStandardPage::allow_any_container_changed, this);
                _allow_96khz_audio->bind(&NonStandardPage::allow_96khz_audio_changed, this);
                _use_all_audio_channels->bind(&NonStandardPage::use_all_channels_changed, this);
+               _allow_smpte_bv20->bind(&NonStandardPage::allow_smpte_bv20_changed, this);
+               _isdcf_name_part_length->SetRange(1, 256);
+               _isdcf_name_part_length->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::isdcf_name_part_length_changed, this));
        }
 
        void config_changed() override
@@ -1563,6 +1580,8 @@ private:
                checked_set(_allow_any_container, config->allow_any_container());
                checked_set(_allow_96khz_audio, config->allow_96khz_audio());
                checked_set(_use_all_audio_channels, config->use_all_audio_channels());
+               checked_set(_allow_smpte_bv20, config->allow_smpte_bv20());
+               checked_set(_isdcf_name_part_length, config->isdcf_name_part_length());
        }
 
        void maximum_j2k_bandwidth_changed()
@@ -1590,11 +1609,23 @@ private:
                Config::instance()->set_use_all_audio_channels(_use_all_audio_channels->GetValue());
        }
 
+       void allow_smpte_bv20_changed()
+       {
+               Config::instance()->set_allow_smpte_bv20(_allow_smpte_bv20->GetValue());
+       }
+
+       void isdcf_name_part_length_changed()
+       {
+               Config::instance()->set_isdcf_name_part_length(_isdcf_name_part_length->GetValue());
+       }
+
        wxSpinCtrl* _maximum_j2k_bandwidth = nullptr;
        CheckBox* _allow_any_dcp_frame_rate = nullptr;
        CheckBox* _allow_any_container = nullptr;
        CheckBox* _allow_96khz_audio = nullptr;
        CheckBox* _use_all_audio_channels = nullptr;
+       CheckBox* _allow_smpte_bv20 = nullptr;
+       wxSpinCtrl* _isdcf_name_part_length = nullptr;
 };
 
 
@@ -1918,6 +1949,9 @@ create_full_config_dialog ()
        e->AddPage (new SoundPage          (ps, border));
        e->AddPage (new DefaultsPage       (ps, border));
        e->AddPage (new EncodingServersPage(ps, border));
+#ifdef DCPOMATIC_GROK
+       e->AddPage (new GPUPage            (ps, border));
+#endif
        e->AddPage (new KeysPage           (ps, border));
        e->AddPage (new TMSPage            (ps, border));
        e->AddPage (new EmailPage          (ps, border));