mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Remove dir mode, just use file mode for scanning all the time
This commit is contained in:
parent
0736a65f2a
commit
84622380d6
@ -238,20 +238,6 @@ TomahawkSettings::hasScannerPaths() const
|
||||
}
|
||||
|
||||
|
||||
TomahawkSettings::ScannerMode
|
||||
TomahawkSettings::scannerMode() const
|
||||
{
|
||||
return (TomahawkSettings::ScannerMode) value( "scanner/mode", TomahawkSettings::Files ).toInt();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setScannerMode( ScannerMode mode )
|
||||
{
|
||||
setValue( "scanner/mode", mode );
|
||||
}
|
||||
|
||||
|
||||
uint
|
||||
TomahawkSettings::scannerTime() const
|
||||
{
|
||||
|
@ -42,12 +42,9 @@ public:
|
||||
void applyChanges() { emit changed(); }
|
||||
|
||||
/// General settings
|
||||
enum ScannerMode { Dirs, Files };
|
||||
QStringList scannerPaths(); /// QDesktopServices::MusicLocation by default
|
||||
void setScannerPaths( const QStringList& paths );
|
||||
bool hasScannerPaths() const;
|
||||
ScannerMode scannerMode() const;
|
||||
void setScannerMode( ScannerMode mode );
|
||||
uint scannerTime() const;
|
||||
void setScannerTime( uint time );
|
||||
uint infoSystemCacheVersion() const;
|
||||
|
@ -38,114 +38,66 @@ using namespace Tomahawk;
|
||||
void
|
||||
DirLister::go()
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Recursive? :" << (m_recursive ? "true" : "false");
|
||||
|
||||
if ( !m_recursive )
|
||||
{
|
||||
foreach ( const QString& dir, m_dirs )
|
||||
{
|
||||
if ( m_dirmtimes.contains( dir ) )
|
||||
{
|
||||
tDebug( LOGEXTRA ) << "Removing" << dir << "from m_dirmtimes because it's specifically requested (so we want to be sure to scan it)";
|
||||
m_dirmtimes.remove( dir );
|
||||
}
|
||||
|
||||
QStringList filtered = QStringList( m_dirmtimes.keys() ).filter( dir );
|
||||
foreach ( const QString& filteredDir, filtered )
|
||||
{
|
||||
if ( !QDir( filteredDir ).exists() )
|
||||
{
|
||||
tDebug( LOGEXTRA ) << "Removing" << filteredDir << "from m_dirmtimes because it does not exist";
|
||||
m_dirmtimes.remove( filteredDir );
|
||||
}
|
||||
}
|
||||
}
|
||||
m_newdirmtimes = m_dirmtimes;
|
||||
}
|
||||
|
||||
tDebug( LOGVERBOSE ) << "m_dirmtimes = " << m_dirmtimes;
|
||||
foreach ( const QString& dir, m_dirs )
|
||||
{
|
||||
m_opcount++;
|
||||
QMetaObject::invokeMethod( this, "scanDir", Qt::QueuedConnection, Q_ARG( QDir, QDir( dir, 0 ) ), Q_ARG( int, 0 ), Q_ARG( DirLister::Mode, ( m_recursive ? DirLister::Recursive : DirLister::NonRecursive ) ) );
|
||||
QMetaObject::invokeMethod( this, "scanDir", Qt::QueuedConnection, Q_ARG( QDir, QDir( dir, 0 ) ), Q_ARG( int, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DirLister::scanDir( QDir dir, int depth, DirLister::Mode mode )
|
||||
DirLister::scanDir( QDir dir, int depth )
|
||||
{
|
||||
if ( isDeleting() )
|
||||
{
|
||||
m_opcount--;
|
||||
if ( m_opcount == 0 )
|
||||
emit finished( m_newdirmtimes );
|
||||
emit finished();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tDebug( LOGVERBOSE ) << "DirLister::scanDir scanning:" << dir.canonicalPath() << "with mode" << mode;
|
||||
tDebug( LOGVERBOSE ) << "DirLister::scanDir scanning:" << dir.canonicalPath();
|
||||
if ( !dir.exists() )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Dir no longer exists, not scanning";
|
||||
|
||||
m_opcount--;
|
||||
if ( m_opcount == 0 )
|
||||
emit finished( m_newdirmtimes );
|
||||
emit finished();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfoList dirs;
|
||||
const uint mtime = QFileInfo( dir.canonicalPath() ).lastModified().toUTC().toTime_t();
|
||||
m_newdirmtimes.insert( dir.canonicalPath(), mtime );
|
||||
|
||||
if ( m_mode == TomahawkSettings::Dirs && m_dirmtimes.contains( dir.canonicalPath() ) && mtime == m_dirmtimes.value( dir.canonicalPath() ) )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Dir unchanged";
|
||||
}
|
||||
else
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Dir changed";
|
||||
if ( m_mode == TomahawkSettings::Dirs
|
||||
&& ( m_dirmtimes.contains( dir.canonicalPath() ) || !m_recursive )
|
||||
&& mtime != m_dirmtimes.value( dir.canonicalPath() ) )
|
||||
{
|
||||
tDebug( LOGINFO ) << "Deleting database file entries from" << dir.canonicalPath();
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( new DatabaseCommand_DeleteFiles( dir, SourceList::instance()->getLocal() ) ) );
|
||||
}
|
||||
dir.setFilter( QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
|
||||
dir.setSorting( QDir::Name );
|
||||
dirs = dir.entryInfoList();
|
||||
|
||||
dir.setFilter( QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
|
||||
dir.setSorting( QDir::Name );
|
||||
dirs = dir.entryInfoList();
|
||||
foreach ( const QFileInfo& di, dirs )
|
||||
emit fileToScan( di );
|
||||
|
||||
foreach ( const QFileInfo& di, dirs )
|
||||
emit fileToScan( di );
|
||||
}
|
||||
dir.setFilter( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
|
||||
dirs = dir.entryInfoList();
|
||||
|
||||
foreach ( const QFileInfo& di, dirs )
|
||||
{
|
||||
const QString canonical = di.canonicalFilePath();
|
||||
const bool haveDi = m_dirmtimes.contains( canonical );
|
||||
if ( !m_newdirmtimes.contains( canonical ) && ( mode == DirLister::Recursive || !haveDi ) ) {
|
||||
m_opcount++;
|
||||
QMetaObject::invokeMethod( this, "scanDir", Qt::QueuedConnection, Q_ARG( QDir, di.canonicalFilePath() ), Q_ARG( int, depth + 1 ), Q_ARG( DirLister::Mode, DirLister::Recursive ) );
|
||||
}
|
||||
m_opcount++;
|
||||
QMetaObject::invokeMethod( this, "scanDir", Qt::QueuedConnection, Q_ARG( QDir, di.canonicalFilePath() ), Q_ARG( int, depth + 1 ) );
|
||||
}
|
||||
|
||||
m_opcount--;
|
||||
if ( m_opcount == 0 )
|
||||
emit finished( m_newdirmtimes );
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
||||
MusicScanner::MusicScanner( const QStringList& dirs, TomahawkSettings::ScannerMode mode, bool recursive, quint32 bs )
|
||||
MusicScanner::MusicScanner( const QStringList& dirs, quint32 bs )
|
||||
: QObject()
|
||||
, m_dirs( dirs )
|
||||
, m_mode( mode )
|
||||
, m_recursive( recursive )
|
||||
, m_batchsize( bs )
|
||||
, m_dirListerThreadController( 0 )
|
||||
{
|
||||
@ -183,34 +135,16 @@ MusicScanner::startScan()
|
||||
m_scanned = m_skipped = 0;
|
||||
m_skippedFiles.clear();
|
||||
|
||||
// trigger the scan once we've loaded old mtimes for dirs below our path
|
||||
// trigger the scan once we've loaded old filemtimes
|
||||
//FIXME: For multiple collection support make sure the right prefix gets passed in...or not...
|
||||
//bear in mind that simply passing in the top-level of a defined collection means it will not return items that need
|
||||
//to be removed that aren't in that root any longer -- might have to do the filtering in setMTimes based on strings
|
||||
DatabaseCommand_DirMtimes *cmd = new DatabaseCommand_DirMtimes();
|
||||
connect( cmd, SIGNAL( done( QMap< QString, unsigned int > ) ),
|
||||
SLOT( setDirMtimes( QMap< QString, unsigned int > ) ) );
|
||||
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes();
|
||||
connect( cmd, SIGNAL( done( QMap< QString, QMap< unsigned int, unsigned int > > ) ),
|
||||
SLOT( setFileMtimes( QMap< QString, QMap< unsigned int, unsigned int > > ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MusicScanner::setDirMtimes( const QMap< QString, unsigned int >& m )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m.count();
|
||||
m_dirmtimes = m;
|
||||
if ( m_mode == TomahawkSettings::Files )
|
||||
{
|
||||
DatabaseCommand_FileMtimes *cmd = new DatabaseCommand_FileMtimes();
|
||||
connect( cmd, SIGNAL( done( QMap< QString, QMap< unsigned int, unsigned int > > ) ),
|
||||
SLOT( setFileMtimes( QMap< QString, QMap< unsigned int, unsigned int > > ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
scan();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -226,24 +160,22 @@ MusicScanner::setFileMtimes( const QMap< QString, QMap< unsigned int, unsigned i
|
||||
void
|
||||
MusicScanner::scan()
|
||||
{
|
||||
tDebug( LOGEXTRA ) << "Scanning, num saved dir mtimes from last scan:" << m_dirmtimes.size();
|
||||
if ( m_mode == TomahawkSettings::Files )
|
||||
tDebug( LOGEXTRA ) << "Num saved file mtimes from last scan:" << m_filemtimes.size();
|
||||
tDebug( LOGEXTRA ) << "Num saved file mtimes from last scan:" << m_filemtimes.size();
|
||||
|
||||
connect( this, SIGNAL( batchReady( QVariantList, QVariantList ) ),
|
||||
SLOT( commitBatch( QVariantList, QVariantList ) ), Qt::DirectConnection );
|
||||
|
||||
m_dirListerThreadController = new QThread( this );
|
||||
|
||||
m_dirLister = QWeakPointer< DirLister >( new DirLister( m_dirs, m_dirmtimes, m_mode, m_recursive ) );
|
||||
m_dirLister = QWeakPointer< DirLister >( new DirLister( m_dirs ) );
|
||||
m_dirLister.data()->moveToThread( m_dirListerThreadController );
|
||||
|
||||
connect( m_dirLister.data(), SIGNAL( fileToScan( QFileInfo ) ),
|
||||
SLOT( scanFile( QFileInfo ) ), Qt::QueuedConnection );
|
||||
|
||||
// queued, so will only fire after all dirs have been scanned:
|
||||
connect( m_dirLister.data(), SIGNAL( finished( QMap< QString, unsigned int > ) ),
|
||||
SLOT( listerFinished( QMap< QString, unsigned int > ) ), Qt::QueuedConnection );
|
||||
connect( m_dirLister.data(), SIGNAL( finished() ),
|
||||
SLOT( listerFinished() ), Qt::QueuedConnection );
|
||||
|
||||
m_dirListerThreadController->start();
|
||||
QMetaObject::invokeMethod( m_dirLister.data(), "go" );
|
||||
@ -251,7 +183,7 @@ MusicScanner::scan()
|
||||
|
||||
|
||||
void
|
||||
MusicScanner::listerFinished( const QMap<QString, unsigned int>& newmtimes )
|
||||
MusicScanner::listerFinished()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
|
||||
@ -263,16 +195,6 @@ MusicScanner::listerFinished( const QMap<QString, unsigned int>& newmtimes )
|
||||
m_scannedfiles.clear();
|
||||
m_filesToDelete.clear();
|
||||
|
||||
// remove obsolete / stale files
|
||||
foreach ( const QString& path, m_dirmtimes.keys() )
|
||||
{
|
||||
if ( !newmtimes.keys().contains( path ) )
|
||||
{
|
||||
tDebug( LOGINFO ) << "Removing stale dir:" << path;
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( new DatabaseCommand_DeleteFiles( path, SourceList::instance()->getLocal() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
tDebug( LOGINFO ) << "Scanning complete, saving to database. "
|
||||
"( scanned" << m_scanned << "skipped" << m_skipped << ")";
|
||||
|
||||
@ -280,13 +202,6 @@ MusicScanner::listerFinished( const QMap<QString, unsigned int>& newmtimes )
|
||||
foreach ( const QString& s, m_skippedFiles )
|
||||
tDebug( LOGEXTRA ) << s;
|
||||
|
||||
// save mtimes, then quit thread
|
||||
{
|
||||
DatabaseCommand_DirMtimes* cmd = new DatabaseCommand_DirMtimes( newmtimes );
|
||||
connect( cmd, SIGNAL( finished() ), SIGNAL( finished() ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
}
|
||||
|
||||
if ( !m_dirLister.isNull() )
|
||||
{
|
||||
m_dirListerThreadController->quit();;
|
||||
@ -325,7 +240,7 @@ void
|
||||
MusicScanner::scanFile( const QFileInfo& fi )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << " scanning file: " << fi.canonicalFilePath();
|
||||
if ( m_mode == TomahawkSettings::Files && m_filemtimes.contains( "file://" + fi.canonicalFilePath() ) )
|
||||
if ( m_filemtimes.contains( "file://" + fi.canonicalFilePath() ) )
|
||||
{
|
||||
if ( fi.lastModified().toUTC().toTime_t() == m_filemtimes.value( "file://" + fi.canonicalFilePath() ).values().first() )
|
||||
{
|
||||
|
@ -44,14 +44,8 @@ Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
enum Mode {
|
||||
NonRecursive,
|
||||
Recursive,
|
||||
MTimeOnly
|
||||
};
|
||||
|
||||
DirLister( const QStringList& dirs, const QMap<QString, unsigned int>& dirmtimes, TomahawkSettings::ScannerMode mode, bool recursive )
|
||||
: QObject(), m_dirs( dirs ), m_dirmtimes( dirmtimes ), m_mode( mode ), m_recursive( recursive ), m_opcount( 0 ), m_deleting( false )
|
||||
DirLister( const QStringList& dirs )
|
||||
: QObject(), m_dirs( dirs ), m_opcount( 0 ), m_deleting( false )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
@ -66,19 +60,14 @@ public:
|
||||
|
||||
signals:
|
||||
void fileToScan( QFileInfo );
|
||||
void finished( const QMap<QString, unsigned int>& );
|
||||
void finished();
|
||||
|
||||
private slots:
|
||||
void go();
|
||||
void scanDir( QDir dir, int depth, DirLister::Mode mode );
|
||||
void scanDir( QDir dir, int depth );
|
||||
|
||||
private:
|
||||
QStringList m_dirs;
|
||||
QMap<QString, unsigned int> m_dirmtimes;
|
||||
TomahawkSettings::ScannerMode m_mode;
|
||||
bool m_recursive;
|
||||
|
||||
QMap<QString, unsigned int> m_newdirmtimes;
|
||||
|
||||
uint m_opcount;
|
||||
QMutex m_deletingMutex;
|
||||
@ -91,7 +80,7 @@ class MusicScanner : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MusicScanner( const QStringList& dirs, TomahawkSettings::ScannerMode mode, bool recursive = true, quint32 bs = 0 );
|
||||
MusicScanner( const QStringList& dirs, quint32 bs = 0 );
|
||||
~MusicScanner();
|
||||
|
||||
signals:
|
||||
@ -103,30 +92,25 @@ private:
|
||||
QVariant readFile( const QFileInfo& fi );
|
||||
|
||||
private slots:
|
||||
void listerFinished( const QMap<QString, unsigned int>& newmtimes );
|
||||
void listerFinished();
|
||||
void scanFile( const QFileInfo& fi );
|
||||
void setFileMtimes( const QMap< QString, QMap< unsigned int, unsigned int > >& m );
|
||||
void startScan();
|
||||
void scan();
|
||||
void setDirMtimes( const QMap< QString, unsigned int >& m );
|
||||
void setFileMtimes( const QMap< QString, QMap< unsigned int, unsigned int > >& m );
|
||||
void commitBatch( const QVariantList& tracks, const QVariantList& deletethese );
|
||||
|
||||
private:
|
||||
QStringList m_dirs;
|
||||
TomahawkSettings::ScannerMode m_mode;
|
||||
QMap<QString, QString> m_ext2mime; // eg: mp3 -> audio/mpeg
|
||||
unsigned int m_scanned;
|
||||
unsigned int m_skipped;
|
||||
|
||||
QList<QString> m_skippedFiles;
|
||||
|
||||
QMap<QString, unsigned int> m_dirmtimes;
|
||||
QMap<QString, QMap< unsigned int, unsigned int > > m_filemtimes;
|
||||
QMap<QString, unsigned int> m_newdirmtimes;
|
||||
|
||||
QVariantList m_scannedfiles;
|
||||
QVariantList m_filesToDelete;
|
||||
bool m_recursive;
|
||||
quint32 m_batchsize;
|
||||
|
||||
QWeakPointer< DirLister > m_dirLister;
|
||||
|
@ -138,23 +138,10 @@ ScanManager::runScan( bool manualFull )
|
||||
|
||||
if ( !manualFull )
|
||||
{
|
||||
runDirScan( TomahawkSettings::instance()->scannerPaths(), false );
|
||||
runDirScan( TomahawkSettings::instance()->scannerPaths() );
|
||||
return;
|
||||
}
|
||||
|
||||
DatabaseCommand_DirMtimes *cmd = new DatabaseCommand_DirMtimes( QMap<QString, unsigned int>() );
|
||||
connect( cmd, SIGNAL( done( QMap< QString, unsigned int > ) ),
|
||||
SLOT( mtimesDeleted( QMap< QString, unsigned int > ) ) );
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScanManager::mtimesDeleted( QMap< QString, unsigned int > returnedMap )
|
||||
{
|
||||
Q_UNUSED( returnedMap );
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
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& ) ) );
|
||||
@ -169,12 +156,12 @@ ScanManager::filesDeleted( const QStringList& files, const Tomahawk::collection_
|
||||
Q_UNUSED( files );
|
||||
Q_UNUSED( collection );
|
||||
if ( !TomahawkSettings::instance()->scannerPaths().isEmpty() )
|
||||
runDirScan( TomahawkSettings::instance()->scannerPaths(), true );
|
||||
runDirScan( TomahawkSettings::instance()->scannerPaths() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ScanManager::runDirScan( const QStringList& paths, bool manualFull )
|
||||
ScanManager::runDirScan( const QStringList& paths )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
@ -184,7 +171,6 @@ ScanManager::runDirScan( const QStringList& paths, bool manualFull )
|
||||
if ( paths.isEmpty() )
|
||||
{
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( new DatabaseCommand_DeleteFiles( SourceList::instance()->getLocal() ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( new DatabaseCommand_DirMtimes( QMap<QString, unsigned int>() ) ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -192,7 +178,7 @@ ScanManager::runDirScan( const QStringList& paths, bool manualFull )
|
||||
{
|
||||
m_scanTimer->stop();
|
||||
m_musicScannerThreadController = new QThread( this );
|
||||
m_scanner = QWeakPointer< MusicScanner>( new MusicScanner( paths, manualFull ? TomahawkSettings::Dirs : TomahawkSettings::instance()->scannerMode() ) );
|
||||
m_scanner = QWeakPointer< MusicScanner>( new MusicScanner( paths ) );
|
||||
m_scanner.data()->moveToThread( m_musicScannerThreadController );
|
||||
connect( m_scanner.data(), SIGNAL( finished() ), SLOT( scannerFinished() ) );
|
||||
m_musicScannerThreadController->start( QThread::IdlePriority );
|
||||
|
@ -48,7 +48,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void runScan( bool manualFull = false );
|
||||
void runDirScan( const QStringList& paths, bool manualFull );
|
||||
void runDirScan( const QStringList& paths );
|
||||
|
||||
private slots:
|
||||
void scannerFinished();
|
||||
@ -58,7 +58,6 @@ private slots:
|
||||
|
||||
void onSettingsChanged();
|
||||
|
||||
void mtimesDeleted( QMap< QString, unsigned int > returnedMap );
|
||||
void filesDeleted( const QStringList& files, const Tomahawk::collection_ptr& collection );
|
||||
|
||||
private:
|
||||
|
@ -139,35 +139,16 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
ui->enableEchonestCatalog->setChecked( s->enableEchonestCatalogs() );
|
||||
|
||||
connect( ui->checkBoxWatchForChanges, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) );
|
||||
connect( ui->scannerDirModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) );
|
||||
connect( ui->scannerFileModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) );
|
||||
|
||||
if ( s->scannerMode() == TomahawkSettings::Files )
|
||||
{
|
||||
ui->scannerFileModeButton->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->scannerDirModeButton->setChecked( true );
|
||||
}
|
||||
|
||||
if ( ui->checkBoxWatchForChanges->isChecked() )
|
||||
{
|
||||
ui->scanTimeLabel->show();
|
||||
ui->scannerTimeSpinBox->show();
|
||||
ui->scannerDirModeButton->show();
|
||||
ui->scannerFileModeButton->show();
|
||||
ui->scanInformationLabelFiles->show();
|
||||
ui->scanInformationLabelDirs->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->scanTimeLabel->hide();
|
||||
ui->scannerTimeSpinBox->hide();
|
||||
ui->scannerDirModeButton->hide();
|
||||
ui->scannerFileModeButton->hide();
|
||||
ui->scanInformationLabelFiles->hide();
|
||||
ui->scanInformationLabelDirs->hide();
|
||||
}
|
||||
|
||||
foreach ( const QString& dir, TomahawkSettings::instance()->scannerPaths() )
|
||||
@ -241,10 +222,9 @@ SettingsDialog::~SettingsDialog()
|
||||
s->setScannerPaths( ui->dirTree->getCheckedPaths() );
|
||||
s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );
|
||||
s->setScannerTime( ui->scannerTimeSpinBox->value() );
|
||||
s->setScannerMode( ui->scannerFileModeButton->isChecked() ? TomahawkSettings::Files : TomahawkSettings::Dirs );
|
||||
s->setEnableEchonestCatalogs( ui->enableEchonestCatalog->isChecked() );
|
||||
|
||||
s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
|
||||
s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
|
||||
|
||||
s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
|
||||
s->setLastFmUsername( ui->lineEditLastfmUsername->text() );
|
||||
@ -410,23 +390,11 @@ SettingsDialog::updateScanOptionsView()
|
||||
{
|
||||
ui->scanTimeLabel->show();
|
||||
ui->scannerTimeSpinBox->show();
|
||||
ui->scannerDirModeButton->show();
|
||||
ui->scannerFileModeButton->show();
|
||||
ui->scanInformationLabelFiles->show();
|
||||
ui->scanInformationLabelDirs->show();
|
||||
if ( sender() == ui->scannerFileModeButton || ( sender() == ui->checkBoxWatchForChanges && TomahawkSettings::instance()->scannerMode() == TomahawkSettings::Files ) )
|
||||
ui->scannerFileModeButton->setChecked( true );
|
||||
else
|
||||
ui->scannerDirModeButton->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->scanTimeLabel->hide();
|
||||
ui->scannerTimeSpinBox->hide();
|
||||
ui->scannerDirModeButton->hide();
|
||||
ui->scannerFileModeButton->hide();
|
||||
ui->scanInformationLabelFiles->hide();
|
||||
ui->scanInformationLabelDirs->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,57 +258,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="scannerFileModeButton">
|
||||
<property name="text">
|
||||
<string>Files Mode (Recommended)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="scannerDirModeButton">
|
||||
<property name="text">
|
||||
<string>Directory Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="scanInformationLabelFiles">
|
||||
<property name="text">
|
||||
<string>⚫ More accurate
|
||||
⚫ Uses more computer resources</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="scanInformationLabelDirs">
|
||||
<property name="text">
|
||||
<string>⚫ Less accurate
|
||||
⚫ Uses less computer resources
|
||||
⚫ Can be better for network files</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -404,11 +404,10 @@ TomahawkApp::registerMetaTypes()
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::InfoRequestData >( "Tomahawk::InfoSystem::InfoRequestData" );
|
||||
qRegisterMetaType< QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > >( "QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache >" );
|
||||
|
||||
qRegisterMetaType< DirLister::Mode >("DirLister::Mode");
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::ArtistTrackPair >("Tomahawk::InfoSystem::ArtistTrackPair");
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::ArtistAlbumPair >("Tomahawk::InfoSystem::ArtistAlbumPair");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::ArtistTrackPair> >("QList<Tomahawk::InfoSystem::ArtistTrackPair>");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::ArtistAlbumPair> >("QList<Tomahawk::InfoSystem::ArtistAlbumPair>");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::ArtistAlbumPair> >("QList<Tomahawk::InfoSystem::ArtistAlbumPair>");
|
||||
qRegisterMetaType< Tomahawk::InfoSystem::Chart>("Tomahawk::InfoSystem::Chart");
|
||||
qRegisterMetaType< QList<Tomahawk::InfoSystem::Chart> >("QList<Tomahawk::InfoSystem::Chart>");
|
||||
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user