void
TrackDashboard::setTrack( const Track& t )
{        
    if (m_track.artist() != t.artist())
    {
        ui.info->hide();

        qDeleteAll( findChildren<WsReply*>() );
        
        WsReply* r;
        r = t.artist().getInfo();
        r->setParent( this );
        connect( r, SIGNAL(finished( WsReply* )), SLOT(onArtistGotInfo( WsReply* )) );
        
        ui.spinner->show();
        
        r = t.artist().getTopTags();
        connect( r, SIGNAL(finished( WsReply* )), SLOT(onArtistGotTopTags( WsReply* )) );
        r->setParent( this );

        resizeEvent( 0 );
    }

    if (m_track.album() != t.album())
    {
        ui.cover->clear();

        qDeleteAll( findChildren<TrackImageFetcher*>() );

        TrackImageFetcher* fetch = new TrackImageFetcher( t, nam );
        fetch->setParent( this );
        connect( fetch, SIGNAL(finished( QImage )), ui.cover, SLOT(setImage( QImage )) );
        connect( fetch, SIGNAL(finished( QImage )), fetch, SLOT(deleteLater()) );
        fetch->start();
    }
    
    ui.cover->setCursor( m_track.album().isNull() ? Qt::PointingHandCursor : Qt::ArrowCursor );
    ui.cover->show();
    
    m_track = t;
}
Example #2
0
void
LoginDialog::authenticate()
{
    m_username = ui.username->text();
    m_password = Qt::md5( ui.password->text().toUtf8() );

    WsReply* reply = WsRequestBuilder( "auth.getMobileSession" )
            .add( "username", m_username )
            // always lowercase the username before generating the md5
            .add( "authToken", Qt::md5( (m_username + m_password).toUtf8() ) )
            .get();
	reply->setParent( this );

    connect( reply, SIGNAL(finished( WsReply* )), SLOT(onAuthenticated( WsReply* )) );
	
#ifdef Q_OS_MAC
	ui.transient->show();
#else
    ui.spinner->show();
    setWindowTitle( tr("Verifying Login Credentials...") );
    ok()->setEnabled( false );
#endif
}