Logging improvements to allow prettier displays in the server GUI.
[dcpomatic.git] / src / wx / dolby_certificate_dialog.cc
index ad43f64795fb731eb77d46b20690cd04f5a43acd..58ad73e0d2a25c0635ac7e208e78719a89e893f0 100644 (file)
 
 */
 
-#include <boost/algorithm/string.hpp>
-#include <curl/curl.h>
+#include "dolby_certificate_dialog.h"
+#include "wx_util.h"
 #include "lib/compose.hpp"
 #include "lib/internet.h"
 #include "lib/signal_manager.h"
-#include "dolby_certificate_dialog.h"
-#include "wx_util.h"
+#include <curl/curl.h>
+#include <boost/algorithm/string.hpp>
+#include <boost/foreach.hpp>
+#include <iostream>
 
 using std::list;
 using std::string;
@@ -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 (_("Cinema"), true);
        _cinema = add (new wxChoice (this, wxID_ANY));
        _cinema->Append (N_("Motion Picture Solutions London Mobile & QC"));
@@ -72,7 +74,7 @@ DolbyCertificateDialog::setup_countries ()
                /* Already set up */
                return;
        }
-       
+
        _country->Append (_("Fetching..."));
        _country->SetSelection (0);
 
@@ -86,10 +88,9 @@ DolbyCertificateDialog::setup_countries ()
 void
 DolbyCertificateDialog::finish_setup_countries ()
 {
-       list<string> const countries = get_dir ("");
        _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));
        }
 }
 
@@ -102,17 +103,16 @@ DolbyCertificateDialog::country_selected ()
 
 #ifdef DCPOMATIC_OSX
        wxMilliSleep (200);
-#endif 
+#endif
        signal_manager->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this));
 }
 
 void
 DolbyCertificateDialog::finish_country_selected ()
 {
-       list<string> const cinemas = get_dir (wx_to_std (_country->GetStringSelection()));
        _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));
        }
 }
 
@@ -133,14 +133,13 @@ void
 DolbyCertificateDialog::finish_cinema_selected ()
 {
        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 ();
-       for (list<string>::const_iterator i = zips.begin(); i != zips.end(); ++i) {
+       BOOST_FOREACH (string i, get_dir (dir)) {
                vector<string> a;
-               split (a, *i, is_any_of ("-_"));
+               split (a, i, is_any_of ("-_"));
                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)));
                }
        }
 }