summaryrefslogtreecommitdiff
path: root/src/playlist_editor.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-08-14 17:15:18 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-08-14 17:15:18 +0200
commitdad2bba13e32fd9b916a6f09655844b553713a7d (patch)
tree0820f5f592f89740d91cc34c4e15a4ab308ffec2 /src/playlist_editor.cpp
parentbab756c57952238bfcd306f1e3a6e6f42f4338c6 (diff)
optimize a bit adding playlists/directories to playlist
Diffstat (limited to 'src/playlist_editor.cpp')
-rw-r--r--src/playlist_editor.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp
index ed250c8b..12e1bebd 100644
--- a/src/playlist_editor.cpp
+++ b/src/playlist_editor.cpp
@@ -18,6 +18,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include <cassert>
#include <algorithm>
#include "charset.h"
@@ -324,9 +325,18 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
if (w == Playlists && !Playlists->Empty())
{
- Mpd.GetPlaylistContent(locale_to_utf_cpy(Playlists->Current()), list);
- if (myPlaylist->Add(list, add_n_play))
- ShowMessage("Loading playlist %s...", Playlists->Current().c_str());
+ const char *msg;
+ if (add_n_play)
+ msg = "Loading and playing playlist \"%s\"...";
+ else
+ msg = "Loading playlist \"%s\"...";
+ ShowMessage(msg, Playlists->Current().c_str());
+ if (Mpd.LoadPlaylist(utf_to_locale_cpy(Playlists->Current())))
+ {
+ ShowMessage("Playlist \"%s\" loaded", Playlists->Current().c_str());
+ if (add_n_play)
+ myPlaylist->PlayNewlyAddedSongs();
+ }
}
else if (w == Content && !Content->Empty())
Content->Bold(Content->Choice(), myPlaylist->Add(Content->Current(), Content->isBold(), add_n_play));
@@ -402,9 +412,7 @@ void PlaylistEditor::GetSelectedSongs(MPD::SongList &v)
if (selected.empty())
selected.push_back(Content->Choice());
for (std::vector<size_t>::const_iterator it = selected.begin(); it != selected.end(); ++it)
- {
v.push_back(new MPD::Song(Content->at(*it)));
- }
}
void PlaylistEditor::ApplyFilter(const std::string &s)
@@ -436,6 +444,5 @@ List *PlaylistEditor::GetList()
else if (w == Content)
return Content;
else // silence compiler
- return 0;
+ assert(false);
}
-