public:
ContentDialog (wxWindow* parent, weak_ptr<Film> film)
: wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640))
- , _content_view (new ContentView(this, film))
+ , _content_view (new ContentView(this))
{
_content_view->update ();
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);
void save_clicked ()
{
- wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
+ Config* c = Config::instance ();
+ 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()));
}
void load_clicked ()
{
- wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"));
+ Config* c = Config::instance ();
+ 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"));
if (d->ShowModal() == wxID_OK) {
_list->DeleteAllItems ();
- if (_playlist.read (wx_to_std(d->GetPath()), _content_dialog)) {
+ if (!_playlist.read (wx_to_std(d->GetPath()), _content_dialog)) {
+ BOOST_FOREACH (SPLEntry i, _playlist.get()) {
+ add (i);
+ }
+ } else {
error_dialog (this, _("Some content in this playlist was not found."));
}
}