Mobile/filtering: update filter in separate thread

We can't use that while the model is shown, which is why this isn't hooked up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-10-20 11:59:35 -04:00
parent 2183e41bb0
commit 466a0bf758
2 changed files with 14 additions and 0 deletions

View file

@ -15,6 +15,8 @@
#include <QDateTime>
#include <QClipboard>
#include <QFile>
#include <QtConcurrent>
#include <QFuture>
#include <QBluetoothLocalDevice>
@ -1844,6 +1846,17 @@ void QMLManager::showDownloadPage(QString deviceString)
emit pluggedInDeviceNameChanged();
}
void QMLManager::setFilter(const QString filterText)
{
// show that we are doing something, then do something in another thread in order not to block the UI
QMetaObject::invokeMethod(qmlWindow, "showBusy");
QtConcurrent::run(QThreadPool::globalInstance(),
[=]{
dlSortModel->setFilter(filterText);
QMetaObject::invokeMethod(qmlWindow, "hideBusy");
});
}
#if defined(Q_OS_ANDROID)
// implemented in core/android.cpp
void checkPendingIntents();

View file

@ -88,6 +88,7 @@ public:
Q_INVOKABLE int getDetectedProductIndex(const QString &currentVendorText);
Q_INVOKABLE int getConnectionIndex(const QString &deviceSubstr);
Q_INVOKABLE void setGitLocalOnly(const bool &value);
Q_INVOKABLE void setFilter(const QString filterText);
static QMLManager *instance();
Q_INVOKABLE void registerError(QString error);