forked from qt-creator/qt-creator
Refactor search result window for use of many items and checked state.
This commit is contained in:
@@ -493,7 +493,10 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
|
||||
|
||||
void CppFindReferences::findAll(Symbol *symbol)
|
||||
{
|
||||
_resultWindow->clearContents();
|
||||
Find::SearchResult *search = _resultWindow->startNewSearch();
|
||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
|
||||
_resultWindow->setShowReplaceUI(true);
|
||||
_resultWindow->popup(true);
|
||||
|
||||
@@ -515,14 +518,11 @@ void CppFindReferences::findAll(Symbol *symbol)
|
||||
void CppFindReferences::displayResult(int index)
|
||||
{
|
||||
Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index);
|
||||
Find::ResultWindowItem *item = _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)));
|
||||
_resultWindow->addResult(result.fileName,
|
||||
result.lineNumber,
|
||||
result.matchingLine,
|
||||
result.matchStart,
|
||||
result.matchLength);
|
||||
}
|
||||
|
||||
void CppFindReferences::searchFinished()
|
||||
@@ -530,8 +530,8 @@ void CppFindReferences::searchFinished()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CppFindReferences::openEditor(const QString &fileName, int line, int column)
|
||||
void CppFindReferences::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column);
|
||||
TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
namespace Find {
|
||||
class SearchResultWindow;
|
||||
struct SearchResultItem;
|
||||
} // end of namespace Find
|
||||
|
||||
namespace CppTools {
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
private Q_SLOTS:
|
||||
void displayResult(int);
|
||||
void searchFinished();
|
||||
void openEditor(const QString&, int, int);
|
||||
void openEditor(const Find::SearchResultItem &item);
|
||||
|
||||
private:
|
||||
QPointer<CppModelManager> _modelManager;
|
||||
|
||||
@@ -86,7 +86,10 @@ FindClassDeclarations::FindClassDeclarations(CppModelManager *modelManager)
|
||||
|
||||
void FindClassDeclarations::findAll(const QString &text, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
_resultWindow->clearContents();
|
||||
Find::SearchResult *search = _resultWindow->startNewSearch();
|
||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
|
||||
_resultWindow->popup(true);
|
||||
|
||||
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
|
||||
@@ -107,14 +110,11 @@ void FindClassDeclarations::findAll(const QString &text, QTextDocument::FindFlag
|
||||
void FindClassDeclarations::displayResult(int index)
|
||||
{
|
||||
Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index);
|
||||
Find::ResultWindowItem *item = _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)));
|
||||
_resultWindow->addResult(result.fileName,
|
||||
result.lineNumber,
|
||||
result.matchingLine,
|
||||
result.matchStart,
|
||||
result.matchLength);
|
||||
}
|
||||
|
||||
void FindClassDeclarations::searchFinished()
|
||||
@@ -122,9 +122,9 @@ void FindClassDeclarations::searchFinished()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void FindClassDeclarations::openEditor(const QString &fileName, int line, int column)
|
||||
void FindClassDeclarations::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column);
|
||||
TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart);
|
||||
}
|
||||
|
||||
//////
|
||||
@@ -139,7 +139,10 @@ FindFunctionCalls::FindFunctionCalls(CppModelManager *modelManager)
|
||||
|
||||
void FindFunctionCalls::findAll(const QString &text, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
_resultWindow->clearContents();
|
||||
Find::SearchResult *search = _resultWindow->startNewSearch();
|
||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
|
||||
_resultWindow->popup(true);
|
||||
|
||||
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
|
||||
@@ -160,14 +163,11 @@ void FindFunctionCalls::findAll(const QString &text, QTextDocument::FindFlags fi
|
||||
void FindFunctionCalls::displayResult(int index)
|
||||
{
|
||||
Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index);
|
||||
Find::ResultWindowItem *item = _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)));
|
||||
_resultWindow->addResult(result.fileName,
|
||||
result.lineNumber,
|
||||
result.matchingLine,
|
||||
result.matchStart,
|
||||
result.matchLength);
|
||||
}
|
||||
|
||||
void FindFunctionCalls::searchFinished()
|
||||
@@ -175,9 +175,9 @@ void FindFunctionCalls::searchFinished()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void FindFunctionCalls::openEditor(const QString &fileName, int line, int column)
|
||||
void FindFunctionCalls::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column);
|
||||
TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class Snapshot;
|
||||
|
||||
namespace Find {
|
||||
class SearchResultWindow;
|
||||
struct SearchResultItem;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
@@ -79,7 +80,7 @@ public:
|
||||
protected Q_SLOTS:
|
||||
void displayResult(int);
|
||||
void searchFinished();
|
||||
void openEditor(const QString&, int, int);
|
||||
void openEditor(const Find::SearchResultItem &item);
|
||||
|
||||
private:
|
||||
QPointer<CppModelManager> _modelManager;
|
||||
@@ -104,7 +105,7 @@ public:
|
||||
protected Q_SLOTS:
|
||||
void displayResult(int);
|
||||
void searchFinished();
|
||||
void openEditor(const QString&, int, int);
|
||||
void openEditor(const Find::SearchResultItem &item);
|
||||
|
||||
private:
|
||||
QPointer<CppModelManager> _modelManager;
|
||||
|
||||
Reference in New Issue
Block a user