mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* PlaylistModel's setAcceptPlayableQueriesOnly( bool ) toggles whether dropping unplayable queries is allowed.
This commit is contained in:
@@ -45,6 +45,7 @@ PlaylistModel::PlaylistModel( QObject* parent )
|
|||||||
, m_isTemporary( false )
|
, m_isTemporary( false )
|
||||||
, m_changesOngoing( false )
|
, m_changesOngoing( false )
|
||||||
, m_isLoading( false )
|
, m_isLoading( false )
|
||||||
|
, m_acceptPlayableQueriesOnly( false )
|
||||||
, m_savedInsertPos( -1 )
|
, m_savedInsertPos( -1 )
|
||||||
{
|
{
|
||||||
m_dropStorage.parent = QPersistentModelIndex();
|
m_dropStorage.parent = QPersistentModelIndex();
|
||||||
@@ -218,6 +219,9 @@ PlaylistModel::insertQueries( const QList< Tomahawk::query_ptr >& queries, int r
|
|||||||
QList< Tomahawk::plentry_ptr > entries;
|
QList< Tomahawk::plentry_ptr > entries;
|
||||||
foreach ( const query_ptr& query, queries )
|
foreach ( const query_ptr& query, queries )
|
||||||
{
|
{
|
||||||
|
if ( m_acceptPlayableQueriesOnly && query && query->resolvingFinished() && !query->playable() )
|
||||||
|
continue;
|
||||||
|
|
||||||
plentry_ptr entry = plentry_ptr( new PlaylistEntry() );
|
plentry_ptr entry = plentry_ptr( new PlaylistEntry() );
|
||||||
|
|
||||||
entry->setDuration( query->displayQuery()->duration() );
|
entry->setDuration( query->displayQuery()->duration() );
|
||||||
|
@@ -57,6 +57,9 @@ public:
|
|||||||
virtual void loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEntries = true );
|
virtual void loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEntries = true );
|
||||||
bool isTemporary() const;
|
bool isTemporary() const;
|
||||||
|
|
||||||
|
bool acceptPlayableQueriesOnly() const { return m_acceptPlayableQueriesOnly; }
|
||||||
|
void setAcceptPlayableQueriesOnly( bool b ) { m_acceptPlayableQueriesOnly = b; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
@@ -95,6 +98,7 @@ private:
|
|||||||
bool m_isTemporary;
|
bool m_isTemporary;
|
||||||
bool m_changesOngoing;
|
bool m_changesOngoing;
|
||||||
bool m_isLoading;
|
bool m_isLoading;
|
||||||
|
bool m_acceptPlayableQueriesOnly;
|
||||||
QList< Tomahawk::Query* > m_waitingForResolved;
|
QList< Tomahawk::Query* > m_waitingForResolved;
|
||||||
QStringList m_waitForRevision;
|
QStringList m_waitForRevision;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user