forked from qt-creator/qt-creator
Show more info about a search and move UI for replacing
Change-Id: I6e024583c0d778a65007eb4590118c4329b2118a Reviewed-on: http://codereview.qt-project.org/4554 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -228,7 +228,8 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context)
|
||||
{
|
||||
m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch(Find::SearchResultWindow::SearchOnly);
|
||||
|
||||
Overview overview;
|
||||
m_currentSearch->setInfo(tr("C++ Usages:"), QString(), overview(context.fullyQualifiedName(symbol)));
|
||||
connect(m_currentSearch, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
|
||||
@@ -244,6 +245,8 @@ void CppFindReferences::renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus:
|
||||
|
||||
m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch(
|
||||
Find::SearchResultWindow::SearchAndReplace, QLatin1String("CppEditor"));
|
||||
Overview overview;
|
||||
m_currentSearch->setInfo(tr("C++ Usages:"), QString(), overview(context.fullyQualifiedName(symbol)));
|
||||
m_currentSearch->setTextToReplace(textToReplace);
|
||||
|
||||
connect(m_currentSearch, SIGNAL(activated(Find::SearchResultItem)),
|
||||
@@ -415,6 +418,7 @@ static void findMacroUses_helper(QFutureInterface<Usage> &future,
|
||||
void CppFindReferences::findMacroUses(const Macro ¯o)
|
||||
{
|
||||
m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch(Find::SearchResultWindow::SearchOnly);
|
||||
m_currentSearch->setInfo(tr("C++ Macro Usages:"), QString(), QString::fromLocal8Bit(macro.name()));
|
||||
|
||||
Find::SearchResultWindow::instance()->popup(true);
|
||||
|
||||
|
||||
@@ -33,15 +33,16 @@
|
||||
#ifndef CPPFINDREFERENCES_H
|
||||
#define CPPFINDREFERENCES_H
|
||||
|
||||
#include <utils/filesearch.h>
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/DependencyTable.h>
|
||||
#include <cplusplus/FindUsages.h>
|
||||
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QFuture>
|
||||
#include <QtCore/QFutureWatcher>
|
||||
#include <utils/filesearch.h>
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/DependencyTable.h>
|
||||
#include <cplusplus/FindUsages.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QTimer)
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags)
|
||||
emit changed();
|
||||
Find::SearchResultWindow *window = Find::SearchResultWindow::instance();
|
||||
m_currentSearch = window->startNewSearch();
|
||||
m_currentSearch->setInfo(label(), toolTip(findFlags), txt);
|
||||
connect(m_currentSearch, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
window->popup(true);
|
||||
|
||||
@@ -244,6 +245,28 @@ void SymbolsFindFilter::onAllTasksFinished(const QString &type)
|
||||
}
|
||||
}
|
||||
|
||||
QString SymbolsFindFilter::label() const
|
||||
{
|
||||
return tr("C++ Symbols:");
|
||||
}
|
||||
|
||||
QString SymbolsFindFilter::toolTip(Find::FindFlags findFlags) const
|
||||
{
|
||||
QStringList types;
|
||||
if (m_symbolsToSearch & SearchSymbols::Classes)
|
||||
types.append(tr("Classes"));
|
||||
if (m_symbolsToSearch & SearchSymbols::Functions)
|
||||
types.append(tr("Methods"));
|
||||
if (m_symbolsToSearch & SearchSymbols::Enums)
|
||||
types.append(tr("Enums"));
|
||||
if (m_symbolsToSearch & SearchSymbols::Declarations)
|
||||
types.append(tr("Declarations"));
|
||||
return tr("Scope: %1\nTypes: %2\nFlags: %3")
|
||||
.arg(searchScope() == SearchGlobal ? tr("All") : tr("Projects"))
|
||||
.arg(types.join(tr(", ")))
|
||||
.arg(Find::IFindFilter::descriptionForFindFlags(findFlags));
|
||||
}
|
||||
|
||||
// #pragma mark -- SymbolsFindFilterConfigWidget
|
||||
|
||||
SymbolsFindFilterConfigWidget::SymbolsFindFilterConfigWidget(SymbolsFindFilter *filter)
|
||||
|
||||
@@ -91,6 +91,9 @@ private slots:
|
||||
void onAllTasksFinished(const QString &type);
|
||||
|
||||
private:
|
||||
QString label() const;
|
||||
QString toolTip(Find::FindFlags findFlags) const;
|
||||
|
||||
CppModelManager *m_manager;
|
||||
bool m_isRunning;
|
||||
bool m_enabled;
|
||||
|
||||
Reference in New Issue
Block a user