mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
* Make stop-after-track better.
This commit is contained in:
parent
b9c61952a6
commit
f0f9e6847b
@ -278,7 +278,7 @@ void
|
||||
AudioControls::onSocialActionsLoaded()
|
||||
{
|
||||
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;
|
||||
|
||||
setSocialActions();
|
||||
|
@ -516,9 +516,9 @@ AudioEngine::loadNextTrack()
|
||||
|
||||
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();
|
||||
stop();
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
@ -220,7 +221,7 @@ ContextMenu::onTriggered( int action )
|
||||
break;
|
||||
|
||||
case ActionStopAfter:
|
||||
if ( AudioEngine::instance()->stopAfterTrack() == m_queries.first() )
|
||||
if ( m_queries.first()->equals( AudioEngine::instance()->stopAfterTrack() ) )
|
||||
AudioEngine::instance()->setStopAfterTrack( query_ptr() );
|
||||
else
|
||||
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
|
||||
foreach( const result_ptr& rp, newresults )
|
||||
{
|
||||
rp->setQuery( q );
|
||||
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
|
||||
Query::toVariant() const
|
||||
{
|
||||
|
@ -91,6 +91,8 @@ public:
|
||||
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
||||
void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
|
||||
|
||||
bool equals( const Tomahawk::query_ptr& other ) const;
|
||||
|
||||
QVariant toVariant() const;
|
||||
QString toString() const;
|
||||
|
||||
|
@ -85,7 +85,6 @@ public:
|
||||
int year() const { return m_year; }
|
||||
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 setTrackId( unsigned int id ) { m_trackId = id; }
|
||||
void setFileId( unsigned int id ) { m_fileId = id; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user