forked from qt-creator/qt-creator
Refactor search result window for use of many items and checked state.
This commit is contained in:
@@ -91,7 +91,8 @@ void BaseFileFind::findAll(const QString &txt, QTextDocument::FindFlags findFlag
|
||||
if (m_filterCombo)
|
||||
updateComboEntries(m_filterCombo, false);
|
||||
m_watcher.setFuture(QFuture<FileSearchResult>());
|
||||
m_resultWindow->clearContents();
|
||||
SearchResult *result = m_resultWindow->startNewSearch();
|
||||
connect(result, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
m_resultWindow->popup(true);
|
||||
if (m_useRegExp)
|
||||
m_watcher.setFuture(Core::Utils::findInFilesRegExp(txt, files(), findFlags, ITextEditor::openedTextEditorsContents()));
|
||||
@@ -109,14 +110,11 @@ void BaseFileFind::findAll(const QString &txt, QTextDocument::FindFlags findFlag
|
||||
|
||||
void BaseFileFind::displayResult(int index) {
|
||||
Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index);
|
||||
ResultWindowItem *item = m_resultWindow->addResult(result.fileName,
|
||||
m_resultWindow->addResult(result.fileName,
|
||||
result.lineNumber,
|
||||
result.matchingLine,
|
||||
result.matchStart,
|
||||
result.matchLength);
|
||||
if (item)
|
||||
connect(item, SIGNAL(activated(const QString&,int,int)), this, SLOT(openEditor(const QString&,int,int)));
|
||||
|
||||
if (m_resultLabel)
|
||||
m_resultLabel->setText(tr("%1 found").arg(m_resultWindow->numberOfResults()));
|
||||
}
|
||||
@@ -236,7 +234,7 @@ void BaseFileFind::syncRegExpSetting(bool useRegExp)
|
||||
m_useRegExp = useRegExp;
|
||||
}
|
||||
|
||||
void BaseFileFind::openEditor(const QString &fileName, int line, int column)
|
||||
void BaseFileFind::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column);
|
||||
TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user