void add_playlist_to_model (shared_ptr<SignalSPL> playlist)
{
_playlists.push_back (playlist);
- playlist->NameChanged.connect (bind(&PlaylistList::name_changed, this, weak_ptr<SignalSPL>(playlist)));
+ playlist->Changed.connect(bind(&PlaylistList::changed, this, weak_ptr<SignalSPL>(playlist), _1));
}
- void name_changed (weak_ptr<SignalSPL> wp)
+ void changed(weak_ptr<SignalSPL> 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()));
+ switch (change) {
+ case SignalSPL::Change::NAME:
+ {
+ int N = 0;
+ for (auto i: _playlists) {
+ if (i == playlist) {
+ _list->SetItem (N, 0, std_to_wx(i->name()));
+ }
+ ++N;
+ }
+ break;
+ }
+ case SignalSPL::Change::CONTENT:
+ if (auto dir = Config::instance()->player_playlist_directory()) {
+ playlist->write(*dir / (playlist->id() + ".xml"));
}
- ++N;
+ break;
}
}
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);
{
_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"));
}
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]);
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]);