mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* A playlist's title now updates in the sidebar when it gets changed.
This commit is contained in:
@@ -29,6 +29,8 @@ DatabaseCommand_RenamePlaylist::exec( DatabaseImpl* lib )
|
|||||||
cre.bindValue( ":id", m_playlistguid );
|
cre.bindValue( ":id", m_playlistguid );
|
||||||
cre.bindValue( ":title", m_playlistTitle );
|
cre.bindValue( ":title", m_playlistTitle );
|
||||||
|
|
||||||
|
qDebug() << Q_FUNC_INFO << m_playlistTitle << m_playlistguid;
|
||||||
|
|
||||||
cre.exec();
|
cre.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ DatabaseCommand_RenamePlaylist::postCommitHook()
|
|||||||
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
|
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
|
||||||
Q_ASSERT( !playlist.isNull() );
|
Q_ASSERT( !playlist.isNull() );
|
||||||
|
|
||||||
|
qDebug() << "Renaming old playlist" << playlist->title() << "to" << m_playlistTitle << m_playlistguid;
|
||||||
playlist->setTitle( m_playlistTitle );
|
playlist->setTitle( m_playlistTitle );
|
||||||
|
|
||||||
if( source()->isLocal() )
|
if( source()->isLocal() )
|
||||||
|
@@ -389,7 +389,7 @@ Playlist::setNewRevision( const QString& rev,
|
|||||||
|
|
||||||
|
|
||||||
source_ptr
|
source_ptr
|
||||||
Playlist::author()
|
Playlist::author() const
|
||||||
{
|
{
|
||||||
return m_source;
|
return m_source;
|
||||||
}
|
}
|
||||||
|
@@ -33,10 +33,10 @@ Q_PROPERTY( QVariant query READ queryVariant WRITE setQueryVariant )
|
|||||||
public:
|
public:
|
||||||
PlaylistEntry();
|
PlaylistEntry();
|
||||||
virtual ~PlaylistEntry();
|
virtual ~PlaylistEntry();
|
||||||
|
|
||||||
void setQuery( const Tomahawk::query_ptr& q );
|
void setQuery( const Tomahawk::query_ptr& q );
|
||||||
const Tomahawk::query_ptr& query() const;
|
const Tomahawk::query_ptr& query() const;
|
||||||
|
|
||||||
// I wish Qt did this for me once i specified the Q_PROPERTIES:
|
// I wish Qt did this for me once i specified the Q_PROPERTIES:
|
||||||
void setQueryVariant( const QVariant& v );
|
void setQueryVariant( const QVariant& v );
|
||||||
QVariant queryVariant() const;
|
QVariant queryVariant() const;
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
source_ptr lastSource() const;
|
source_ptr lastSource() const;
|
||||||
void setLastSource( source_ptr s );
|
void setLastSource( source_ptr s );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_guid;
|
QString m_guid;
|
||||||
Tomahawk::query_ptr m_query;
|
Tomahawk::query_ptr m_query;
|
||||||
QString m_annotation;
|
QString m_annotation;
|
||||||
@@ -97,7 +97,7 @@ friend class ::DatabaseCommand_CreatePlaylist;
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
~Playlist();
|
~Playlist();
|
||||||
|
|
||||||
static Tomahawk::playlist_ptr load( const QString& guid );
|
static Tomahawk::playlist_ptr load( const QString& guid );
|
||||||
|
|
||||||
// one CTOR is private, only called by DatabaseCommand_LoadAllPlaylists
|
// one CTOR is private, only called by DatabaseCommand_LoadAllPlaylists
|
||||||
@@ -113,14 +113,14 @@ public:
|
|||||||
|
|
||||||
virtual void loadRevision( const QString& rev = "" );
|
virtual void loadRevision( const QString& rev = "" );
|
||||||
|
|
||||||
source_ptr author();
|
source_ptr author() const;
|
||||||
const QString& currentrevision() { return m_currentrevision; }
|
QString currentrevision() const { return m_currentrevision; }
|
||||||
const QString& title() { return m_title; }
|
QString title() const { return m_title; }
|
||||||
const QString& info() { return m_info; }
|
QString info() const { return m_info; }
|
||||||
const QString& creator() { return m_creator; }
|
QString creator() const { return m_creator; }
|
||||||
unsigned int lastmodified() { return m_lastmodified; }
|
QString guid() const { return m_guid; }
|
||||||
const QString& guid() { return m_guid; }
|
bool shared() const { return m_shared; }
|
||||||
bool shared() const { return m_shared; }
|
unsigned int lastmodified() const { return m_lastmodified; }
|
||||||
|
|
||||||
const QList< plentry_ptr >& entries() { return m_entries; }
|
const QList< plentry_ptr >& entries() { return m_entries; }
|
||||||
virtual void addEntry( const Tomahawk::query_ptr& query, const QString& oldrev );
|
virtual void addEntry( const Tomahawk::query_ptr& query, const QString& oldrev );
|
||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
// maybe friend QObjectHelper and make them private?
|
// maybe friend QObjectHelper and make them private?
|
||||||
explicit Playlist( const source_ptr& author );
|
explicit Playlist( const source_ptr& author );
|
||||||
void setCurrentrevision( const QString& s ) { m_currentrevision = s; }
|
void setCurrentrevision( const QString& s ) { m_currentrevision = s; }
|
||||||
void setTitle( const QString& s ) { m_title = s; }
|
void setTitle( const QString& s ) { m_title = s; emit changed(); }
|
||||||
void setInfo( const QString& s ) { m_info = s; }
|
void setInfo( const QString& s ) { m_info = s; }
|
||||||
void setCreator( const QString& s ) { m_creator = s; }
|
void setCreator( const QString& s ) { m_creator = s; }
|
||||||
void setGuid( const QString& s ) { m_guid = s; }
|
void setGuid( const QString& s ) { m_guid = s; }
|
||||||
@@ -148,12 +148,12 @@ public:
|
|||||||
|
|
||||||
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
|
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
|
||||||
virtual bool shuffled() const { return false; }
|
virtual bool shuffled() const { return false; }
|
||||||
|
|
||||||
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
|
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
|
||||||
virtual void setShuffled( bool ) {}
|
virtual void setShuffled( bool ) {}
|
||||||
|
|
||||||
virtual void setFilter( const QString& pattern ) {}
|
virtual void setFilter( const QString& pattern ) {}
|
||||||
|
|
||||||
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::PlaylistRevision );
|
void revisionLoaded( Tomahawk::PlaylistRevision );
|
||||||
@@ -161,6 +161,9 @@ signals:
|
|||||||
/// watch for this to see when newly created playlist is synced to DB (if you care)
|
/// watch for this to see when newly created playlist is synced to DB (if you care)
|
||||||
void created();
|
void created();
|
||||||
|
|
||||||
|
/// renamed etc.
|
||||||
|
void changed();
|
||||||
|
|
||||||
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
|
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
|
||||||
void shuffleModeChanged( bool enabled );
|
void shuffleModeChanged( bool enabled );
|
||||||
|
|
||||||
@@ -201,24 +204,24 @@ protected:
|
|||||||
const QString& info,
|
const QString& info,
|
||||||
const QString& creator,
|
const QString& creator,
|
||||||
bool shared );
|
bool shared );
|
||||||
|
|
||||||
QList< plentry_ptr > newEntries( const QList< plentry_ptr >& entries );
|
QList< plentry_ptr > newEntries( const QList< plentry_ptr >& entries );
|
||||||
PlaylistRevision setNewRevision( const QString& rev,
|
PlaylistRevision setNewRevision( const QString& rev,
|
||||||
const QList<QString>& neworderedguids,
|
const QList<QString>& neworderedguids,
|
||||||
const QList<QString>& oldorderedguids,
|
const QList<QString>& oldorderedguids,
|
||||||
bool is_newest_rev,
|
bool is_newest_rev,
|
||||||
const QMap< QString, Tomahawk::plentry_ptr >& addedmap );
|
const QMap< QString, Tomahawk::plentry_ptr >& addedmap );
|
||||||
|
|
||||||
QList<plentry_ptr> addEntriesInternal( const QList<Tomahawk::query_ptr>& queries );
|
QList<plentry_ptr> addEntriesInternal( const QList<Tomahawk::query_ptr>& queries );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onResultsFound( const QList<Tomahawk::result_ptr>& results );
|
void onResultsFound( const QList<Tomahawk::result_ptr>& results );
|
||||||
void onResolvingFinished();
|
void onResolvingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Playlist();
|
Playlist();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
source_ptr m_source;
|
source_ptr m_source;
|
||||||
QString m_currentrevision;
|
QString m_currentrevision;
|
||||||
QString m_guid, m_title, m_info, m_creator;
|
QString m_guid, m_title, m_info, m_creator;
|
||||||
|
@@ -41,7 +41,7 @@ SourceTreeItem::SourceTreeItem( const source_ptr& source, QObject* parent )
|
|||||||
SLOT( onPlaylistsAdded( QList<Tomahawk::playlist_ptr> ) ) );
|
SLOT( onPlaylistsAdded( QList<Tomahawk::playlist_ptr> ) ) );
|
||||||
connect( source->collection().data(), SIGNAL( playlistsDeleted( QList<Tomahawk::playlist_ptr> ) ),
|
connect( source->collection().data(), SIGNAL( playlistsDeleted( QList<Tomahawk::playlist_ptr> ) ),
|
||||||
SLOT( onPlaylistsDeleted( QList<Tomahawk::playlist_ptr> ) ) );
|
SLOT( onPlaylistsDeleted( QList<Tomahawk::playlist_ptr> ) ) );
|
||||||
|
|
||||||
connect( source->collection().data(), SIGNAL( dynamicPlaylistsAdded( QList<Tomahawk::dynplaylist_ptr> ) ),
|
connect( source->collection().data(), SIGNAL( dynamicPlaylistsAdded( QList<Tomahawk::dynplaylist_ptr> ) ),
|
||||||
SLOT( onDynamicPlaylistsAdded( QList<Tomahawk::dynplaylist_ptr> ) ) );
|
SLOT( onDynamicPlaylistsAdded( QList<Tomahawk::dynplaylist_ptr> ) ) );
|
||||||
connect( source->collection().data(), SIGNAL( dynamicPlaylistsDeleted( QList<Tomahawk::dynplaylist_ptr> ) ),
|
connect( source->collection().data(), SIGNAL( dynamicPlaylistsDeleted( QList<Tomahawk::dynplaylist_ptr> ) ),
|
||||||
@@ -88,14 +88,14 @@ SourceTreeItem::onPlaylistsAdded( const QList<playlist_ptr>& playlists )
|
|||||||
{
|
{
|
||||||
m_playlists.append( p );
|
m_playlists.append( p );
|
||||||
qlonglong ptr = reinterpret_cast<qlonglong>( &m_playlists.last() );
|
qlonglong ptr = reinterpret_cast<qlonglong>( &m_playlists.last() );
|
||||||
qDebug() << "Setting playlist ptr to:" << ptr;
|
|
||||||
|
|
||||||
connect( p.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ),
|
connect( p.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ),
|
||||||
SLOT( onPlaylistLoaded( Tomahawk::PlaylistRevision ) ),
|
SLOT( onPlaylistLoaded( Tomahawk::PlaylistRevision ) ), Qt::QueuedConnection );
|
||||||
Qt::QueuedConnection);
|
connect( p.data(), SIGNAL( changed() ),
|
||||||
|
SLOT( onPlaylistChanged() ), Qt::QueuedConnection );
|
||||||
|
|
||||||
qDebug() << "Playlist added:" << p->title() << p->creator() << p->info() << ptr;
|
qDebug() << "Playlist added:" << p->title() << p->creator() << p->info() << ptr;
|
||||||
|
|
||||||
playlistAddedInternal( ptr, p, false );
|
playlistAddedInternal( ptr, p, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ SourceTreeItem::onPlaylistsDeleted( const QList<playlist_ptr>& playlists )
|
|||||||
{
|
{
|
||||||
qlonglong ptr = qlonglong( p.data() );
|
qlonglong ptr = qlonglong( p.data() );
|
||||||
qDebug() << "Playlist removed:" << p->title() << p->creator() << p->info() << ptr;
|
qDebug() << "Playlist removed:" << p->title() << p->creator() << p->info() << ptr;
|
||||||
|
|
||||||
QStandardItem* item = m_columns.at( 0 );
|
QStandardItem* item = m_columns.at( 0 );
|
||||||
int rows = item->rowCount();
|
int rows = item->rowCount();
|
||||||
for ( int i = rows - 1; i >= 0; i-- )
|
for ( int i = rows - 1; i >= 0; i-- )
|
||||||
@@ -118,7 +118,7 @@ SourceTreeItem::onPlaylistsDeleted( const QList<playlist_ptr>& playlists )
|
|||||||
qlonglong piptr = pi->data( PlaylistPointer ).toLongLong();
|
qlonglong piptr = pi->data( PlaylistPointer ).toLongLong();
|
||||||
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
||||||
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
||||||
|
|
||||||
if ( type == SourcesModel::PlaylistSource && ptr == qlonglong( pl->data() ) )
|
if ( type == SourcesModel::PlaylistSource && ptr == qlonglong( pl->data() ) )
|
||||||
{
|
{
|
||||||
m_playlists.removeAll( p );
|
m_playlists.removeAll( p );
|
||||||
@@ -133,8 +133,7 @@ void
|
|||||||
SourceTreeItem::onPlaylistLoaded( Tomahawk::PlaylistRevision revision )
|
SourceTreeItem::onPlaylistLoaded( Tomahawk::PlaylistRevision revision )
|
||||||
{
|
{
|
||||||
qlonglong ptr = reinterpret_cast<qlonglong>( sender() );
|
qlonglong ptr = reinterpret_cast<qlonglong>( sender() );
|
||||||
qDebug() << "sender ptr:" << ptr;
|
|
||||||
|
|
||||||
QStandardItem* item = m_columns.at( 0 );
|
QStandardItem* item = m_columns.at( 0 );
|
||||||
int rows = item->rowCount();
|
int rows = item->rowCount();
|
||||||
for ( int i = 0; i < rows; i++ )
|
for ( int i = 0; i < rows; i++ )
|
||||||
@@ -143,10 +142,9 @@ SourceTreeItem::onPlaylistLoaded( Tomahawk::PlaylistRevision revision )
|
|||||||
qlonglong piptr = pi->data( PlaylistPointer ).toLongLong();
|
qlonglong piptr = pi->data( PlaylistPointer ).toLongLong();
|
||||||
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
||||||
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
||||||
|
|
||||||
if ( type == SourcesModel::PlaylistSource && ptr == qlonglong( pl->data() ) )
|
if ( type == SourcesModel::PlaylistSource && ptr == qlonglong( pl->data() ) )
|
||||||
{
|
{
|
||||||
qDebug() << "Found normal playlist!";
|
|
||||||
pi->setEnabled( true );
|
pi->setEnabled( true );
|
||||||
m_current_revisions.insert( pl->data()->guid(), revision.revisionguid );
|
m_current_revisions.insert( pl->data()->guid(), revision.revisionguid );
|
||||||
}
|
}
|
||||||
@@ -154,6 +152,38 @@ SourceTreeItem::onPlaylistLoaded( Tomahawk::PlaylistRevision revision )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SourceTreeItem::onPlaylistChanged()
|
||||||
|
{
|
||||||
|
qlonglong ptr = reinterpret_cast<qlonglong>( sender() );
|
||||||
|
|
||||||
|
QStandardItem* item = m_columns.at( 0 );
|
||||||
|
int rows = item->rowCount();
|
||||||
|
for ( int i = 0; i < rows; i++ )
|
||||||
|
{
|
||||||
|
QStandardItem* pi = item->child( i );
|
||||||
|
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
||||||
|
|
||||||
|
if ( type == SourcesModel::PlaylistSource )
|
||||||
|
{
|
||||||
|
qlonglong piptr = pi->data( PlaylistPointer ).toLongLong();
|
||||||
|
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
||||||
|
|
||||||
|
if ( ptr == qlonglong( pl->data() ) )
|
||||||
|
pi->setText( pl->data()->title() );
|
||||||
|
}
|
||||||
|
if ( type == SourcesModel::DynamicPlaylistSource )
|
||||||
|
{
|
||||||
|
qlonglong piptr = pi->data( DynamicPlaylistPointer ).toLongLong();
|
||||||
|
dynplaylist_ptr* pl = reinterpret_cast<dynplaylist_ptr*>(piptr);
|
||||||
|
|
||||||
|
if ( ptr == qlonglong( pl->data() ) )
|
||||||
|
pi->setText( pl->data()->title() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeItem::onDynamicPlaylistsAdded( const QList< dynplaylist_ptr >& playlists )
|
SourceTreeItem::onDynamicPlaylistsAdded( const QList< dynplaylist_ptr >& playlists )
|
||||||
{
|
{
|
||||||
@@ -162,13 +192,14 @@ SourceTreeItem::onDynamicPlaylistsAdded( const QList< dynplaylist_ptr >& playlis
|
|||||||
{
|
{
|
||||||
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;
|
|
||||||
connect( p.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ),
|
connect( p.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ),
|
||||||
SLOT( onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision ) ),
|
SLOT( onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision ) ), Qt::QueuedConnection );
|
||||||
Qt::QueuedConnection);
|
connect( p.data(), SIGNAL( changed() ),
|
||||||
|
SLOT( onPlaylistChanged() ), Qt::QueuedConnection );
|
||||||
|
|
||||||
// qDebug() << "Dynamic Playlist added:" << p->title() << p->creator() << p->info() << p->currentrevision() << ptr;
|
// qDebug() << "Dynamic Playlist added:" << p->title() << p->creator() << p->info() << p->currentrevision() << ptr;
|
||||||
|
|
||||||
playlistAddedInternal( ptr, p, true );
|
playlistAddedInternal( ptr, p, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +213,7 @@ SourceTreeItem::onDynamicPlaylistsDeleted( const QList< dynplaylist_ptr >& playl
|
|||||||
{
|
{
|
||||||
qlonglong ptr = qlonglong( p.data() );
|
qlonglong ptr = qlonglong( p.data() );
|
||||||
// qDebug() << "dynamic playlist removed:" << p->title() << p->creator() << p->info() << ptr;
|
// qDebug() << "dynamic playlist removed:" << p->title() << p->creator() << p->info() << ptr;
|
||||||
|
|
||||||
QStandardItem* item = m_columns.at( 0 );
|
QStandardItem* item = m_columns.at( 0 );
|
||||||
int rows = item->rowCount();
|
int rows = item->rowCount();
|
||||||
for ( int i = rows - 1; i >= 0; i-- )
|
for ( int i = rows - 1; i >= 0; i-- )
|
||||||
@@ -191,7 +222,8 @@ SourceTreeItem::onDynamicPlaylistsDeleted( const QList< dynplaylist_ptr >& playl
|
|||||||
qlonglong piptr = pi->data( DynamicPlaylistPointer ).toLongLong();
|
qlonglong piptr = pi->data( DynamicPlaylistPointer ).toLongLong();
|
||||||
dynplaylist_ptr* pl = reinterpret_cast<dynplaylist_ptr*>(piptr);
|
dynplaylist_ptr* pl = reinterpret_cast<dynplaylist_ptr*>(piptr);
|
||||||
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
||||||
//qDebug() << "Deleting dynamic playlsit:" << pl->isNull();
|
|
||||||
|
//qDebug() << "Deleting dynamic playlist:" << pl->isNull();
|
||||||
if ( type == SourcesModel::DynamicPlaylistSource && ptr == qlonglong( pl->data() ) )
|
if ( type == SourcesModel::DynamicPlaylistSource && ptr == qlonglong( pl->data() ) )
|
||||||
{
|
{
|
||||||
m_dynplaylists.removeAll( p );
|
m_dynplaylists.removeAll( p );
|
||||||
@@ -206,7 +238,7 @@ void
|
|||||||
SourceTreeItem::onDynamicPlaylistLoaded( DynamicPlaylistRevision revision )
|
SourceTreeItem::onDynamicPlaylistLoaded( DynamicPlaylistRevision revision )
|
||||||
{
|
{
|
||||||
qlonglong ptr = reinterpret_cast<qlonglong>( sender() );
|
qlonglong ptr = reinterpret_cast<qlonglong>( sender() );
|
||||||
|
|
||||||
QStandardItem* item = m_columns.at( 0 );
|
QStandardItem* item = m_columns.at( 0 );
|
||||||
int rows = item->rowCount();
|
int rows = item->rowCount();
|
||||||
for ( int i = 0; i < rows; i++ )
|
for ( int i = 0; i < rows; i++ )
|
||||||
@@ -215,10 +247,9 @@ SourceTreeItem::onDynamicPlaylistLoaded( DynamicPlaylistRevision revision )
|
|||||||
qlonglong piptr = pi->data( DynamicPlaylistPointer ).toLongLong();
|
qlonglong piptr = pi->data( DynamicPlaylistPointer ).toLongLong();
|
||||||
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
playlist_ptr* pl = reinterpret_cast<playlist_ptr*>(piptr);
|
||||||
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
SourcesModel::SourceType type = static_cast<SourcesModel::SourceType>( pi->data( Type ).toInt() );
|
||||||
// qDebug() << "found dynamic playlist:" << (*pl)->title() << type;
|
|
||||||
if ( type == SourcesModel::DynamicPlaylistSource && ptr == qlonglong( pl->data() ) )
|
if ( type == SourcesModel::DynamicPlaylistSource && ptr == qlonglong( pl->data() ) )
|
||||||
{
|
{
|
||||||
//qDebug() << "Found dynamicplaylist!";
|
|
||||||
pi->setEnabled( true );
|
pi->setEnabled( true );
|
||||||
m_current_dynamic_revisions.insert( pl->data()->guid(), revision.revisionguid );
|
m_current_dynamic_revisions.insert( pl->data()->guid(), revision.revisionguid );
|
||||||
}
|
}
|
||||||
@@ -235,10 +266,10 @@ void SourceTreeItem::playlistAddedInternal( qlonglong ptr, const Tomahawk::playl
|
|||||||
subitem->setData( ptr, dynamic ? DynamicPlaylistPointer : PlaylistPointer );
|
subitem->setData( ptr, dynamic ? DynamicPlaylistPointer : PlaylistPointer );
|
||||||
subitem->setData( dynamic ? SourcesModel::DynamicPlaylistSource : SourcesModel::PlaylistSource, Type );
|
subitem->setData( dynamic ? SourcesModel::DynamicPlaylistSource : SourcesModel::PlaylistSource, Type );
|
||||||
subitem->setData( (qlonglong)this, SourceItemPointer );
|
subitem->setData( (qlonglong)this, SourceItemPointer );
|
||||||
|
|
||||||
m_columns.at( 0 )->appendRow( subitem );
|
m_columns.at( 0 )->appendRow( subitem );
|
||||||
// Q_ASSERT( qobject_cast<QTreeView*>((parent()->parent()) ) );
|
// Q_ASSERT( qobject_cast<QTreeView*>((parent()->parent()) ) );
|
||||||
// qobject_cast<QTreeView*>((parent()->parent()))->expandAll();
|
// qobject_cast<QTreeView*>((parent()->parent()))->expandAll();
|
||||||
|
|
||||||
p->loadRevision();
|
p->loadRevision();
|
||||||
}
|
}
|
||||||
|
@@ -47,13 +47,15 @@ private slots:
|
|||||||
void onPlaylistsAdded( const QList<Tomahawk::playlist_ptr>& playlists );
|
void onPlaylistsAdded( const QList<Tomahawk::playlist_ptr>& playlists );
|
||||||
void onPlaylistsDeleted( const QList<Tomahawk::playlist_ptr>& playlists );
|
void onPlaylistsDeleted( const QList<Tomahawk::playlist_ptr>& playlists );
|
||||||
void onPlaylistLoaded( Tomahawk::PlaylistRevision revision );
|
void onPlaylistLoaded( Tomahawk::PlaylistRevision revision );
|
||||||
|
void onPlaylistChanged();
|
||||||
|
|
||||||
void onDynamicPlaylistsAdded( const QList<Tomahawk::dynplaylist_ptr>& playlists );
|
void onDynamicPlaylistsAdded( const QList<Tomahawk::dynplaylist_ptr>& playlists );
|
||||||
void onDynamicPlaylistsDeleted( const QList<Tomahawk::dynplaylist_ptr>& playlists );
|
void onDynamicPlaylistsDeleted( const QList<Tomahawk::dynplaylist_ptr>& playlists );
|
||||||
void onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision revision );
|
void onDynamicPlaylistLoaded( Tomahawk::DynamicPlaylistRevision revision );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void playlistAddedInternal( qlonglong ptr, const Tomahawk::playlist_ptr& pl, bool dynamic );
|
void playlistAddedInternal( qlonglong ptr, const Tomahawk::playlist_ptr& pl, bool dynamic );
|
||||||
|
|
||||||
QList<QStandardItem*> m_columns;
|
QList<QStandardItem*> m_columns;
|
||||||
Tomahawk::source_ptr m_source;
|
Tomahawk::source_ptr m_source;
|
||||||
SourceTreeItemWidget* m_widget;
|
SourceTreeItemWidget* m_widget;
|
||||||
|
Reference in New Issue
Block a user