projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Logging improvements to allow prettier displays in the server GUI.
[dcpomatic.git]
/
src
/
wx
/
dolby_certificate_dialog.cc
diff --git
a/src/wx/dolby_certificate_dialog.cc
b/src/wx/dolby_certificate_dialog.cc
index e5bb1896207fe396464624e7ca730093b8d217ab..58ad73e0d2a25c0635ac7e208e78719a89e893f0 100644
(file)
--- a/
src/wx/dolby_certificate_dialog.cc
+++ b/
src/wx/dolby_certificate_dialog.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2015
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
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
@@
-17,17
+17,19
@@
*/
*/
-#include <boost/algorithm/string.hpp>
-#include <curl/curl.h>
-#include "lib/compose.hpp"
-#include "lib/internet.h"
#include "dolby_certificate_dialog.h"
#include "wx_util.h"
#include "dolby_certificate_dialog.h"
#include "wx_util.h"
+#include "lib/compose.hpp"
+#include "lib/internet.h"
+#include "lib/signal_manager.h"
+#include <curl/curl.h>
+#include <boost/algorithm/string.hpp>
+#include <boost/foreach.hpp>
+#include <iostream>
using std::list;
using std::string;
using std::vector;
using std::list;
using std::string;
using std::vector;
-using std::stringstream;
using std::cout;
using boost::optional;
using boost::algorithm::split;
using std::cout;
using boost::optional;
using boost::algorithm::split;
@@
-39,7
+41,7
@@
DolbyCertificateDialog::DolbyCertificateDialog (wxWindow* parent, boost::functio
add (_("Country"), true);
_country = add (new wxChoice (this, wxID_ANY));
_country->Append (N_("Hashemite Kingdom of Jordan"));
add (_("Country"), true);
_country = add (new wxChoice (this, wxID_ANY));
_country->Append (N_("Hashemite Kingdom of Jordan"));
-
+
add (_("Cinema"), true);
_cinema = add (new wxChoice (this, wxID_ANY));
_cinema->Append (N_("Motion Picture Solutions London Mobile & QC"));
add (_("Cinema"), true);
_cinema = add (new wxChoice (this, wxID_ANY));
_cinema->Append (N_("Motion Picture Solutions London Mobile & QC"));
@@
-72,15
+74,23
@@
DolbyCertificateDialog::setup_countries ()
/* Already set up */
return;
}
/* Already set up */
return;
}
-
+
_country->Append (_("Fetching..."));
_country->SetSelection (0);
_country->Append (_("Fetching..."));
_country->SetSelection (0);
- run_gui_loop ();
-
- list<string> const countries = get_dir ("");
+
+#ifdef DCPOMATIC_OSX
+ /* See DoremiCertificateDialog for discussion about this daft delay */
+ wxMilliSleep (200);
+#endif
+ signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_setup_countries, this));
+}
+
+void
+DolbyCertificateDialog::finish_setup_countries ()
+{
_country->Clear ();
_country->Clear ();
-
for (list<string>::const_iterator i = countries.begin(); i != countries.end(); ++i
) {
- _country->Append (std_to_wx (
*
i));
+
BOOST_FOREACH (string i, get_dir ("")
) {
+ _country->Append (std_to_wx (i));
}
}
}
}
@@
-90,12
+100,19
@@
DolbyCertificateDialog::country_selected ()
_cinema->Clear ();
_cinema->Append (_("Fetching..."));
_cinema->SetSelection (0);
_cinema->Clear ();
_cinema->Append (_("Fetching..."));
_cinema->SetSelection (0);
- run_gui_loop ();
-
- list<string> const cinemas = get_dir (wx_to_std (_country->GetStringSelection()));
+
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+ signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this));
+}
+
+void
+DolbyCertificateDialog::finish_country_selected ()
+{
_cinema->Clear ();
_cinema->Clear ();
-
for (list<string>::const_iterator i = cinemas.begin(); i != cinemas.end(); ++i
) {
- _cinema->Append (std_to_wx (
*
i));
+
BOOST_FOREACH (string i, get_dir (wx_to_std (_country->GetStringSelection()))
) {
+ _cinema->Append (std_to_wx (i));
}
}
}
}
@@
-105,17
+122,24
@@
DolbyCertificateDialog::cinema_selected ()
_serial->Clear ();
_serial->Append (_("Fetching..."));
_serial->SetSelection (0);
_serial->Clear ();
_serial->Append (_("Fetching..."));
_serial->SetSelection (0);
- run_gui_loop ();
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+ signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_cinema_selected, this));
+}
+
+void
+DolbyCertificateDialog::finish_cinema_selected ()
+{
string const dir = String::compose ("%1/%2", wx_to_std (_country->GetStringSelection()), wx_to_std (_cinema->GetStringSelection()));
string const dir = String::compose ("%1/%2", wx_to_std (_country->GetStringSelection()), wx_to_std (_cinema->GetStringSelection()));
- list<string> const zips = get_dir (dir);
_serial->Clear ();
_serial->Clear ();
-
for (list<string>::const_iterator i = zips.begin(); i != zips.end(); ++i
) {
+
BOOST_FOREACH (string i, get_dir (dir)
) {
vector<string> a;
vector<string> a;
- split (a,
*
i, is_any_of ("-_"));
+ split (a, i, is_any_of ("-_"));
if (a.size() >= 4) {
if (a.size() >= 4) {
- _serial->Append (std_to_wx (a[3]), new wxStringClientData (std_to_wx (
*
i)));
+ _serial->Append (std_to_wx (a[3]), new wxStringClientData (std_to_wx (i)));
}
}
}
}
}
}
@@
-129,9
+153,19
@@
DolbyCertificateDialog::serial_selected ()
void
DolbyCertificateDialog::download ()
{
void
DolbyCertificateDialog::download ()
{
+ downloaded (false);
_message->SetLabel (_("Downloading certificate"));
_message->SetLabel (_("Downloading certificate"));
- run_gui_loop ();
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+
+ signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_download, this));
+}
+
+void
+DolbyCertificateDialog::finish_download ()
+{
string const zip = string_client_data (_serial->GetClientObject (_serial->GetSelection ()));
string const file = String::compose (
string const zip = string_client_data (_serial->GetClientObject (_serial->GetSelection ()));
string const file = String::compose (
@@
-155,5
+189,6
@@
DolbyCertificateDialog::download ()
_message->SetLabel (std_to_wx (error.get ()));
} else {
_message->SetLabel (_("Certificate downloaded"));
_message->SetLabel (std_to_wx (error.get ()));
} else {
_message->SetLabel (_("Certificate downloaded"));
+ downloaded (true);
}
}
}
}