1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

* Fixed broken signal / slot connection. Re-scanning now live-updates the CollectionFlatModel, again.

This commit is contained in:
Christian Muehlhaeuser 2011-03-19 06:14:22 +01:00
parent 85826249c9
commit 9de221e9d0
9 changed files with 18 additions and 18 deletions

1
README
View File

@ -105,7 +105,6 @@ Dependencies
To build the app:
-----------------
$ mkdir build && cd build
Pick one of the following two choices. If uncertain pick the second one, you probably want a GUI.

View File

@ -176,7 +176,6 @@ Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
{
qDebug() << Q_FUNC_INFO << tracks.count() << name();
m_isLoaded = true;
m_tracks << tracks;
emit tracksAdded( tracks );
}

View File

@ -51,6 +51,7 @@ public:
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
virtual ~Collection();
virtual void setLoaded() { m_isLoaded = true; }
virtual bool isLoaded() const { return m_isLoaded; }
virtual QString name() const;
@ -90,9 +91,10 @@ public slots:
void setPlaylists( const QList<Tomahawk::playlist_ptr>& plists );
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 resetTrackCache() { m_tracks.clear(); m_isLoaded = false; }
protected:
QString m_name;

View File

@ -30,7 +30,6 @@ using namespace Tomahawk;
DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* 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();
m_loadedTracks = true;
setLoaded();
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
@ -128,7 +127,7 @@ DatabaseCollection::tracks()
{
qDebug() << Q_FUNC_INFO;
if ( !m_loadedTracks )
if ( !isLoaded() )
{
loadTracks();
}

View File

@ -52,9 +52,6 @@ public slots:
private slots:
void dynamicPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
private:
bool m_loadedTracks;
};
#endif // DATABASECOLLECTION_H

View File

@ -63,11 +63,11 @@ DatabaseCommand_AddFiles::postCommitHook()
// collection browser will update/fade in etc.
Collection* coll = source()->collection().data();
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
coll, SLOT( setTracks( QList<Tomahawk::query_ptr>, Tomahawk::collection_ptr ) ),
connect( this, SIGNAL( notify( QList<Tomahawk::query_ptr> ) ),
coll, SLOT( setTracks( QList<Tomahawk::query_ptr> ) ),
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:
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );

View File

@ -55,7 +55,7 @@ public:
signals:
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:
QVariantList m_files;

View File

@ -41,10 +41,10 @@ DatabaseCommand_DeleteFiles::postCommitHook()
// collection browser will update/fade in etc.
Collection* coll = source()->collection().data();
connect( this, SIGNAL( notify( QStringList, Tomahawk::collection_ptr ) ),
coll, SLOT( delTracks( QStringList, Tomahawk::collection_ptr ) ), Qt::QueuedConnection );
connect( this, SIGNAL( notify( QStringList ) ),
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:
DatabaseCommand_CollectionStats* cmd = new DatabaseCommand_CollectionStats( source() );
@ -66,6 +66,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
int deleted = 0;
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
TomahawkSqlQuery delquery = dbi->newquery();
QString lastPath;
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://
if ( fi.absolutePath() != m_dir.absolutePath() )
{
qDebug() << "Skipping subdir:" << fi.absolutePath();
if ( lastPath != fi.absolutePath() )
qDebug() << "Skipping subdir:" << fi.absolutePath();
lastPath = fi.absolutePath();
continue;
}

View File

@ -59,7 +59,7 @@ public:
signals:
void done( const QStringList&, const Tomahawk::collection_ptr& );
void notify( const QStringList&, const Tomahawk::collection_ptr& );
void notify( const QStringList& );
private:
QDir m_dir;