mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-26 12:53:41 +01:00
Move more logic from Dashboard to ViewPageLazyLoader
This commit is contained in:
parent
95a94ca60c
commit
453f746659
@ -35,11 +35,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~ViewPageLazyLoader()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
|
||||
virtual T* widget()
|
||||
{
|
||||
if( !m_widget )
|
||||
@ -49,6 +51,32 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual playlistinterface_ptr playlistInterface() const
|
||||
{
|
||||
if( m_widget )
|
||||
return m_widget->playlistInterface();
|
||||
|
||||
return playlistinterface_ptr();
|
||||
}
|
||||
|
||||
|
||||
virtual bool isBeingPlayed() const
|
||||
{
|
||||
if( m_widget && m_widget->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual bool jumpToCurrentTrack()
|
||||
{
|
||||
if( m_widget && m_widget->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
T* m_widget;
|
||||
};
|
||||
|
@ -200,20 +200,20 @@ DashboardWidget::~DashboardWidget()
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
Dashboard::playlistInterface() const
|
||||
playlistinterface_ptr
|
||||
DashboardWidget::playlistInterface() const
|
||||
{
|
||||
return m_widget->m_playlistInterface;
|
||||
return m_playlistInterface;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Dashboard::jumpToCurrentTrack()
|
||||
DashboardWidget::jumpToCurrentTrack()
|
||||
{
|
||||
if ( m_widget->ui->tracksView->jumpToCurrentTrack() )
|
||||
if ( ui->tracksView->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( m_widget->ui->additionsView->jumpToCurrentTrack() )
|
||||
if ( ui->additionsView->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -221,12 +221,12 @@ Dashboard::jumpToCurrentTrack()
|
||||
|
||||
|
||||
bool
|
||||
Dashboard::isBeingPlayed() const
|
||||
DashboardWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( m_widget->ui->additionsView->isBeingPlayed() )
|
||||
if ( ui->additionsView->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == m_widget->ui->tracksView->playlistInterface();
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == ui->tracksView->playlistInterface();
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,6 +61,10 @@ public:
|
||||
DashboardWidget( QWidget* parent = 0 );
|
||||
virtual ~DashboardWidget();
|
||||
|
||||
virtual bool isBeingPlayed() const;
|
||||
virtual playlistinterface_ptr playlistInterface() const;
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
public slots:
|
||||
void updatePlaylists();
|
||||
void updateRecentAdditions();
|
||||
@ -92,8 +96,6 @@ public:
|
||||
Dashboard( QWidget* parent = 0 );
|
||||
virtual ~Dashboard();
|
||||
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||
|
||||
virtual const QString defaultName() { return DASHBOARD_VIEWPAGE_NAME; }
|
||||
virtual QString title() const { return tr( "Dashboard" ); }
|
||||
virtual QString description() const { return tr( "An overview of your recent activity" ); }
|
||||
@ -102,9 +104,6 @@ public:
|
||||
virtual int sortValue() { return 1; }
|
||||
|
||||
virtual bool showInfoBar() const { return true; }
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
virtual bool jumpToCurrentTrack();
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user