Extract all uses of DCP-o-matic name to allow branding.
[dcpomatic.git] / src / tools / dcpomatic_playlist.cc
index 96dff56ed21ec169264eb6d822ae7f3a8ac5366e..56cf07413d9010c78d46e65c5a5f420a984e745e 100644 (file)
 #include "wx/playlist_editor_config_dialog.h"
 #include "wx/wx_signal_manager.h"
 #include "wx/wx_util.h"
+#include "wx/wx_variant.h"
 #include "lib/config.h"
+#include "lib/constants.h"
 #include "lib/cross.h"
 #include "lib/dcp_content.h"
 #include "lib/film.h"
 #include "lib/spl.h"
 #include "lib/spl_entry.h"
-#include "lib/util.h"
+#include <dcp/filesystem.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/imaglist.h>
@@ -222,13 +224,15 @@ private:
 
                _list->DeleteAllItems ();
                _playlists.clear ();
-               for (auto i: boost::filesystem::directory_iterator(*path)) {
-                       auto spl = make_shared<SignalSPL>();
-                       try {
-                               spl->read (i, _content_store);
-                               add_playlist_to_model (spl);
-                       } catch (...) {}
-               }
+               try {
+                       for (auto i: dcp::filesystem::directory_iterator(*path)) {
+                               auto spl = make_shared<SignalSPL>();
+                               try {
+                                       spl->read (i, _content_store);
+                                       add_playlist_to_model (spl);
+                               } catch (...) {}
+                       }
+               } catch (...) {}
 
                for (auto i: _playlists) {
                        add_playlist_to_view (i);
@@ -271,7 +275,7 @@ private:
                        return;
                }
 
-               boost::filesystem::remove(*dir / (_playlists[*index]->id() + ".xml"));
+               dcp::filesystem::remove(*dir / (_playlists[*index]->id() + ".xml"));
                _list->DeleteItem(*index);
                _playlists.erase(_playlists.begin() + *index);
 
@@ -328,16 +332,6 @@ public:
                _list->AppendColumn (_("Type"), wxLIST_FORMAT_LEFT, 100);
                _list->AppendColumn (_("Encrypted"), wxLIST_FORMAT_CENTRE, 90);
 
-               auto images = new wxImageList (16, 16);
-               wxIcon tick_icon;
-               wxIcon no_tick_icon;
-               tick_icon.LoadFile (bitmap_path("tick.png"), wxBITMAP_TYPE_PNG);
-               no_tick_icon.LoadFile (bitmap_path("no_tick.png"), wxBITMAP_TYPE_PNG);
-               images->Add (tick_icon);
-               images->Add (no_tick_icon);
-
-               _list->SetImageList (images, wxIMAGE_LIST_SMALL);
-
                list->Add (_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
 
                auto button_sizer = new wxBoxSizer (wxVERTICAL);
@@ -551,9 +545,8 @@ private:
 
        void help_about ()
        {
-               auto d = new AboutDialog (this);
+               auto d = make_wx<AboutDialog>(this);
                d->ShowModal ();
-               d->Destroy ();
        }
 
        void edit_preferences ()
@@ -575,33 +568,36 @@ private:
 
        void setup_menu (wxMenuBar* m)
        {
-               auto file = new wxMenu;
-#ifdef __WXOSX__
-               file->Append (wxID_EXIT, _("&Exit"));
+#ifdef DCPOMATIC_OSX
+               auto help = new wxMenu;
+               /* These just need to be appended somewhere, it seems - they magically
+                * get moved to the right place.
+                */
+               if (!Config::instance()->playlist_editor_restricted_menus()) {
+                       help->Append(wxID_PREFERENCES, _("&Preferences...\tCtrl-,"));
+               }
+               help->Append(wxID_EXIT, _("&Exit"));
+               help->Append(wxID_ABOUT, variant::wx::insert_dcpomatic_playlist_editor(_("About %s")));
+
+               m->Append(help, _("&Help"));
 #else
-               file->Append (wxID_EXIT, _("&Quit"));
-#endif
+               auto file = new wxMenu;
+               file->Append(wxID_EXIT, _("&Quit"));
 
-#ifndef __WXOSX__
                auto edit = new wxMenu;
-               edit->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
-#endif
+               edit->Append(wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
 
                auto help = new wxMenu;
-#ifdef __WXOSX__
-               help->Append (wxID_ABOUT, _("About DCP-o-matic"));
-#else
-               help->Append (wxID_ABOUT, _("About"));
-#endif
+               help->Append(wxID_ABOUT, _("About"));
 
-               m->Append (file, _("&File"));
-#ifndef __WXOSX__
-               m->Append (edit, _("&Edit"));
+               m->Append(file, _("&File"));
+               if (!Config::instance()->playlist_editor_restricted_menus()) {
+                       m->Append(edit, _("&Edit"));
+                       m->Append(help, _("&Help"));
+               }
 #endif
-               m->Append (help, _("&Help"));
        }
 
-
        void config_changed ()
        {
                try {
@@ -642,7 +638,7 @@ private:
        try
        {
                wxInitAllImageHandlers ();
-               SetAppName (_("DCP-o-matic Playlist Editor"));
+               SetAppName(variant::wx::dcpomatic_playlist_editor());
 
                if (!wxApp::OnInit()) {
                        return false;
@@ -676,7 +672,7 @@ private:
                */
                Config::drop ();
 
-               _frame = new DOMFrame (_("DCP-o-matic Playlist Editor"));
+               _frame = new DOMFrame(variant::wx::dcpomatic_playlist_editor());
                SetTopWindow (_frame);
                _frame->Maximize ();
                _frame->Show ();
@@ -688,7 +684,7 @@ private:
        }
        catch (exception& e)
        {
-               error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what()));
+               error_dialog(nullptr, variant::wx::insert_dcpomatic_playlist_editor(_("%s could not start %s")), std_to_wx(e.what()));
                return true;
        }