TreeModelItem::TreeModelItem( const Tomahawk::artist_ptr& artist, TreeModelItem* parent, int row ) : QObject( parent ) , m_artist( artist ) { this->parent = parent; fetchingMore = false; m_isPlaying = false; if ( parent ) { if ( row < 0 ) { parent->children.append( this ); row = parent->children.count() - 1; } else { parent->children.insert( row, this ); } this->model = parent->model; } toberemoved = false; connect( artist.data(), SIGNAL( updated() ), SIGNAL( dataChanged() ) ); }
PlayableItem::PlayableItem( const Tomahawk::artist_ptr& artist, PlayableItem* parent, int row ) : QObject( parent ) , m_artist( artist ) { init( parent, row ); connect( artist.data(), SIGNAL( updated() ), SIGNAL( dataChanged() ) ); }
void PlaylistModel::append( const Tomahawk::artist_ptr& artist ) { if ( artist.isNull() ) return; connect( artist.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr> ) ), SLOT( append( QList<Tomahawk::query_ptr> ) ) ); if ( rowCount( QModelIndex() ) == 0 ) { setTitle( artist->name() ); setDescription( tr( "All tracks by %1" ).arg( artist->name() ) ); m_isTemporary = true; } append( artist->playlistInterface()->tracks() ); }
void AudioEngine::playItem( const Tomahawk::artist_ptr& artist ) { playlistinterface_ptr pli = artist->playlistInterface( Mixed ); if ( pli->isFinished() ) { if ( !pli->tracks().count() ) { JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the artist '%1'" ).arg( artist->name() ), 15 ) ); if ( isStopped() ) emit stopped(); // we do this so the original caller knows we couldn't find this track } else playItem( pli, pli->tracks().first() ); } else { NewClosure( artist.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::artist_ptr ) ), artist ); pli->tracks(); } }
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent ) : QWidget( parent ) , ui( new Ui::ArtistInfoWidget ) , m_artist( artist ) { QWidget* widget = new QWidget; ui->setupUi( widget ); artist->loadStats(); connect( artist.data(), SIGNAL( statsLoaded() ), SLOT( onArtistStatsLoaded() ) ); ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) ); ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) ); ui->lineAbove2->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) ); ui->lineBelow2->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) ); QHBoxLayout* l = new QHBoxLayout( ui->statsWidget ); m_playStatsGauge = new StatsGauge( ui->statsWidget ); m_playStatsGauge->setText( tr( "YOUR ARTIST RANK" ) ); m_playStatsGauge->setInvertedAppearance( true ); l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) ); l->addWidget( m_playStatsGauge ); l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) ); ui->statsWidget->setLayout( l ); TomahawkUtils::unmarginLayout( l ); m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Original, QSize( 48, 48 ) ); ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::Grid, ui->cover->size() ) ); ui->cover->setShowText( false ); { m_relatedModel = new PlayableModel( ui->relatedArtists ); ui->relatedArtists->setPlayableModel( m_relatedModel ); ui->relatedArtists->proxyModel()->sort( -1 ); ui->relatedArtists->setEmptyTip( tr( "Sorry, we could not find any related artists!" ) ); ui->relatedArtists->setAutoFitItems( true ); /* ui->relatedArtists->setWrapping( false ); ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/ ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) ); TomahawkStyle::stylePageFrame( ui->relatedArtists ); TomahawkStyle::stylePageFrame( ui->artistFrame ); TomahawkStyle::styleScrollBar( ui->relatedArtists->verticalScrollBar() ); } { ui->albums->setAutoResize( true ); ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); /* ui->albums->setWrapping( false ); ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/ ui->albums->delegate()->setItemSize( QSize( 170, 170 ) ); ui->albums->proxyModel()->setHideDupeItems( true ); m_albumsModel = new PlayableModel( ui->albums ); ui->albums->setPlayableModel( m_albumsModel ); ui->albums->proxyModel()->sort( -1 ); ui->albums->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) ); ui->albums->setStyleSheet( QString( "QListView { background-color: %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) ); TomahawkStyle::stylePageFrame( ui->albumFrame ); TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() ); } { m_topHitsModel = new PlaylistModel( ui->topHits ); AlbumItemDelegate* del = new AlbumItemDelegate( ui->topHits, ui->topHits->proxyModel() ); ui->topHits->setPlaylistItemDelegate( del ); ui->topHits->proxyModel()->setStyle( PlayableProxyModel::Short ); ui->topHits->setPlayableModel( m_topHitsModel ); ui->topHits->setSortingEnabled( false ); ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) ); ui->topHits->setAutoResize( true ); ui->topHits->setAlternatingRowColors( false ); QPalette p = ui->topHits->palette(); p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED ); p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED ); p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER ); p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT ); p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT ); ui->topHits->setPalette( p ); TomahawkStyle::stylePageFrame( ui->topHits ); TomahawkStyle::stylePageFrame( ui->trackFrame ); } { QFont f = ui->biography->font(); f.setFamily( "Titillium Web" ); QPalette p = ui->biography->palette(); p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT ); ui->biography->setFont( f ); ui->biography->setPalette( p ); ui->biography->setOpenLinks( false ); ui->biography->setOpenExternalLinks( true ); ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) ); TomahawkStyle::stylePageFrame( ui->biography ); TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() ); connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) ); } { QFont f = ui->artistLabel->font(); f.setFamily( "Titillium Web" ); QPalette p = ui->artistLabel->palette(); p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_LABEL ); ui->artistLabel->setFont( f ); ui->artistLabel->setPalette( p ); } { QFont f = ui->label->font(); f.setFamily( "Pathway Gothic One" ); QPalette p = ui->label->palette(); p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION ); ui->label->setFont( f ); ui->label_2->setFont( f ); ui->label->setPalette( p ); ui->label_2->setPalette( p ); } { QFont f = ui->albumLabel->font(); f.setFamily( "Pathway Gothic One" ); QPalette p = ui->albumLabel->palette(); p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT ); ui->albumLabel->setFont( f ); ui->albumLabel->setPalette( p ); } { QScrollArea* area = new QScrollArea(); area->setWidgetResizable( true ); area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); area->setWidget( widget ); QPalette pal = palette(); pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND ); area->setPalette( pal ); area->setAutoFillBackground( true ); area->setFrameShape( QFrame::NoFrame ); area->setAttribute( Qt::WA_MacShowFocusRect, 0 ); QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget( area ); setLayout( layout ); TomahawkUtils::unmarginLayout( layout ); } { QPalette pal = palette(); pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND ); ui->widget->setPalette( pal ); ui->widget->setAutoFillBackground( true ); } MetaPlaylistInterface* mpl = new MetaPlaylistInterface(); mpl->addChildInterface( ui->relatedArtists->playlistInterface() ); mpl->addChildInterface( ui->topHits->playlistInterface() ); mpl->addChildInterface( ui->albums->playlistInterface() ); m_plInterface = playlistinterface_ptr( mpl ); load( artist ); }