make the playermanager use the tracksequencemanager

parent b3e20d23
......@@ -47,6 +47,7 @@
#include "tag.h"
#include "scrobbler.h"
#include "juk.h"
#include "tracksequencemanager.h"
using namespace ActionCollection;
......@@ -220,8 +221,7 @@ void PlayerManager::play(const FileHandle& file)
emit seeked(0);
}
else {
// m_playlistInterface->playNext();
// m_file = m_playlistInterface->currentFile();
m_file = TrackSequenceManager::instance()->nextFile();
if(!m_file.isNull())
{
......
......@@ -106,7 +106,7 @@ void PlaylistView::contextMenuEvent(QContextMenuEvent *event)
// Disable edit menu if only one file is selected, and it's read-only
FileHandle file = playlist()->fileHandles()[indexAt(event->pos()).row()];
const FileHandle &file = playlist()->data(indexAt(event->pos()), Qt::UserRole).value<FileHandle>();
m_editAction->setEnabled(file.fileInfo().isWritable() || selectedIndexes().count() > 1);
......@@ -1302,13 +1302,14 @@ void PlaylistView::setSearchEnabled(bool enabled)
// action("forward")->trigger();
// }
//
//
// void Playlist::playFirst()
// {
// TrackSequenceManager::instance()->setNextItem(m_items.first());
// action("forward")->trigger();
// TrackSequenceManager::instance()->setNextItem(m_items.first());
// action("forward")->trigger();
// }
//
//
// void Playlist::playNextAlbum()
// {
// PlaylistItem *current = TrackSequenceManager::instance()->currentItem();
......
......@@ -190,7 +190,7 @@ void TagEditor::slotSetItems(const QModelIndexList& list)
m_currentPlaylist = itemPlaylist;
foreach(const QModelIndex &index, list) {
m_items.append(itemPlaylist->fileHandles()[index.row()]);
m_items.append(itemPlaylist->data(index, Qt::UserRole).value<FileHandle>());
}
}
......
......@@ -100,6 +100,14 @@ const QModelIndex &TrackSequenceManager::nextItem()
return m_iterator->current();
}
FileHandle TrackSequenceManager::nextFile()
{
const QModelIndex &next = nextItem();
const Playlist *playlist = qobject_cast<const Playlist*>(next.model());
return playlist->data(next, Qt::UserRole).value<FileHandle>();
}
const QModelIndex &TrackSequenceManager::previousItem()
{
m_iterator->backup();
......
......@@ -20,6 +20,8 @@
#include <QPointer>
#include <QModelIndex>
#include "filehandle.h"
class KMenu;
class TrackSequenceIterator;
class Playlist;
......@@ -92,6 +94,8 @@ public:
* been reached
*/
const QModelIndex &nextItem();
FileHandle nextFile();
/**
* Returns the previous track, and backs up in the current sequence. Note
......
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