optimize a bit adding playlists/directories to playlist
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user