summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-12-01 20:24:56 +0100
committerCarl Hetherington <cth@carlh.net>2022-12-01 20:25:08 +0100
commit986a681d008c432f68a4ff67d44e7a019ceab1a5 (patch)
tree60031902dd99c3d6d9aca17717710c73ae154a6a
parent62c03e3d3493df8a31361b3281c443cac35decb0 (diff)
Check for playlist directory on new playlist, rather than save.
-rw-r--r--src/tools/dcpomatic_playlist.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc
index 3e3bd0266..4a4407b02 100644
--- a/src/tools/dcpomatic_playlist.cc
+++ b/src/tools/dcpomatic_playlist.cc
@@ -106,6 +106,7 @@ public:
PlaylistList (wxPanel* parent, ContentStore* content_store)
: _sizer (new wxBoxSizer(wxVERTICAL))
, _content_store (content_store)
+ , _parent(parent)
{
auto label = new wxStaticText (parent, wxID_ANY, wxEmptyString);
label->SetLabelMarkup (_("<b>Playlists</b>"));
@@ -227,6 +228,12 @@ private:
void new_playlist ()
{
+ auto dir = Config::instance()->player_playlist_directory();
+ if (!dir) {
+ error_dialog(_parent, _("No playlist folder is specified in preferences. Please set one and then try again."));
+ return;
+ }
+
shared_ptr<SignalSPL> spl (new SignalSPL(wx_to_std(_("New Playlist"))));
add_playlist_to_model (spl);
add_playlist_to_view (spl);
@@ -280,6 +287,7 @@ private:
wxButton* _delete;
vector<shared_ptr<SignalSPL>> _playlists;
ContentStore* _content_store;
+ wxWindow* _parent;
};
@@ -546,12 +554,9 @@ private:
void save_playlist (shared_ptr<SignalSPL> playlist)
{
- auto dir = Config::instance()->player_playlist_directory();
- if (!dir) {
- error_dialog (this, _("No playlist folder is specified in preferences. Please set one and then try again."));
- return;
+ if (auto dir = Config::instance()->player_playlist_directory()) {
+ playlist->write(*dir / (playlist->id() + ".xml"));
}
- playlist->write (*dir / (playlist->id() + ".xml"));
}
void setup_menu (wxMenuBar* m)