Commit 5990b039 authored by Eike Ziller's avatar Eike Ziller

Show more info about a search and move UI for replacing

Change-Id: I6e024583c0d778a65007eb4590118c4329b2118a
Reviewed-on: http://codereview.qt-project.org/4554Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarLeandro T. C. Melo <leandro.melo@nokia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent d298cffe
......@@ -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 &macro)
{
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;
......
......@@ -33,6 +33,7 @@
#include "findtoolbar.h"
#include "findplugin.h"
#include "textfindconstants.h"
#include "ifindfilter.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h>
......@@ -79,9 +80,6 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_replaceAction(0),
m_replaceNextAction(0),
m_replacePreviousAction(0),
m_casesensitiveIcon(":/find/images/casesensitively.png"),
m_regexpIcon(":/find/images/regexp.png"),
m_wholewordsIcon(":/find/images/wholewords.png"),
m_findIncrementalTimer(this), m_findStepTimer(this),
m_useFakeVim(false),
m_eventFiltersInstalled(false)
......@@ -539,33 +537,17 @@ void FindToolBar::updateIcons()
bool casesensitive = effectiveFlags & Find::FindCaseSensitively;
bool wholewords = effectiveFlags & Find::FindWholeWords;
bool regexp = effectiveFlags & Find::FindRegularExpression;
int width = 0;
if (casesensitive) width += 6;
if (wholewords) width += 6;
if (regexp) width += 6;
if (width == 0) width = 18;
--width;
QPixmap pixmap(width, 17);
if (!casesensitive && !wholewords && !regexp) {
QPixmap pixmap(17, 17);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
int x = 0;
if (casesensitive) {
painter.drawPixmap(x - 6, 0, m_casesensitiveIcon);
x += 6;
}
if (wholewords) {
painter.drawPixmap(x - 6, 0, m_wholewordsIcon);
x += 6;
}
if (regexp) {
painter.drawPixmap(x - 6, 0, m_regexpIcon);
}
if (!casesensitive && !wholewords && !regexp) {
QPixmap mag(Core::Constants::ICON_MAGNIFIER);
painter.drawPixmap(0, (pixmap.height() - mag.height()) / 2, mag);
}
m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap);
} else {
m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left,
IFindFilter::pixmapForFindFlags(effectiveFlags));
}
}
Find::FindFlags FindToolBar::effectiveFindFlags()
......
......@@ -133,10 +133,6 @@ private:
QAction *m_regularExpressionAction;
Find::FindFlags m_findFlags;
QPixmap m_casesensitiveIcon;
QPixmap m_regexpIcon;
QPixmap m_wholewordsIcon;
QTimer m_findIncrementalTimer;
QTimer m_findStepTimer;
bool m_useFakeVim;
......
......@@ -32,6 +32,8 @@
#include "ifindfilter.h"
#include <QtGui/QPainter>
/*!
\class Find::IFindFilter
\brief The IFindFilter class is the base class for find implementations
......@@ -220,3 +222,52 @@ Find::FindFlags Find::IFindFilter::supportedFindFlags() const
return Find::FindCaseSensitively
| Find::FindRegularExpression | Find::FindWholeWords;
}
QPixmap Find::IFindFilter::pixmapForFindFlags(Find::FindFlags flags)
{
static const QPixmap casesensitiveIcon(":/find/images/casesensitively.png");
static const QPixmap regexpIcon(":/find/images/regexp.png");
static const QPixmap wholewordsIcon(":/find/images/wholewords.png");
bool casesensitive = flags & Find::FindCaseSensitively;
bool wholewords = flags & Find::FindWholeWords;
bool regexp = flags & Find::FindRegularExpression;
int width = 0;
if (casesensitive) width += 6;
if (wholewords) width += 6;
if (regexp) width += 6;
if (width > 0) --width;
QPixmap pixmap(width, 17);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
int x = 0;
if (casesensitive) {
painter.drawPixmap(x - 6, 0, casesensitiveIcon);
x += 6;
}
if (wholewords) {
painter.drawPixmap(x - 6, 0, wholewordsIcon);
x += 6;
}
if (regexp) {
painter.drawPixmap(x - 6, 0, regexpIcon);
}
return pixmap;
}
QString Find::IFindFilter::descriptionForFindFlags(Find::FindFlags flags)
{
QStringList flagStrings;
if (flags & Find::FindCaseSensitively)
flagStrings.append(tr("Case sensitive"));
if (flags & Find::FindWholeWords)
flagStrings.append(tr("Whole words"));
if (flags & Find::FindRegularExpression)
flagStrings.append(tr("Regular expressions"));
QString description = tr("Flags: %1");
if (flagStrings.isEmpty())
description = description.arg(tr("None"));
else
description = description.arg(flagStrings.join(tr(", ")));
return description;
}
......@@ -36,6 +36,8 @@
#include "find_global.h"
#include "textfindconstants.h"
#include <QtGui/QPixmap>
QT_BEGIN_NAMESPACE
class QWidget;
class QSettings;
......@@ -69,6 +71,8 @@ public:
virtual void writeSettings(QSettings *settings) { Q_UNUSED(settings) }
virtual void readSettings(QSettings *settings) { Q_UNUSED(settings) }
static QPixmap pixmapForFindFlags(FindFlags flags);
static QString descriptionForFindFlags(FindFlags flags);
signals:
void changed();
};
......
......@@ -43,6 +43,7 @@
#include <QtCore/QDir>
#include <QtCore/QSettings>
#include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout>
namespace Find {
namespace Internal {
......@@ -214,10 +215,17 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
layout->setSpacing(0);
setLayout(layout);
m_noMatchesFoundDisplay = new QListWidget(this);
m_noMatchesFoundDisplay->addItem(tr("No matches found!"));
m_noMatchesFoundDisplay->setFrameStyle(QFrame::NoFrame);
m_noMatchesFoundDisplay->hide();
QFrame *topWidget = new QFrame;
QPalette pal = topWidget->palette();
pal.setColor(QPalette::Window, QColor(255, 255, 225));
pal.setColor(QPalette::WindowText, Qt::black);
topWidget->setPalette(pal);
topWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
topWidget->setLineWidth(1);
topWidget->setAutoFillBackground(true);
QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
topLayout->setMargin(2);
topWidget->setLayout(topLayout);
m_searchResultTreeView = new Internal::SearchResultTreeView(this);
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
......@@ -226,21 +234,41 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
agg->add(m_searchResultTreeView);
agg->add(new SearchResultFindSupport(m_searchResultTreeView));
layout->addWidget(m_noMatchesFoundDisplay);
layout->addWidget(topWidget);
layout->addWidget(m_searchResultTreeView);
m_infoBarDisplay.setTarget(layout, 0);
m_infoBarDisplay.setTarget(layout, 1);
m_infoBarDisplay.setInfoBar(&m_infoBar);
m_replaceLabel = new QLabel(tr("Replace with:"), parent);
m_replaceLabel->setContentsMargins(12, 0, 5, 0);
m_replaceTextEdit = new WideEnoughLineEdit(parent);
m_replaceButton = new QToolButton(parent);
m_descriptionContainer = new QWidget(topWidget);
QHBoxLayout *descriptionLayout = new QHBoxLayout(m_descriptionContainer);
m_descriptionContainer->setLayout(descriptionLayout);
descriptionLayout->setMargin(0);
m_label = new QLabel(m_descriptionContainer);
m_label->setVisible(false);
m_searchTerm = new QLabel(m_descriptionContainer);
m_searchTerm->setVisible(false);
descriptionLayout->addWidget(m_label);
descriptionLayout->addWidget(m_searchTerm);
m_replaceLabel = new QLabel(tr("Replace with:"), topWidget);
m_replaceTextEdit = new WideEnoughLineEdit(topWidget);
m_replaceButton = new QToolButton(topWidget);
m_replaceButton->setToolTip(tr("Replace all occurrences"));
m_replaceButton->setText(tr("Replace"));
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
m_replaceButton->setAutoRaise(true);
m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
m_matchesFoundLabel = new QLabel(topWidget);
updateMatchesFoundLabel();
topLayout->addWidget(m_descriptionContainer);
topLayout->addWidget(m_replaceLabel);
topLayout->addWidget(m_replaceTextEdit);
topLayout->addWidget(m_replaceButton);
topLayout->addStretch(2);
topLayout->addWidget(m_matchesFoundLabel);
setShowReplaceUI(false);
connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(SearchResultItem)),
......@@ -249,6 +277,15 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
}
void SearchResultWidget::setInfo(const QString &label, const QString &toolTip, const QString &term)
{
m_label->setText(label);
m_label->setVisible(!label.isEmpty());
m_descriptionContainer->setToolTip(toolTip);
m_searchTerm->setText(term);
m_searchTerm->setVisible(!term.isEmpty());
}
void SearchResultWidget::addResult(const QString &fileName, int lineNumber, const QString &rowText,
int searchTermStart, int searchTermLength, const QVariant &userData)
{
......@@ -286,6 +323,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
emit navigateStateChanged();
}
updateMatchesFoundLabel();
}
int SearchResultWidget::count() const
......@@ -398,11 +436,8 @@ void SearchResultWidget::goToPrevious()
void SearchResultWidget::finishSearch()
{
if (m_count > 0) {
m_replaceButton->setEnabled(true);
} else {
showNoMatchesFound();
}
m_replaceTextEdit->setEnabled(m_count > 0);
m_replaceButton->setEnabled(m_count > 0);
}
void SearchResultWidget::clear()
......@@ -412,17 +447,12 @@ void SearchResultWidget::clear()
m_replaceTextEdit->clear();
m_searchResultTreeView->clear();
m_count = 0;
m_noMatchesFoundDisplay->hide();
m_label->setVisible(false);
m_searchTerm->setVisible(false);
updateMatchesFoundLabel();
m_infoBar.clear();
}
void SearchResultWidget::showNoMatchesFound()
{
m_replaceTextEdit->setEnabled(false);
m_replaceButton->setEnabled(false);
m_noMatchesFoundDisplay->show();
}
void SearchResultWidget::hideNoUndoWarning()
{
setShowWarningMessage(false);
......@@ -486,4 +516,12 @@ QList<SearchResultItem> SearchResultWidget::checkedItems() const
return result;
}
void SearchResultWidget::updateMatchesFoundLabel()
{
if (m_count == 0)
m_matchesFoundLabel->setText(tr("No matches found."));
else
m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
}
#include "searchresultwidget.moc"
......@@ -39,7 +39,6 @@
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QListWidget>
#include <QtGui/QToolButton>
#include <QtGui/QWidget>
......@@ -54,6 +53,8 @@ class SearchResultWidget : public QWidget
public:
explicit SearchResultWidget(QWidget *parent = 0);
void setInfo(const QString &label, const QString &toolTip, const QString &term);
void addResult(const QString &fileName, int lineNumber, const QString &lineText,
int searchTermStart, int searchTermLength, const QVariant &userData = QVariant());
void addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode);
......@@ -82,13 +83,9 @@ public:
void goToNext();
void goToPrevious();
// TODO: temporary
QList<QWidget*> toolBarWidgets() const { return QList<QWidget*>() << m_replaceLabel << m_replaceTextEdit << m_replaceButton; }
public slots:
void finishSearch();
void clear();
void showNoMatchesFound();
signals:
void activated(const Find::SearchResultItem &item);
......@@ -106,17 +103,21 @@ private:
bool showWarningMessage() const;
void setShowWarningMessage(bool showWarningMessage);
QList<SearchResultItem> checkedItems() const;
void updateMatchesFoundLabel();
SearchResultTreeView *m_searchResultTreeView;
int m_count;
QString m_dontAskAgainGroup;
Core::InfoBar m_infoBar;
Core::InfoBarDisplay m_infoBarDisplay;
QListWidget *m_noMatchesFoundDisplay;
bool m_isShowingReplaceUI;
QLabel *m_replaceLabel;
QLineEdit *m_replaceTextEdit;
QToolButton *m_replaceButton;
QWidget *m_descriptionContainer;
QLabel *m_label;
QLabel *m_searchTerm;
QLabel *m_matchesFoundLabel;
};
} // Internal
......
......@@ -230,7 +230,7 @@ QWidget *SearchResultWindow::outputWidget(QWidget *)
*/
QList<QWidget*> SearchResultWindow::toolBarWidgets() const
{
return QList<QWidget*>() << d->m_expandCollapseButton << d->m_searchResultWidget->toolBarWidgets();
return QList<QWidget*>() << d->m_expandCollapseButton;
}
/*!
......@@ -445,6 +445,23 @@ QString SearchResult::textToReplace() const
return m_widget->textToReplace();
}
/*!
\fn void SearchResult::setInfo(const QString &label, const QString &toolTip, const QString &term)
\brief Set the information about the search that is show in the top-left corner of
the search result window.
The \a label should be a string that shortly describes the
search, i.e. search filter and a most relevant search options, followed by a colon ':'.
E.g. \code{Project 'myproject':}
The search \a term will be shown behind the colon.
The \a toolTip should elaborate on the search parameters, like file patterns that are searched and
find flags.
*/
void SearchResult::setInfo(const QString &label, const QString &toolTip, const QString &term)
{
m_widget->setInfo(label, toolTip, term);
}
/*!
\fn void SearchResult::addResult(const QString &fileName, int lineNumber, const QString &rowText, int searchTermStart, int searchTermLength, const QVariant &userData)
\brief Adds a single result line to the search results.
......
......@@ -98,6 +98,7 @@ public:
void setUserData(const QVariant &data);
QVariant userData() const;
QString textToReplace() const;
void setInfo(const QString &label, const QString &toolTip, const QString &term);
public slots:
void addResult(const QString &fileName, int lineNumber, const QString &lineText,
......
......@@ -46,6 +46,7 @@
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
#include <QtGui/QHBoxLayout>
using namespace Find;
using namespace ProjectExplorer;
......@@ -116,6 +117,16 @@ Utils::FileIterator *AllProjectsFind::files() const
return new Utils::FileIterator(encodings.keys(), encodings.values());
}
QString AllProjectsFind::label() const
{
return tr("All Projects:");
}
QString AllProjectsFind::toolTip() const
{
return tr("Filter: %1\n%2").arg(fileNameFilters().join(QLatin1String(",")));
}
QWidget *AllProjectsFind::createConfigWidget()
{
if (!m_configWidget) {
......
......@@ -63,6 +63,9 @@ public:
protected:
virtual QList<Project *> projects() const;
Utils::FileIterator *files() const;
QString label() const;
QString toolTip() const;
private:
ProjectExplorerPlugin *m_plugin;
......
......@@ -33,11 +33,14 @@
#include "currentprojectfind.h"
#include "projectexplorer.h"
#include "project.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QLabel>
#include <QtGui/QHBoxLayout>
using namespace Find;
using namespace ProjectExplorer;
......@@ -72,6 +75,11 @@ QList<Project *> CurrentProjectFind::projects() const
return QList<Project *>() << m_plugin->currentProject();
}
QString CurrentProjectFind::label() const
{
return tr("Project '%1':").arg(projects().first()->displayName());
}
void CurrentProjectFind::writeSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String("CurrentProjectFind"));
......
......@@ -63,6 +63,7 @@ public:
protected:
QList<Project *> projects() const;
QString label() const;
private:
ProjectExplorerPlugin *m_plugin;
......
......@@ -61,6 +61,7 @@
#include <QtCore/QtConcurrentMap>
#include <QtCore/QDir>
#include <QtGui/QApplication>
#include <QtGui/QLabel>
#include <qtconcurrent/runextensions.h>
#include <functional>
......@@ -849,7 +850,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
future.setProgressRange(0, files.size());
// report a dummy usage to indicate the search is starting
FindReferences::Usage searchStarting(replacement, QString(), 0, 0, 0);
FindReferences::Usage searchStarting(replacement, name, 0, 0, 0);
if (findTarget.typeKind() == findTarget.TypeKind){
const ObjectValue *typeValue = value_cast<const ObjectValue*>(findTarget.targetValue());
......@@ -868,6 +869,8 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
scope->lookupMember(name, context, &scope);
if (!scope)
return;
if (!scope->className().isEmpty())
searchStarting.lineText.prepend(scope->className() + QLatin1Char('.'));
future.reportResult(searchStarting);
ProcessFile process(context, name, scope);
......@@ -912,6 +915,7 @@ void FindReferences::displayResults(int first, int last)
if (first == 0) {
Usage dummy = m_watcher.future().resultAt(0);
QString replacement = dummy.path;
QString symbolName = dummy.lineText;
if (replacement.isEmpty()) {
m_currentSearch = Find::SearchResultWindow::instance()->startNewSearch(Find::SearchResultWindow::SearchOnly);
......@@ -921,6 +925,7 @@ void FindReferences::displayResults(int first, int last)
connect(m_currentSearch, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>)),
SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>)));
}
m_currentSearch->setInfo(tr("Usages:"), QString(), symbolName);
connect(m_currentSearch, SIGNAL(activated(Find::SearchResultItem)),
this, SLOT(openEditor(Find::SearchResultItem)));
Find::SearchResultWindow::instance()->popup(true);
......
......@@ -52,6 +52,7 @@
#include <QtGui/QFileDialog>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
#include <QtGui/QPushButton>
......@@ -122,6 +123,9 @@ void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags,
? QString::fromLatin1("TextEditor")
: QString());
m_currentSearch->setTextToReplace(txt);
m_currentSearch->setInfo(label(),
toolTip().arg(Find::IFindFilter::descriptionForFindFlags(findFlags)),
txt);
QVariantList searchParameters;
searchParameters << qVariantFromValue(txt) << qVariantFromValue(findFlags);
m_currentSearch->setUserData(searchParameters);
......
......@@ -80,6 +80,10 @@ public:
protected:
virtual Utils::FileIterator *files() const = 0;
virtual QString label() const = 0; // see Find::SearchResult::setInfo
virtual QString toolTip() const = 0; // see Find::SearchResult::setInfo,
// add %1 placeholder where the find flags should be put
void writeCommonSettings(QSettings *settings);
void readCommonSettings(QSettings *settings, const QString &defaultFilter);
QWidget *createPatternWidget();
......
......@@ -77,6 +77,16 @@ Utils::FileIterator *FindInCurrentFile::files() const
return new Utils::FileIterator(QStringList() << fileName, QList<QTextCodec *>() << codec);
}
QString FindInCurrentFile::label() const
{
return tr("File '%1':").arg(QFileInfo(m_currentFile->fileName()).fileName());
}
QString FindInCurrentFile::toolTip() const
{
return tr("File path: %1\n%2").arg(QDir::toNativeSeparators(m_currentFile->fileName()));
}
bool FindInCurrentFile::isEnabled() const
{
return m_currentFile && !m_currentFile->fileName().isEmpty();
......
......@@ -64,6 +64,8 @@ public:
protected:
Utils::FileIterator *files() const;
QString label() const;
QString toolTip() const;
private slots:
void handleFileChange(Core::IEditor *editor);
......
......@@ -40,6 +40,7 @@
#include <QtCore/QDirIterator>
#include <QtGui/QPushButton>
#include <QtGui/QFileDialog>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
using namespace Find;
......@@ -74,6 +75,17 @@ Utils::FileIterator *FindInFiles::files() const