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