SOUND_OUTPUT,
INTERFACE_COMPLEXITY,
PLAYER_CONTENT_DIRECTORY,
+ PLAYER_PLAYLIST_DIRECTORY,
HISTORY,
#ifdef DCPOMATIC_VARIANT_SWAROOP
PLAYER_BACKGROUND_IMAGE,
}
void set_player_playlist_directory (boost::filesystem::path p) {
- maybe_set (_player_playlist_directory, p);
+ maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
}
void unset_player_playlist_directory () {
return;
}
_player_playlist_directory = boost::none;
- changed ();
+ changed (PLAYER_PLAYLIST_DIRECTORY);
}
void set_player_kdm_directory (boost::filesystem::path p) {
using std::string;
using std::list;
using std::make_pair;
+using std::exception;
using boost::optional;
using boost::shared_ptr;
using boost::weak_ptr;
setup_sensitivity ();
update_content_directory ();
+ update_playlist_directory ();
JobManager::instance()->ActiveJobsChanged.connect (
bind (&Controls::active_jobs_changed, this, _2)
);
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 (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);
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 ()
{
}
}
+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 ()
void stopped ();
void film_changed ();
void update_content_directory ();
+ void update_playlist_directory ();
void config_changed (int property);
typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
void save_clicked ();
void load_clicked ();
void add_content_to_list (boost::shared_ptr<Content> content, wxListCtrl* list);
+ void add_playlist_to_list (boost::shared_ptr<Film> film);
boost::shared_ptr<Film> _film;
boost::shared_ptr<FilmViewer> _viewer;
wxButton* _save_button;
wxButton* _load_button;
std::vector<boost::shared_ptr<Content> > _content;
+ std::vector<boost::shared_ptr<Film> > _playlists;
wxSlider* _slider;
wxButton* _rewind_button;
wxButton* _back_button;