+ void save_clicked ()
+ {
+ wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
+ if (d->ShowModal() == wxID_OK) {
+ xmlpp::Document doc;
+ xmlpp::Element* root = doc.create_root_node ("SPL");
+ BOOST_FOREACH (PlaylistEntry i, _playlist) {
+ i.as_xml (root->add_child("Entry"));
+ }
+ doc.write_to_file_formatted (wx_to_std(d->GetPath()));
+ }
+ }
+
+ void load_clicked ()
+ {
+ wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"));
+ if (d->ShowModal() == wxID_OK) {
+ _list->DeleteAllItems ();
+ _playlist.clear ();
+ cxml::Document doc ("SPL");
+ doc.read_file (wx_to_std(d->GetPath()));
+ bool missing = false;
+ BOOST_FOREACH (cxml::ConstNodePtr i, doc.node_children("Entry")) {
+ shared_ptr<Content> c = _content_dialog->get(i->string_child("Digest"));
+ if (c) {
+ add (PlaylistEntry(c, i));
+ } else {
+ missing = true;
+ }
+ }
+ if (missing) {
+ error_dialog (this, _("Some content in this playlist was not found."));
+ }
+ }
+ }
+