You can now rmb in a playlist item and select it to be played after the

current one finishes.

svn path=/trunk/kdemultimedia/juk/; revision=211882
parent 72522daf
......@@ -253,6 +253,12 @@ void Playlist::setName(const QString &n)
// public slots
////////////////////////////////////////////////////////////////////////////////
void Playlist::playNext()
{
if(m_splitter)
m_splitter->playSelectedFileNext();
}
void Playlist::copy()
{
kapp->clipboard()->setData(dragObject(0), QClipboard::Clipboard);
......@@ -523,6 +529,7 @@ void Playlist::setup()
m_rmbMenu = new KPopupMenu(this);
m_rmbMenu->insertItem(SmallIcon("player_play"), i18n("Play Next"), this, SLOT(playNext()));
m_rmbMenu->insertItem(SmallIcon("editcut"), i18n("Cut"), this, SLOT(cut()));
m_rmbMenu->insertItem(SmallIcon("editcopy"), i18n("Copy"), this, SLOT(copy()));
m_rmbPasteID = m_rmbMenu->insertItem(SmallIcon("editpaste"), i18n("Paste"), this, SLOT(paste()));
......
......@@ -132,6 +132,7 @@ public slots:
virtual void paste();
virtual void clear();
virtual void selectAll() { KListView::selectAll(true); }
virtual void playNext();
protected:
/**
......
......@@ -51,7 +51,7 @@ void processEvents()
////////////////////////////////////////////////////////////////////////////////
PlaylistSplitter::PlaylistSplitter(QWidget *parent, bool restore, const char *name) : QSplitter(Qt::Horizontal, parent, name),
m_playingItem(0), m_restore(restore)
m_playingItem(0), m_restore(restore), m_nextPlaylistItem(0)
{
if(!m_mediaExtensions && !m_listExtensions) {
m_mediaExtensions = new QStringList();
......@@ -118,6 +118,10 @@ QString PlaylistSplitter::playNextFile(bool random)
i = static_cast<PlaylistItem *>(p->firstChild());
}
}
if (m_nextPlaylistItem) {
i = m_nextPlaylistItem;
m_nextPlaylistItem = 0;
}
if(i) {
i->setPixmap(0, QPixmap(UserIcon("playing")));
......@@ -161,6 +165,20 @@ QString PlaylistSplitter::playSelectedFile()
return QString::null;
}
QString PlaylistSplitter::playSelectedFileNext()
{
PlaylistItemList items = playlistSelection();
if(items.isEmpty())
{
m_nextPlaylistItem = 0L;
return QString::null;
}
m_nextPlaylistItem = items.first();
return m_nextPlaylistItem->absFilePath();
}
QString PlaylistSplitter::playFirstFile()
{
stop();
......@@ -169,7 +187,6 @@ QString PlaylistSplitter::playFirstFile()
PlaylistItem *i = static_cast<PlaylistItem *>(p->firstChild());
if(i) {
i->setPixmap(0, QPixmap(UserIcon("playing")));
i->setPixmap(0, QPixmap(UserIcon("playing")));
m_playingItem = i;
......@@ -579,7 +596,8 @@ void PlaylistSplitter::slotChangePlaylist(Playlist *p)
{
if(!p)
return;
m_nextPlaylistItem = 0;
m_playlistStack->raiseWidget(p);
m_editor->slotSetItems(playlistSelection());
setupColumns(p);
......@@ -596,6 +614,9 @@ void PlaylistSplitter::slotPlaylistItemRemoved(PlaylistItem *item)
{
if(item == m_playingItem)
m_playingItem = 0;
if(item == m_nextPlaylistItem)
m_nextPlaylistItem = 0;
}
#include "playlistsplitter.moc"
......@@ -84,6 +84,12 @@ public:
*/
QString playSelectedFile();
/**
* Returns the name of the currently selected file and stores it so that
* it's forced to be the next file played.
*/
QString playSelectedFileNext();
/**
* Returns the name of the first item in the playlist and moves the playing
* indicator to that file.
......@@ -301,6 +307,8 @@ private:
QStringList m_columnNames;
bool m_restore;
PlaylistItem *m_nextPlaylistItem;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment