mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01:00
make welcomewidget and recently played playlist behave
This commit is contained in:
parent
59d72df046
commit
40d3b87af5
@ -121,6 +121,8 @@ ViewManager::ViewManager( QObject* parent )
|
||||
m_widget->layout()->setMargin( 0 );
|
||||
m_widget->layout()->setSpacing( 0 );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( PlaylistInterface* ) ), this, SLOT( playlistInterfaceChanged( PlaylistInterface* ) ) );
|
||||
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||
|
||||
connect( m_topbar, SIGNAL( filterTextChanged( QString ) ),
|
||||
@ -180,7 +182,7 @@ ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
||||
}
|
||||
|
||||
setPage( view );
|
||||
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist );
|
||||
|
||||
emit numSourcesChanged( SourceList::instance()->count() );
|
||||
|
||||
return view;
|
||||
@ -206,7 +208,6 @@ ViewManager::show( const Tomahawk::dynplaylist_ptr& playlist )
|
||||
else
|
||||
m_queueView->show();
|
||||
|
||||
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist );
|
||||
emit numSourcesChanged( SourceList::instance()->count() );
|
||||
|
||||
return m_dynamicWidgets.value( playlist );
|
||||
@ -421,6 +422,22 @@ ViewManager::showSuperCollection()
|
||||
return shown;
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::playlistInterfaceChanged( PlaylistInterface* interface )
|
||||
{
|
||||
playlist_ptr pl = playlistForInterface( interface );
|
||||
if ( !pl.isNull() )
|
||||
{
|
||||
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl );
|
||||
} else
|
||||
{
|
||||
pl = dynamicPlaylistForInterface( interface );
|
||||
if ( !pl.isNull() )
|
||||
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( pl );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::ViewPage*
|
||||
ViewManager::showWelcomePage()
|
||||
{
|
||||
@ -599,7 +616,7 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
|
||||
qDebug() << "View page shown:" << page->title();
|
||||
emit viewPageActivated( page );
|
||||
|
||||
if ( !AudioEngine::instance()->isPlaying() )
|
||||
if ( !AudioEngine::instance()->playlist() )
|
||||
AudioEngine::instance()->setPlaylist( currentPlaylistInterface() );
|
||||
|
||||
// UGH!
|
||||
|
@ -145,6 +145,8 @@ public slots:
|
||||
void setRepeatMode( PlaylistInterface::RepeatMode mode );
|
||||
void setShuffled( bool enabled );
|
||||
|
||||
void playlistInterfaceChanged( PlaylistInterface* );
|
||||
|
||||
// called by the playlist creation dbcmds
|
||||
void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
|
@ -45,10 +45,14 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
ui->setupUi( this );
|
||||
|
||||
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
|
||||
ui->playlistWidget->setModel( new WelcomePlaylistModel( this ) );
|
||||
WelcomePlaylistModel* model = new WelcomePlaylistModel( this );
|
||||
ui->playlistWidget->setModel( model );
|
||||
ui->playlistWidget->overlay()->resize( 380, 86 );
|
||||
ui->tracksView->overlay()->setEnabled( false );
|
||||
|
||||
connect( model,SIGNAL( emptinessChanged( bool) ), this, SLOT( updatePlaylists() ) );
|
||||
|
||||
|
||||
m_tracksModel = new PlaylistModel( ui->tracksView );
|
||||
ui->tracksView->setPlaylistModel( m_tracksModel );
|
||||
m_tracksModel->loadHistory( Tomahawk::source_ptr(), HISTORY_TRACK_ITEMS );
|
||||
|
Loading…
x
Reference in New Issue
Block a user