forked from qt-creator/qt-creator
Find: Remove some Find namespace usages
Change-Id: I3caf03474c7e080766b85c6a3042f6a29f13cd40 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1401,8 +1401,8 @@ void FakeVimPluginPrivate::find(bool reverse)
|
|||||||
if (Find::FindPlugin *plugin = Find::FindPlugin::instance()) {
|
if (Find::FindPlugin *plugin = Find::FindPlugin::instance()) {
|
||||||
plugin->setUseFakeVim(true);
|
plugin->setUseFakeVim(true);
|
||||||
plugin->openFindToolBar(reverse
|
plugin->openFindToolBar(reverse
|
||||||
? Find::FindPlugin::FindBackward
|
? Find::FindPlugin::FindBackwardDirection
|
||||||
: Find::FindPlugin::FindForward);
|
: Find::FindPlugin::FindForwardDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,11 +121,10 @@ bool BaseTextFind::supportsReplace() const
|
|||||||
return !isReadOnly();
|
return !isReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::FindFlags BaseTextFind::supportedFindFlags() const
|
FindFlags BaseTextFind::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return Find::FindBackward | Find::FindCaseSensitively
|
return FindBackward | FindCaseSensitively | FindRegularExpression
|
||||||
| Find::FindRegularExpression | Find::FindWholeWords
|
| FindWholeWords | FindPreserveCase;
|
||||||
| Find::FindPreserveCase;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::resetIncrementalSearch()
|
void BaseTextFind::resetIncrementalSearch()
|
||||||
@@ -172,7 +171,7 @@ QString BaseTextFind::completedFindString() const
|
|||||||
return cursor.selectedText();
|
return cursor.selectedText();
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, Find::FindFlags findFlags)
|
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (d->m_incrementalStartPos < 0)
|
if (d->m_incrementalStartPos < 0)
|
||||||
@@ -191,7 +190,7 @@ IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, Find::Fin
|
|||||||
return found ? Found : NotFound;
|
return found ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result BaseTextFind::findStep(const QString &txt, Find::FindFlags findFlags)
|
IFindSupport::Result BaseTextFind::findStep(const QString &txt, FindFlags findFlags)
|
||||||
{
|
{
|
||||||
bool wrapped = false;
|
bool wrapped = false;
|
||||||
bool found = find(txt, findFlags, textCursor(), &wrapped);
|
bool found = find(txt, findFlags, textCursor(), &wrapped);
|
||||||
@@ -204,21 +203,20 @@ IFindSupport::Result BaseTextFind::findStep(const QString &txt, Find::FindFlags
|
|||||||
return found ? Found : NotFound;
|
return found ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::replace(const QString &before, const QString &after,
|
void BaseTextFind::replace(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCursor BaseTextFind::replaceInternal(const QString &before, const QString &after,
|
QTextCursor BaseTextFind::replaceInternal(const QString &before, const QString &after,
|
||||||
Find::FindFlags findFlags)
|
FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
bool usesRegExp = (findFlags & Find::FindRegularExpression);
|
bool usesRegExp = (findFlags & FindRegularExpression);
|
||||||
bool preserveCase = (findFlags & Find::FindPreserveCase);
|
bool preserveCase = (findFlags & FindPreserveCase);
|
||||||
QRegExp regexp(before,
|
QRegExp regexp(before,
|
||||||
(findFlags & Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive,
|
(findFlags & FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive,
|
||||||
usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
||||||
|
|
||||||
if (regexp.exactMatch(cursor.selectedText())) {
|
if (regexp.exactMatch(cursor.selectedText())) {
|
||||||
@@ -231,14 +229,13 @@ QTextCursor BaseTextFind::replaceInternal(const QString &before, const QString &
|
|||||||
realAfter = after;
|
realAfter = after;
|
||||||
int start = cursor.selectionStart();
|
int start = cursor.selectionStart();
|
||||||
cursor.insertText(realAfter);
|
cursor.insertText(realAfter);
|
||||||
if ((findFlags&Find::FindBackward) != 0)
|
if ((findFlags & FindBackward) != 0)
|
||||||
cursor.setPosition(start);
|
cursor.setPosition(start);
|
||||||
}
|
}
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextFind::replaceStep(const QString &before, const QString &after,
|
bool BaseTextFind::replaceStep(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
||||||
bool wrapped = false;
|
bool wrapped = false;
|
||||||
@@ -248,8 +245,7 @@ bool BaseTextFind::replaceStep(const QString &before, const QString &after,
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
int BaseTextFind::replaceAll(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTextCursor editCursor = textCursor();
|
QTextCursor editCursor = textCursor();
|
||||||
if (!d->m_findScopeStart.isNull())
|
if (!d->m_findScopeStart.isNull())
|
||||||
@@ -258,12 +254,12 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
|||||||
editCursor.movePosition(QTextCursor::Start);
|
editCursor.movePosition(QTextCursor::Start);
|
||||||
editCursor.beginEditBlock();
|
editCursor.beginEditBlock();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool usesRegExp = (findFlags & Find::FindRegularExpression);
|
bool usesRegExp = (findFlags & FindRegularExpression);
|
||||||
bool preserveCase = (findFlags & Find::FindPreserveCase);
|
bool preserveCase = (findFlags & FindPreserveCase);
|
||||||
QRegExp regexp(before);
|
QRegExp regexp(before);
|
||||||
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
||||||
regexp.setCaseSensitivity((findFlags & Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
regexp.setCaseSensitivity((findFlags & FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
QTextCursor found = findOne(regexp, editCursor, Find::textDocumentFlagsForFindFlags(findFlags));
|
QTextCursor found = findOne(regexp, editCursor, textDocumentFlagsForFindFlags(findFlags));
|
||||||
bool first = true;
|
bool first = true;
|
||||||
while (!found.isNull() && inScope(found.selectionStart(), found.selectionEnd())) {
|
while (!found.isNull() && inScope(found.selectionStart(), found.selectionEnd())) {
|
||||||
if (found == editCursor && !first) {
|
if (found == editCursor && !first) {
|
||||||
@@ -273,10 +269,10 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
|||||||
// otherwise we would run into an endless loop for some regular expressions
|
// otherwise we would run into an endless loop for some regular expressions
|
||||||
// like ^ or \b.
|
// like ^ or \b.
|
||||||
QTextCursor newPosCursor = editCursor;
|
QTextCursor newPosCursor = editCursor;
|
||||||
newPosCursor.movePosition(findFlags & Find::FindBackward ?
|
newPosCursor.movePosition(findFlags & FindBackward ?
|
||||||
QTextCursor::PreviousCharacter :
|
QTextCursor::PreviousCharacter :
|
||||||
QTextCursor::NextCharacter);
|
QTextCursor::NextCharacter);
|
||||||
found = findOne(regexp, newPosCursor, Find::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, newPosCursor, textDocumentFlagsForFindFlags(findFlags));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (first)
|
if (first)
|
||||||
@@ -294,13 +290,13 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
|||||||
else
|
else
|
||||||
realAfter = after;
|
realAfter = after;
|
||||||
editCursor.insertText(realAfter);
|
editCursor.insertText(realAfter);
|
||||||
found = findOne(regexp, editCursor, Find::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, editCursor, textDocumentFlagsForFindFlags(findFlags));
|
||||||
}
|
}
|
||||||
editCursor.endEditBlock();
|
editCursor.endEditBlock();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextFind::find(const QString &txt, Find::FindFlags findFlags,
|
bool BaseTextFind::find(const QString &txt, FindFlags findFlags,
|
||||||
QTextCursor start, bool *wrapped)
|
QTextCursor start, bool *wrapped)
|
||||||
{
|
{
|
||||||
if (txt.isEmpty()) {
|
if (txt.isEmpty()) {
|
||||||
@@ -308,9 +304,9 @@ bool BaseTextFind::find(const QString &txt, Find::FindFlags findFlags,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
QRegExp regexp(txt);
|
QRegExp regexp(txt);
|
||||||
regexp.setPatternSyntax((findFlags&Find::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
|
regexp.setPatternSyntax((findFlags & FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
|
||||||
regexp.setCaseSensitivity((findFlags&Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
regexp.setCaseSensitivity((findFlags & FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
QTextCursor found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
QTextCursor found = findOne(regexp, start, textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (wrapped)
|
if (wrapped)
|
||||||
*wrapped = false;
|
*wrapped = false;
|
||||||
|
|
||||||
@@ -318,11 +314,11 @@ bool BaseTextFind::find(const QString &txt, Find::FindFlags findFlags,
|
|||||||
|
|
||||||
// scoped
|
// scoped
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
||||||
if ((findFlags&Find::FindBackward) == 0)
|
if ((findFlags & FindBackward) == 0)
|
||||||
start.setPosition(d->m_findScopeStart.position());
|
start.setPosition(d->m_findScopeStart.position());
|
||||||
else
|
else
|
||||||
start.setPosition(d->m_findScopeEnd.position());
|
start.setPosition(d->m_findScopeEnd.position());
|
||||||
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, start, textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
||||||
return false;
|
return false;
|
||||||
if (wrapped)
|
if (wrapped)
|
||||||
@@ -332,11 +328,11 @@ bool BaseTextFind::find(const QString &txt, Find::FindFlags findFlags,
|
|||||||
|
|
||||||
// entire document
|
// entire document
|
||||||
if (found.isNull()) {
|
if (found.isNull()) {
|
||||||
if ((findFlags&Find::FindBackward) == 0)
|
if ((findFlags & FindBackward) == 0)
|
||||||
start.movePosition(QTextCursor::Start);
|
start.movePosition(QTextCursor::Start);
|
||||||
else
|
else
|
||||||
start.movePosition(QTextCursor::End);
|
start.movePosition(QTextCursor::End);
|
||||||
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, start, textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (found.isNull())
|
if (found.isNull())
|
||||||
return false;
|
return false;
|
||||||
if (wrapped)
|
if (wrapped)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ QT_END_NAMESPACE
|
|||||||
namespace Find {
|
namespace Find {
|
||||||
struct BaseTextFindPrivate;
|
struct BaseTextFindPrivate;
|
||||||
|
|
||||||
class FIND_EXPORT BaseTextFind : public Find::IFindSupport
|
class FIND_EXPORT BaseTextFind : public IFindSupport
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -52,20 +52,17 @@ public:
|
|||||||
virtual ~BaseTextFind();
|
virtual ~BaseTextFind();
|
||||||
|
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
Find::FindFlags supportedFindFlags() const;
|
FindFlags supportedFindFlags() const;
|
||||||
void resetIncrementalSearch();
|
void resetIncrementalSearch();
|
||||||
void clearResults();
|
void clearResults();
|
||||||
QString currentFindString() const;
|
QString currentFindString() const;
|
||||||
QString completedFindString() const;
|
QString completedFindString() const;
|
||||||
|
|
||||||
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
Result findIncremental(const QString &txt, FindFlags findFlags);
|
||||||
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
Result findStep(const QString &txt, FindFlags findFlags);
|
||||||
void replace(const QString &before, const QString &after,
|
void replace(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
Find::FindFlags findFlags);
|
bool replaceStep(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
bool replaceStep(const QString &before, const QString &after,
|
int replaceAll(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
Find::FindFlags findFlags);
|
|
||||||
int replaceAll(const QString &before, const QString &after,
|
|
||||||
Find::FindFlags findFlags);
|
|
||||||
|
|
||||||
void defineFindScope();
|
void defineFindScope();
|
||||||
void clearFindScope();
|
void clearFindScope();
|
||||||
@@ -77,12 +74,8 @@ signals:
|
|||||||
int verticalBlockSelectionLastColumn);
|
int verticalBlockSelectionLastColumn);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool find(const QString &txt,
|
bool find(const QString &txt, FindFlags findFlags, QTextCursor start, bool *wrapped);
|
||||||
Find::FindFlags findFlags,
|
QTextCursor replaceInternal(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
QTextCursor start,
|
|
||||||
bool *wrapped);
|
|
||||||
QTextCursor replaceInternal(const QString &before, const QString &after,
|
|
||||||
Find::FindFlags findFlags);
|
|
||||||
|
|
||||||
QTextCursor textCursor() const;
|
QTextCursor textCursor() const;
|
||||||
void setTextCursor(const QTextCursor&);
|
void setTextCursor(const QTextCursor&);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ bool CurrentDocumentFind::supportsReplace() const
|
|||||||
return m_currentFind->supportsReplace();
|
return m_currentFind->supportsReplace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::FindFlags CurrentDocumentFind::supportedFindFlags() const
|
FindFlags CurrentDocumentFind::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return 0);
|
QTC_ASSERT(m_currentFind, return 0);
|
||||||
return m_currentFind->supportedFindFlags();
|
return m_currentFind->supportedFindFlags();
|
||||||
@@ -100,40 +100,37 @@ QString CurrentDocumentFind::completedFindString() const
|
|||||||
return m_currentFind->completedFindString();
|
return m_currentFind->completedFindString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentDocumentFind::highlightAll(const QString &txt, Find::FindFlags findFlags)
|
void CurrentDocumentFind::highlightAll(const QString &txt, FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return);
|
QTC_ASSERT(m_currentFind, return);
|
||||||
m_currentFind->highlightAll(txt, findFlags);
|
m_currentFind->highlightAll(txt, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result CurrentDocumentFind::findIncremental(const QString &txt, Find::FindFlags findFlags)
|
IFindSupport::Result CurrentDocumentFind::findIncremental(const QString &txt, FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
|
QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
|
||||||
return m_currentFind->findIncremental(txt, findFlags);
|
return m_currentFind->findIncremental(txt, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result CurrentDocumentFind::findStep(const QString &txt, Find::FindFlags findFlags)
|
IFindSupport::Result CurrentDocumentFind::findStep(const QString &txt, FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
|
QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
|
||||||
return m_currentFind->findStep(txt, findFlags);
|
return m_currentFind->findStep(txt, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentDocumentFind::replace(const QString &before, const QString &after,
|
void CurrentDocumentFind::replace(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return);
|
QTC_ASSERT(m_currentFind, return);
|
||||||
m_currentFind->replace(before, after, findFlags);
|
m_currentFind->replace(before, after, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CurrentDocumentFind::replaceStep(const QString &before, const QString &after,
|
bool CurrentDocumentFind::replaceStep(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return false);
|
QTC_ASSERT(m_currentFind, return false);
|
||||||
return m_currentFind->replaceStep(before, after, findFlags);
|
return m_currentFind->replaceStep(before, after, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CurrentDocumentFind::replaceAll(const QString &before, const QString &after,
|
int CurrentDocumentFind::replaceAll(const QString &before, const QString &after, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentFind, return 0);
|
QTC_ASSERT(m_currentFind, return 0);
|
||||||
return m_currentFind->replaceAll(before, after, findFlags);
|
return m_currentFind->replaceAll(before, after, findFlags);
|
||||||
|
|||||||
@@ -47,21 +47,18 @@ public:
|
|||||||
void resetIncrementalSearch();
|
void resetIncrementalSearch();
|
||||||
void clearResults();
|
void clearResults();
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
Find::FindFlags supportedFindFlags() const;
|
FindFlags supportedFindFlags() const;
|
||||||
QString currentFindString() const;
|
QString currentFindString() const;
|
||||||
QString completedFindString() const;
|
QString completedFindString() const;
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool candidateIsEnabled() const;
|
bool candidateIsEnabled() const;
|
||||||
void highlightAll(const QString &txt, Find::FindFlags findFlags);
|
void highlightAll(const QString &txt, FindFlags findFlags);
|
||||||
IFindSupport::Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
IFindSupport::Result findIncremental(const QString &txt, FindFlags findFlags);
|
||||||
IFindSupport::Result findStep(const QString &txt, Find::FindFlags findFlags);
|
IFindSupport::Result findStep(const QString &txt, FindFlags findFlags);
|
||||||
void replace(const QString &before, const QString &after,
|
void replace(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
Find::FindFlags findFlags);
|
bool replaceStep(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
bool replaceStep(const QString &before, const QString &after,
|
int replaceAll(const QString &before, const QString &after, FindFlags findFlags);
|
||||||
Find::FindFlags findFlags);
|
|
||||||
int replaceAll(const QString &before, const QString &after,
|
|
||||||
Find::FindFlags findFlags);
|
|
||||||
void defineFindScope();
|
void defineFindScope();
|
||||||
void clearFindScope();
|
void clearFindScope();
|
||||||
void acceptCandidate();
|
void acceptCandidate();
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ namespace {
|
|||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
|
|
||||||
struct FindPluginPrivate {
|
class FindPluginPrivate {
|
||||||
|
public:
|
||||||
explicit FindPluginPrivate(FindPlugin *q);
|
explicit FindPluginPrivate(FindPlugin *q);
|
||||||
|
|
||||||
//variables
|
//variables
|
||||||
@@ -85,7 +86,7 @@ struct FindPluginPrivate {
|
|||||||
Internal::CurrentDocumentFind *m_currentDocumentFind;
|
Internal::CurrentDocumentFind *m_currentDocumentFind;
|
||||||
Internal::FindToolBar *m_findToolBar;
|
Internal::FindToolBar *m_findToolBar;
|
||||||
Internal::FindToolWindow *m_findDialog;
|
Internal::FindToolWindow *m_findDialog;
|
||||||
Find::FindFlags m_findFlags;
|
FindFlags m_findFlags;
|
||||||
QStringListModel *m_findCompletionModel;
|
QStringListModel *m_findCompletionModel;
|
||||||
QStringListModel *m_replaceCompletionModel;
|
QStringListModel *m_replaceCompletionModel;
|
||||||
QStringList m_findCompletions;
|
QStringList m_findCompletions;
|
||||||
@@ -244,37 +245,37 @@ void FindPlugin::setupFilterMenuItems()
|
|||||||
d->m_openFindDialog->setEnabled(haveEnabledFilters);
|
d->m_openFindDialog->setEnabled(haveEnabledFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::FindFlags FindPlugin::findFlags() const
|
FindFlags FindPlugin::findFlags() const
|
||||||
{
|
{
|
||||||
return d->m_findFlags;
|
return d->m_findFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setCaseSensitive(bool sensitive)
|
void FindPlugin::setCaseSensitive(bool sensitive)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindCaseSensitively, sensitive);
|
setFindFlag(FindCaseSensitively, sensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setWholeWord(bool wholeOnly)
|
void FindPlugin::setWholeWord(bool wholeOnly)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindWholeWords, wholeOnly);
|
setFindFlag(FindWholeWords, wholeOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setBackward(bool backward)
|
void FindPlugin::setBackward(bool backward)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, backward);
|
setFindFlag(FindBackward, backward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setRegularExpression(bool regExp)
|
void FindPlugin::setRegularExpression(bool regExp)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindRegularExpression, regExp);
|
setFindFlag(FindRegularExpression, regExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setPreserveCase(bool preserveCase)
|
void FindPlugin::setPreserveCase(bool preserveCase)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindPreserveCase, preserveCase);
|
setFindFlag(FindPreserveCase, preserveCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setFindFlag(Find::FindFlag flag, bool enabled)
|
void FindPlugin::setFindFlag(FindFlag flag, bool enabled)
|
||||||
{
|
{
|
||||||
bool hasFlag = hasFindFlag(flag);
|
bool hasFlag = hasFindFlag(flag);
|
||||||
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
||||||
@@ -283,11 +284,11 @@ void FindPlugin::setFindFlag(Find::FindFlag flag, bool enabled)
|
|||||||
d->m_findFlags |= flag;
|
d->m_findFlags |= flag;
|
||||||
else
|
else
|
||||||
d->m_findFlags &= ~flag;
|
d->m_findFlags &= ~flag;
|
||||||
if (flag != Find::FindBackward)
|
if (flag != FindBackward)
|
||||||
emit findFlagsChanged();
|
emit findFlagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindPlugin::hasFindFlag(Find::FindFlag flag)
|
bool FindPlugin::hasFindFlag(FindFlag flag)
|
||||||
{
|
{
|
||||||
return d->m_findFlags & flag;
|
return d->m_findFlags & flag;
|
||||||
}
|
}
|
||||||
@@ -296,11 +297,11 @@ void FindPlugin::writeSettings()
|
|||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
settings->beginGroup(QLatin1String("Find"));
|
settings->beginGroup(QLatin1String("Find"));
|
||||||
settings->setValue(QLatin1String("Backward"), hasFindFlag(Find::FindBackward));
|
settings->setValue(QLatin1String("Backward"), hasFindFlag(FindBackward));
|
||||||
settings->setValue(QLatin1String("CaseSensitively"), hasFindFlag(Find::FindCaseSensitively));
|
settings->setValue(QLatin1String("CaseSensitively"), hasFindFlag(FindCaseSensitively));
|
||||||
settings->setValue(QLatin1String("WholeWords"), hasFindFlag(Find::FindWholeWords));
|
settings->setValue(QLatin1String("WholeWords"), hasFindFlag(FindWholeWords));
|
||||||
settings->setValue(QLatin1String("RegularExpression"), hasFindFlag(Find::FindRegularExpression));
|
settings->setValue(QLatin1String("RegularExpression"), hasFindFlag(FindRegularExpression));
|
||||||
settings->setValue(QLatin1String("PreserveCase"), hasFindFlag(Find::FindPreserveCase));
|
settings->setValue(QLatin1String("PreserveCase"), hasFindFlag(FindPreserveCase));
|
||||||
settings->setValue(QLatin1String("FindStrings"), d->m_findCompletions);
|
settings->setValue(QLatin1String("FindStrings"), d->m_findCompletions);
|
||||||
settings->setValue(QLatin1String("ReplaceStrings"), d->m_replaceCompletions);
|
settings->setValue(QLatin1String("ReplaceStrings"), d->m_replaceCompletions);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -359,7 +360,7 @@ void FindPlugin::setUseFakeVim(bool on)
|
|||||||
void FindPlugin::openFindToolBar(FindDirection direction)
|
void FindPlugin::openFindToolBar(FindDirection direction)
|
||||||
{
|
{
|
||||||
if (d->m_findToolBar) {
|
if (d->m_findToolBar) {
|
||||||
d->m_findToolBar->setBackward(direction == FindBackward);
|
d->m_findToolBar->setBackward(direction == FindBackwardDirection);
|
||||||
d->m_findToolBar->openFindToolBar();
|
d->m_findToolBar->openFindToolBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,7 +386,7 @@ QKeySequence IFindFilter::defaultShortcut() const
|
|||||||
QTextDocument::FindFlags Find::textDocumentFlagsForFindFlags(Find::FindFlags flags)
|
QTextDocument::FindFlags Find::textDocumentFlagsForFindFlags(Find::FindFlags flags)
|
||||||
{
|
{
|
||||||
QTextDocument::FindFlags textDocFlags;
|
QTextDocument::FindFlags textDocFlags;
|
||||||
if (flags & Find::FindBackward)
|
if (flags & FindBackward)
|
||||||
textDocFlags |= QTextDocument::FindBackward;
|
textDocFlags |= QTextDocument::FindBackward;
|
||||||
if (flags & Find::FindCaseSensitively)
|
if (flags & Find::FindCaseSensitively)
|
||||||
textDocFlags |= QTextDocument::FindCaseSensitively;
|
textDocFlags |= QTextDocument::FindCaseSensitively;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
class IFindFilter;
|
class IFindFilter;
|
||||||
struct FindPluginPrivate;
|
class FindPluginPrivate;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class FindToolBar;
|
class FindToolBar;
|
||||||
@@ -59,8 +59,8 @@ public:
|
|||||||
static FindPlugin *instance();
|
static FindPlugin *instance();
|
||||||
|
|
||||||
enum FindDirection {
|
enum FindDirection {
|
||||||
FindForward,
|
FindForwardDirection,
|
||||||
FindBackward
|
FindBackwardDirection
|
||||||
};
|
};
|
||||||
|
|
||||||
// IPlugin
|
// IPlugin
|
||||||
@@ -68,8 +68,8 @@ public:
|
|||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
ShutdownFlag aboutToShutdown();
|
ShutdownFlag aboutToShutdown();
|
||||||
|
|
||||||
Find::FindFlags findFlags() const;
|
FindFlags findFlags() const;
|
||||||
bool hasFindFlag(Find::FindFlag flag);
|
bool hasFindFlag(FindFlag flag);
|
||||||
void updateFindCompletion(const QString &text);
|
void updateFindCompletion(const QString &text);
|
||||||
void updateReplaceCompletion(const QString &text);
|
void updateReplaceCompletion(const QString &text);
|
||||||
QStringListModel *findCompletionModel() const;
|
QStringListModel *findCompletionModel() const;
|
||||||
@@ -93,7 +93,7 @@ private slots:
|
|||||||
void openFindFilter();
|
void openFindFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setFindFlag(Find::FindFlag flag, bool enabled);
|
void setFindFlag(FindFlag flag, bool enabled);
|
||||||
void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model);
|
void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model);
|
||||||
void setupMenu();
|
void setupMenu();
|
||||||
void setupFilterMenuItems();
|
void setupFilterMenuItems();
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ void FindToolBar::updateToolBar()
|
|||||||
m_caseSensitiveAction->setEnabled(enabled);
|
m_caseSensitiveAction->setEnabled(enabled);
|
||||||
m_wholeWordAction->setEnabled(enabled);
|
m_wholeWordAction->setEnabled(enabled);
|
||||||
m_regularExpressionAction->setEnabled(enabled);
|
m_regularExpressionAction->setEnabled(enabled);
|
||||||
m_preserveCaseAction->setEnabled(replaceEnabled && !hasFindFlag(Find::FindRegularExpression));
|
m_preserveCaseAction->setEnabled(replaceEnabled && !hasFindFlag(FindRegularExpression));
|
||||||
if (QApplication::clipboard()->supportsFindBuffer())
|
if (QApplication::clipboard()->supportsFindBuffer())
|
||||||
m_enterFindStringAction->setEnabled(enabled);
|
m_enterFindStringAction->setEnabled(enabled);
|
||||||
bool replaceFocus = m_ui.replaceEdit->hasFocus();
|
bool replaceFocus = m_ui.replaceEdit->hasFocus();
|
||||||
@@ -415,13 +415,13 @@ void FindToolBar::invokeClearResults()
|
|||||||
|
|
||||||
void FindToolBar::invokeFindNext()
|
void FindToolBar::invokeFindNext()
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, false);
|
setFindFlag(FindBackward, false);
|
||||||
invokeFindStep();
|
invokeFindStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::invokeFindPrevious()
|
void FindToolBar::invokeFindPrevious()
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, true);
|
setFindFlag(FindBackward, true);
|
||||||
invokeFindStep();
|
invokeFindStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ QString FindToolBar::getReplaceText()
|
|||||||
void FindToolBar::setFindText(const QString &text)
|
void FindToolBar::setFindText(const QString &text)
|
||||||
{
|
{
|
||||||
disconnect(m_ui.findEdit, SIGNAL(textChanged(QString)), this, SLOT(invokeFindIncremental()));
|
disconnect(m_ui.findEdit, SIGNAL(textChanged(QString)), this, SLOT(invokeFindIncremental()));
|
||||||
if (hasFindFlag(Find::FindRegularExpression))
|
if (hasFindFlag(FindRegularExpression))
|
||||||
m_ui.findEdit->setText(QRegExp::escape(text));
|
m_ui.findEdit->setText(QRegExp::escape(text));
|
||||||
else
|
else
|
||||||
m_ui.findEdit->setText(text);
|
m_ui.findEdit->setText(text);
|
||||||
@@ -480,7 +480,7 @@ void FindToolBar::invokeFindIncremental()
|
|||||||
|
|
||||||
void FindToolBar::invokeReplace()
|
void FindToolBar::invokeReplace()
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, false);
|
setFindFlag(FindBackward, false);
|
||||||
if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) {
|
if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) {
|
||||||
m_plugin->updateFindCompletion(getFindText());
|
m_plugin->updateFindCompletion(getFindText());
|
||||||
m_plugin->updateReplaceCompletion(getReplaceText());
|
m_plugin->updateReplaceCompletion(getReplaceText());
|
||||||
@@ -490,13 +490,13 @@ void FindToolBar::invokeReplace()
|
|||||||
|
|
||||||
void FindToolBar::invokeReplaceNext()
|
void FindToolBar::invokeReplaceNext()
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, false);
|
setFindFlag(FindBackward, false);
|
||||||
invokeReplaceStep();
|
invokeReplaceStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::invokeReplacePrevious()
|
void FindToolBar::invokeReplacePrevious()
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, true);
|
setFindFlag(FindBackward, true);
|
||||||
invokeReplaceStep();
|
invokeReplaceStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,11 +554,11 @@ void FindToolBar::findFlagsChanged()
|
|||||||
|
|
||||||
void FindToolBar::updateIcons()
|
void FindToolBar::updateIcons()
|
||||||
{
|
{
|
||||||
Find::FindFlags effectiveFlags = effectiveFindFlags();
|
FindFlags effectiveFlags = effectiveFindFlags();
|
||||||
bool casesensitive = effectiveFlags & Find::FindCaseSensitively;
|
bool casesensitive = effectiveFlags & FindCaseSensitively;
|
||||||
bool wholewords = effectiveFlags & Find::FindWholeWords;
|
bool wholewords = effectiveFlags & FindWholeWords;
|
||||||
bool regexp = effectiveFlags & Find::FindRegularExpression;
|
bool regexp = effectiveFlags & FindRegularExpression;
|
||||||
bool preserveCase = effectiveFlags & Find::FindPreserveCase;
|
bool preserveCase = effectiveFlags & FindPreserveCase;
|
||||||
if (!casesensitive && !wholewords && !regexp && !preserveCase) {
|
if (!casesensitive && !wholewords && !regexp && !preserveCase) {
|
||||||
QPixmap pixmap(17, 17);
|
QPixmap pixmap(17, 17);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
@@ -572,27 +572,27 @@ void FindToolBar::updateIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::FindFlags FindToolBar::effectiveFindFlags()
|
FindFlags FindToolBar::effectiveFindFlags()
|
||||||
{
|
{
|
||||||
Find::FindFlags supportedFlags;
|
FindFlags supportedFlags;
|
||||||
bool supportsReplace = true;
|
bool supportsReplace = true;
|
||||||
if (m_currentDocumentFind->isEnabled()) {
|
if (m_currentDocumentFind->isEnabled()) {
|
||||||
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
||||||
supportsReplace = m_currentDocumentFind->supportsReplace();
|
supportsReplace = m_currentDocumentFind->supportsReplace();
|
||||||
} else {
|
} else {
|
||||||
supportedFlags = (Find::FindFlags)0xFFFFFF;
|
supportedFlags = (FindFlags)0xFFFFFF;
|
||||||
}
|
}
|
||||||
if (!supportsReplace || m_findFlags & Find::FindRegularExpression)
|
if (!supportsReplace || m_findFlags & FindRegularExpression)
|
||||||
supportedFlags &= ~Find::FindPreserveCase;
|
supportedFlags &= ~FindPreserveCase;
|
||||||
return supportedFlags & m_findFlags;
|
return supportedFlags & m_findFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::updateFlagMenus()
|
void FindToolBar::updateFlagMenus()
|
||||||
{
|
{
|
||||||
bool wholeOnly = ((m_findFlags & Find::FindWholeWords));
|
bool wholeOnly = ((m_findFlags & FindWholeWords));
|
||||||
bool sensitive = ((m_findFlags & Find::FindCaseSensitively));
|
bool sensitive = ((m_findFlags & FindCaseSensitively));
|
||||||
bool regexp = ((m_findFlags & Find::FindRegularExpression));
|
bool regexp = ((m_findFlags & FindRegularExpression));
|
||||||
bool preserveCase = ((m_findFlags & Find::FindPreserveCase));
|
bool preserveCase = ((m_findFlags & FindPreserveCase));
|
||||||
if (m_wholeWordAction->isChecked() != wholeOnly)
|
if (m_wholeWordAction->isChecked() != wholeOnly)
|
||||||
m_wholeWordAction->setChecked(wholeOnly);
|
m_wholeWordAction->setChecked(wholeOnly);
|
||||||
if (m_caseSensitiveAction->isChecked() != sensitive)
|
if (m_caseSensitiveAction->isChecked() != sensitive)
|
||||||
@@ -601,14 +601,14 @@ void FindToolBar::updateFlagMenus()
|
|||||||
m_regularExpressionAction->setChecked(regexp);
|
m_regularExpressionAction->setChecked(regexp);
|
||||||
if (m_preserveCaseAction->isChecked() != preserveCase)
|
if (m_preserveCaseAction->isChecked() != preserveCase)
|
||||||
m_preserveCaseAction->setChecked(preserveCase);
|
m_preserveCaseAction->setChecked(preserveCase);
|
||||||
Find::FindFlags supportedFlags;
|
FindFlags supportedFlags;
|
||||||
if (m_currentDocumentFind->isEnabled())
|
if (m_currentDocumentFind->isEnabled())
|
||||||
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
||||||
m_wholeWordAction->setEnabled(supportedFlags & Find::FindWholeWords);
|
m_wholeWordAction->setEnabled(supportedFlags & FindWholeWords);
|
||||||
m_caseSensitiveAction->setEnabled(supportedFlags & Find::FindCaseSensitively);
|
m_caseSensitiveAction->setEnabled(supportedFlags & FindCaseSensitively);
|
||||||
m_regularExpressionAction->setEnabled(supportedFlags & Find::FindRegularExpression);
|
m_regularExpressionAction->setEnabled(supportedFlags & FindRegularExpression);
|
||||||
bool replaceEnabled = m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace();
|
bool replaceEnabled = m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace();
|
||||||
m_preserveCaseAction->setEnabled((supportedFlags & Find::FindPreserveCase) && !regexp && replaceEnabled);
|
m_preserveCaseAction->setEnabled((supportedFlags & FindPreserveCase) && !regexp && replaceEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindToolBar::setFocusToCurrentFindSupport()
|
bool FindToolBar::setFocusToCurrentFindSupport()
|
||||||
@@ -698,11 +698,11 @@ void FindToolBar::writeSettings()
|
|||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
settings->beginGroup(QLatin1String("Find"));
|
settings->beginGroup(QLatin1String("Find"));
|
||||||
settings->beginGroup(QLatin1String("FindToolBar"));
|
settings->beginGroup(QLatin1String("FindToolBar"));
|
||||||
settings->setValue(QLatin1String("Backward"), QVariant((m_findFlags & Find::FindBackward) != 0));
|
settings->setValue(QLatin1String("Backward"), QVariant((m_findFlags & FindBackward) != 0));
|
||||||
settings->setValue(QLatin1String("CaseSensitively"), QVariant((m_findFlags & Find::FindCaseSensitively) != 0));
|
settings->setValue(QLatin1String("CaseSensitively"), QVariant((m_findFlags & FindCaseSensitively) != 0));
|
||||||
settings->setValue(QLatin1String("WholeWords"), QVariant((m_findFlags & Find::FindWholeWords) != 0));
|
settings->setValue(QLatin1String("WholeWords"), QVariant((m_findFlags & FindWholeWords) != 0));
|
||||||
settings->setValue(QLatin1String("RegularExpression"), QVariant((m_findFlags & Find::FindRegularExpression) != 0));
|
settings->setValue(QLatin1String("RegularExpression"), QVariant((m_findFlags & FindRegularExpression) != 0));
|
||||||
settings->setValue(QLatin1String("PreserveCase"), QVariant((m_findFlags & Find::FindPreserveCase) != 0));
|
settings->setValue(QLatin1String("PreserveCase"), QVariant((m_findFlags & FindPreserveCase) != 0));
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
@@ -712,17 +712,17 @@ void FindToolBar::readSettings()
|
|||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
settings->beginGroup(QLatin1String("Find"));
|
settings->beginGroup(QLatin1String("Find"));
|
||||||
settings->beginGroup(QLatin1String("FindToolBar"));
|
settings->beginGroup(QLatin1String("FindToolBar"));
|
||||||
Find::FindFlags flags;
|
FindFlags flags;
|
||||||
if (settings->value(QLatin1String("Backward"), false).toBool())
|
if (settings->value(QLatin1String("Backward"), false).toBool())
|
||||||
flags |= Find::FindBackward;
|
flags |= FindBackward;
|
||||||
if (settings->value(QLatin1String("CaseSensitively"), false).toBool())
|
if (settings->value(QLatin1String("CaseSensitively"), false).toBool())
|
||||||
flags |= Find::FindCaseSensitively;
|
flags |= FindCaseSensitively;
|
||||||
if (settings->value(QLatin1String("WholeWords"), false).toBool())
|
if (settings->value(QLatin1String("WholeWords"), false).toBool())
|
||||||
flags |= Find::FindWholeWords;
|
flags |= FindWholeWords;
|
||||||
if (settings->value(QLatin1String("RegularExpression"), false).toBool())
|
if (settings->value(QLatin1String("RegularExpression"), false).toBool())
|
||||||
flags |= Find::FindRegularExpression;
|
flags |= FindRegularExpression;
|
||||||
if (settings->value(QLatin1String("PreserveCase"), false).toBool())
|
if (settings->value(QLatin1String("PreserveCase"), false).toBool())
|
||||||
flags |= Find::FindPreserveCase;
|
flags |= FindPreserveCase;
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
m_findFlags = flags;
|
m_findFlags = flags;
|
||||||
@@ -734,7 +734,7 @@ void FindToolBar::setUseFakeVim(bool on)
|
|||||||
m_useFakeVim = on;
|
m_useFakeVim = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setFindFlag(Find::FindFlag flag, bool enabled)
|
void FindToolBar::setFindFlag(FindFlag flag, bool enabled)
|
||||||
{
|
{
|
||||||
bool hasFlag = hasFindFlag(flag);
|
bool hasFlag = hasFindFlag(flag);
|
||||||
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
||||||
@@ -743,36 +743,36 @@ void FindToolBar::setFindFlag(Find::FindFlag flag, bool enabled)
|
|||||||
m_findFlags |= flag;
|
m_findFlags |= flag;
|
||||||
else
|
else
|
||||||
m_findFlags &= ~flag;
|
m_findFlags &= ~flag;
|
||||||
if (flag != Find::FindBackward)
|
if (flag != FindBackward)
|
||||||
findFlagsChanged();
|
findFlagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindToolBar::hasFindFlag(Find::FindFlag flag)
|
bool FindToolBar::hasFindFlag(FindFlag flag)
|
||||||
{
|
{
|
||||||
return m_findFlags & flag;
|
return m_findFlags & flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setCaseSensitive(bool sensitive)
|
void FindToolBar::setCaseSensitive(bool sensitive)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindCaseSensitively, sensitive);
|
setFindFlag(FindCaseSensitively, sensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setWholeWord(bool wholeOnly)
|
void FindToolBar::setWholeWord(bool wholeOnly)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindWholeWords, wholeOnly);
|
setFindFlag(FindWholeWords, wholeOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setRegularExpressions(bool regexp)
|
void FindToolBar::setRegularExpressions(bool regexp)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindRegularExpression, regexp);
|
setFindFlag(FindRegularExpression, regexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setPreserveCase(bool preserveCase)
|
void FindToolBar::setPreserveCase(bool preserveCase)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindPreserveCase, preserveCase);
|
setFindFlag(FindPreserveCase, preserveCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setBackward(bool backward)
|
void FindToolBar::setBackward(bool backward)
|
||||||
{
|
{
|
||||||
setFindFlag(Find::FindBackward, backward);
|
setFindFlag(FindBackward, backward);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,9 +103,9 @@ private:
|
|||||||
void installEventFilters();
|
void installEventFilters();
|
||||||
void invokeClearResults();
|
void invokeClearResults();
|
||||||
bool setFocusToCurrentFindSupport();
|
bool setFocusToCurrentFindSupport();
|
||||||
void setFindFlag(Find::FindFlag flag, bool enabled);
|
void setFindFlag(FindFlag flag, bool enabled);
|
||||||
bool hasFindFlag(Find::FindFlag flag);
|
bool hasFindFlag(FindFlag flag);
|
||||||
Find::FindFlags effectiveFindFlags();
|
FindFlags effectiveFindFlags();
|
||||||
Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
|
Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
|
||||||
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
@@ -137,7 +137,7 @@ private:
|
|||||||
QAction *m_wholeWordAction;
|
QAction *m_wholeWordAction;
|
||||||
QAction *m_regularExpressionAction;
|
QAction *m_regularExpressionAction;
|
||||||
QAction *m_preserveCaseAction;
|
QAction *m_preserveCaseAction;
|
||||||
Find::FindFlags m_findFlags;
|
FindFlags m_findFlags;
|
||||||
|
|
||||||
QTimer m_findIncrementalTimer;
|
QTimer m_findIncrementalTimer;
|
||||||
QTimer m_findStepTimer;
|
QTimer m_findStepTimer;
|
||||||
|
|||||||
@@ -124,19 +124,19 @@ void FindToolWindow::updateButtonStates()
|
|||||||
m_configWidget->setEnabled(filterEnabled);
|
m_configWidget->setEnabled(filterEnabled);
|
||||||
|
|
||||||
m_ui.matchCase->setEnabled(filterEnabled
|
m_ui.matchCase->setEnabled(filterEnabled
|
||||||
&& (m_currentFilter->supportedFindFlags() & Find::FindCaseSensitively));
|
&& (m_currentFilter->supportedFindFlags() & FindCaseSensitively));
|
||||||
m_ui.wholeWords->setEnabled(filterEnabled
|
m_ui.wholeWords->setEnabled(filterEnabled
|
||||||
&& (m_currentFilter->supportedFindFlags() & Find::FindWholeWords));
|
&& (m_currentFilter->supportedFindFlags() & FindWholeWords));
|
||||||
m_ui.regExp->setEnabled(filterEnabled
|
m_ui.regExp->setEnabled(filterEnabled
|
||||||
&& (m_currentFilter->supportedFindFlags() & Find::FindRegularExpression));
|
&& (m_currentFilter->supportedFindFlags() & FindRegularExpression));
|
||||||
m_ui.searchTerm->setEnabled(filterEnabled);
|
m_ui.searchTerm->setEnabled(filterEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolWindow::updateFindFlags()
|
void FindToolWindow::updateFindFlags()
|
||||||
{
|
{
|
||||||
m_ui.matchCase->setChecked(m_plugin->hasFindFlag(Find::FindCaseSensitively));
|
m_ui.matchCase->setChecked(m_plugin->hasFindFlag(FindCaseSensitively));
|
||||||
m_ui.wholeWords->setChecked(m_plugin->hasFindFlag(Find::FindWholeWords));
|
m_ui.wholeWords->setChecked(m_plugin->hasFindFlag(FindWholeWords));
|
||||||
m_ui.regExp->setChecked(m_plugin->hasFindFlag(Find::FindRegularExpression));
|
m_ui.regExp->setChecked(m_plugin->hasFindFlag(FindRegularExpression));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -215,22 +215,25 @@
|
|||||||
The default is Find::FindCaseSensitively, Find::FindRegularExpression
|
The default is Find::FindCaseSensitively, Find::FindRegularExpression
|
||||||
and Find::FindWholeWords
|
and Find::FindWholeWords
|
||||||
*/
|
*/
|
||||||
Find::FindFlags Find::IFindFilter::supportedFindFlags() const
|
|
||||||
|
namespace Find {
|
||||||
|
|
||||||
|
FindFlags IFindFilter::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return Find::FindCaseSensitively
|
return FindCaseSensitively
|
||||||
| Find::FindRegularExpression | Find::FindWholeWords;
|
| FindRegularExpression | FindWholeWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap Find::IFindFilter::pixmapForFindFlags(Find::FindFlags flags)
|
QPixmap IFindFilter::pixmapForFindFlags(FindFlags flags)
|
||||||
{
|
{
|
||||||
static const QPixmap casesensitiveIcon = QPixmap(QLatin1String(":/find/images/casesensitively.png"));
|
static const QPixmap casesensitiveIcon = QPixmap(QLatin1String(":/find/images/casesensitively.png"));
|
||||||
static const QPixmap regexpIcon = QPixmap(QLatin1String(":/find/images/regexp.png"));
|
static const QPixmap regexpIcon = QPixmap(QLatin1String(":/find/images/regexp.png"));
|
||||||
static const QPixmap wholewordsIcon = QPixmap(QLatin1String(":/find/images/wholewords.png"));
|
static const QPixmap wholewordsIcon = QPixmap(QLatin1String(":/find/images/wholewords.png"));
|
||||||
static const QPixmap preservecaseIcon = QPixmap(QLatin1String(":/find/images/preservecase.png"));
|
static const QPixmap preservecaseIcon = QPixmap(QLatin1String(":/find/images/preservecase.png"));
|
||||||
bool casesensitive = flags & Find::FindCaseSensitively;
|
bool casesensitive = flags & FindCaseSensitively;
|
||||||
bool wholewords = flags & Find::FindWholeWords;
|
bool wholewords = flags & FindWholeWords;
|
||||||
bool regexp = flags & Find::FindRegularExpression;
|
bool regexp = flags & FindRegularExpression;
|
||||||
bool preservecase = flags & Find::FindPreserveCase;
|
bool preservecase = flags & FindPreserveCase;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
if (casesensitive) width += 6;
|
if (casesensitive) width += 6;
|
||||||
if (wholewords) width += 6;
|
if (wholewords) width += 6;
|
||||||
@@ -259,16 +262,16 @@ QPixmap Find::IFindFilter::pixmapForFindFlags(Find::FindFlags flags)
|
|||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Find::IFindFilter::descriptionForFindFlags(Find::FindFlags flags)
|
QString IFindFilter::descriptionForFindFlags(FindFlags flags)
|
||||||
{
|
{
|
||||||
QStringList flagStrings;
|
QStringList flagStrings;
|
||||||
if (flags & Find::FindCaseSensitively)
|
if (flags & FindCaseSensitively)
|
||||||
flagStrings.append(tr("Case sensitive"));
|
flagStrings.append(tr("Case sensitive"));
|
||||||
if (flags & Find::FindWholeWords)
|
if (flags & FindWholeWords)
|
||||||
flagStrings.append(tr("Whole words"));
|
flagStrings.append(tr("Whole words"));
|
||||||
if (flags & Find::FindRegularExpression)
|
if (flags & FindRegularExpression)
|
||||||
flagStrings.append(tr("Regular expressions"));
|
flagStrings.append(tr("Regular expressions"));
|
||||||
if (flags & Find::FindPreserveCase)
|
if (flags & FindPreserveCase)
|
||||||
flagStrings.append(tr("Preserve case"));
|
flagStrings.append(tr("Preserve case"));
|
||||||
QString description = tr("Flags: %1");
|
QString description = tr("Flags: %1");
|
||||||
if (flagStrings.isEmpty())
|
if (flagStrings.isEmpty())
|
||||||
@@ -277,3 +280,5 @@ QString Find::IFindFilter::descriptionForFindFlags(Find::FindFlags flags)
|
|||||||
description = description.arg(flagStrings.join(tr(", ")));
|
description = description.arg(flagStrings.join(tr(", ")));
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Find
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public:
|
|||||||
virtual bool isReplaceSupported() const { return false; }
|
virtual bool isReplaceSupported() const { return false; }
|
||||||
virtual FindFlags supportedFindFlags() const;
|
virtual FindFlags supportedFindFlags() const;
|
||||||
|
|
||||||
virtual void findAll(const QString &txt, Find::FindFlags findFlags) = 0;
|
virtual void findAll(const QString &txt, FindFlags findFlags) = 0;
|
||||||
virtual void replaceAll(const QString &txt, Find::FindFlags findFlags)
|
virtual void replaceAll(const QString &txt, FindFlags findFlags)
|
||||||
{ Q_UNUSED(txt) Q_UNUSED(findFlags) }
|
{ Q_UNUSED(txt) Q_UNUSED(findFlags) }
|
||||||
|
|
||||||
virtual QWidget *createConfigWidget() { return 0; }
|
virtual QWidget *createConfigWidget() { return 0; }
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace Find::Internal;
|
using namespace Find::Internal;
|
||||||
|
|
||||||
SearchResultTreeItem::SearchResultTreeItem(const Find::SearchResultItem &item,
|
SearchResultTreeItem::SearchResultTreeItem(const SearchResultItem &item,
|
||||||
SearchResultTreeItem *parent)
|
SearchResultTreeItem *parent)
|
||||||
: item(item),
|
: item(item),
|
||||||
m_parent(parent),
|
m_parent(parent),
|
||||||
@@ -115,7 +115,7 @@ int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeIt
|
|||||||
return insertionPosition - m_children.begin();
|
return insertionPosition - m_children.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SearchResultTreeItem::insertionIndex(const Find::SearchResultItem &item, SearchResultTreeItem **existingItem) const
|
int SearchResultTreeItem::insertionIndex(const SearchResultItem &item, SearchResultTreeItem **existingItem) const
|
||||||
{
|
{
|
||||||
return insertionIndex(item.text, existingItem);
|
return insertionIndex(item.text, existingItem);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ void SearchResultTreeItem::insertChild(int index, SearchResultTreeItem *child)
|
|||||||
m_children.insert(index, child);
|
m_children.insert(index, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultTreeItem::insertChild(int index, const Find::SearchResultItem &item)
|
void SearchResultTreeItem::insertChild(int index, const SearchResultItem &item)
|
||||||
{
|
{
|
||||||
SearchResultTreeItem *child = new SearchResultTreeItem(item, this);
|
SearchResultTreeItem *child = new SearchResultTreeItem(item, this);
|
||||||
if (isUserCheckable()) {
|
if (isUserCheckable()) {
|
||||||
@@ -135,7 +135,7 @@ void SearchResultTreeItem::insertChild(int index, const Find::SearchResultItem &
|
|||||||
insertChild(index, child);
|
insertChild(index, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultTreeItem::appendChild(const Find::SearchResultItem &item)
|
void SearchResultTreeItem::appendChild(const SearchResultItem &item)
|
||||||
{
|
{
|
||||||
insertChild(m_children.count(), item);
|
insertChild(m_children.count(), item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void SearchResultTreeView::clear()
|
|||||||
m_model->clear();
|
m_model->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultTreeView::addResults(const QList<Find::SearchResultItem> &items, Find::SearchResult::AddMode mode)
|
void SearchResultTreeView::addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode)
|
||||||
{
|
{
|
||||||
QList<QModelIndex> addedParents = m_model->addResults(items, mode);
|
QList<QModelIndex> addedParents = m_model->addResults(items, mode);
|
||||||
if (m_autoExpandResults && !addedParents.isEmpty()) {
|
if (m_autoExpandResults && !addedParents.isEmpty()) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
void setTextEditorFont(const QFont &font, const SearchResultColor color);
|
void setTextEditorFont(const QFont &font, const SearchResultColor color);
|
||||||
|
|
||||||
SearchResultTreeModel *model() const;
|
SearchResultTreeModel *model() const;
|
||||||
void addResults(const QList<Find::SearchResultItem> &items, SearchResult::AddMode mode);
|
void addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void jumpToSearchResult(const SearchResultItem &item);
|
void jumpToSearchResult(const SearchResultItem &item);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
|||||||
m_preserveCaseCheck->setEnabled(false);
|
m_preserveCaseCheck->setEnabled(false);
|
||||||
|
|
||||||
if (FindPlugin * plugin = FindPlugin::instance()) {
|
if (FindPlugin * plugin = FindPlugin::instance()) {
|
||||||
m_preserveCaseCheck->setChecked(plugin->hasFindFlag(Find::FindPreserveCase));
|
m_preserveCaseCheck->setChecked(plugin->hasFindFlag(FindPreserveCase));
|
||||||
connect(m_preserveCaseCheck, SIGNAL(clicked(bool)), plugin, SLOT(setPreserveCase(bool)));
|
connect(m_preserveCaseCheck, SIGNAL(clicked(bool)), plugin, SLOT(setPreserveCase(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ enum FindFlag {
|
|||||||
Q_DECLARE_FLAGS(FindFlags, FindFlag)
|
Q_DECLARE_FLAGS(FindFlags, FindFlag)
|
||||||
|
|
||||||
// defined in findplugin.cpp
|
// defined in findplugin.cpp
|
||||||
QTextDocument::FindFlags FIND_EXPORT textDocumentFlagsForFindFlags(Find::FindFlags flags);
|
QTextDocument::FindFlags FIND_EXPORT textDocumentFlagsForFindFlags(FindFlags flags);
|
||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,9 @@ bool TreeViewFind::supportsReplace() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::FindFlags TreeViewFind::supportedFindFlags() const
|
FindFlags TreeViewFind::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return Find::FindBackward | Find::FindCaseSensitively
|
return FindBackward | FindCaseSensitively | FindRegularExpression | FindWholeWords;
|
||||||
| Find::FindRegularExpression | Find::FindWholeWords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeViewFind::resetIncrementalSearch()
|
void TreeViewFind::resetIncrementalSearch()
|
||||||
@@ -96,8 +95,7 @@ void TreeViewFind::highlightAll(const QString &/*txt*/, FindFlags /*findFlags*/)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result TreeViewFind::findIncremental(const QString &txt,
|
IFindSupport::Result TreeViewFind::findIncremental(const QString &txt, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
if (!d->m_incrementalFindStart.isValid()) {
|
if (!d->m_incrementalFindStart.isValid()) {
|
||||||
d->m_incrementalFindStart = d->m_view->currentIndex();
|
d->m_incrementalFindStart = d->m_view->currentIndex();
|
||||||
@@ -114,8 +112,7 @@ IFindSupport::Result TreeViewFind::findIncremental(const QString &txt,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result TreeViewFind::findStep(const QString &txt,
|
IFindSupport::Result TreeViewFind::findStep(const QString &txt, FindFlags findFlags)
|
||||||
Find::FindFlags findFlags)
|
|
||||||
{
|
{
|
||||||
bool wrapped = false;
|
bool wrapped = false;
|
||||||
IFindSupport::Result result = find(txt, findFlags, false/*startFromNext*/,
|
IFindSupport::Result result = find(txt, findFlags, false/*startFromNext*/,
|
||||||
@@ -130,7 +127,7 @@ IFindSupport::Result TreeViewFind::findStep(const QString &txt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result TreeViewFind::find(const QString &searchTxt,
|
IFindSupport::Result TreeViewFind::find(const QString &searchTxt,
|
||||||
Find::FindFlags findFlags,
|
FindFlags findFlags,
|
||||||
bool startFromCurrentIndex,
|
bool startFromCurrentIndex,
|
||||||
bool *wrapped)
|
bool *wrapped)
|
||||||
{
|
{
|
||||||
@@ -139,8 +136,7 @@ IFindSupport::Result TreeViewFind::find(const QString &searchTxt,
|
|||||||
if (searchTxt.isEmpty())
|
if (searchTxt.isEmpty())
|
||||||
return IFindSupport::NotFound;
|
return IFindSupport::NotFound;
|
||||||
|
|
||||||
QTextDocument::FindFlags flags =
|
QTextDocument::FindFlags flags = textDocumentFlagsForFindFlags(findFlags);
|
||||||
Find::textDocumentFlagsForFindFlags(findFlags);
|
|
||||||
QModelIndex resultIndex;
|
QModelIndex resultIndex;
|
||||||
QModelIndex currentIndex = d->m_view->currentIndex();
|
QModelIndex currentIndex = d->m_view->currentIndex();
|
||||||
QModelIndex index = currentIndex;
|
QModelIndex index = currentIndex;
|
||||||
@@ -160,8 +156,8 @@ IFindSupport::Result TreeViewFind::find(const QString &searchTxt,
|
|||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
const QString &text = d->m_view->model()->data(
|
const QString &text = d->m_view->model()->data(
|
||||||
index, d->m_role).toString();
|
index, d->m_role).toString();
|
||||||
if (findFlags & Find::FindRegularExpression) {
|
if (findFlags & FindRegularExpression) {
|
||||||
bool sensitive = (findFlags & Find::FindCaseSensitively);
|
bool sensitive = (findFlags & FindCaseSensitively);
|
||||||
QRegExp searchExpr = QRegExp(searchTxt,
|
QRegExp searchExpr = QRegExp(searchTxt,
|
||||||
(sensitive ? Qt::CaseSensitive :
|
(sensitive ? Qt::CaseSensitive :
|
||||||
Qt::CaseInsensitive));
|
Qt::CaseInsensitive));
|
||||||
@@ -172,8 +168,7 @@ IFindSupport::Result TreeViewFind::find(const QString &searchTxt,
|
|||||||
} else {
|
} else {
|
||||||
QTextDocument doc(text);
|
QTextDocument doc(text);
|
||||||
if (!doc.find(searchTxt, 0,
|
if (!doc.find(searchTxt, 0,
|
||||||
flags & (Find::FindCaseSensitively |
|
flags & (FindCaseSensitively | FindWholeWords)).isNull()
|
||||||
Find::FindWholeWords)).isNull()
|
|
||||||
&& d->m_view->model()->flags(index) & Qt::ItemIsSelectable
|
&& d->m_view->model()->flags(index) & Qt::ItemIsSelectable
|
||||||
&& (index.row() != currentRow || index.parent() != currentIndex.parent()))
|
&& (index.row() != currentRow || index.parent() != currentIndex.parent()))
|
||||||
resultIndex = index;
|
resultIndex = index;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ QT_END_NAMESPACE
|
|||||||
namespace Find {
|
namespace Find {
|
||||||
class ItemModelFindPrivate;
|
class ItemModelFindPrivate;
|
||||||
|
|
||||||
class FIND_EXPORT TreeViewFind : public Find::IFindSupport
|
class FIND_EXPORT TreeViewFind : public IFindSupport
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -48,18 +48,18 @@ public:
|
|||||||
virtual ~TreeViewFind();
|
virtual ~TreeViewFind();
|
||||||
|
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
Find::FindFlags supportedFindFlags() const;
|
FindFlags supportedFindFlags() const;
|
||||||
void resetIncrementalSearch();
|
void resetIncrementalSearch();
|
||||||
void clearResults();
|
void clearResults();
|
||||||
QString currentFindString() const;
|
QString currentFindString() const;
|
||||||
QString completedFindString() const;
|
QString completedFindString() const;
|
||||||
|
|
||||||
virtual void highlightAll(const QString &txt, FindFlags findFlags);
|
virtual void highlightAll(const QString &txt, FindFlags findFlags);
|
||||||
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
Result findIncremental(const QString &txt, FindFlags findFlags);
|
||||||
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
Result findStep(const QString &txt, FindFlags findFlags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result find(const QString &txt, Find::FindFlags findFlags,
|
Result find(const QString &txt, FindFlags findFlags,
|
||||||
bool startFromCurrentIndex, bool *wrapped);
|
bool startFromCurrentIndex, bool *wrapped);
|
||||||
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped) const;
|
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped) const;
|
||||||
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped) const;
|
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped) const;
|
||||||
|
|||||||
@@ -1229,7 +1229,7 @@ void HelpPlugin::slotReportBug()
|
|||||||
void HelpPlugin::openFindToolBar()
|
void HelpPlugin::openFindToolBar()
|
||||||
{
|
{
|
||||||
if (Find::FindPlugin::instance())
|
if (Find::FindPlugin::instance())
|
||||||
Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForward);
|
Find::FindPlugin::instance()->openFindToolBar(Find::FindPlugin::FindForwardDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::onSideBarVisibilityChanged()
|
void HelpPlugin::onSideBarVisibilityChanged()
|
||||||
|
|||||||
Reference in New Issue
Block a user