1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Make showing scan progress optional

This commit is contained in:
Uwe L. Korn
2014-09-20 20:13:12 +01:00
parent 935309000f
commit 4a9d0eea8c
2 changed files with 24 additions and 2 deletions

View File

@@ -136,6 +136,7 @@ MusicScanner::MusicScanner( MusicScanner::ScanMode scanMode, const QStringList&
: QObject() : QObject()
, m_scanMode( scanMode ) , m_scanMode( scanMode )
, m_paths( paths ) , m_paths( paths )
, m_showProgress( true )
, m_batchsize( bs ) , m_batchsize( bs )
, m_dirListerThreadController( 0 ) , m_dirListerThreadController( 0 )
{ {
@@ -157,6 +158,20 @@ MusicScanner::~MusicScanner()
} }
void
MusicScanner::showProgress( bool _showProgress )
{
m_showProgress = _showProgress;
}
bool
MusicScanner::showingProgress()
{
return m_showProgress;
}
void void
MusicScanner::startScan() MusicScanner::startScan()
{ {
@@ -164,7 +179,10 @@ MusicScanner::startScan()
m_scanned = m_skipped = m_cmdQueue = 0; m_scanned = m_skipped = m_cmdQueue = 0;
m_skippedFiles.clear(); m_skippedFiles.clear();
if ( m_showProgress )
{
SourceList::instance()->getLocal()->scanningProgress( m_scanned ); SourceList::instance()->getLocal()->scanningProgress( m_scanned );
}
// trigger the scan once we've loaded old filemtimes // trigger the scan once we've loaded old filemtimes
//FIXME: For multiple collection support make sure the right prefix gets passed in...or not... //FIXME: For multiple collection support make sure the right prefix gets passed in...or not...
@@ -412,7 +430,7 @@ MusicScanner::readFile( const QFileInfo& fi )
const QVariant m = readTags( fi ); const QVariant m = readTags( fi );
if ( m_scanned ) if ( m_scanned )
if ( m_scanned % 3 == 0 ) if ( m_scanned % 3 == 0 && m_showProgress )
SourceList::instance()->getLocal()->scanningProgress( m_scanned ); SourceList::instance()->getLocal()->scanningProgress( m_scanned );
if ( m_scanned % 100 == 0 ) if ( m_scanned % 100 == 0 )
tDebug( LOGINFO ) << "Scan progress:" << m_scanned << fi.canonicalFilePath(); tDebug( LOGINFO ) << "Scan progress:" << m_scanned << fi.canonicalFilePath();

View File

@@ -107,6 +107,9 @@ public:
MusicScanner( MusicScanner::ScanMode scanMode, const QStringList& paths, quint32 bs = 0 ); MusicScanner( MusicScanner::ScanMode scanMode, const QStringList& paths, quint32 bs = 0 );
~MusicScanner(); ~MusicScanner();
void showProgress( bool _showProgress );
bool showingProgress();
signals: signals:
//void fileScanned( QVariantMap ); //void fileScanned( QVariantMap );
void finished(); void finished();
@@ -133,6 +136,7 @@ private:
QStringList m_paths; QStringList m_paths;
unsigned int m_scanned; unsigned int m_scanned;
unsigned int m_skipped; unsigned int m_skipped;
bool m_showProgress;
QList<QString> m_skippedFiles; QList<QString> m_skippedFiles;
QMap<QString, QMap< unsigned int, unsigned int > > m_filemtimes; QMap<QString, QMap< unsigned int, unsigned int > > m_filemtimes;