mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-01 01:51:58 +02:00
* Fixed broken signal / slot connection. Re-scanning now live-updates the CollectionFlatModel, again.
This commit is contained in:
1
README
1
README
@@ -105,7 +105,6 @@ Dependencies
|
|||||||
|
|
||||||
To build the app:
|
To build the app:
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
$ mkdir build && cd build
|
$ mkdir build && cd build
|
||||||
|
|
||||||
Pick one of the following two choices. If uncertain pick the second one, you probably want a GUI.
|
Pick one of the following two choices. If uncertain pick the second one, you probably want a GUI.
|
||||||
|
@@ -176,7 +176,6 @@ Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << tracks.count() << name();
|
qDebug() << Q_FUNC_INFO << tracks.count() << name();
|
||||||
|
|
||||||
m_isLoaded = true;
|
|
||||||
m_tracks << tracks;
|
m_tracks << tracks;
|
||||||
emit tracksAdded( tracks );
|
emit tracksAdded( tracks );
|
||||||
}
|
}
|
||||||
|
@@ -51,6 +51,7 @@ public:
|
|||||||
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
|
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
|
||||||
virtual ~Collection();
|
virtual ~Collection();
|
||||||
|
|
||||||
|
virtual void setLoaded() { m_isLoaded = true; }
|
||||||
virtual bool isLoaded() const { return m_isLoaded; }
|
virtual bool isLoaded() const { return m_isLoaded; }
|
||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
|
|
||||||
@@ -90,9 +91,10 @@ public slots:
|
|||||||
|
|
||||||
void setPlaylists( const QList<Tomahawk::playlist_ptr>& plists );
|
void setPlaylists( const QList<Tomahawk::playlist_ptr>& plists );
|
||||||
void setDynamicPlaylists( const QList< Tomahawk::dynplaylist_ptr >& dynplists );
|
void setDynamicPlaylists( const QList< Tomahawk::dynplaylist_ptr >& dynplists );
|
||||||
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
|
|
||||||
|
|
||||||
|
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
|
||||||
void delTracks( const QStringList& files );
|
void delTracks( const QStringList& files );
|
||||||
|
void resetTrackCache() { m_tracks.clear(); m_isLoaded = false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
@@ -30,7 +30,6 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent )
|
DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent )
|
||||||
: Collection( src, QString( "dbcollection:%1" ).arg( src->userName() ), parent )
|
: Collection( src, QString( "dbcollection:%1" ).arg( src->userName() ), parent )
|
||||||
, m_loadedTracks( false )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ DatabaseCollection::loadTracks()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << source()->userName();
|
qDebug() << Q_FUNC_INFO << source()->userName();
|
||||||
|
|
||||||
m_loadedTracks = true;
|
setLoaded();
|
||||||
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
|
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
|
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
|
||||||
@@ -128,7 +127,7 @@ DatabaseCollection::tracks()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
if ( !m_loadedTracks )
|
if ( !isLoaded() )
|
||||||
{
|
{
|
||||||
loadTracks();
|
loadTracks();
|
||||||
}
|
}
|
||||||
|
@@ -52,9 +52,6 @@ public slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void dynamicPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
void dynamicPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_loadedTracks;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATABASECOLLECTION_H
|
#endif // DATABASECOLLECTION_H
|
||||||
|
@@ -63,11 +63,11 @@ DatabaseCommand_AddFiles::postCommitHook()
|
|||||||
// collection browser will update/fade in etc.
|
// collection browser will update/fade in etc.
|
||||||
Collection* coll = source()->collection().data();
|
Collection* coll = source()->collection().data();
|
||||||
|
|
||||||
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
|
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr> ) ),
|
||||||
coll, SLOT( setTracks( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
|
coll, SLOT( setTracks( QList<Tomahawk::query_ptr> ) ),
|
||||||
Qt::QueuedConnection );
|
Qt::QueuedConnection );
|
||||||
|
|
||||||
emit notify( m_queries, source()->collection() );
|
emit notify( m_queries );
|
||||||
|
|
||||||
// also re-calc the collection stats, to updates the "X tracks" in the sidebar etc:
|
// also re-calc the collection stats, to updates the "X tracks" in the sidebar etc:
|
||||||
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );
|
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
|
void done( const QList<QVariant>&, const Tomahawk::collection_ptr& );
|
||||||
void notify( const QList<Tomahawk::query_ptr>&, const Tomahawk::collection_ptr& );
|
void notify( const QList<Tomahawk::query_ptr>& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantList m_files;
|
QVariantList m_files;
|
||||||
|
@@ -41,10 +41,10 @@ DatabaseCommand_DeleteFiles::postCommitHook()
|
|||||||
// collection browser will update/fade in etc.
|
// collection browser will update/fade in etc.
|
||||||
Collection* coll = source()->collection().data();
|
Collection* coll = source()->collection().data();
|
||||||
|
|
||||||
connect( this, SIGNAL( notify( QStringList, Tomahawk::collection_ptr ) ),
|
connect( this, SIGNAL( notify( QStringList ) ),
|
||||||
coll, SLOT( delTracks( QStringList, Tomahawk::collection_ptr ) ), Qt::QueuedConnection );
|
coll, SLOT( delTracks( QStringList ) ), Qt::QueuedConnection );
|
||||||
|
|
||||||
emit notify( m_files, source()->collection() );
|
emit notify( m_files );
|
||||||
|
|
||||||
// also re-calc the collection stats, to updates the "X tracks" in the sidebar etc:
|
// also re-calc the collection stats, to updates the "X tracks" in the sidebar etc:
|
||||||
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );
|
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );
|
||||||
@@ -66,6 +66,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
||||||
TomahawkSqlQuery delquery = dbi->newquery();
|
TomahawkSqlQuery delquery = dbi->newquery();
|
||||||
|
QString lastPath;
|
||||||
|
|
||||||
if ( !m_dir.path().isEmpty() && source()->isLocal() )
|
if ( !m_dir.path().isEmpty() && source()->isLocal() )
|
||||||
{
|
{
|
||||||
@@ -85,7 +86,10 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
QFileInfo fi( dirquery.value( 1 ).toString().mid( 7 ) ); // remove file://
|
QFileInfo fi( dirquery.value( 1 ).toString().mid( 7 ) ); // remove file://
|
||||||
if ( fi.absolutePath() != m_dir.absolutePath() )
|
if ( fi.absolutePath() != m_dir.absolutePath() )
|
||||||
{
|
{
|
||||||
qDebug() << "Skipping subdir:" << fi.absolutePath();
|
if ( lastPath != fi.absolutePath() )
|
||||||
|
qDebug() << "Skipping subdir:" << fi.absolutePath();
|
||||||
|
|
||||||
|
lastPath = fi.absolutePath();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done( const QStringList&, const Tomahawk::collection_ptr& );
|
void done( const QStringList&, const Tomahawk::collection_ptr& );
|
||||||
void notify( const QStringList&, const Tomahawk::collection_ptr& );
|
void notify( const QStringList& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDir m_dir;
|
QDir m_dir;
|
||||||
|
Reference in New Issue
Block a user