X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_playlist.cc;h=64549765fd8acad416c823bf3fdc69694c519a39;hb=eb2ea2746ac25ede54a04b46b26e1ebc088357b7;hp=c9ceadb2658eb99df5132356f4343b19ba721a8a;hpb=69f9e9881aa6f8036e93b8a1dba0a5bd1df1f901;p=dcpomatic.git diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc index c9ceadb26..64549765f 100644 --- a/src/tools/dcpomatic_playlist.cc +++ b/src/tools/dcpomatic_playlist.cc @@ -21,6 +21,7 @@ #include "../wx/wx_util.h" #include "../wx/wx_signal_manager.h" #include "../wx/content_view.h" +#include "../wx/dcpomatic_button.h" #include "../lib/util.h" #include "../lib/config.h" #include "../lib/cross.h" @@ -31,6 +32,9 @@ #include #include #include +#ifdef __WXOSX__ +#include +#endif using std::exception; using std::cout; @@ -44,7 +48,7 @@ using boost::dynamic_pointer_cast; class ContentDialog : public wxDialog, public ContentStore { public: - ContentDialog (wxWindow* parent, weak_ptr film) + ContentDialog (wxWindow* parent) : wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640)) , _content_view (new ContentView(this)) { @@ -82,9 +86,7 @@ class DOMFrame : public wxFrame public: explicit DOMFrame (wxString const & title) : wxFrame (0, -1, title) - /* XXX: this is a bit of a hack, but we need it to be able to use the Content class hierarchy */ - , _film (new Film(optional())) - , _content_dialog (new ContentDialog(this, _film)) + , _content_dialog (new ContentDialog(this)) { /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. @@ -125,12 +127,12 @@ public: main_sizer->Add (_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); wxBoxSizer* button_sizer = new wxBoxSizer (wxVERTICAL); - _up = new wxButton (overall_panel, wxID_ANY, _("Up")); - _down = new wxButton (overall_panel, wxID_ANY, _("Down")); - _add = new wxButton (overall_panel, wxID_ANY, _("Add")); - _remove = new wxButton (overall_panel, wxID_ANY, _("Remove")); - _save = new wxButton (overall_panel, wxID_ANY, _("Save playlist")); - _load = new wxButton (overall_panel, wxID_ANY, _("Load playlist")); + _up = new Button (overall_panel, _("Up")); + _down = new Button (overall_panel, _("Down")); + _add = new Button (overall_panel, _("Add")); + _remove = new Button (overall_panel, _("Remove")); + _save = new Button (overall_panel, _("Save playlist")); + _load = new Button (overall_panel, _("Load playlist")); button_sizer->Add (_up, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); button_sizer->Add (_down, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); button_sizer->Add (_add, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); @@ -162,7 +164,6 @@ private: item.SetId (_list->GetItemCount()); long const N = _list->InsertItem (item); set_item (N, e); - _playlist.add (e); } void selection_changed () @@ -176,7 +177,7 @@ private: _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, 3, e.type == SPLEntry::DCP ? _("DCP") : _("E-cinema")); - _list->SetItem (N, 4, e.encrypted ? _("Y") : _("N")); + _list->SetItem (N, 4, e.encrypted ? S_("Question|Y") : S_("Question|N")); _list->SetItem (N, COLUMN_SKIPPABLE, wxEmptyString, e.skippable ? 0 : 1); _list->SetItem (N, COLUMN_DISABLE_TIMELINE, wxEmptyString, e.disable_timeline ? 0 : 1); _list->SetItem (N, COLUMN_STOP_AFTER_PLAY, wxEmptyString, e.stop_after_play ? 0 : 1); @@ -231,7 +232,9 @@ private: if (r == wxID_OK) { shared_ptr content = _content_dialog->selected (); if (content) { - add (SPLEntry(content)); + SPLEntry e (content); + add (e); + _playlist.add (e); } } } @@ -283,7 +286,9 @@ private: wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString); wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (d->ShowModal() == wxID_OK) { - _playlist.write (wx_to_std(d->GetPath())); + boost::filesystem::path file = wx_to_std (d->GetPath()); + file.replace_extension (".xml"); + _playlist.write (file); } } @@ -294,7 +299,9 @@ private: wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml")); if (d->ShowModal() == wxID_OK) { _list->DeleteAllItems (); - if (!_playlist.read (wx_to_std(d->GetPath()), _content_dialog)) { + _playlist.read (wx_to_std(d->GetPath()), _content_dialog); + if (!_playlist.missing()) { + _list->DeleteAllItems (); BOOST_FOREACH (SPLEntry i, _playlist.get()) { add (i); } @@ -311,7 +318,6 @@ private: wxButton* _remove; wxButton* _save; wxButton* _load; - boost::shared_ptr _film; SPL _playlist; ContentDialog* _content_dialog; @@ -348,7 +354,7 @@ private: unsetenv ("UBUNTU_MENUPROXY"); #endif - #ifdef __WXOSX__ +#ifdef __WXOSX__ ProcessSerialNumber serial; GetCurrentProcess (&serial); TransformProcessType (&serial, kProcessTransformToForegroundApplication);