using std::string;
using std::list;
using std::make_pair;
+using std::exception;
using boost::optional;
using boost::shared_ptr;
using boost::weak_ptr;
_v_sizer->Add (view_options, 0, wxALL, DCPOMATIC_SIZER_GAP);
- wxBoxSizer* e_sizer = new wxBoxSizer (wxHORIZONTAL);
+ wxBoxSizer* left_sizer = new wxBoxSizer (wxVERTICAL);
+
+ _spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
+ _spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 740);
+ left_sizer->Add (_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
_content_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
/* time */
_content_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
/* annotation text */
_content_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
- e_sizer->Add (_content_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
+ left_sizer->Add (_content_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
- _spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
- _spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
- _spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
- _spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
- e_sizer->Add (_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
+ wxBoxSizer* e_sizer = new wxBoxSizer (wxHORIZONTAL);
+ e_sizer->Add (left_sizer, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
+
+ _current_spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
+ _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
+ _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
+ _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
+ e_sizer->Add (_current_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
wxBoxSizer* buttons_sizer = new wxBoxSizer (wxVERTICAL);
_add_button = new wxButton(this, wxID_ANY, _("Add"));
_content_view->Show (false);
_spl_view->Show (false);
+ _current_spl_view->Show (false);
_add_button->Show (false);
_save_button->Show (false);
_load_button->Show (false);
setup_sensitivity ();
update_content_directory ();
+ update_playlist_directory ();
JobManager::instance()->ActiveJobsChanged.connect (
bind (&Controls::active_jobs_changed, this, _2)
void
Controls::add_clicked ()
{
- shared_ptr<Content> sel = selected_content ();
+ shared_ptr<Content> sel = selected_content()->clone();
DCPOMATIC_ASSERT (sel);
_film->examine_and_add_content (sel);
bool const ok = display_progress (_("DCP-o-matic"), _("Loading DCP"));
if (!ok || !report_errors_from_last_job(this)) {
return;
}
- if (_film->content().size() == 1) {
- /* Put 1 frame of black at the start so when we seek to 0 we don't see anything */
- sel->set_position (DCPTime::from_frames(1, _film->video_frame_rate()));
- }
- add_content_to_list (sel, _spl_view);
+ add_content_to_list (sel, _current_spl_view);
setup_sensitivity ();
}
);
if (d->ShowModal() == wxID_OK) {
- _film->write_metadata(wx_to_std(d->GetPath()));
+ boost::filesystem::path p(wx_to_std(d->GetPath()));
+ _film->set_name(p.stem().string());
+ _film->write_metadata(p);
}
d->Destroy ();
if (d->ShowModal() == wxID_OK) {
_film->read_metadata (boost::filesystem::path(wx_to_std(d->GetPath())));
- _spl_view->DeleteAllItems ();
+ _current_spl_view->DeleteAllItems ();
BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(i);
- add_content_to_list (dcp, _spl_view);
+ add_content_to_list (dcp, _current_spl_view);
}
}
{
if (property == Config::PLAYER_CONTENT_DIRECTORY) {
update_content_directory ();
+ } else if (property == Config::PLAYER_PLAYLIST_DIRECTORY) {
+ update_playlist_directory ();
} else {
setup_sensitivity ();
}
Controls::show_extended_player_controls (bool s)
{
_content_view->Show (s);
+ _spl_view->Show (s);
if (s) {
update_content_directory ();
+ update_playlist_directory ();
}
- _spl_view->Show (s);
+ _current_spl_view->Show (s);
_log->Show (s);
_add_button->Show (s);
_save_button->Show (s);
ctrl->SetItem(it);
}
+void
+Controls::add_playlist_to_list (shared_ptr<Film> film)
+{
+ int const N = _spl_view->GetItemCount();
+
+ wxListItem it;
+ it.SetId(N);
+ it.SetColumn(0);
+ it.SetText (std_to_wx(film->name()));
+ _spl_view->InsertItem (it);
+}
+
void
Controls::update_content_directory ()
{
shared_ptr<Content> content;
if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
content.reset (new DCPContent(_film, *i));
- } else if (i->path().extension() == ".mp4") {
+ } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
content = content_factory(_film, *i).front();
}
}
}
+void
+Controls::update_playlist_directory ()
+{
+ if (!_spl_view->IsShown()) {
+ return;
+ }
+
+ using namespace boost::filesystem;
+
+ _spl_view->DeleteAllItems ();
+ optional<path> dir = Config::instance()->player_playlist_directory();
+ if (!dir) {
+ return;
+ }
+
+ for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
+ try {
+ shared_ptr<Film> film (new Film(optional<path>()));
+ film->read_metadata (i->path());
+ _playlists.push_back (film);
+ add_playlist_to_list (film);
+ } catch (exception& e) {
+ /* Never mind */
+ }
+ }
+}
+
#ifdef DCPOMATIC_VARIANT_SWAROOP
void
Controls::pause_clicked ()