Use $HOME rather than hard-coded user name.
[dcpomatic.git] / src / wx / full_config_dialog.cc
index c61c75eced8660635dfd288ef95138fa8c29ec02..c1c36c4a4e370dbc3d74edd305fdf30c6270f167 100644 (file)
@@ -49,7 +49,7 @@
 #include "lib/config.h"
 #include "lib/cross.h"
 #include "lib/dcp_content_type.h"
-#include "lib/emailer.h"
+#include "lib/email.h"
 #include "lib/exceptions.h"
 #include "lib/filter.h"
 #include "lib/log.h"
@@ -57,6 +57,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 +115,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 +187,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 +216,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 +231,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()
@@ -977,7 +980,7 @@ private:
                        return;
                }
 
-               Emailer emailer(
+               Email email(
                        wx_to_std(dialog.from()),
                        { wx_to_std(dialog.to()) },
                        wx_to_std(_("DCP-o-matic test email")),
@@ -985,7 +988,7 @@ private:
                        );
                auto config = Config::instance();
                try {
-                       emailer.send(config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
+                       email.send(config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
                } catch (NetworkError& e) {
                        error_dialog(_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or("")));
                        return;
@@ -1561,7 +1564,7 @@ private:
                _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(14, 256);
+               _isdcf_name_part_length->SetRange(1, 256);
                _isdcf_name_part_length->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::isdcf_name_part_length_changed, this));
        }
 
@@ -1932,7 +1935,7 @@ create_full_config_dialog ()
           the containing window doesn't shrink too much when we select those panels.
           This is obviously an unpleasant hack.
        */
-       wxSize ps = wxSize (750, -1);
+       wxSize ps = wxSize(900, -1);
        int const border = 16;
 #else
        wxSize ps = wxSize (-1, -1);