Cleanup: replace some list with vector.
[dcpomatic.git] / src / tools / dcpomatic.cc
index bd5be54aed3b19fe8987fb2ae0975a33be7bca9a..d6b6bc2b72aaba15126950ebdf4244c7e051d260 100644 (file)
@@ -1115,12 +1115,11 @@ private:
                for (auto i: translations) {
                        body += i.first + "\n" + i.second + "\n\n";
                }
-               list<string> to = { "carl@dcpomatic.com" };
                if (dialog.email().find("@") == string::npos) {
                        error_dialog (this, _("You must enter a valid email address when sending translations, "
                                              "otherwise the DCP-o-matic maintainers cannot credit you or contact you with questions."));
                } else {
-                       Emailer emailer(dialog.email(), to, "DCP-o-matic translations", body);
+                       Emailer emailer(dialog.email(), { "carl@dcpomatic.com" }, "DCP-o-matic translations", body);
                        try {
                                emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
                        } catch (NetworkError& e) {
@@ -1269,14 +1268,20 @@ private:
                        return true;
                }
 
-               if (_film->dirty ()) {
+               while (_film->dirty()) {
                        T dialog(_film->name());
                        switch (dialog.run()) {
                        case wxID_NO:
                                return true;
                        case wxID_YES:
-                               _film->write_metadata ();
-                               return true;
+                               try {
+                                       _film->write_metadata();
+                                       return true;
+                               } catch (exception& e) {
+                                       error_dialog(this, _("Could not save project."), std_to_wx(e.what()));
+                                       /* Go round again for another try */
+                               }
+                               break;
                        case wxID_CANCEL:
                                return false;
                        }
@@ -1703,7 +1708,7 @@ private:
                }
                catch (exception& e)
                {
-                       _splash.reset();
+                       close_splash();
                        error_dialog (nullptr, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
                }
 
@@ -1815,7 +1820,8 @@ private:
 
        void close_splash ()
        {
-               _splash.reset();
+               _splash->Destroy();
+               _splash = nullptr;
        }
 
        void config_failed_to_load (Config::LoadFailure what)
@@ -1833,7 +1839,7 @@ private:
                /* Destroy the splash screen here, as otherwise bad things seem to happen (for reasons unknown)
                   when we open our recreate dialog, close it, *then* try to Destroy the splash (the Destroy fails).
                */
-               _splash.reset();
+               close_splash();
 
                auto config = Config::instance();
                switch (reason) {
@@ -1902,7 +1908,7 @@ private:
        }
 
        DOMFrame* _frame = nullptr;
-       wx_ptr<wxSplashScreen> _splash;
+       wxSplashScreen* _splash;
        shared_ptr<wxTimer> _timer;
        string _film_to_load;
        string _film_to_create;