QmlProjectContentItem(parent),
m_recurse(RecurseDefault)
{
+ m_updateFileListTimer.setSingleShot(true);
+ m_updateFileListTimer.setInterval(50);
connect(&m_dirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateFileList()));
+ connect(&m_updateFileListTimer, SIGNAL(timeout()), this, SLOT(updateFileListNow()));
}
QString FileFilterBaseItem::directory() const
return;
m_defaultDir = dirPath;
- updateFileList();
+ updateFileListNow();
}
QString FileFilterBaseItem::filter() const
void FileFilterBaseItem::updateFileList()
{
+ if (!m_updateFileListTimer.isActive())
+ m_updateFileListTimer.start();
+}
+
+void FileFilterBaseItem::updateFileListNow()
+{
+ if (m_updateFileListTimer.isActive())
+ m_updateFileListTimer.stop();
+
const QString projectDir = absoluteDir();
if (projectDir.isEmpty())
return;
#include <QSet>
#include <qdeclarative.h>
#include <QFileSystemWatcher>
+#include <QTimer>
#include "qmlprojectitem.h"
#include "filesystemwatcher.h"
private slots:
void updateFileList();
+ void updateFileListNow();
private:
QString absolutePath(const QString &path) const;
QSet<QString> m_files;
FileSystemWatcher m_dirWatcher;
+ QTimer m_updateFileListTimer;
friend class ProjectItem;