1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

Emit scanning progress from ScanManager. Don't update the local source directly.

This commit is contained in:
Christian Muehlhaeuser
2014-10-23 16:07:14 +02:00
parent b9e2c8fa53
commit e19800c0de
4 changed files with 10 additions and 8 deletions

View File

@@ -213,10 +213,7 @@ MusicScanner::startScan()
m_scanned = m_skipped = m_cmdQueue = 0;
m_skippedFiles.clear();
if ( m_showProgress )
{
SourceList::instance()->getLocal()->scanningProgress( m_scanned );
}
emit progress( m_scanned );
// trigger the scan once we've loaded old filemtimes
//FIXME: For multiple collection support make sure the right prefix gets passed in...or not...
@@ -467,8 +464,9 @@ MusicScanner::readFile( const QFileInfo& fi )
const QVariant m = readTags( fi );
if ( m_scanned )
if ( m_scanned % 3 == 0 && m_showProgress )
SourceList::instance()->getLocal()->scanningProgress( m_scanned );
if ( m_scanned % 3 == 0 )
emit progress( m_scanned );
if ( m_scanned % 100 == 0 || m_verbose )
tDebug( LOGINFO ) << "Scanning file:" << m_scanned << fi.canonicalFilePath();

View File

@@ -130,6 +130,7 @@ signals:
//void fileScanned( QVariantMap );
void finished();
void batchReady( const QVariantList&, const QVariantList& );
void progress( unsigned int files );
private:
QVariant readFile( const QFileInfo& fi );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -56,6 +56,7 @@ MusicScannerThreadController::run()
{
m_musicScanner = QPointer< MusicScanner >( new MusicScanner( m_mode, m_paths, m_bs ) );
connect( m_musicScanner.data(), SIGNAL( finished() ), parent(), SLOT( scannerFinished() ), Qt::QueuedConnection );
connect( m_musicScanner.data(), SIGNAL( progress( unsigned int ) ), parent(), SIGNAL( progress( unsigned int ) ), Qt::QueuedConnection );
QMetaObject::invokeMethod( m_musicScanner.data(), "startScan", Qt::QueuedConnection );
exec();

View File

@@ -52,7 +52,7 @@ private:
QPointer< MusicScanner > m_musicScanner;
MusicScanner::ScanMode m_mode;
QStringList m_paths;
quint32 m_bs;
quint32 m_bs;
};
@@ -67,6 +67,8 @@ public:
virtual ~ScanManager();
signals:
void started();
void progress( unsigned int files );
void finished();
public slots: