mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
* Use MetaPlaylistInterface in various ViewPages.
This commit is contained in:
parent
1fb507e92d
commit
68c2ea239f
@ -38,6 +38,7 @@
|
||||
#include "SingleTrackPlaylistInterface.h"
|
||||
#include "ContextMenu.h"
|
||||
#include "ViewManager.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/AnimatedSpinner.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
@ -47,37 +48,6 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
class GridPlaylistInterface : public PlayableProxyModelPlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GridPlaylistInterface( PlayableProxyModel* proxy, GridView* view ) : PlayableProxyModelPlaylistInterface( proxy ), m_view( view ) {}
|
||||
|
||||
virtual bool hasChildInterface( playlistinterface_ptr playlistInterface )
|
||||
{
|
||||
if ( m_view.isNull() || !m_view.data()->m_playing.isValid() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayableItem* item = m_view.data()->model()->itemFromIndex( m_view.data()->proxyModel()->mapToSource( m_view.data()->m_playing ) );
|
||||
if ( item )
|
||||
{
|
||||
if ( !item->album().isNull() )
|
||||
return item->album()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
|
||||
else if ( !item->artist().isNull() )
|
||||
return item->artist()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
|
||||
else if ( !item->query().isNull() && !playlistInterface.dynamicCast< SingleTrackPlaylistInterface >().isNull() )
|
||||
return item->query() == playlistInterface.dynamicCast< SingleTrackPlaylistInterface >()->track();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
QWeakPointer<GridView> m_view;
|
||||
};
|
||||
|
||||
|
||||
GridView::GridView( QWidget* parent )
|
||||
: QListView( parent )
|
||||
, m_model( 0 )
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "NewReleasesWidget.h"
|
||||
#include "WhatsHotWidget_p.h"
|
||||
#include "ui_NewReleasesWidget.h"
|
||||
|
||||
#include "ViewManager.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "RecentPlaylistsModel.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "playlist/AlbumModel.h"
|
||||
@ -44,58 +45,6 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
class WelcomeWidgetInterface : public Tomahawk::PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WelcomeWidgetInterface( WelcomeWidget* w )
|
||||
: PlaylistInterface()
|
||||
, m_w( w )
|
||||
{
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ),
|
||||
SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
|
||||
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
SIGNAL( shuffleModeChanged( bool ) ) );
|
||||
}
|
||||
virtual ~WelcomeWidgetInterface() {}
|
||||
|
||||
virtual void setCurrentIndex( qint64 index ) { m_w->ui->tracksView->proxyModel()->playlistInterface()->setCurrentIndex( index ); }
|
||||
virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->repeatMode(); }
|
||||
virtual bool shuffled() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->shuffled(); }
|
||||
|
||||
virtual Tomahawk::result_ptr resultAt( qint64 index ) const { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::result_ptr(); }
|
||||
virtual Tomahawk::query_ptr queryAt( qint64 index ) const { Q_UNUSED( index ); Q_ASSERT( false ); return Tomahawk::query_ptr(); }
|
||||
virtual qint64 indexOfResult( const Tomahawk::result_ptr& result ) const { Q_UNUSED( result ); Q_ASSERT( false ); return -1; }
|
||||
virtual qint64 indexOfQuery( const Tomahawk::query_ptr& query ) const { Q_UNUSED( query ); Q_ASSERT( false ); return -1; }
|
||||
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->currentItem(); }
|
||||
virtual qint64 siblingIndex( int itemsAway, qint64 rootIndex = -1 ) const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->siblingIndex( itemsAway, rootIndex ); }
|
||||
virtual int trackCount() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->trackCount(); }
|
||||
virtual QList< Tomahawk::query_ptr > tracks() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->tracks(); }
|
||||
|
||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||
{
|
||||
return m_w->ui->tracksView->proxyModel()->playlistInterface() == other ||
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->hasChildInterface( other ) ||
|
||||
m_w->ui->additionsView->playlistInterface()->hasChildInterface( other );
|
||||
}
|
||||
|
||||
virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setRepeatMode( mode );
|
||||
}
|
||||
|
||||
virtual void setShuffled( bool enabled )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setShuffled( enabled );
|
||||
}
|
||||
|
||||
private:
|
||||
WelcomeWidget* m_w;
|
||||
|
||||
};
|
||||
|
||||
|
||||
WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::WelcomeWidget )
|
||||
@ -139,7 +88,10 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
|
||||
ui->additionsView->proxyModel()->sort( -1 );
|
||||
|
||||
m_playlistInterface = playlistinterface_ptr( new WelcomeWidgetInterface( this ) );
|
||||
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
|
||||
mpl->addChildInterface( ui->tracksView->playlistInterface() );
|
||||
mpl->addChildInterface( ui->additionsView->playlistInterface() );
|
||||
m_playlistInterface = playlistinterface_ptr( mpl );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
|
@ -20,15 +20,14 @@
|
||||
*/
|
||||
|
||||
#include "WhatsHotWidget.h"
|
||||
#include "WhatsHotWidget_p.h"
|
||||
#include "ui_WhatsHotWidget.h"
|
||||
|
||||
|
||||
#include "ViewManager.h"
|
||||
#include "SourceList.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "RecentPlaylistsModel.h"
|
||||
#include "ChartDataLoader.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
@ -91,12 +90,9 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
||||
artistsProxy->setDynamicSortFilter( true );
|
||||
|
||||
ui->artistsViewLeft->setProxyModel( artistsProxy );
|
||||
|
||||
ui->artistsViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
ui->artistsViewLeft->header()->setVisible( true );
|
||||
|
||||
m_playlistInterface = Tomahawk::playlistinterface_ptr( new ChartsPlaylistInterface( this ) );
|
||||
|
||||
m_workerThread = new QThread( this );
|
||||
m_workerThread->start();
|
||||
|
||||
@ -115,6 +111,11 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
||||
m_loadingSpinner = new AnimatedSpinner( ui->tracksViewLeft );
|
||||
m_loadingSpinner->fadeIn();
|
||||
|
||||
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
|
||||
mpl->addChildInterface( ui->tracksViewLeft->playlistInterface() );
|
||||
mpl->addChildInterface( ui->artistsViewLeft->playlistInterface() );
|
||||
mpl->addChildInterface( ui->albumsView->playlistInterface() );
|
||||
m_playlistInterface = playlistinterface_ptr( mpl );
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "AlbumInfoWidget.h"
|
||||
#include "ui_AlbumInfoWidget.h"
|
||||
#include "AlbumInfoWidget_p.h"
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "ViewManager.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "playlist/PlayableModel.h"
|
||||
#include "playlist/GridItemDelegate.h"
|
||||
#include "Source.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
|
||||
#include "database/DatabaseCommand_AllTracks.h"
|
||||
#include "database/DatabaseCommand_AllAlbums.h"
|
||||
@ -134,7 +134,11 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
|
||||
"border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
|
||||
"border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );
|
||||
|
||||
m_playlistInterface = playlistinterface_ptr( new MetaAlbumInfoInterface( this ) );
|
||||
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
|
||||
mpl->addChildInterface( ui->tracks->playlistInterface() );
|
||||
mpl->addChildInterface( ui->albums->playlistInterface() );
|
||||
m_playlistInterface = playlistinterface_ptr( mpl );
|
||||
|
||||
load( album );
|
||||
|
||||
connect( ui->artistLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) );
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include "ArtistInfoWidget.h"
|
||||
#include "ArtistInfoWidget_p.h"
|
||||
#include "ui_ArtistInfoWidget.h"
|
||||
|
||||
#include <QScrollArea>
|
||||
@ -35,6 +34,7 @@
|
||||
#include "Source.h"
|
||||
#include "GlobalActionManager.h"
|
||||
#include "Pipeline.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
#include "utils/StyleHelper.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -56,8 +56,6 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
||||
widget->setPalette( pal );
|
||||
widget->setAutoFillBackground( true );
|
||||
|
||||
m_plInterface = Tomahawk::playlistinterface_ptr( new MetaArtistInfoInterface( this ) );
|
||||
|
||||
/* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() );
|
||||
@ -163,6 +161,12 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
||||
|
||||
connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user