1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

* Prevent watch for changes interfering with running scan.

This commit is contained in:
Christian Muehlhaeuser 2011-11-11 19:46:44 +01:00
parent 8e742a06d9
commit 011ece182f

View File

@ -135,22 +135,29 @@ ScanManager::runScan( bool manualFull )
if ( !Database::instance() || ( Database::instance() && !Database::instance()->isReady() ) )
return;
if ( manualFull )
if ( !m_musicScannerThreadController && m_scanner.isNull() ) //still running if these are not zero
{
DatabaseCommand_DeleteFiles *cmd = new DatabaseCommand_DeleteFiles( SourceList::instance()->getLocal() );
connect( cmd, SIGNAL( done( const QStringList&, const Tomahawk::collection_ptr& ) ),
SLOT( filesDeleted( const QStringList&, const Tomahawk::collection_ptr& ) ) );
if ( manualFull )
{
DatabaseCommand_DeleteFiles *cmd = new DatabaseCommand_DeleteFiles( SourceList::instance()->getLocal() );
connect( cmd, SIGNAL( done( const QStringList&, const Tomahawk::collection_ptr& ) ),
SLOT( filesDeleted( const QStringList&, const Tomahawk::collection_ptr& ) ) );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
return;
}
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes( true );
connect( cmd, SIGNAL( done( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ),
SLOT( fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ) );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
}
else
{
qDebug() << "Could not run dir scan, old scan still running";
return;
}
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes( true );
connect( cmd, SIGNAL( done( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ),
SLOT( fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned int > >& ) ) );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
}
@ -166,7 +173,7 @@ ScanManager::fileMtimesCheck( const QMap< QString, QMap< unsigned int, unsigned
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
return;
}
runDirScan();
}
@ -190,7 +197,7 @@ ScanManager::runDirScan()
return;
QStringList paths = TomahawkSettings::instance()->scannerPaths();
if ( !m_musicScannerThreadController && m_scanner.isNull() ) //still running if these are not zero
{
m_scanTimer->stop();