re-enabled search while typing, now that it is fast enough

This commit is contained in:
csoler 2018-04-22 17:57:14 +02:00
parent 849ed79cf2
commit 236b0ce2b4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 10 additions and 10 deletions

View File

@ -943,7 +943,7 @@ void SharedFilesDialog::restoreExpandedPathsAndSelection(const std::set<std::str
void SharedFilesDialog::expandAll() void SharedFilesDialog::expandAll()
{ {
if(ui.dirTreeView->model() == NULL) if(ui.dirTreeView->model() == NULL || ui.dirTreeView->model() == flat_proxyModel) // this method causes infinite loops on flat models
return ; return ;
ui.dirTreeView->blockSignals(true) ; ui.dirTreeView->blockSignals(true) ;
@ -956,7 +956,6 @@ void SharedFilesDialog::expandAll()
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString(); std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
recursExpandAll(ui.dirTreeView->model()->index(row,0)); recursExpandAll(ui.dirTreeView->model()->index(row,0));
} }
//QItemSelection selection ;
ui.dirTreeView->blockSignals(false) ; ui.dirTreeView->blockSignals(false) ;
@ -972,14 +971,6 @@ void SharedFilesDialog::recursExpandAll(const QModelIndex& index)
if(ui.dirTreeView->model()->rowCount(idx) > 0) if(ui.dirTreeView->model()->rowCount(idx) > 0)
recursExpandAll(idx) ; recursExpandAll(idx) ;
// QModelIndex midx = proxyModel->mapToSource(idx) ;
//
// if (!midx.isValid())
// continue ;
//
// if (model->getType(midx) != DIR_TYPE_FILE)
// recursExpandAll(idx) ;
} }
} }
@ -1332,6 +1323,7 @@ void SharedFilesDialog::onFilterTextEdited()
ui.filterStartButton->setEnabled(true) ; ui.filterStartButton->setEnabled(true) ;
ui.filterPatternFrame->setToolTip(QString()); ui.filterPatternFrame->setToolTip(QString());
FilterItems();
#ifndef DISABLE_SEARCH_WHILE_TYPING #ifndef DISABLE_SEARCH_WHILE_TYPING
mFilterTimer->start( 500 ); // This will fire filterRegExpChanged after 500 ms. mFilterTimer->start( 500 ); // This will fire filterRegExpChanged after 500 ms.
// If the user types something before it fires, the timer restarts counting // If the user types something before it fires, the timer restarts counting
@ -1519,11 +1511,15 @@ void SharedFilesDialog::FilterItems()
if(mLastFilterText == text) // do not filter again if we already did. This is an optimization if(mLastFilterText == text) // do not filter again if we already did. This is an optimization
{ {
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "Last text is equal to text. skipping" << std::endl; std::cerr << "Last text is equal to text. skipping" << std::endl;
#endif
return ; return ;
} }
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << "New last text. Performing the filter on string \"" << text.toStdString() << "\"" << std::endl; std::cerr << "New last text. Performing the filter on string \"" << text.toStdString() << "\"" << std::endl;
#endif
mLastFilterText = text ; mLastFilterText = text ;
QCursorContextBlocker q(ui.dirTreeView) ; QCursorContextBlocker q(ui.dirTreeView) ;
@ -1563,7 +1559,9 @@ void SharedFilesDialog::FilterItems()
else else
ui.filterPatternFrame->setToolTip(tr("Found %1 results.").arg(found)) ; ui.filterPatternFrame->setToolTip(tr("Found %1 results.").arg(found)) ;
#ifdef DEBUG_SHARED_FILES_DIALOG
std::cerr << found << " results found by search." << std::endl; std::cerr << found << " results found by search." << std::endl;
#endif
} }
#ifdef DEPRECATED_CODE #ifdef DEPRECATED_CODE

View File

@ -1524,7 +1524,9 @@ void RetroshareDirModel::filterItems(const std::list<std::string>& keywords,uint
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
} }
#ifdef RDM_SEARCH_DEBUG
std::cerr << mFilteredPointers.size() << " pointers in filter set." << std::endl; std::cerr << mFilteredPointers.size() << " pointers in filter set." << std::endl;
#endif
} }