mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Allow for overriding of a TrackView's PlaylistInterface.
This commit is contained in:
@@ -102,8 +102,13 @@ TrackView::~TrackView()
|
|||||||
void
|
void
|
||||||
TrackView::setGuid( const QString& guid )
|
TrackView::setGuid( const QString& guid )
|
||||||
{
|
{
|
||||||
m_guid = guid;
|
if ( !guid.isEmpty() )
|
||||||
m_header->setGuid( guid );
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO << "Setting guid on header" << guid << "for a view with" << m_proxyModel->columnCount() << "columns";
|
||||||
|
|
||||||
|
m_guid = QString( "%1/%2" ).arg( guid ).arg( m_proxyModel->columnCount() );
|
||||||
|
m_header->setGuid( m_guid );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -143,6 +148,7 @@ TrackView::setPlayableModel( PlayableModel* model )
|
|||||||
|
|
||||||
setAcceptDrops( true );
|
setAcceptDrops( true );
|
||||||
m_header->setDefaultColumnWeights( m_proxyModel->columnWeights() );
|
m_header->setDefaultColumnWeights( m_proxyModel->columnWeights() );
|
||||||
|
setGuid( m_proxyModel->guid() );
|
||||||
|
|
||||||
switch( m_proxyModel->style() )
|
switch( m_proxyModel->style() )
|
||||||
{
|
{
|
||||||
@@ -303,7 +309,7 @@ TrackView::tryToPlayItem( const QModelIndex& index )
|
|||||||
if ( item && !item->query().isNull() )
|
if ( item && !item->query().isNull() )
|
||||||
{
|
{
|
||||||
m_proxyModel->setCurrentIndex( index );
|
m_proxyModel->setCurrentIndex( index );
|
||||||
AudioEngine::instance()->playItem( m_proxyModel->playlistInterface(), item->query() );
|
AudioEngine::instance()->playItem( playlistInterface(), item->query() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -710,7 +716,19 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
|||||||
Tomahawk::playlistinterface_ptr
|
Tomahawk::playlistinterface_ptr
|
||||||
TrackView::playlistInterface() const
|
TrackView::playlistInterface() const
|
||||||
{
|
{
|
||||||
|
if ( m_playlistInterface.isNull() )
|
||||||
|
{
|
||||||
return proxyModel()->playlistInterface();
|
return proxyModel()->playlistInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_playlistInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface )
|
||||||
|
{
|
||||||
|
m_playlistInterface = playlistInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -64,6 +64,7 @@ public:
|
|||||||
|
|
||||||
virtual QWidget* widget() { return this; }
|
virtual QWidget* widget() { return this; }
|
||||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||||
|
void setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface );
|
||||||
|
|
||||||
virtual QString title() const;
|
virtual QString title() const;
|
||||||
virtual QString description() const;
|
virtual QString description() const;
|
||||||
@@ -145,6 +146,7 @@ private:
|
|||||||
|
|
||||||
bool m_updateContextView;
|
bool m_updateContextView;
|
||||||
|
|
||||||
|
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||||
QModelIndex m_hoveredIndex;
|
QModelIndex m_hoveredIndex;
|
||||||
QModelIndex m_contextMenuIndex;
|
QModelIndex m_contextMenuIndex;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user