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

* Updated Track- & TreeView to handle new interfaces.

This commit is contained in:
Christian Muehlhaeuser 2012-11-28 04:52:45 +01:00
parent ad7263477f
commit df1235b8df
3 changed files with 6 additions and 11 deletions

View File

@ -248,7 +248,6 @@ TrackView::autoPlayResolveFinished( const query_ptr& query, int row )
const QModelIndex sib = index.sibling( index.row() + 1, index.column() );
if ( sib.isValid() )
startAutoPlay( sib );
}
@ -308,7 +307,6 @@ TrackView::tryToPlayItem( const QModelIndex& index )
PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
if ( item && !item->query().isNull() )
{
m_proxyModel->setCurrentIndex( index );
AudioEngine::instance()->playItem( playlistInterface(), item->query() );
return true;
@ -719,19 +717,14 @@ TrackView::mousePressEvent( QMouseEvent* event )
Tomahawk::playlistinterface_ptr
TrackView::playlistInterface() const
{
if ( m_playlistInterface.isNull() )
{
return proxyModel()->playlistInterface();
}
return m_playlistInterface;
return proxyModel()->playlistInterface();
}
void
TrackView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface )
{
m_playlistInterface = playlistInterface;
proxyModel()->setPlaylistInterface( playlistInterface );
}

View File

@ -146,7 +146,6 @@ private:
bool m_updateContextView;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QModelIndex m_hoveredIndex;
QModelIndex m_contextMenuIndex;

View File

@ -232,12 +232,15 @@ TreeView::onItemActivated( const QModelIndex& index )
if ( item )
{
if ( !item->artist().isNull() )
{
ViewManager::instance()->show( item->artist() );
}
else if ( !item->album().isNull() )
{
ViewManager::instance()->show( item->album() );
}
else if ( !item->result().isNull() && item->result()->isOnline() )
{
m_model->setCurrentItem( item->index );
AudioEngine::instance()->playItem( m_proxyModel->playlistInterface(), item->result() );
}
}