/*
* Copyright (C) 2005-2013 Team XBMC
- * http://www.xbmc.org
+ * http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "playlists/PlayList.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "music/tags/MusicInfoTag.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "guilib/LocalizeStrings.h"
#include "interfaces/AnnouncementManager.h"
+#include "guilib/Key.h"
using namespace PLAYLIST;
delete m_PlaylistEmpty;
}
+bool CPlayListPlayer::OnAction(const CAction &action)
+{
+ if (action.GetID() == ACTION_PREV_ITEM && !IsSingleItemNonRepeatPlaylist())
+ {
+ PlayPrevious();
+ return true;
+ }
+ else if (action.GetID() == ACTION_NEXT_ITEM && !IsSingleItemNonRepeatPlaylist())
+ {
+ PlayNext();
+ return true;
+ }
+ else
+ return false;
+}
+
bool CPlayListPlayer::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
return Play(iSong, false, true);
}
+bool CPlayListPlayer::IsSingleItemNonRepeatPlaylist() const
+{
+ const CPlayList& playlist = GetPlaylist(m_iCurrentPlayList);
+ return (playlist.size() <= 1 && !RepeatedOne(m_iCurrentPlayList) && !Repeated(m_iCurrentPlayList));
+}
+
bool CPlayListPlayer::Play()
{
if (m_iCurrentPlayList == PLAYLIST_NONE)
void CPlayListPlayer::ClearPlaylist(int iPlaylist)
{
// clear our applications playlist file
- g_application.m_strPlayListFile.Empty();
+ g_application.m_strPlayListFile.clear();
CPlayList& playlist = GetPlaylist(iPlaylist);
playlist.Clear();
if (bNotify)
{
- CStdString shuffleStr;
- shuffleStr.Format("%s: %s", g_localizeStrings.Get(191), g_localizeStrings.Get(bYesNo ? 593 : 591)); // Shuffle: All/Off
+ CStdString shuffleStr = StringUtils::Format("%s: %s", g_localizeStrings.Get(191).c_str(), g_localizeStrings.Get(bYesNo ? 593 : 591).c_str()); // Shuffle: All/Off
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(559), shuffleStr);
}
else if (iPlaylist == m_iCurrentPlayList)
{
if (
- (g_application.IsPlayingAudio() && iPlaylist == PLAYLIST_MUSIC) ||
- (g_application.IsPlayingVideo() && iPlaylist == PLAYLIST_VIDEO)
+ (g_application.m_pPlayer->IsPlayingAudio() && iPlaylist == PLAYLIST_MUSIC) ||
+ (g_application.m_pPlayer->IsPlayingVideo() && iPlaylist == PLAYLIST_VIDEO)
)
{
g_playlistPlayer.GetPlaylist(iPlaylist).Shuffle(m_iCurrentSong + 2);
void CPlayListPlayer::AnnouncePropertyChanged(int iPlaylist, const std::string &strProperty, const CVariant &value)
{
if (strProperty.empty() || value.isNull() ||
- (iPlaylist == PLAYLIST_VIDEO && !g_application.IsPlayingVideo()) ||
- (iPlaylist == PLAYLIST_MUSIC && !g_application.IsPlayingAudio()))
+ (iPlaylist == PLAYLIST_VIDEO && !g_application.m_pPlayer->IsPlayingVideo()) ||
+ (iPlaylist == PLAYLIST_MUSIC && !g_application.m_pPlayer->IsPlayingAudio()))
return;
CVariant data;