1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

* Fixed TWK-464: Remove items from queue if you manually start them from there.

This commit is contained in:
Christian Muehlhaeuser 2011-09-06 07:45:42 +02:00
parent 06bd6edc8c
commit 7547250631
5 changed files with 22 additions and 7 deletions

View File

@ -18,17 +18,19 @@
#include "queueproxymodel.h"
#include "playlist/trackview.h"
#include "viewmanager.h"
#include "utils/logger.h"
using namespace Tomahawk;
QueueProxyModel::QueueProxyModel( QObject* parent )
QueueProxyModel::QueueProxyModel( TrackView* parent )
: PlaylistProxyModel( parent )
{
qDebug() << Q_FUNC_INFO;
connect( parent, SIGNAL( itemActivated( QModelIndex ) ), this, SLOT( onIndexActivated( QModelIndex ) ) );
connect( this, SIGNAL( sourceTrackCountChanged( unsigned int ) ), this, SLOT( onTrackCountChanged( unsigned int ) ) );
}
@ -38,11 +40,17 @@ QueueProxyModel::~QueueProxyModel()
}
void
QueueProxyModel::onIndexActivated( const QModelIndex& index )
{
setCurrentIndex( QModelIndex() );
removeIndex( index );
}
Tomahawk::result_ptr
QueueProxyModel::siblingItem( int itemsAway )
{
qDebug() << Q_FUNC_INFO << rowCount( QModelIndex() );
setCurrentIndex( QModelIndex() );
Tomahawk::result_ptr res = PlaylistProxyModel::siblingItem( itemsAway );

View File

@ -24,13 +24,14 @@
#include "dllmacro.h"
class QMetaData;
class TrackView;
class DLLEXPORT QueueProxyModel : public PlaylistProxyModel
{
Q_OBJECT
public:
explicit QueueProxyModel( QObject* parent = 0 );
explicit QueueProxyModel( TrackView* parent = 0 );
~QueueProxyModel();
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
@ -38,6 +39,7 @@ public:
using PlaylistProxyModel::siblingItem;
private slots:
void onIndexActivated( const QModelIndex& index );
void onTrackCountChanged( unsigned int count );
};

View File

@ -39,7 +39,7 @@ QueueView::QueueView( AnimatedSplitter* parent )
setHiddenSize( QSize( 0, 22 ) );
ui->queue->setProxyModel( new QueueProxyModel( this ) );
ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) );
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
ui->queue->setFrameShape( QFrame::NoFrame );
ui->queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );

View File

@ -183,6 +183,8 @@ TrackView::onItemActivated( const QModelIndex& index )
m_proxyModel->setCurrentIndex( index );
AudioEngine::instance()->playItem( m_proxyModel, item->query()->results().first() );
}
emit itemActivated( index );
}

View File

@ -40,7 +40,7 @@ class DLLEXPORT TrackView : public QTreeView
Q_OBJECT
public:
explicit TrackView( QWidget* parent = 0 );
explicit TrackView( QWidget* parent = 0 );
~TrackView();
virtual QString guid() const { return m_guid; }
@ -66,11 +66,14 @@ explicit TrackView( QWidget* parent = 0 );
void setUpdatesContextView( bool b ) { m_updateContextView = b; }
public slots:
void onItemActivated( const QModelIndex& index );
virtual void onItemActivated( const QModelIndex& index );
void playItem();
void onMenuTriggered( int action );
signals:
void itemActivated( const QModelIndex& index );
protected:
virtual void resizeEvent( QResizeEvent* event );