Reduce overhead of Cache.h

This commit is contained in:
Nicolas Werner 2019-12-15 02:56:04 +01:00
parent 7d6a015f36
commit 5fc1f3bd67
28 changed files with 1404 additions and 644 deletions

View file

@ -529,12 +529,12 @@ TextInputWidget::TextInputWidget(QWidget *parent)
emit heightChanged(widgetHeight);
});
connect(input_, &FilteredTextEdit::showSuggestions, this, [this](const QString &q) {
if (q.isEmpty() || !cache::client())
if (q.isEmpty())
return;
QtConcurrent::run([this, q = q.toLower().toStdString()]() {
try {
emit input_->resultsRetrieved(cache::client()->searchUsers(
emit input_->resultsRetrieved(cache::searchUsers(
ChatPage::instance()->currentRoom().toStdString(), q));
} catch (const lmdb::error &e) {
std::cout << e.what() << '\n';