Commit 4a1f15db authored by dt's avatar dt
Browse files

Qt4ProjectManager: Compress the folderChanged via a small timer

Reviewed-By: hunger
parent 3cd9c596
......@@ -1132,6 +1132,10 @@ namespace {
CentralizedFolderWatcher::CentralizedFolderWatcher()
{
m_compressTimer.setSingleShot(true);
m_compressTimer.setInterval(200);
connect(&m_compressTimer, SIGNAL(timeout()),
this, SLOT(onTimer()));
connect (&m_watcher, SIGNAL(directoryChanged(QString)),
this, SLOT(folderChanged(QString)));
}
......@@ -1225,8 +1229,20 @@ void CentralizedFolderWatcher::unwatchFolders(const QList<QString> &folders, Qt4
}
}
void CentralizedFolderWatcher::folderChanged(const QString &folder)
{
m_changedFolders.insert(folder);
m_compressTimer.start();
}
void CentralizedFolderWatcher::onTimer()
{
foreach(const QString &folder, m_changedFolders)
delayedFolderChanged(folder);
m_changedFolders.clear();
}
void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
{
if (debugCFW)
qDebug()<<"CFW::folderChanged"<<folder;
......
......@@ -122,6 +122,8 @@ public:
private slots:
void folderChanged(const QString &folder);
void onTimer();
void delayedFolderChanged(const QString &folder);
private:
QSet<QString> recursiveDirs(const QString &folder);
......@@ -129,6 +131,8 @@ private:
QMultiMap<QString, Qt4PriFileNode *> m_map;
QSet<QString> m_recursiveWatchedFolders;
QTimer m_compressTimer;
QSet<QString> m_changedFolders;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment