Add passive mode option to TMS upload.
[dcpomatic.git] / src / wx / full_config_dialog.cc
index 8554af5b989495163ffc8bd1f6bdab250d894317..1eb87d93e70b05f419b0b65cb0f88dcad46c7112 100644 (file)
@@ -118,7 +118,7 @@ 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, false);
                table->Add (_cinemas_file, wxGBPosition (r, 1));
-               Button* export_cinemas = new Button (_panel, _("Export..."));
+               auto export_cinemas = new Button (_panel, _("Export..."));
                table->Add (export_cinemas, wxGBPosition (r, 2));
                ++r;
 
@@ -173,7 +173,7 @@ private:
                 );
 
                if (d->ShowModal () == wxID_OK) {
-                       boost::filesystem::copy_file (Config::instance()->cinemas_file(), wx_to_std(d->GetPath()));
+                       boost::filesystem::copy_file(Config::instance()->cinemas_file(), wx_to_std(d->GetPath()), boost::filesystem::copy_option::overwrite_if_exists);
                }
                d->Destroy ();
        }
@@ -257,7 +257,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("defaults"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("defaults"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -615,7 +615,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("servers"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("servers"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -633,7 +633,7 @@ private:
                        boost::bind (&Config::servers, Config::instance()),
                        boost::bind (&Config::set_servers, Config::instance(), _1),
                        boost::bind (&EncodingServersPage::server_column, this, _1),
-                       false,
+                       EditableListTitle::INVISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
 
@@ -678,7 +678,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("tms"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("tms"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -696,6 +696,10 @@ private:
                _tms_protocol = new wxChoice (_panel, wxID_ANY);
                table->Add (_tms_protocol, 1, wxEXPAND);
 
+               _tms_passive = new CheckBox(_panel, _("Passive mode"));
+               table->Add(_tms_passive, 1, wxEXPAND);
+               table->AddSpacer(0);
+
                add_label_to_sizer (table, _panel, _("IP address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
                _tms_ip = new wxTextCtrl (_panel, wxID_ANY);
                table->Add (_tms_ip, 1, wxEXPAND);
@@ -717,6 +721,8 @@ private:
 
                _upload->Bind (wxEVT_CHECKBOX, boost::bind(&TMSPage::upload_changed, this));
                _tms_protocol->Bind (wxEVT_CHOICE, boost::bind (&TMSPage::tms_protocol_changed, this));
+               _tms_passive->bind(&TMSPage::tms_passive_changed, this);
+
                _tms_ip->Bind (wxEVT_TEXT, boost::bind (&TMSPage::tms_ip_changed, this));
                _tms_path->Bind (wxEVT_TEXT, boost::bind (&TMSPage::tms_path_changed, this));
                _tms_user->Bind (wxEVT_TEXT, boost::bind (&TMSPage::tms_user_changed, this));
@@ -729,10 +735,13 @@ private:
 
                checked_set (_upload, config->upload_after_make_dcp());
                checked_set (_tms_protocol, static_cast<int>(config->tms_protocol()));
+               checked_set(_tms_passive, config->tms_protocol() == FileTransferProtocol::FTP && config->tms_passive());
                checked_set (_tms_ip, config->tms_ip ());
                checked_set (_tms_path, config->tms_path ());
                checked_set (_tms_user, config->tms_user ());
                checked_set (_tms_password, config->tms_password ());
+
+               _tms_passive->Enable(config->tms_protocol() == FileTransferProtocol::FTP);
        }
 
        void upload_changed ()
@@ -745,6 +754,11 @@ private:
                Config::instance()->set_tms_protocol(static_cast<FileTransferProtocol>(_tms_protocol->GetSelection()));
        }
 
+       void tms_passive_changed()
+       {
+               Config::instance()->set_tms_passive(_tms_passive->get());
+       }
+
        void tms_ip_changed ()
        {
                Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ()));
@@ -766,6 +780,7 @@ private:
        }
 
        CheckBox* _upload;
+       CheckBox* _tms_passive;
        wxChoice* _tms_protocol;
        wxTextCtrl* _tms_ip;
        wxTextCtrl* _tms_path;
@@ -789,7 +804,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("email"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("email"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -961,7 +976,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("kdm_email"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("kdm_email"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -991,7 +1006,7 @@ private:
                        [] (string s, int) {
                                return s;
                        },
-                       true,
+                       EditableListTitle::VISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
                table->Add (_cc, 1, wxEXPAND | wxALL);
@@ -1086,7 +1101,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("notifications"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("notifications"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1128,7 +1143,7 @@ private:
                        [] (string s, int) {
                                return s;
                        },
-                       true,
+                       EditableListTitle::VISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
                table->Add (_cc, 1, wxEXPAND | wxALL);
@@ -1262,7 +1277,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("cover_sheet"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("cover_sheet"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1321,7 +1336,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("identifiers"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("identifiers"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -1439,7 +1454,7 @@ public:
 #ifdef DCPOMATIC_OSX
        wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap(bitmap_path("advanced"), wxBITMAP_TYPE_PNG);
+               return wxBitmap(icon_path("advanced"), wxBITMAP_TYPE_PNG);
        }
 #endif