mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
fix static mode dynamic playlists
This commit is contained in:
@@ -93,6 +93,7 @@ void DynamicWidget::loadDynamicPlaylist(const Tomahawk::dynplaylist_ptr& playlis
|
||||
{
|
||||
if( !m_playlist.isNull() ) {
|
||||
disconnect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
disconnect( m_playlist.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ), this, SLOT(onRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ) );
|
||||
}
|
||||
|
||||
m_playlist = playlist;
|
||||
@@ -109,12 +110,15 @@ void DynamicWidget::loadDynamicPlaylist(const Tomahawk::dynplaylist_ptr& playlis
|
||||
m_headerLayout->removeWidget(m_generateButton);
|
||||
}
|
||||
connect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
connect( m_playlist.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ), this, SLOT(onRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicWidget::setPlaylist( const Tomahawk::DynamicPlaylistRevision& rev )
|
||||
DynamicWidget::onRevisionLoaded( const Tomahawk::DynamicPlaylistRevision& rev )
|
||||
{
|
||||
qDebug() << "DynamicWidget::onRevisionLoaded";
|
||||
loadDynamicPlaylist( m_playlist );
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
PlaylistInterface* playlistInterface() const;
|
||||
|
||||
public slots:
|
||||
void setPlaylist( const DynamicPlaylistRevision& rev );
|
||||
void onRevisionLoaded( const DynamicPlaylistRevision& rev );
|
||||
|
||||
private slots:
|
||||
void generate();
|
||||
|
@@ -128,10 +128,10 @@ DatabaseCommand_SetDynamicPlaylistRevision::exec( DatabaseImpl* lib )
|
||||
query.exec();
|
||||
|
||||
// delete all the old controls, replace with new onws
|
||||
qDebug() << "Deleting controls with playlist id" << m_currentRevision;
|
||||
qDebug() << "Deleting controls with playlist id" << m_playlistguid;
|
||||
TomahawkSqlQuery delQuery = lib->newquery();
|
||||
delQuery.prepare( "DELETE FROM dynamic_playlist_controls WHERE playlist = ?" );
|
||||
delQuery.addBindValue( m_currentRevision );
|
||||
delQuery.addBindValue( m_playlistguid );
|
||||
if( !delQuery.exec() )
|
||||
qWarning() << "Failed to delete controls from dynamic playlist controls table";
|
||||
|
||||
|
@@ -309,9 +309,10 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
if( applied )
|
||||
setCurrentrevision( rev );
|
||||
|
||||
qDebug() << "EMITTING REVISION LOADED 1!";
|
||||
// meh :-( emit both, one for PlaylistModel, the other for DynamicWidget
|
||||
emit revisionLoaded( pr );
|
||||
emit revisionLoaded( dpr );
|
||||
emit dynamicRevisionLoaded( dpr );
|
||||
}
|
||||
|
||||
// ondemand version
|
||||
@@ -341,13 +342,16 @@ DynamicPlaylist::setRevision( const QString& rev,
|
||||
m_generator->setControls( controls );
|
||||
m_generator->setMode( OnDemand );
|
||||
|
||||
DynamicPlaylistRevision pr;
|
||||
PlaylistRevision pr;
|
||||
pr.oldrevisionguid = currentrevision();
|
||||
pr.revisionguid = rev;
|
||||
pr.controls = controls;
|
||||
pr.type = type;
|
||||
pr.mode = OnDemand;
|
||||
DynamicPlaylistRevision dpr = pr;
|
||||
dpr.controls = controls;
|
||||
dpr.type = type;
|
||||
dpr.mode = OnDemand;
|
||||
|
||||
qDebug() << "EMITTING REVISION LOADED 2!";
|
||||
emit revisionLoaded( pr );
|
||||
emit revisionLoaded( dpr );
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
signals:
|
||||
/// emitted when the playlist revision changes (whenever the playlist changes)
|
||||
void revisionLoaded( Tomahawk::DynamicPlaylistRevision );
|
||||
void dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision );
|
||||
|
||||
public slots:
|
||||
// want to update the playlist from the model?
|
||||
|
@@ -171,6 +171,7 @@ PlaylistModel::onDataChanged()
|
||||
void
|
||||
PlaylistModel::onRevisionLoaded( Tomahawk::PlaylistRevision revision )
|
||||
{
|
||||
qDebug() << "PLAYLIST::onRevisionLoaded";
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_waitForUpdate )
|
||||
|
@@ -157,7 +157,7 @@ void SourceTreeItem::onDynamicPlaylistsAdded( const QList< dynplaylist_ptr >& pl
|
||||
m_dynplaylists.append( p );
|
||||
qlonglong ptr = reinterpret_cast<qlonglong>( &m_dynplaylists.last() );
|
||||
qDebug() << "Setting dynamic ptr to:" << ptr;
|
||||
connect( p.data(), SIGNAL( revisionLoaded( Tomahawk::DynamicPlaylistRevision ) ),
|
||||
connect( p.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ),
|
||||
SLOT( onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision ) ),
|
||||
Qt::QueuedConnection);
|
||||
|
||||
|
Reference in New Issue
Block a user