do not examine directories for being empty when adding them - speeds up LMMS-startup a lot

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@889 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-04-05 14:24:06 +00:00
parent 0bb4bf5221
commit 7f72593f06
3 changed files with 10 additions and 52 deletions

View File

@@ -1,3 +1,10 @@
2008-04-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/file_browser.h:
* src/gui/file_browser.cpp:
do not examine directories for being empty when adding them - speeds
up LMMS-startup a lot!
2008-04-04 Paul Giblock <drfaygo/at/gmail/dot/com>
* include/knob.h:

View File

@@ -53,9 +53,6 @@ public:
QWidget * _parent );
virtual ~fileBrowser();
static bool isDirWithContent( const QString & _path,
const QString & _filter );
public slots:
void reloadTree( void );

View File

@@ -100,9 +100,7 @@ void fileBrowser::addItems( const QString & _path )
it != files.constEnd(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.' &&
isDirWithContent( _path + QDir::separator() + cur_file,
m_filter ) )
if( cur_file[0] != '.' )
{
bool orphan = TRUE;
for( int i = 0; i < m_l->topLevelItemCount(); ++i )
@@ -137,14 +135,7 @@ void fileBrowser::addItems( const QString & _path )
it != files.constEnd(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.'
#warning TODO: add match here
#ifdef QT4
// TBD
#else
// && QDir::match( m_filter, cur_file.lower() )
#endif
)
if( cur_file[0] != '.' )
{
// TODO: don't insert instead of removing, order changed
// remove existing file-items
@@ -162,41 +153,6 @@ void fileBrowser::addItems( const QString & _path )
bool fileBrowser::isDirWithContent( const QString & _path,
const QString & _filter )
{
QDir cdir( _path );
QStringList files = cdir.entryList( QDir::Files, QDir::Unsorted );
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.'
#warning TODO: add match here
&& QDir::match( _filter, cur_file.toLower() )
)
{
return( TRUE );
}
}
files = cdir.entryList( QDir::Dirs, QDir::Unsorted );
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.' &&
isDirWithContent( _path + QDir::separator() + cur_file,
_filter ) )
{
return( TRUE );
}
}
return( FALSE );
}
void fileBrowser::keyPressEvent( QKeyEvent * _ke )
{
if( _ke->key() == Qt::Key_F5 )
@@ -708,9 +664,7 @@ bool directory::addItems( const QString & _path )
it != files.constEnd(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.' && fileBrowser::isDirWithContent(
thisDir.absolutePath() + QDir::separator() +
cur_file, m_filter ) )
if( cur_file[0] != '.' )
{
bool orphan = TRUE;
for( int i = 0; i < childCount(); ++i )