Commit 99e8066a authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Delay project filtering

It is too slow and unusable otherwise
parent f7b82b3e
Pipeline #245293 canceled with stage
in 4 minutes and 23 seconds
......@@ -58,12 +58,18 @@ KateProjectView::KateProjectView(KateProjectPluginView *pluginView, KateProject
});
chckbr->setText(i18n("Checkout Git Branch"));
m_filterStartTimer.setSingleShot(true);
m_filterStartTimer.setInterval(400);
m_filterStartTimer.callOnTimeout(this, &KateProjectView::filterTextChanged);
/**
* setup filter line edit
*/
m_filter->setPlaceholderText(i18n("Filter..."));
m_filter->setClearButtonEnabled(true);
connect(m_filter, &KLineEdit::textChanged, this, &KateProjectView::filterTextChanged);
connect(m_filter, &KLineEdit::textChanged, this, [this] {
m_filterStartTimer.start();
});
/**
* Setup git checkout stuff
......@@ -98,8 +104,9 @@ void KateProjectView::openSelectedDocument()
m_treeView->openSelectedDocument();
}
void KateProjectView::filterTextChanged(const QString &filterText)
void KateProjectView::filterTextChanged()
{
const auto filterText = m_filter->text();
/**
* filter
*/
......
......@@ -12,6 +12,7 @@
#include "kateprojectviewtree.h"
#include <QFileSystemWatcher>
#include <QTimer>
class KLineEdit;
class KateProjectPluginView;
......@@ -66,7 +67,7 @@ private Q_SLOTS:
* React on filter change
* @param filterText new filter text
*/
void filterTextChanged(const QString &filterText);
void filterTextChanged();
/**
* On project model change, check if project
......@@ -105,6 +106,11 @@ private:
* watches for changes to .git/HEAD
*/
QFileSystemWatcher m_branchChangedWatcher;
/**
* filter timer
*/
QTimer m_filterStartTimer;
};
#endif
Supports Markdown
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