diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-02-06 00:53:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-02-06 00:53:22 +0100 |
| commit | 351c9a6a87df18a6048ee8da541cde2efb1ce6f0 (patch) | |
| tree | c6cdf66a092e1347cd7033b60b7b2c1b334e6499 /src/wx/content_view.cc | |
| parent | 90bcaa36fa76e7d22ae2cbe6f299bc2784076fde (diff) | |
wip: use sqlite3 for playlists2895-http-playlists
Diffstat (limited to 'src/wx/content_view.cc')
| -rw-r--r-- | src/wx/content_view.cc | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc index f3c11fa04..46da832a0 100644 --- a/src/wx/content_view.cc +++ b/src/wx/content_view.cc @@ -62,55 +62,50 @@ ContentView::ContentView (wxWindow* parent) } -shared_ptr<Content> -ContentView::selected () const +optional<ShowPlaylistEntry> +ContentView::selected() const { - long int s = GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + long int s = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (s == -1) { return {}; } - DCPOMATIC_ASSERT(s < int(_content_digests.size())); - return ContentStore::instance()->get(_content_digests[s]); + DCPOMATIC_ASSERT(s < int(_uuids.size())); + return ShowPlaylistContentStore::instance()->get(_uuids[s]); } void -ContentView::update () +ContentView::update() { - DeleteAllItems (); - _content_digests.clear(); - for (auto content: ContentStore::instance()->all()) { - add(content); + DeleteAllItems(); + _uuids.clear(); + for (auto entry: ShowPlaylistContentStore::instance()->all()) { + add(entry); } } void -ContentView::add(shared_ptr<Content> content) +ContentView::add(ShowPlaylistEntry entry) { int const N = GetItemCount(); wxListItem it; it.SetId(N); it.SetColumn(0); - auto length = content->approximate_length (); - auto const hmsf = length.split (24); - it.SetText(wxString::Format(char_to_wx("%02d:%02d:%02d"), hmsf.h, hmsf.m, hmsf.s)); + it.SetText(std_to_wx(entry.approximate_length())); InsertItem(it); - auto dcp = dynamic_pointer_cast<DCPContent>(content); - if (dcp && dcp->content_kind()) { - it.SetId(N); - it.SetColumn(1); - it.SetText(std_to_wx(dcp->content_kind()->name())); - SetItem(it); - } + it.SetId(N); + it.SetColumn(1); + it.SetText(std_to_wx(entry.kind().name())); + SetItem(it); it.SetId(N); it.SetColumn(2); - it.SetText(std_to_wx(content->summary())); + it.SetText(std_to_wx(entry.name())); SetItem(it); - _content_digests.push_back(content->digest()); + _uuids.push_back(entry.uuid()); } |
