示例#1
0
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();
}
示例#3
0
QString
FriendWidget::userString( const lastfm::User& user )
{
    QString text;

    text = QString("%1").arg( user.realName().isEmpty() ? user.name() : user.realName() );
    if ( user.age() ) text.append( QString(", %1").arg( user.age() ) );
    if ( user.gender().known() ) text.append( QString(", %1").arg( genderString( user.gender() ) ) );
    if ( !user.country().isEmpty() ) text.append( QString(", %1").arg( user.country() ) );

    return text;
}
void
AnalyticsService::onGotUserInfo( const lastfm::User& user )
{
    // set all the session level custom vars
    m_customVars.clear();
    m_customVars.enqueue( QString( "http://cdn.last.fm/client/ga.html#custom?version=%1&usertype=%2" ).arg( QCoreApplication::applicationVersion(), userTypeToString( user.type() ) ) );
    m_customVarsSet = true;

    loadPages();
}
void
NothingPlayingWidget::setUser( const lastfm::User& user )
{
    if ( !user.name().isEmpty() )
        ui->top->setText( tr(  "Hello, %1!" ).arg( user.name() ) );
}