Browse files

ADD: "Queue from here" context menu; Queue from current item to end o…

…f list
  • Loading branch information...
1 parent 6d17467 commit a6f04d180243cbbcf32df5e70a4f845892d027b1 @koying committed Oct 23, 2012
View
6 language/English/strings.po
@@ -4869,7 +4869,11 @@ msgctxt "#13361"
msgid "Enable voice"
msgstr ""
-#empty strings from id 13362 to 13374
+msgctxt "#13362"
+msgid "Queue from here"
+msgstr ""
+
+#empty strings from id 13363 to 13374
msgctxt "#13375"
msgid "Enable device"
View
1 xbmc/dialogs/GUIDialogContextMenu.h
@@ -64,6 +64,7 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0,
CONTEXT_BUTTON_LOAD,
CONTEXT_BUTTON_CLEAR,
CONTEXT_BUTTON_QUEUE_ITEM,
+ CONTEXT_BUTTON_QUEUE_FROM_HERE,
CONTEXT_BUTTON_PLAY_ITEM,
CONTEXT_BUTTON_PLAY_WITH,
CONTEXT_BUTTON_PLAY_PARTYMODE,
View
23 xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -648,6 +648,21 @@ void CGUIWindowMusicBase::OnQueueItem(int iItem)
}
}
+/// \brief Add from selected list/thumb control item to to end of list to playlist
+/// \param iItem Selected Item in list/thumb control
+void CGUIWindowMusicBase::OnQueueFromHere(int iItem)
+{
+ // don't re-queue items from playlist window
+ if ( iItem < 0 || iItem >= m_vecItems->Size() || GetID() == WINDOW_MUSIC_PLAYLIST ) return ;
+
+ CFileItemList queueItems;
+ for ( int i = iItem; i < m_vecItems->Size(); i++ )
+ AddItemToPlayList(m_vecItems->Get(i), queueItems);
+
+ g_playlistPlayer.Add(PLAYLIST_MUSIC, queueItems);
+ g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
+}
+
/// \brief Add unique file and folders and its subfolders to playlist
/// \param pItem The file item to add
void CGUIWindowMusicBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItemList &queuedItems)
@@ -878,6 +893,10 @@ void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &but
else if (item->CanQueue() && !item->IsAddonsPath() && !item->IsScript())
{
buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); //queue
+ if (!(item->m_bIsFolder || item->IsScript()) && m_vecItems->Size() > 1 && itemNumber < m_vecItems->Size()-1)
+ {
+ buttons.Add(CONTEXT_BUTTON_QUEUE_FROM_HERE, 13362); // Queue to Playlist
+ }
// allow a folder to be ad-hoc queued and played by the default player
if (item->m_bIsFolder || (item->IsPlayList() &&
@@ -928,6 +947,10 @@ bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
OnQueueItem(itemNumber);
return true;
+ case CONTEXT_BUTTON_QUEUE_FROM_HERE:
+ OnQueueFromHere(itemNumber);
+ return true;
+
case CONTEXT_BUTTON_INFO:
OnInfo(itemNumber);
return true;
View
1 xbmc/music/windows/GUIWindowMusicBase.h
@@ -83,6 +83,7 @@ class CGUIWindowMusicBase : public CGUIMediaWindow
void OnInfo(int iItem, bool bShowInfo = true);
void OnInfoAll(int iItem, bool bCurrent=false, bool refresh=false);
virtual void OnQueueItem(int iItem);
+ virtual void OnQueueFromHere(int iItem);
enum ALLOW_SELECTION { SELECTION_ALLOWED = 0, SELECTION_AUTO, SELECTION_FORCED };
bool FindAlbumInfo(const CStdString& strAlbum, const CStdString& strArtist, MUSIC_GRABBER::CMusicAlbumInfo& album, ALLOW_SELECTION allowSelection);
bool FindArtistInfo(const CStdString& strArtist, MUSIC_GRABBER::CMusicArtistInfo& artist, ALLOW_SELECTION allowSelection);
View
21 xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -729,6 +729,19 @@ void CGUIWindowVideoBase::OnQueueItem(int iItem)
m_viewControl.SetSelectedItem(iItem + 1);
}
+void CGUIWindowVideoBase::OnQueueFromHere(int iItem)
+{
+ // don't re-queue items from playlist window
+ if ( iItem < 0 || iItem >= m_vecItems->Size() || GetID() == WINDOW_VIDEO_PLAYLIST ) return ;
+
+ CFileItemList queueItems;
+ for ( int i = iItem; i < m_vecItems->Size(); i++ )
+ AddItemToPlayList(m_vecItems->Get(i), queueItems);
+
+ g_playlistPlayer.Add(PLAYLIST_VIDEO, queueItems);
+ g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
+}
+
void CGUIWindowVideoBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItemList &queuedItems)
{
if (!pItem->CanQueue() || pItem->IsRAR() || pItem->IsZIP() || pItem->IsParentFolder()) // no zip/rar enques thank you!
@@ -1184,6 +1197,10 @@ void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &but
&& !m_vecItems->IsSourcesPath())
{
buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); // Add to Playlist
+ if (!(item->m_bIsFolder || item->IsScript()) && m_vecItems->Size() > 1 && itemNumber < m_vecItems->Size()-1)
+ {
+ buttons.Add(CONTEXT_BUTTON_QUEUE_FROM_HERE, 13362); // Queue to Playlist
+ }
}
// allow a folder to be ad-hoc queued and played by the default player
@@ -1331,6 +1348,10 @@ bool CGUIWindowVideoBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
OnQueueItem(itemNumber);
return true;
+ case CONTEXT_BUTTON_QUEUE_FROM_HERE:
+ OnQueueFromHere(itemNumber);
+ return true;
+
case CONTEXT_BUTTON_PLAY_ITEM:
PlayItem(itemNumber);
return true;
View
1 xbmc/video/windows/GUIWindowVideoBase.h
@@ -97,6 +97,7 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse
void GetNonContextButtons(int itemNumber, CContextButtons &buttons);
virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
virtual void OnQueueItem(int iItem);
+ virtual void OnQueueFromHere(int iItem);
virtual void OnDeleteItem(CFileItemPtr pItem);
virtual void OnDeleteItem(int iItem);
virtual void DoSearch(const CStdString& strSearch, CFileItemList& items) {};

0 comments on commit a6f04d1

Please sign in to comment.