mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Make stop-after-track better.
This commit is contained in:
@@ -278,7 +278,7 @@ void
|
|||||||
AudioControls::onSocialActionsLoaded()
|
AudioControls::onSocialActionsLoaded()
|
||||||
{
|
{
|
||||||
Query* query = qobject_cast< Query* >( sender() );
|
Query* query = qobject_cast< Query* >( sender() );
|
||||||
if ( !query || !m_currentTrack || query != m_currentTrack->toQuery().data() )
|
if ( !query || !m_currentTrack || !query->equals( m_currentTrack->toQuery() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setSocialActions();
|
setSocialActions();
|
||||||
|
@@ -516,9 +516,9 @@ AudioEngine::loadNextTrack()
|
|||||||
|
|
||||||
Tomahawk::result_ptr result;
|
Tomahawk::result_ptr result;
|
||||||
|
|
||||||
if ( !m_stopAfterTrack.isNull() && !m_currentTrack.isNull() )
|
if ( !m_stopAfterTrack.isNull() )
|
||||||
{
|
{
|
||||||
if ( m_stopAfterTrack.data() == m_currentTrack->toQuery().data() )
|
if ( m_stopAfterTrack->equals( m_currentTrack->toQuery() ) )
|
||||||
{
|
{
|
||||||
m_stopAfterTrack.clear();
|
m_stopAfterTrack.clear();
|
||||||
stop();
|
stop();
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
@@ -220,7 +221,7 @@ ContextMenu::onTriggered( int action )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ActionStopAfter:
|
case ActionStopAfter:
|
||||||
if ( AudioEngine::instance()->stopAfterTrack() == m_queries.first() )
|
if ( m_queries.first()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||||
AudioEngine::instance()->setStopAfterTrack( query_ptr() );
|
AudioEngine::instance()->setStopAfterTrack( query_ptr() );
|
||||||
else
|
else
|
||||||
AudioEngine::instance()->setStopAfterTrack( m_queries.first() );
|
AudioEngine::instance()->setStopAfterTrack( m_queries.first() );
|
||||||
|
@@ -168,7 +168,6 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
|
|||||||
// hook up signals, and check solved status
|
// hook up signals, and check solved status
|
||||||
foreach( const result_ptr& rp, newresults )
|
foreach( const result_ptr& rp, newresults )
|
||||||
{
|
{
|
||||||
rp->setQuery( q );
|
|
||||||
connect( rp.data(), SIGNAL( statusChanged() ), SLOT( onResultStatusChanged() ) );
|
connect( rp.data(), SIGNAL( statusChanged() ), SLOT( onResultStatusChanged() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,6 +412,18 @@ Query::checkResults()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Query::equals( const Tomahawk::query_ptr& other ) const
|
||||||
|
{
|
||||||
|
if ( other.isNull() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return ( artist() == other->artist() &&
|
||||||
|
album() == other->album() &&
|
||||||
|
track() == other->track() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
Query::toVariant() const
|
Query::toVariant() const
|
||||||
{
|
{
|
||||||
|
@@ -91,6 +91,8 @@ public:
|
|||||||
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
||||||
void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
|
void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
|
||||||
|
|
||||||
|
bool equals( const Tomahawk::query_ptr& other ) const;
|
||||||
|
|
||||||
QVariant toVariant() const;
|
QVariant toVariant() const;
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
|
||||||
|
@@ -85,7 +85,6 @@ public:
|
|||||||
int year() const { return m_year; }
|
int year() const { return m_year; }
|
||||||
unsigned int discnumber() const { return m_discnumber; }
|
unsigned int discnumber() const { return m_discnumber; }
|
||||||
|
|
||||||
void setQuery( const Tomahawk::query_ptr& query ) { m_query = query; }
|
|
||||||
void setScore( float score ) { m_score = score; }
|
void setScore( float score ) { m_score = score; }
|
||||||
void setTrackId( unsigned int id ) { m_trackId = id; }
|
void setTrackId( unsigned int id ) { m_trackId = id; }
|
||||||
void setFileId( unsigned int id ) { m_fileId = id; }
|
void setFileId( unsigned int id ) { m_fileId = id; }
|
||||||
|
Reference in New Issue
Block a user