X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftools%2Fdcpomatic_playlist.cc;h=5a8ee91267a9cb27aa65dbc42f828a36fe6257fd;hb=bf471e4e6d2502bb3b4e2eb4b1309d87e1003070;hp=6f06c0624e91109475a6b320c4ca5e8a56ed6fa1;hpb=3339d3bce70afe9ae2ca10e9fcfc4b54b748fbf4;p=dcpomatic.git diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc index 6f06c0624..5a8ee9126 100644 --- a/src/tools/dcpomatic_playlist.cc +++ b/src/tools/dcpomatic_playlist.cc @@ -19,12 +19,12 @@ */ -#include "wx/wx_util.h" -#include "wx/wx_signal_manager.h" +#include "wx/about_dialog.h" #include "wx/content_view.h" #include "wx/dcpomatic_button.h" -#include "wx/about_dialog.h" #include "wx/playlist_editor_config_dialog.h" +#include "wx/wx_signal_manager.h" +#include "wx/wx_util.h" #include "lib/config.h" #include "lib/cross.h" #include "lib/dcp_content.h" @@ -32,11 +32,14 @@ #include "lib/spl.h" #include "lib/spl_entry.h" #include "lib/util.h" -#include -#include +#include +LIBDCP_DISABLE_WARNINGS #include -#include +#include #include +#include +#include +LIBDCP_ENABLE_WARNINGS using std::cout; @@ -85,7 +88,7 @@ public: return _content_view->selected (); } - shared_ptr get (string digest) const + shared_ptr get (string digest) const override { return _content_view->get (digest); } @@ -163,22 +166,24 @@ private: void add_playlist_to_model (shared_ptr playlist) { _playlists.push_back (playlist); - playlist->NameChanged.connect (bind(&PlaylistList::name_changed, this, weak_ptr(playlist))); + playlist->Changed.connect(bind(&PlaylistList::changed, this, weak_ptr(playlist), _1)); } - void name_changed (weak_ptr wp) + void changed(weak_ptr wp, SignalSPL::Change change) { auto playlist = wp.lock (); if (!playlist) { return; } - int N = 0; - for (auto i: _playlists) { - if (i == playlist) { - _list->SetItem (N, 0, std_to_wx(i->name())); + if (change == SignalSPL::Change::NAME) { + int N = 0; + for (auto i: _playlists) { + if (i == playlist) { + _list->SetItem (N, 0, std_to_wx(i->name())); + } + ++N; } - ++N; } } @@ -279,8 +284,8 @@ public: auto images = new wxImageList (16, 16); wxIcon tick_icon; wxIcon no_tick_icon; - tick_icon.LoadFile (bitmap_path("tick"), wxBITMAP_TYPE_PNG); - no_tick_icon.LoadFile (bitmap_path("no_tick"), wxBITMAP_TYPE_PNG); + 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); @@ -357,7 +362,7 @@ private: { _list->SetItem (N, 0, std_to_wx(e.name)); _list->SetItem (N, 1, std_to_wx(e.id)); - _list->SetItem (N, 2, std_to_wx(dcp::content_kind_to_string(e.kind))); + _list->SetItem (N, 2, std_to_wx(e.kind->name())); _list->SetItem (N, 3, e.encrypted ? S_("Question|Y") : S_("Question|N")); } @@ -397,9 +402,7 @@ private: DCPOMATIC_ASSERT (_playlist); - auto tmp = (*_playlist)[s]; - (*_playlist)[s] = (*_playlist)[s-1]; - (*_playlist)[s-1] = tmp; + _playlist->swap(s, s - 1); set_item (s - 1, (*_playlist)[s-1]); set_item (s, (*_playlist)[s]); @@ -414,9 +417,7 @@ private: DCPOMATIC_ASSERT (_playlist); - auto tmp = (*_playlist)[s]; - (*_playlist)[s] = (*_playlist)[s+1]; - (*_playlist)[s+1] = tmp; + _playlist->swap(s, s + 1); set_item (s + 1, (*_playlist)[s+1]); set_item (s, (*_playlist)[s]); @@ -590,7 +591,7 @@ public: private: - bool OnInit () + bool OnInit () override try { wxInitAllImageHandlers (); @@ -645,7 +646,7 @@ private: } /* An unhandled exception has occurred inside the main event loop */ - bool OnExceptionInMainLoop () + bool OnExceptionInMainLoop () override { try { throw; @@ -674,7 +675,7 @@ private: return false; } - void OnUnhandledException () + void OnUnhandledException () override { error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); }