mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
* Correctly unset pause / spinner on GridView when a new track is loading.
This commit is contained in:
@@ -122,8 +122,8 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
m_covers.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->query(), r.size(), TomahawkUtils::Grid ) ) );
|
m_covers.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->query(), r.size(), TomahawkUtils::Grid ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
_detail::Closure* closure = NewClosure( m_covers[ index ], SIGNAL( repaintRequest() ), const_cast<GridItemDelegate*>(this), SLOT( doUpdateIndex( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
NewClosure( m_covers[ index ], SIGNAL( repaintRequest() ),
|
||||||
closure->setAutoDelete( false );
|
const_cast<GridItemDelegate*>(this), SLOT( doUpdateIndex( QPersistentModelIndex ) ), QPersistentModelIndex( index ) )->setAutoDelete( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer< Tomahawk::PixmapDelegateFader > fader = m_covers[ index ];
|
QSharedPointer< Tomahawk::PixmapDelegateFader > fader = m_covers[ index ];
|
||||||
@@ -243,17 +243,18 @@ GridItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
|
|||||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||||
if ( item )
|
if ( item )
|
||||||
{
|
{
|
||||||
_detail::Closure* closure;
|
NewClosure( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ),
|
||||||
|
const_cast<GridItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||||
|
|
||||||
closure = NewClosure( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ),
|
m_closures.remove( index );
|
||||||
const_cast<GridItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
|
||||||
|
|
||||||
closure = NewClosure( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ),
|
m_closures.insertMulti( index, NewClosure( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ),
|
||||||
const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) ) );
|
||||||
closure = NewClosure( AudioEngine::instance(), SIGNAL( stopped() ),
|
m_closures.insertMulti( index, NewClosure( AudioEngine::instance(), SIGNAL( stopped() ),
|
||||||
const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) ) );
|
||||||
|
|
||||||
closure->setAutoDelete( false );
|
foreach ( _detail::Closure* closure, m_closures.values( index ) )
|
||||||
|
closure->setAutoDelete( false );
|
||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackFinished() ) );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackFinished() ) );
|
||||||
|
|
||||||
@@ -485,6 +486,9 @@ GridItemDelegate::onPlaylistChanged( const QPersistentModelIndex& index )
|
|||||||
|
|
||||||
if ( finished )
|
if ( finished )
|
||||||
{
|
{
|
||||||
|
foreach ( _detail::Closure* closure, m_closures.values( index ) )
|
||||||
|
closure->deleteLater();
|
||||||
|
|
||||||
if ( m_pauseButton.contains( index ) )
|
if ( m_pauseButton.contains( index ) )
|
||||||
{
|
{
|
||||||
m_pauseButton[ index ]->deleteLater();
|
m_pauseButton[ index ]->deleteLater();
|
||||||
|
@@ -29,6 +29,10 @@ namespace Tomahawk {
|
|||||||
class PixmapDelegateFader;
|
class PixmapDelegateFader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace _detail {
|
||||||
|
class Closure;
|
||||||
|
}
|
||||||
|
|
||||||
class QEvent;
|
class QEvent;
|
||||||
class QTimeLine;
|
class QTimeLine;
|
||||||
class PlayableProxyModel;
|
class PlayableProxyModel;
|
||||||
@@ -86,8 +90,8 @@ private:
|
|||||||
mutable QHash< QPersistentModelIndex, QWidget* > m_spinner;
|
mutable QHash< QPersistentModelIndex, QWidget* > m_spinner;
|
||||||
mutable QHash< QPersistentModelIndex, ImageButton* > m_playButton;
|
mutable QHash< QPersistentModelIndex, ImageButton* > m_playButton;
|
||||||
mutable QHash< QPersistentModelIndex, ImageButton* > m_pauseButton;
|
mutable QHash< QPersistentModelIndex, ImageButton* > m_pauseButton;
|
||||||
|
|
||||||
mutable QHash< QPersistentModelIndex, QTimeLine* > m_hoverFaders;
|
mutable QHash< QPersistentModelIndex, QTimeLine* > m_hoverFaders;
|
||||||
|
mutable QHash< QPersistentModelIndex, _detail::Closure* > m_closures;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRIDITEMDELEGATE_H
|
#endif // GRIDITEMDELEGATE_H
|
||||||
|
Reference in New Issue
Block a user