Merge branch 'master' of ssh://carlh.dyndns.org/home/carl/git/dcpomatic
authorCarl Hetherington <cth@carlh.net>
Mon, 31 Mar 2014 14:24:52 +0000 (15:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 31 Mar 2014 14:24:52 +0000 (15:24 +0100)
src/lib/internet.cc
src/wx/dolby_certificate_dialog.cc
src/wx/doremi_certificate_dialog.cc
src/wx/doremi_certificate_dialog.h
src/wx/kdm_dialog.cc
src/wx/screen_dialog.cc

index 16fd67244f4d0753ffe5e12f115ab4afa41a9cc1..c3f9dce659522099a13b047477494307ecaf3a18 100644 (file)
@@ -55,6 +55,7 @@ get_from_zip_url (string url, string file, function<void (boost::filesystem::pat
        FILE* f = temp_zip.open ("wb");
        curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, get_from_zip_url_data);
        curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
+       curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
 
        CURLcode const cr = curl_easy_perform (curl);
 
index 9960c16c917a860d88ec49565055393fdd6fc485..e5bb1896207fe396464624e7ca730093b8d217ab 100644 (file)
@@ -135,7 +135,7 @@ DolbyCertificateDialog::download ()
        string const zip = string_client_data (_serial->GetClientObject (_serial->GetSelection ()));
 
        string const file = String::compose (
-               "%1/%2/%3",
+               "ftp://dolbyrootcertificates:houro61l@ftp.dolby.co.uk/SHA256/%1/%2/%3",
                wx_to_std (_country->GetStringSelection()),
                wx_to_std (_cinema->GetStringSelection()),
                zip
@@ -149,11 +149,11 @@ DolbyCertificateDialog::download ()
                return;
        }
        string const cert = b[0] + "_" + b[1] + ".pem.crt";
-       
+
        optional<string> error = get_from_zip_url (file, cert, _load);
        if (error) {
-               error_dialog (this, std_to_wx (error.get ()));
+               _message->SetLabel (std_to_wx (error.get ()));
+       } else {
+               _message->SetLabel (_("Certificate downloaded"));
        }
-
-       _message->SetLabel (wxT (""));
 }
index 8509c97d150d502bff9c43be50dc18894be9ec2c..b0840a83fa23f9831f7f47734957b3ce95dddcdc 100644 (file)
@@ -33,7 +33,9 @@ DoremiCertificateDialog::DoremiCertificateDialog (wxWindow* parent, function<voi
        : DownloadCertificateDialog (parent, load)
 {
        add (_("Server serial number"), true);
-       _serial = add (new wxTextCtrl (this, wxID_ANY));
+       _serial = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (300, -1)));
+
+       _serial->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DoremiCertificateDialog::set_sensitivity, this));
 
        add_common_widgets ();
 }
@@ -48,6 +50,7 @@ DoremiCertificateDialog::download ()
        }
 
        _message->SetLabel (_("Downloading certificate"));
+       run_gui_loop ();
 
        optional<string> error = get_from_zip_url (
                String::compose (
@@ -61,6 +64,13 @@ DoremiCertificateDialog::download ()
        if (error) {
                error_dialog (this, std_to_wx (error.get ()));
        } else {
-               _message->SetLabel (wxT (""));
+               _message->SetLabel (_("Certificate downloaded"));
        }
 }
+
+void
+DoremiCertificateDialog::set_sensitivity ()
+{
+       _download->Enable (!_serial->IsEmpty ());
+}
+
index c2cb15dfdb7f3498ae0f43a8f78c1823d48cecdb..28118472692e663a4172b46323f5b6afa96863d6 100644 (file)
@@ -26,6 +26,7 @@ public:
 
 private:
        void download ();
+        void set_sensitivity ();
 
        wxTextCtrl* _serial;
 };
index cc643c8ef09925aaff9c9c5231bb8f1adefab94e..0336d0cb7f5484d1244c286509745e43041915c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -354,9 +354,11 @@ KDMDialog::remove_screen_clicked ()
        pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
 
        map<wxTreeItemId, shared_ptr<Cinema> >::iterator i = _cinemas.begin ();
-       list<shared_ptr<Screen> > sc = i->second->screens ();
-       while (i != _cinemas.end() && find (sc.begin(), sc.end(), s.second) == sc.end()) {
-               ++i;
+       while (i != _cinemas.end ()) {
+               list<shared_ptr<Screen> > sc = i->second->screens ();
+               if (find (sc.begin(), sc.end(), s.second) != sc.end ()) {
+                       break;
+               }
        }
 
        if (i == _cinemas.end()) {
index 232afa33c1fee2715dfc4240128d6c82c835dc1e..b702ae0ad8188be5892108c5b8ebef9afee3157e 100644 (file)
@@ -120,6 +120,8 @@ ScreenDialog::download_certificate ()
                d->ShowModal ();
                d->Destroy ();
        }
+
+       setup_sensitivity ();
 }
 
 void