mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Fixed TWK-464: Remove items from queue if you manually start them from there.
This commit is contained in:
@@ -18,17 +18,19 @@
|
|||||||
|
|
||||||
#include "queueproxymodel.h"
|
#include "queueproxymodel.h"
|
||||||
|
|
||||||
|
#include "playlist/trackview.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
QueueProxyModel::QueueProxyModel( QObject* parent )
|
QueueProxyModel::QueueProxyModel( TrackView* parent )
|
||||||
: PlaylistProxyModel( parent )
|
: PlaylistProxyModel( parent )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
connect( parent, SIGNAL( itemActivated( QModelIndex ) ), this, SLOT( onIndexActivated( QModelIndex ) ) );
|
||||||
connect( this, SIGNAL( sourceTrackCountChanged( unsigned int ) ), this, SLOT( onTrackCountChanged( unsigned int ) ) );
|
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
|
Tomahawk::result_ptr
|
||||||
QueueProxyModel::siblingItem( int itemsAway )
|
QueueProxyModel::siblingItem( int itemsAway )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << rowCount( QModelIndex() );
|
|
||||||
|
|
||||||
setCurrentIndex( QModelIndex() );
|
setCurrentIndex( QModelIndex() );
|
||||||
Tomahawk::result_ptr res = PlaylistProxyModel::siblingItem( itemsAway );
|
Tomahawk::result_ptr res = PlaylistProxyModel::siblingItem( itemsAway );
|
||||||
|
|
||||||
|
@@ -24,13 +24,14 @@
|
|||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
class QMetaData;
|
class QMetaData;
|
||||||
|
class TrackView;
|
||||||
|
|
||||||
class DLLEXPORT QueueProxyModel : public PlaylistProxyModel
|
class DLLEXPORT QueueProxyModel : public PlaylistProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QueueProxyModel( QObject* parent = 0 );
|
explicit QueueProxyModel( TrackView* parent = 0 );
|
||||||
~QueueProxyModel();
|
~QueueProxyModel();
|
||||||
|
|
||||||
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
|
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
|
||||||
@@ -38,6 +39,7 @@ public:
|
|||||||
using PlaylistProxyModel::siblingItem;
|
using PlaylistProxyModel::siblingItem;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onIndexActivated( const QModelIndex& index );
|
||||||
void onTrackCountChanged( unsigned int count );
|
void onTrackCountChanged( unsigned int count );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ QueueView::QueueView( AnimatedSplitter* parent )
|
|||||||
|
|
||||||
setHiddenSize( QSize( 0, 22 ) );
|
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->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||||
ui->queue->setFrameShape( QFrame::NoFrame );
|
ui->queue->setFrameShape( QFrame::NoFrame );
|
||||||
ui->queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
ui->queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
@@ -183,6 +183,8 @@ TrackView::onItemActivated( const QModelIndex& index )
|
|||||||
m_proxyModel->setCurrentIndex( index );
|
m_proxyModel->setCurrentIndex( index );
|
||||||
AudioEngine::instance()->playItem( m_proxyModel, item->query()->results().first() );
|
AudioEngine::instance()->playItem( m_proxyModel, item->query()->results().first() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit itemActivated( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ class DLLEXPORT TrackView : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TrackView( QWidget* parent = 0 );
|
explicit TrackView( QWidget* parent = 0 );
|
||||||
~TrackView();
|
~TrackView();
|
||||||
|
|
||||||
virtual QString guid() const { return m_guid; }
|
virtual QString guid() const { return m_guid; }
|
||||||
@@ -66,11 +66,14 @@ explicit TrackView( QWidget* parent = 0 );
|
|||||||
void setUpdatesContextView( bool b ) { m_updateContextView = b; }
|
void setUpdatesContextView( bool b ) { m_updateContextView = b; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onItemActivated( const QModelIndex& index );
|
virtual void onItemActivated( const QModelIndex& index );
|
||||||
|
|
||||||
void playItem();
|
void playItem();
|
||||||
void onMenuTriggered( int action );
|
void onMenuTriggered( int action );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void itemActivated( const QModelIndex& index );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent( QResizeEvent* event );
|
virtual void resizeEvent( QResizeEvent* event );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user