mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-28 11:42:42 +01:00
Add reset logic to interface for use by all; fixes bug when re-listening to a source before a track change
This commit is contained in:
parent
ec83adcd39
commit
189f3b4aff
@ -145,6 +145,9 @@ AudioEngine::stop()
|
||||
|
||||
m_mediaObject->stop();
|
||||
m_retryTimer.stop();
|
||||
|
||||
if ( m_playlist )
|
||||
m_playlist->reset();
|
||||
|
||||
setCurrentTrack( Tomahawk::result_ptr() );
|
||||
emit stopped();
|
||||
@ -380,6 +383,9 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_playlist )
|
||||
m_playlist->reset();
|
||||
|
||||
setPlaylist( playlist );
|
||||
m_currentTrackPlaylist = playlist;
|
||||
|
||||
@ -452,6 +458,8 @@ AudioEngine::timerTriggered( qint64 time )
|
||||
void
|
||||
AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
||||
{
|
||||
if ( m_playlist )
|
||||
m_playlist->reset();
|
||||
m_playlist = playlist;
|
||||
emit playlistChanged( playlist );
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
virtual QString filter() const { return m_filter; }
|
||||
virtual void setFilter( const QString& pattern ) { m_filter = pattern; }
|
||||
|
||||
virtual void reset() {}
|
||||
|
||||
QObject* object() const { return m_object; }
|
||||
|
||||
public slots:
|
||||
|
@ -375,13 +375,6 @@ SourceTreeView::latchOff()
|
||||
if( type != SourcesModel::Collection )
|
||||
return;
|
||||
|
||||
PlaylistInterface* pi = AudioEngine::instance()->playlist();
|
||||
if ( pi && dynamic_cast< SourcePlaylistInterface* >( pi ) )
|
||||
{
|
||||
SourcePlaylistInterface* sourcepi = dynamic_cast< SourcePlaylistInterface* >( pi );
|
||||
sourcepi->reset();
|
||||
}
|
||||
|
||||
AudioEngine::instance()->stop();
|
||||
AudioEngine::instance()->setPlaylist( 0 );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user