Assorted C++11 tidying.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 78466d25baabbc4c112fe969ba3f726ac587fad0..be172ed2d0e29b5ec27af78a0f0630704d0eebc4 100644 (file)
@@ -102,7 +102,6 @@ DCPOMATIC_ENABLE_WARNINGS
 #include <shellapi.h>
 #endif
 #include <boost/filesystem.hpp>
-#include <boost/noncopyable.hpp>
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 #include <fstream>
@@ -135,7 +134,7 @@ using namespace boost::placeholders;
 #endif
 using dcp::raw_convert;
 
-class FilmChangedClosingDialog : public boost::noncopyable
+class FilmChangedClosingDialog
 {
 public:
        explicit FilmChangedClosingDialog (string name)
@@ -159,6 +158,9 @@ public:
                _dialog->Destroy ();
        }
 
+       FilmChangedClosingDialog (FilmChangedClosingDialog const&) = delete;
+       FilmChangedClosingDialog& operator= (FilmChangedClosingDialog const&) = delete;
+
        int run ()
        {
                return _dialog->ShowModal ();
@@ -168,7 +170,8 @@ private:
        wxMessageDialog* _dialog;
 };
 
-class FilmChangedDuplicatingDialog : public boost::noncopyable
+
+class FilmChangedDuplicatingDialog
 {
 public:
        explicit FilmChangedDuplicatingDialog (string name)
@@ -192,6 +195,9 @@ public:
                _dialog->Destroy ();
        }
 
+       FilmChangedDuplicatingDialog (FilmChangedDuplicatingDialog const&) = delete;
+       FilmChangedDuplicatingDialog& operator= (FilmChangedDuplicatingDialog const&) = delete;
+
        int run ()
        {
                return _dialog->ShowModal ();
@@ -512,7 +518,7 @@ private:
 
        void film_change (ChangeType type)
        {
-               if (type == CHANGE_TYPE_DONE) {
+               if (type == ChangeType::DONE) {
                        set_menu_sensitivity ();
                }
        }
@@ -1118,7 +1124,7 @@ private:
                        }
                        list<string> to = { "carl@dcpomatic.com" };
                        Emailer emailer (d->email(), to, "DCP-o-matic translations", body);
-                       emailer.send ("main.carlh.net", 2525, EMAIL_PROTOCOL_STARTTLS);
+                       emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
                }
 
                d->Destroy ();
@@ -1462,11 +1468,11 @@ private:
                        return;
                }
 
-               if (uc->state() == UpdateChecker::YES) {
+               if (uc->state() == UpdateChecker::State::YES) {
                        auto dialog = new UpdateDialog (this, uc->stable(), uc->test());
                        dialog->ShowModal ();
                        dialog->Destroy ();
-               } else if (uc->state() == UpdateChecker::FAILED) {
+               } else if (uc->state() == UpdateChecker::State::FAILED) {
                        error_dialog (this, _("The DCP-o-matic download server could not be contacted."));
                } else {
                        error_dialog (this, _("There are no new versions of DCP-o-matic available."));
@@ -1710,17 +1716,27 @@ private:
                        throw;
                } catch (FileError& e) {
                        error_dialog (
-                               0,
-                               wxString::Format (
+                               nullptr,
+                               wxString::Format(
                                        _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what()),
-                                       std_to_wx (e.file().string().c_str ())
+                                       std_to_wx (e.file().string().c_str())
+                                       )
+                               );
+               } catch (boost::filesystem::filesystem_error& e) {
+                       error_dialog (
+                               nullptr,
+                               wxString::Format(
+                                       _("An exception occurred: %s (%s) (%s)\n\n") + REPORT_PROBLEM,
+                                       std_to_wx (e.what()),
+                                       std_to_wx (e.path1().string()),
+                                       std_to_wx (e.path2().string())
                                        )
                                );
                } catch (exception& e) {
                        error_dialog (
                                nullptr,
-                               wxString::Format (
+                               wxString::Format(
                                        _("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what ())
                                        )