1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 08:34:34 +02:00

* Update QueryLabel when underlying result changes.

This commit is contained in:
Christian Muehlhaeuser
2012-11-16 07:13:01 +01:00
parent 4902bac904
commit 11483d22ec
2 changed files with 18 additions and 6 deletions

View File

@@ -179,6 +179,19 @@ QueryLabel::setText( const QString& text )
} }
void
QueryLabel::onResultChanged()
{
m_query = m_result->toQuery();
m_artist = m_result->artist();
m_album = m_result->album();
updateLabel();
emit textChanged( text() );
}
void void
QueryLabel::setResult( const Tomahawk::result_ptr& result ) QueryLabel::setResult( const Tomahawk::result_ptr& result )
{ {
@@ -193,13 +206,9 @@ QueryLabel::setResult( const Tomahawk::result_ptr& result )
if ( m_result.isNull() || m_result.data() != result.data() ) if ( m_result.isNull() || m_result.data() != result.data() )
{ {
m_result = result; m_result = result;
m_query = m_result->toQuery(); connect( m_result.data(), SIGNAL( updated() ), SLOT( onResultChanged() ) );
m_artist = result->artist();
m_album = result->album();
updateLabel(); onResultChanged();
emit textChanged( text() );
emit resultChanged( m_result ); emit resultChanged( m_result );
} }
} }

View File

@@ -116,6 +116,9 @@ protected:
virtual void startDrag(); virtual void startDrag();
private slots:
void onResultChanged();
private: private:
QString smartAppend( QString& text, const QString& appendage ) const; QString smartAppend( QString& text, const QString& appendage ) const;
QTime m_time; QTime m_time;