projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7709de3
)
Extract selected().
author
Carl Hetherington
<cth@carlh.net>
Thu, 1 Dec 2022 19:12:56 +0000
(20:12 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Thu, 1 Dec 2022 19:12:56 +0000
(20:12 +0100)
src/tools/dcpomatic_playlist.cc
patch
|
blob
|
history
diff --git
a/src/tools/dcpomatic_playlist.cc
b/src/tools/dcpomatic_playlist.cc
index 05dea1f330bfa09c88862ec43ccefd3706d02d53..835582c091d88ceef49f547c8f8a119af99ed8af 100644
(file)
--- a/
src/tools/dcpomatic_playlist.cc
+++ b/
src/tools/dcpomatic_playlist.cc
@@
-226,10
+226,20
@@
private:
_list->SetItemState (_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
_list->SetItemState (_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
- void delete_playlist ()
+ boost::optional<int> selected() const
{
{
- long int selected = _list->GetNextItem
(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ long int selected = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (selected < 0 || selected >= int(_playlists.size())) {
if (selected < 0 || selected >= int(_playlists.size())) {
+ return {};
+ }
+
+ return selected;
+ }
+
+ void delete_playlist ()
+ {
+ auto index = selected();
+ if (!index) {
return;
}
return;
}
@@
-238,11
+248,11
@@
private:
return;
}
return;
}
- boost::filesystem::remove
(*dir / (_playlists[selected
]->id() + ".xml"));
- _list->DeleteItem
(selected
);
- _playlists.erase
(_playlists.begin() + selected
);
+ boost::filesystem::remove
(*dir / (_playlists[*index
]->id() + ".xml"));
+ _list->DeleteItem
(*index
);
+ _playlists.erase
(_playlists.begin() + *index
);
- Edit
(shared_ptr<SignalSPL>());
+ Edit(shared_ptr<SignalSPL>());
}
void selection_changed ()
}
void selection_changed ()