mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 16:29:43 +01:00
* Added global Recently Played page.
This commit is contained in:
parent
1af928790e
commit
e049dcd6af
@ -40,6 +40,8 @@ RecentlyPlayedModel::RecentlyPlayedModel( const source_ptr& source, QObject* par
|
||||
{
|
||||
if ( source.isNull() )
|
||||
{
|
||||
onSourcesReady();
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "customplaylistview.h"
|
||||
#include "PlaylistLargeItemDelegate.h"
|
||||
#include "RecentlyPlayedModel.h"
|
||||
#include "dynamic/widgets/DynamicWidget.h"
|
||||
|
||||
#include "widgets/welcomewidget.h"
|
||||
@ -75,6 +76,7 @@ ViewManager::ViewManager( QObject* parent )
|
||||
, m_welcomeWidget( new WelcomeWidget() )
|
||||
, m_whatsHotWidget( new WhatsHotWidget() )
|
||||
, m_topLovedWidget( 0 )
|
||||
, m_recentPlaysWidget( 0 )
|
||||
, m_currentMode( PlaylistInterface::Tree )
|
||||
, m_loaded( false )
|
||||
{
|
||||
@ -131,6 +133,7 @@ ViewManager::~ViewManager()
|
||||
delete m_whatsHotWidget;
|
||||
delete m_welcomeWidget;
|
||||
delete m_topLovedWidget;
|
||||
delete m_recentPlaysWidget;
|
||||
delete m_contextWidget;
|
||||
delete m_widget;
|
||||
}
|
||||
@ -450,6 +453,28 @@ ViewManager::showTopLovedPage()
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::ViewPage*
|
||||
ViewManager::showRecentPlaysPage()
|
||||
{
|
||||
if ( !m_recentPlaysWidget )
|
||||
{
|
||||
PlaylistView* pv = new PlaylistView( m_widget );
|
||||
pv->setFrameShape( QFrame::NoFrame );
|
||||
pv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
|
||||
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( source_ptr(), pv );
|
||||
raModel->setStyle( TrackModel::Large );
|
||||
|
||||
pv->setItemDelegate( new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv, pv->proxyModel() ) );
|
||||
pv->setPlaylistModel( raModel );
|
||||
|
||||
m_recentPlaysWidget = pv;
|
||||
}
|
||||
|
||||
return show( m_recentPlaysWidget );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::setTableMode()
|
||||
{
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
Tomahawk::ViewPage* welcomeWidget() const { return m_welcomeWidget; }
|
||||
Tomahawk::ViewPage* whatsHotWidget() const { return m_whatsHotWidget; }
|
||||
Tomahawk::ViewPage* topLovedWidget() const { return m_topLovedWidget; }
|
||||
Tomahawk::ViewPage* recentPlaysWidget() const { return m_recentPlaysWidget; }
|
||||
ArtistView* superCollectionView() const { return m_superCollectionView; }
|
||||
|
||||
/// Get the view page for the given item. Not pretty...
|
||||
@ -140,6 +141,7 @@ public slots:
|
||||
Tomahawk::ViewPage* showWelcomePage();
|
||||
Tomahawk::ViewPage* showWhatsHotPage();
|
||||
Tomahawk::ViewPage* showTopLovedPage();
|
||||
Tomahawk::ViewPage* showRecentPlaysPage();
|
||||
void showCurrentTrack();
|
||||
|
||||
// Returns the shown viewpage
|
||||
@ -204,6 +206,7 @@ private:
|
||||
WelcomeWidget* m_welcomeWidget;
|
||||
WhatsHotWidget* m_whatsHotWidget;
|
||||
Tomahawk::ViewPage* m_topLovedWidget;
|
||||
Tomahawk::ViewPage* m_recentPlaysWidget;
|
||||
|
||||
QList< Tomahawk::collection_ptr > m_superCollections;
|
||||
|
||||
|
@ -263,13 +263,18 @@ SourcesModel::flags( const QModelIndex& index ) const
|
||||
void
|
||||
SourcesModel::appendGroups()
|
||||
{
|
||||
beginInsertRows( QModelIndex(), rowCount(), rowCount() + 2 );
|
||||
beginInsertRows( QModelIndex(), rowCount(), rowCount() + 3 );
|
||||
|
||||
GroupItem* browse = new GroupItem( this, m_rootItem, tr( "Browse" ), 0 );
|
||||
new HistoryItem( this, m_rootItem, tr( "Search History" ), 1 );
|
||||
// new SourceTreeItem( this, m_rootItem, SourcesModel::Divider, 2 );
|
||||
m_myMusicGroup = new GroupItem( this, m_rootItem, tr( "My Music" ), 3 );
|
||||
|
||||
GenericPageItem* dashboard = new GenericPageItem( this, browse, tr( "Dashboard" ), QIcon( RESPATH "images/dashboard.png" ),
|
||||
boost::bind( &ViewManager::showWelcomePage, ViewManager::instance() ),
|
||||
boost::bind( &ViewManager::welcomeWidget, ViewManager::instance() ) );
|
||||
dashboard->setSortValue( 0 );
|
||||
|
||||
// super collection
|
||||
GenericPageItem* sc = new GenericPageItem( this, browse, tr( "SuperCollection" ), QIcon( RESPATH "images/supercollection.png" ),
|
||||
boost::bind( &ViewManager::showSuperCollection, ViewManager::instance() ),
|
||||
@ -282,15 +287,15 @@ SourcesModel::appendGroups()
|
||||
boost::bind( &ViewManager::topLovedWidget, ViewManager::instance() ) );
|
||||
loved->setSortValue( 2 );
|
||||
|
||||
GenericPageItem* recent = new GenericPageItem( this, browse, tr( "Dashboard" ), QIcon( RESPATH "images/dashboard.png" ),
|
||||
boost::bind( &ViewManager::showWelcomePage, ViewManager::instance() ),
|
||||
boost::bind( &ViewManager::welcomeWidget, ViewManager::instance() ) );
|
||||
recent->setSortValue( 0 );
|
||||
GenericPageItem* recent = new GenericPageItem( this, browse, tr( "Recently Played" ), QIcon( RESPATH "images/recently-played.png" ),
|
||||
boost::bind( &ViewManager::showRecentPlaysPage, ViewManager::instance() ),
|
||||
boost::bind( &ViewManager::recentPlaysWidget, ViewManager::instance() ) );
|
||||
recent->setSortValue( 3 );
|
||||
|
||||
GenericPageItem* hot = new GenericPageItem( this, browse, tr( "Charts" ), QIcon( RESPATH "images/charts.png" ),
|
||||
boost::bind( &ViewManager::showWhatsHotPage, ViewManager::instance() ),
|
||||
boost::bind( &ViewManager::whatsHotWidget, ViewManager::instance() ) );
|
||||
hot->setSortValue( 3 );
|
||||
hot->setSortValue( 4 );
|
||||
|
||||
m_collectionsGroup = new GroupItem( this, m_rootItem, tr( "Friends" ), 4 );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user