void ProfileWidget::changeUser( const lastfm::User& user ) { // Make sure we don't recieve any updates about the last session disconnect( this, SLOT(onGotLovedTracks()) ); disconnect( this, SLOT(onGotTopOverallArtists())); disconnect( this, SLOT(onGotTopWeeklyArtists())); disconnect( this, SLOT(onGotLibraryArtists())); ui->avatar->setAlignment( Qt::AlignCenter ); ui->avatar->setUser( user ); ui->avatar->loadUrl( user.imageUrl( User::LargeImage, true ), HttpImageWidget::ScaleNone ); ui->avatar->setHref( user.www() ); ui->infoString->setText( user.getInfoString() ); ui->scrobbles->setText( tr( "Scrobbles since %1" ).arg( user.dateRegistered().toString( "d MMMM yyyy" ) ) ); m_scrobbleCount = user.scrobbleCount(); setScrobbleCount(); ui->name->setText( unicorn::Label::boldLinkStyle( unicorn::Label::anchor( user.www().toString(), user.name() ), Qt::black ) ); connect( user.getLovedTracks( 1 ), SIGNAL(finished()), SLOT(onGotLovedTracks()) ); connect( user.getTopArtists( "overall", 5, 1 ), SIGNAL(finished()), SLOT(onGotTopOverallArtists())); connect( user.getTopArtists( "7day", 5, 1 ), SIGNAL(finished()), SLOT(onGotTopWeeklyArtists())); connect( lastfm::Library::getArtists( user.name(), 1 ), SIGNAL(finished()), SLOT(onGotLibraryArtists())); }
void ProfileWidget::onGotUserInfo( const lastfm::User& userDetails ) { changeUser( userDetails.name() ); m_scrobbleCount = userDetails.scrobbleCount(); ui.avatar->setUser( userDetails ); ui.avatar->loadUrl( userDetails.imageUrl( lastfm::Medium, true ), HttpImageWidget::ScaleNone ); ui.avatar->setHref( userDetails.www() ); setScrobbleCount(); }