mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02: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:
@@ -145,6 +145,9 @@ AudioEngine::stop()
|
|||||||
|
|
||||||
m_mediaObject->stop();
|
m_mediaObject->stop();
|
||||||
m_retryTimer.stop();
|
m_retryTimer.stop();
|
||||||
|
|
||||||
|
if ( m_playlist )
|
||||||
|
m_playlist->reset();
|
||||||
|
|
||||||
setCurrentTrack( Tomahawk::result_ptr() );
|
setCurrentTrack( Tomahawk::result_ptr() );
|
||||||
emit stopped();
|
emit stopped();
|
||||||
@@ -380,6 +383,9 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
if ( m_playlist )
|
||||||
|
m_playlist->reset();
|
||||||
|
|
||||||
setPlaylist( playlist );
|
setPlaylist( playlist );
|
||||||
m_currentTrackPlaylist = playlist;
|
m_currentTrackPlaylist = playlist;
|
||||||
|
|
||||||
@@ -452,6 +458,8 @@ AudioEngine::timerTriggered( qint64 time )
|
|||||||
void
|
void
|
||||||
AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
||||||
{
|
{
|
||||||
|
if ( m_playlist )
|
||||||
|
m_playlist->reset();
|
||||||
m_playlist = playlist;
|
m_playlist = playlist;
|
||||||
emit playlistChanged( playlist );
|
emit playlistChanged( playlist );
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,8 @@ public:
|
|||||||
virtual QString filter() const { return m_filter; }
|
virtual QString filter() const { return m_filter; }
|
||||||
virtual void setFilter( const QString& pattern ) { m_filter = pattern; }
|
virtual void setFilter( const QString& pattern ) { m_filter = pattern; }
|
||||||
|
|
||||||
|
virtual void reset() {}
|
||||||
|
|
||||||
QObject* object() const { return m_object; }
|
QObject* object() const { return m_object; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@@ -375,13 +375,6 @@ SourceTreeView::latchOff()
|
|||||||
if( type != SourcesModel::Collection )
|
if( type != SourcesModel::Collection )
|
||||||
return;
|
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()->stop();
|
||||||
AudioEngine::instance()->setPlaylist( 0 );
|
AudioEngine::instance()->setPlaylist( 0 );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user