1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-22 17:01:51 +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
src/libtomahawk/filemetadata

@ -136,6 +136,7 @@ MusicScanner::MusicScanner( MusicScanner::ScanMode scanMode, const QStringList&
: QObject()
, m_scanMode( scanMode )
, m_paths( paths )
, m_showProgress( true )
, m_batchsize( bs )
, m_dirListerThreadController( 0 )
{
@ -157,6 +158,20 @@ MusicScanner::~MusicScanner()
}
void
MusicScanner::showProgress( bool _showProgress )
{
m_showProgress = _showProgress;
}
bool
MusicScanner::showingProgress()
{
return m_showProgress;
}
void
MusicScanner::startScan()
{
@ -164,7 +179,10 @@ MusicScanner::startScan()
m_scanned = m_skipped = m_cmdQueue = 0;
m_skippedFiles.clear();
SourceList::instance()->getLocal()->scanningProgress( m_scanned );
if ( m_showProgress )
{
SourceList::instance()->getLocal()->scanningProgress( 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...
@ -412,7 +430,7 @@ MusicScanner::readFile( const QFileInfo& fi )
const QVariant m = readTags( fi );
if ( m_scanned )
if ( m_scanned % 3 == 0 )
if ( m_scanned % 3 == 0 && m_showProgress )
SourceList::instance()->getLocal()->scanningProgress( m_scanned );
if ( m_scanned % 100 == 0 )
tDebug( LOGINFO ) << "Scan progress:" << m_scanned << fi.canonicalFilePath();

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