forked from qt-creator/qt-creator
Move find flags from IFindSupport to more accessible place.
For later use in IFindFilter.
This commit is contained in:
@@ -72,9 +72,9 @@ public:
|
|||||||
~BinEditorFind() {}
|
~BinEditorFind() {}
|
||||||
|
|
||||||
bool supportsReplace() const { return false; }
|
bool supportsReplace() const { return false; }
|
||||||
IFindSupport::FindFlags supportedFindFlags() const
|
Find::FindFlags supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return IFindSupport::FindBackward | IFindSupport::FindCaseSensitively;
|
return Find::FindBackward | Find::FindCaseSensitively;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetIncrementalSearch()
|
void resetIncrementalSearch()
|
||||||
@@ -87,16 +87,16 @@ public:
|
|||||||
QString completedFindString() const { return QString(); }
|
QString completedFindString() const { return QString(); }
|
||||||
|
|
||||||
|
|
||||||
int find(const QByteArray &pattern, int pos, Find::IFindSupport::FindFlags findFlags) {
|
int find(const QByteArray &pattern, int pos, Find::FindFlags findFlags) {
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
m_editor->setCursorPosition(pos);
|
m_editor->setCursorPosition(pos);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_editor->find(pattern, pos, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
return m_editor->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags) {
|
Result findIncremental(const QString &txt, Find::FindFlags findFlags) {
|
||||||
QByteArray pattern = txt.toLatin1();
|
QByteArray pattern = txt.toLatin1();
|
||||||
if (pattern != m_lastPattern)
|
if (pattern != m_lastPattern)
|
||||||
resetIncrementalSearch(); // Because we don't search for nibbles.
|
resetIncrementalSearch(); // Because we don't search for nibbles.
|
||||||
@@ -109,13 +109,13 @@ public:
|
|||||||
Result result;
|
Result result;
|
||||||
if (found >= 0) {
|
if (found >= 0) {
|
||||||
result = Found;
|
result = Found;
|
||||||
m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
m_editor->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
m_contPos = -1;
|
m_contPos = -1;
|
||||||
} else {
|
} else {
|
||||||
if (found == -2) {
|
if (found == -2) {
|
||||||
result = NotYetFound;
|
result = NotYetFound;
|
||||||
m_contPos +=
|
m_contPos +=
|
||||||
findFlags & Find::IFindSupport::FindBackward
|
findFlags & Find::FindBackward
|
||||||
? -BinEditor::SearchStride : BinEditor::SearchStride;
|
? -BinEditor::SearchStride : BinEditor::SearchStride;
|
||||||
} else {
|
} else {
|
||||||
result = NotFound;
|
result = NotFound;
|
||||||
@@ -126,12 +126,12 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags) {
|
Result findStep(const QString &txt, Find::FindFlags findFlags) {
|
||||||
QByteArray pattern = txt.toLatin1();
|
QByteArray pattern = txt.toLatin1();
|
||||||
bool wasReset = (m_incrementalStartPos < 0);
|
bool wasReset = (m_incrementalStartPos < 0);
|
||||||
if (m_contPos == -1) {
|
if (m_contPos == -1) {
|
||||||
m_contPos = m_editor->cursorPosition();
|
m_contPos = m_editor->cursorPosition();
|
||||||
if (findFlags & Find::IFindSupport::FindBackward)
|
if (findFlags & Find::FindBackward)
|
||||||
m_contPos = m_editor->selectionStart()-1;
|
m_contPos = m_editor->selectionStart()-1;
|
||||||
}
|
}
|
||||||
int found = find(pattern, m_contPos, findFlags);
|
int found = find(pattern, m_contPos, findFlags);
|
||||||
@@ -141,10 +141,10 @@ public:
|
|||||||
m_incrementalStartPos = found;
|
m_incrementalStartPos = found;
|
||||||
m_contPos = -1;
|
m_contPos = -1;
|
||||||
if (wasReset)
|
if (wasReset)
|
||||||
m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
m_editor->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
} else if (found == -2) {
|
} else if (found == -2) {
|
||||||
result = NotYetFound;
|
result = NotYetFound;
|
||||||
m_contPos += findFlags & Find::IFindSupport::FindBackward
|
m_contPos += findFlags & Find::FindBackward
|
||||||
? -BinEditor::SearchStride : BinEditor::SearchStride;
|
? -BinEditor::SearchStride : BinEditor::SearchStride;
|
||||||
} else {
|
} else {
|
||||||
result = NotFound;
|
result = NotFound;
|
||||||
@@ -155,11 +155,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void replace(const QString &, const QString &,
|
void replace(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags) { }
|
Find::FindFlags) { }
|
||||||
bool replaceStep(const QString &, const QString &,
|
bool replaceStep(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags) { return false;}
|
Find::FindFlags) { return false;}
|
||||||
int replaceAll(const QString &, const QString &,
|
int replaceAll(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags) { return 0; }
|
Find::FindFlags) { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BinEditor *m_editor;
|
BinEditor *m_editor;
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ bool BaseTextFind::supportsReplace() const
|
|||||||
return !isReadOnly();
|
return !isReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::FindFlags BaseTextFind::supportedFindFlags() const
|
Find::FindFlags BaseTextFind::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return IFindSupport::FindBackward | IFindSupport::FindCaseSensitively
|
return Find::FindBackward | Find::FindCaseSensitively
|
||||||
| IFindSupport::FindRegularExpression | IFindSupport::FindWholeWords;
|
| Find::FindRegularExpression | Find::FindWholeWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::resetIncrementalSearch()
|
void BaseTextFind::resetIncrementalSearch()
|
||||||
@@ -131,7 +131,7 @@ QString BaseTextFind::completedFindString() const
|
|||||||
return cursor.selectedText();
|
return cursor.selectedText();
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (m_incrementalStartPos < 0)
|
if (m_incrementalStartPos < 0)
|
||||||
@@ -145,7 +145,7 @@ IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, IFindSupp
|
|||||||
return found ? Found : NotFound;
|
return found ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result BaseTextFind::findStep(const QString &txt, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result BaseTextFind::findStep(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
bool found = find(txt, findFlags, textCursor());
|
bool found = find(txt, findFlags, textCursor());
|
||||||
if (found)
|
if (found)
|
||||||
@@ -154,40 +154,40 @@ IFindSupport::Result BaseTextFind::findStep(const QString &txt, IFindSupport::Fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::replace(const QString &before, const QString &after,
|
void BaseTextFind::replace(const QString &before, const QString &after,
|
||||||
IFindSupport::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,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
bool usesRegExp = (findFlags & IFindSupport::FindRegularExpression);
|
bool usesRegExp = (findFlags & Find::FindRegularExpression);
|
||||||
QRegExp regexp(before,
|
QRegExp regexp(before,
|
||||||
(findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive,
|
(findFlags & Find::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())) {
|
||||||
QString realAfter = usesRegExp ? Utils::expandRegExpReplacement(after, regexp.capturedTexts()) : after;
|
QString realAfter = usesRegExp ? Utils::expandRegExpReplacement(after, regexp.capturedTexts()) : after;
|
||||||
int start = cursor.selectionStart();
|
int start = cursor.selectionStart();
|
||||||
cursor.insertText(realAfter);
|
cursor.insertText(realAfter);
|
||||||
if ((findFlags&IFindSupport::FindBackward) != 0)
|
if ((findFlags&Find::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,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
QTextCursor cursor = replaceInternal(before, after, findFlags);
|
||||||
return find(before, findFlags, cursor);
|
return find(before, findFlags, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor editCursor = textCursor();
|
QTextCursor editCursor = textCursor();
|
||||||
if (!m_findScopeStart.isNull())
|
if (!m_findScopeStart.isNull())
|
||||||
@@ -196,11 +196,11 @@ 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 & IFindSupport::FindRegularExpression);
|
bool usesRegExp = (findFlags & Find::FindRegularExpression);
|
||||||
QRegExp regexp(before);
|
QRegExp regexp(before);
|
||||||
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
|
||||||
regexp.setCaseSensitivity((findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
regexp.setCaseSensitivity((findFlags & Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
QTextCursor found = findOne(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
QTextCursor found = findOne(regexp, editCursor, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
while (!found.isNull() && found.selectionStart() < found.selectionEnd()
|
while (!found.isNull() && found.selectionStart() < found.selectionEnd()
|
||||||
&& inScope(found.selectionStart(), found.selectionEnd())) {
|
&& inScope(found.selectionStart(), found.selectionEnd())) {
|
||||||
++count;
|
++count;
|
||||||
@@ -209,14 +209,14 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
|||||||
regexp.exactMatch(found.selectedText());
|
regexp.exactMatch(found.selectedText());
|
||||||
QString realAfter = usesRegExp ? Utils::expandRegExpReplacement(after, regexp.capturedTexts()) : after;
|
QString realAfter = usesRegExp ? Utils::expandRegExpReplacement(after, regexp.capturedTexts()) : after;
|
||||||
editCursor.insertText(realAfter);
|
editCursor.insertText(realAfter);
|
||||||
found = findOne(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, editCursor, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
}
|
}
|
||||||
editCursor.endEditBlock();
|
editCursor.endEditBlock();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextFind::find(const QString &txt,
|
bool BaseTextFind::find(const QString &txt,
|
||||||
IFindSupport::FindFlags findFlags,
|
Find::FindFlags findFlags,
|
||||||
QTextCursor start)
|
QTextCursor start)
|
||||||
{
|
{
|
||||||
if (txt.isEmpty()) {
|
if (txt.isEmpty()) {
|
||||||
@@ -224,19 +224,19 @@ bool BaseTextFind::find(const QString &txt,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
QRegExp regexp(txt);
|
QRegExp regexp(txt);
|
||||||
regexp.setPatternSyntax((findFlags&IFindSupport::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
|
regexp.setPatternSyntax((findFlags&Find::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
|
||||||
regexp.setCaseSensitivity((findFlags&IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
regexp.setCaseSensitivity((findFlags&Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
QTextCursor found = findOne(regexp, start, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
QTextCursor found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
|
|
||||||
if (!m_findScopeStart.isNull()) {
|
if (!m_findScopeStart.isNull()) {
|
||||||
|
|
||||||
// scoped
|
// scoped
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
||||||
if ((findFlags&IFindSupport::FindBackward) == 0)
|
if ((findFlags&Find::FindBackward) == 0)
|
||||||
start.setPosition(m_findScopeStart.position());
|
start.setPosition(m_findScopeStart.position());
|
||||||
else
|
else
|
||||||
start.setPosition(m_findScopeEnd.position());
|
start.setPosition(m_findScopeEnd.position());
|
||||||
found = findOne(regexp, start, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -244,11 +244,11 @@ bool BaseTextFind::find(const QString &txt,
|
|||||||
|
|
||||||
// entire document
|
// entire document
|
||||||
if (found.isNull()) {
|
if (found.isNull()) {
|
||||||
if ((findFlags&IFindSupport::FindBackward) == 0)
|
if ((findFlags&Find::FindBackward) == 0)
|
||||||
start.movePosition(QTextCursor::Start);
|
start.movePosition(QTextCursor::Start);
|
||||||
else
|
else
|
||||||
start.movePosition(QTextCursor::End);
|
start.movePosition(QTextCursor::End);
|
||||||
found = findOne(regexp, start, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (found.isNull()) {
|
if (found.isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,34 +52,34 @@ public:
|
|||||||
BaseTextFind(QTextEdit *editor);
|
BaseTextFind(QTextEdit *editor);
|
||||||
|
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
IFindSupport::FindFlags supportedFindFlags() const;
|
Find::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, IFindSupport::FindFlags findFlags);
|
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||||
Result findStep(const QString &txt, IFindSupport::FindFlags findFlags);
|
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||||
void replace(const QString &before, const QString &after,
|
void replace(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
bool replaceStep(const QString &before, const QString &after,
|
bool replaceStep(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
int replaceAll(const QString &before, const QString &after,
|
int replaceAll(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
|
|
||||||
void defineFindScope();
|
void defineFindScope();
|
||||||
void clearFindScope();
|
void clearFindScope();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void highlightAll(const QString &txt, Find::IFindSupport::FindFlags findFlags);
|
void highlightAll(const QString &txt, Find::FindFlags findFlags);
|
||||||
void findScopeChanged(const QTextCursor &start, const QTextCursor &end, int verticalBlockSelection);
|
void findScopeChanged(const QTextCursor &start, const QTextCursor &end, int verticalBlockSelection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool find(const QString &txt,
|
bool find(const QString &txt,
|
||||||
IFindSupport::FindFlags findFlags,
|
Find::FindFlags findFlags,
|
||||||
QTextCursor start);
|
QTextCursor start);
|
||||||
QTextCursor replaceInternal(const QString &before, const QString &after,
|
QTextCursor replaceInternal(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::FindFlags CurrentDocumentFind::supportedFindFlags() const
|
Find::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,40 @@ QString CurrentDocumentFind::completedFindString() const
|
|||||||
return m_currentFind->completedFindString();
|
return m_currentFind->completedFindString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentDocumentFind::highlightAll(const QString &txt, IFindSupport::FindFlags findFlags)
|
void CurrentDocumentFind::highlightAll(const QString &txt, Find::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, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result CurrentDocumentFind::findIncremental(const QString &txt, Find::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, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result CurrentDocumentFind::findStep(const QString &txt, Find::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,
|
||||||
IFindSupport::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,
|
||||||
IFindSupport::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,
|
||||||
IFindSupport::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,21 @@ public:
|
|||||||
void resetIncrementalSearch();
|
void resetIncrementalSearch();
|
||||||
void clearResults();
|
void clearResults();
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
IFindSupport::FindFlags supportedFindFlags() const;
|
Find::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, IFindSupport::FindFlags findFlags);
|
void highlightAll(const QString &txt, Find::FindFlags findFlags);
|
||||||
IFindSupport::Result findIncremental(const QString &txt, IFindSupport::FindFlags findFlags);
|
IFindSupport::Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||||
IFindSupport::Result findStep(const QString &txt, IFindSupport::FindFlags findFlags);
|
IFindSupport::Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||||
void replace(const QString &before, const QString &after,
|
void replace(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
bool replaceStep(const QString &before, const QString &after,
|
bool replaceStep(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
int replaceAll(const QString &before, const QString &after,
|
int replaceAll(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags);
|
Find::FindFlags findFlags);
|
||||||
void defineFindScope();
|
void defineFindScope();
|
||||||
void clearFindScope();
|
void clearFindScope();
|
||||||
void acceptCandidate();
|
void acceptCandidate();
|
||||||
|
|||||||
@@ -361,6 +361,17 @@ QStringListModel *FindPlugin::replaceCompletionModel() const
|
|||||||
return d->m_replaceCompletionModel;
|
return d->m_replaceCompletionModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextDocument::FindFlags textDocumentFlagsForFindFlags(FindFlags flags)
|
||||||
|
{
|
||||||
|
QTextDocument::FindFlags textDocFlags;
|
||||||
|
if (flags & Find::FindBackward)
|
||||||
|
textDocFlags |= QTextDocument::FindBackward;
|
||||||
|
if (flags & Find::FindCaseSensitively)
|
||||||
|
textDocFlags |= QTextDocument::FindCaseSensitively;
|
||||||
|
if (flags & Find::FindWholeWords)
|
||||||
|
textDocFlags |= QTextDocument::FindWholeWords;
|
||||||
|
return textDocFlags;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
|
|||||||
@@ -383,13 +383,13 @@ void FindToolBar::invokeClearResults()
|
|||||||
|
|
||||||
void FindToolBar::invokeFindNext()
|
void FindToolBar::invokeFindNext()
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, false);
|
setFindFlag(Find::FindBackward, false);
|
||||||
invokeFindStep();
|
invokeFindStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::invokeFindPrevious()
|
void FindToolBar::invokeFindPrevious()
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, true);
|
setFindFlag(Find::FindBackward, true);
|
||||||
invokeFindStep();
|
invokeFindStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ QString FindToolBar::getReplaceText()
|
|||||||
void FindToolBar::setFindText(const QString &text)
|
void FindToolBar::setFindText(const QString &text)
|
||||||
{
|
{
|
||||||
disconnect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental()));
|
disconnect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental()));
|
||||||
if (hasFindFlag(IFindSupport::FindRegularExpression))
|
if (hasFindFlag(Find::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);
|
||||||
@@ -448,7 +448,7 @@ void FindToolBar::invokeFindIncremental()
|
|||||||
|
|
||||||
void FindToolBar::invokeReplace()
|
void FindToolBar::invokeReplace()
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, false);
|
setFindFlag(Find::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());
|
||||||
@@ -458,13 +458,13 @@ void FindToolBar::invokeReplace()
|
|||||||
|
|
||||||
void FindToolBar::invokeReplaceNext()
|
void FindToolBar::invokeReplaceNext()
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, false);
|
setFindFlag(Find::FindBackward, false);
|
||||||
invokeReplaceStep();
|
invokeReplaceStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::invokeReplacePrevious()
|
void FindToolBar::invokeReplacePrevious()
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, true);
|
setFindFlag(Find::FindBackward, true);
|
||||||
invokeReplaceStep();
|
invokeReplaceStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,10 +524,10 @@ void FindToolBar::findFlagsChanged()
|
|||||||
|
|
||||||
void FindToolBar::updateIcons()
|
void FindToolBar::updateIcons()
|
||||||
{
|
{
|
||||||
IFindSupport::FindFlags effectiveFlags = effectiveFindFlags();
|
Find::FindFlags effectiveFlags = effectiveFindFlags();
|
||||||
bool casesensitive = effectiveFlags & IFindSupport::FindCaseSensitively;
|
bool casesensitive = effectiveFlags & Find::FindCaseSensitively;
|
||||||
bool wholewords = effectiveFlags & IFindSupport::FindWholeWords;
|
bool wholewords = effectiveFlags & Find::FindWholeWords;
|
||||||
bool regexp = effectiveFlags & IFindSupport::FindRegularExpression;
|
bool regexp = effectiveFlags & Find::FindRegularExpression;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
if (casesensitive) width += 6;
|
if (casesensitive) width += 6;
|
||||||
if (wholewords) width += 6;
|
if (wholewords) width += 6;
|
||||||
@@ -557,33 +557,33 @@ void FindToolBar::updateIcons()
|
|||||||
m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap);
|
m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::FindFlags FindToolBar::effectiveFindFlags()
|
Find::FindFlags FindToolBar::effectiveFindFlags()
|
||||||
{
|
{
|
||||||
IFindSupport::FindFlags supportedFlags;
|
Find::FindFlags supportedFlags;
|
||||||
if (m_currentDocumentFind->isEnabled())
|
if (m_currentDocumentFind->isEnabled())
|
||||||
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
||||||
else
|
else
|
||||||
supportedFlags = (IFindSupport::FindFlags)0xFFFFFF;
|
supportedFlags = (Find::FindFlags)0xFFFFFF;
|
||||||
return supportedFlags & m_findFlags;
|
return supportedFlags & m_findFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::updateFlagMenus()
|
void FindToolBar::updateFlagMenus()
|
||||||
{
|
{
|
||||||
bool wholeOnly = ((m_findFlags & IFindSupport::FindWholeWords));
|
bool wholeOnly = ((m_findFlags & Find::FindWholeWords));
|
||||||
bool sensitive = ((m_findFlags & IFindSupport::FindCaseSensitively));
|
bool sensitive = ((m_findFlags & Find::FindCaseSensitively));
|
||||||
bool regexp = ((m_findFlags & IFindSupport::FindRegularExpression));
|
bool regexp = ((m_findFlags & Find::FindRegularExpression));
|
||||||
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)
|
||||||
m_caseSensitiveAction->setChecked(sensitive);
|
m_caseSensitiveAction->setChecked(sensitive);
|
||||||
if (m_regularExpressionAction->isChecked() != regexp)
|
if (m_regularExpressionAction->isChecked() != regexp)
|
||||||
m_regularExpressionAction->setChecked(regexp);
|
m_regularExpressionAction->setChecked(regexp);
|
||||||
IFindSupport::FindFlags supportedFlags;
|
Find::FindFlags supportedFlags;
|
||||||
if (m_currentDocumentFind->isEnabled())
|
if (m_currentDocumentFind->isEnabled())
|
||||||
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
supportedFlags = m_currentDocumentFind->supportedFindFlags();
|
||||||
m_wholeWordAction->setEnabled(supportedFlags & IFindSupport::FindWholeWords);
|
m_wholeWordAction->setEnabled(supportedFlags & Find::FindWholeWords);
|
||||||
m_caseSensitiveAction->setEnabled(supportedFlags & IFindSupport::FindCaseSensitively);
|
m_caseSensitiveAction->setEnabled(supportedFlags & Find::FindCaseSensitively);
|
||||||
m_regularExpressionAction->setEnabled(supportedFlags & IFindSupport::FindRegularExpression);
|
m_regularExpressionAction->setEnabled(supportedFlags & Find::FindRegularExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindToolBar::setFocusToCurrentFindSupport()
|
bool FindToolBar::setFocusToCurrentFindSupport()
|
||||||
@@ -660,10 +660,10 @@ void FindToolBar::writeSettings()
|
|||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup("Find");
|
settings->beginGroup("Find");
|
||||||
settings->beginGroup("FindToolBar");
|
settings->beginGroup("FindToolBar");
|
||||||
settings->setValue("Backward", QVariant((m_findFlags & IFindSupport::FindBackward) != 0));
|
settings->setValue("Backward", QVariant((m_findFlags & Find::FindBackward) != 0));
|
||||||
settings->setValue("CaseSensitively", QVariant((m_findFlags & IFindSupport::FindCaseSensitively) != 0));
|
settings->setValue("CaseSensitively", QVariant((m_findFlags & Find::FindCaseSensitively) != 0));
|
||||||
settings->setValue("WholeWords", QVariant((m_findFlags & IFindSupport::FindWholeWords) != 0));
|
settings->setValue("WholeWords", QVariant((m_findFlags & Find::FindWholeWords) != 0));
|
||||||
settings->setValue("RegularExpression", QVariant((m_findFlags & IFindSupport::FindRegularExpression) != 0));
|
settings->setValue("RegularExpression", QVariant((m_findFlags & Find::FindRegularExpression) != 0));
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
@@ -673,15 +673,15 @@ void FindToolBar::readSettings()
|
|||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup("Find");
|
settings->beginGroup("Find");
|
||||||
settings->beginGroup("FindToolBar");
|
settings->beginGroup("FindToolBar");
|
||||||
IFindSupport::FindFlags flags;
|
Find::FindFlags flags;
|
||||||
if (settings->value("Backward", false).toBool())
|
if (settings->value("Backward", false).toBool())
|
||||||
flags |= IFindSupport::FindBackward;
|
flags |= Find::FindBackward;
|
||||||
if (settings->value("CaseSensitively", false).toBool())
|
if (settings->value("CaseSensitively", false).toBool())
|
||||||
flags |= IFindSupport::FindCaseSensitively;
|
flags |= Find::FindCaseSensitively;
|
||||||
if (settings->value("WholeWords", false).toBool())
|
if (settings->value("WholeWords", false).toBool())
|
||||||
flags |= IFindSupport::FindWholeWords;
|
flags |= Find::FindWholeWords;
|
||||||
if (settings->value("RegularExpression", false).toBool())
|
if (settings->value("RegularExpression", false).toBool())
|
||||||
flags |= IFindSupport::FindRegularExpression;
|
flags |= Find::FindRegularExpression;
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
m_findFlags = flags;
|
m_findFlags = flags;
|
||||||
@@ -693,7 +693,7 @@ void FindToolBar::setUseFakeVim(bool on)
|
|||||||
m_useFakeVim = on;
|
m_useFakeVim = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setFindFlag(IFindSupport::FindFlag flag, bool enabled)
|
void FindToolBar::setFindFlag(Find::FindFlag flag, bool enabled)
|
||||||
{
|
{
|
||||||
bool hasFlag = hasFindFlag(flag);
|
bool hasFlag = hasFindFlag(flag);
|
||||||
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
||||||
@@ -702,31 +702,31 @@ void FindToolBar::setFindFlag(IFindSupport::FindFlag flag, bool enabled)
|
|||||||
m_findFlags |= flag;
|
m_findFlags |= flag;
|
||||||
else
|
else
|
||||||
m_findFlags &= ~flag;
|
m_findFlags &= ~flag;
|
||||||
if (flag != IFindSupport::FindBackward)
|
if (flag != Find::FindBackward)
|
||||||
findFlagsChanged();
|
findFlagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindToolBar::hasFindFlag(IFindSupport::FindFlag flag)
|
bool FindToolBar::hasFindFlag(Find::FindFlag flag)
|
||||||
{
|
{
|
||||||
return m_findFlags & flag;
|
return m_findFlags & flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setCaseSensitive(bool sensitive)
|
void FindToolBar::setCaseSensitive(bool sensitive)
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindCaseSensitively, sensitive);
|
setFindFlag(Find::FindCaseSensitively, sensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setWholeWord(bool wholeOnly)
|
void FindToolBar::setWholeWord(bool wholeOnly)
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindWholeWords, wholeOnly);
|
setFindFlag(Find::FindWholeWords, wholeOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setRegularExpressions(bool regexp)
|
void FindToolBar::setRegularExpressions(bool regexp)
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindRegularExpression, regexp);
|
setFindFlag(Find::FindRegularExpression, regexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindToolBar::setBackward(bool backward)
|
void FindToolBar::setBackward(bool backward)
|
||||||
{
|
{
|
||||||
setFindFlag(IFindSupport::FindBackward, backward);
|
setFindFlag(Find::FindBackward, backward);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ private:
|
|||||||
void installEventFilters();
|
void installEventFilters();
|
||||||
void invokeClearResults();
|
void invokeClearResults();
|
||||||
bool setFocusToCurrentFindSupport();
|
bool setFocusToCurrentFindSupport();
|
||||||
void setFindFlag(IFindSupport::FindFlag flag, bool enabled);
|
void setFindFlag(Find::FindFlag flag, bool enabled);
|
||||||
bool hasFindFlag(IFindSupport::FindFlag flag);
|
bool hasFindFlag(Find::FindFlag flag);
|
||||||
IFindSupport::FindFlags effectiveFindFlags();
|
Find::FindFlags effectiveFindFlags();
|
||||||
Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
|
Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
|
||||||
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
@@ -128,7 +128,7 @@ private:
|
|||||||
QAction *m_caseSensitiveAction;
|
QAction *m_caseSensitiveAction;
|
||||||
QAction *m_wholeWordAction;
|
QAction *m_wholeWordAction;
|
||||||
QAction *m_regularExpressionAction;
|
QAction *m_regularExpressionAction;
|
||||||
IFindSupport::FindFlags m_findFlags;
|
Find::FindFlags m_findFlags;
|
||||||
|
|
||||||
QPixmap m_casesensitiveIcon;
|
QPixmap m_casesensitiveIcon;
|
||||||
QPixmap m_regexpIcon;
|
QPixmap m_regexpIcon;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#define IFINDSUPPORT_H
|
#define IFINDSUPPORT_H
|
||||||
|
|
||||||
#include "find_global.h"
|
#include "find_global.h"
|
||||||
|
#include "textfindconstants.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
@@ -42,14 +44,6 @@ class FIND_EXPORT IFindSupport : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FindFlag {
|
|
||||||
FindBackward = 0x01,
|
|
||||||
FindCaseSensitively = 0x02,
|
|
||||||
FindWholeWords = 0x04,
|
|
||||||
FindRegularExpression = 0x08
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(FindFlags, FindFlag)
|
|
||||||
|
|
||||||
enum Result { Found, NotFound, NotYetFound };
|
enum Result { Found, NotFound, NotYetFound };
|
||||||
|
|
||||||
IFindSupport() : QObject(0) {}
|
IFindSupport() : QObject(0) {}
|
||||||
@@ -75,18 +69,6 @@ public:
|
|||||||
virtual void defineFindScope(){}
|
virtual void defineFindScope(){}
|
||||||
virtual void clearFindScope(){}
|
virtual void clearFindScope(){}
|
||||||
|
|
||||||
static QTextDocument::FindFlags textDocumentFlagsForFindFlags(IFindSupport::FindFlags flags)
|
|
||||||
{
|
|
||||||
QTextDocument::FindFlags textDocFlags;
|
|
||||||
if (flags&IFindSupport::FindBackward)
|
|
||||||
textDocFlags |= QTextDocument::FindBackward;
|
|
||||||
if (flags&IFindSupport::FindCaseSensitively)
|
|
||||||
textDocFlags |= QTextDocument::FindCaseSensitively;
|
|
||||||
if (flags&IFindSupport::FindWholeWords)
|
|
||||||
textDocFlags |= QTextDocument::FindWholeWords;
|
|
||||||
return textDocFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
};
|
};
|
||||||
@@ -95,6 +77,4 @@ inline void IFindSupport::highlightAll(const QString &, FindFlags) {}
|
|||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Find::IFindSupport::FindFlags)
|
|
||||||
|
|
||||||
#endif // IFINDSUPPORT_H
|
#endif // IFINDSUPPORT_H
|
||||||
|
|||||||
@@ -90,10 +90,10 @@ namespace Internal {
|
|||||||
|
|
||||||
bool supportsReplace() const { return false; }
|
bool supportsReplace() const { return false; }
|
||||||
|
|
||||||
IFindSupport::FindFlags supportedFindFlags() const
|
Find::FindFlags supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return IFindSupport::FindBackward | IFindSupport::FindCaseSensitively
|
return Find::FindBackward | Find::FindCaseSensitively
|
||||||
| IFindSupport::FindRegularExpression | IFindSupport::FindWholeWords;
|
| Find::FindRegularExpression | Find::FindWholeWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetIncrementalSearch()
|
void resetIncrementalSearch()
|
||||||
@@ -113,14 +113,14 @@ namespace Internal {
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void highlightAll(const QString &txt, IFindSupport::FindFlags findFlags)
|
void highlightAll(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
Q_UNUSED(txt)
|
Q_UNUSED(txt)
|
||||||
Q_UNUSED(findFlags)
|
Q_UNUSED(findFlags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result findIncremental(const QString &txt, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result findIncremental(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
if (!m_incrementalFindStart.isValid())
|
if (!m_incrementalFindStart.isValid())
|
||||||
m_incrementalFindStart = m_view->currentIndex();
|
m_incrementalFindStart = m_view->currentIndex();
|
||||||
@@ -128,7 +128,7 @@ namespace Internal {
|
|||||||
return find(txt, findFlags);
|
return find(txt, findFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result findStep(const QString &txt, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result findStep(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
IFindSupport::Result result = find(txt, findFlags);
|
IFindSupport::Result result = find(txt, findFlags);
|
||||||
if (result == IFindSupport::Found)
|
if (result == IFindSupport::Found)
|
||||||
@@ -136,19 +136,19 @@ namespace Internal {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFindSupport::Result find(const QString &txt, IFindSupport::FindFlags findFlags)
|
IFindSupport::Result find(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
if (txt.isEmpty())
|
if (txt.isEmpty())
|
||||||
return IFindSupport::NotFound;
|
return IFindSupport::NotFound;
|
||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
if (findFlags & IFindSupport::FindRegularExpression) {
|
if (findFlags & Find::FindRegularExpression) {
|
||||||
bool sensitive = (findFlags & IFindSupport::FindCaseSensitively);
|
bool sensitive = (findFlags & Find::FindCaseSensitively);
|
||||||
index = m_view->model()->find(QRegExp(txt, (sensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)),
|
index = m_view->model()->find(QRegExp(txt, (sensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)),
|
||||||
m_view->currentIndex(),
|
m_view->currentIndex(),
|
||||||
IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
} else {
|
} else {
|
||||||
index = m_view->model()->find(txt, m_view->currentIndex(),
|
index = m_view->model()->find(txt, m_view->currentIndex(),
|
||||||
IFindSupport::textDocumentFlagsForFindFlags(findFlags));
|
Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
}
|
}
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
m_view->setCurrentIndex(index);
|
m_view->setCurrentIndex(index);
|
||||||
@@ -161,7 +161,7 @@ namespace Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void replace(const QString &before, const QString &after,
|
void replace(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
Q_UNUSED(before)
|
Q_UNUSED(before)
|
||||||
Q_UNUSED(after)
|
Q_UNUSED(after)
|
||||||
@@ -169,7 +169,7 @@ namespace Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool replaceStep(const QString &before, const QString &after,
|
bool replaceStep(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
Q_UNUSED(before)
|
Q_UNUSED(before)
|
||||||
Q_UNUSED(after)
|
Q_UNUSED(after)
|
||||||
@@ -178,7 +178,7 @@ namespace Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int replaceAll(const QString &before, const QString &after,
|
int replaceAll(const QString &before, const QString &after,
|
||||||
IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
Q_UNUSED(before)
|
Q_UNUSED(before)
|
||||||
Q_UNUSED(after)
|
Q_UNUSED(after)
|
||||||
|
|||||||
@@ -30,6 +30,11 @@
|
|||||||
#ifndef TEXTFINDCONSTANTS_H
|
#ifndef TEXTFINDCONSTANTS_H
|
||||||
#define TEXTFINDCONSTANTS_H
|
#define TEXTFINDCONSTANTS_H
|
||||||
|
|
||||||
|
#include "find_global.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFlags>
|
||||||
|
#include <QtGui/QTextDocument>
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
@@ -56,6 +61,20 @@ const char * const REGULAR_EXPRESSIONS="Find.RegularExpressions";
|
|||||||
const char * const TASK_SEARCH = "Find.Task.Search";
|
const char * const TASK_SEARCH = "Find.Task.Search";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|
||||||
|
enum FindFlag {
|
||||||
|
FindBackward = 0x01,
|
||||||
|
FindCaseSensitively = 0x02,
|
||||||
|
FindWholeWords = 0x04,
|
||||||
|
FindRegularExpression = 0x08
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(FindFlags, FindFlag)
|
||||||
|
|
||||||
|
// defined in findplugin.cpp
|
||||||
|
QTextDocument::FindFlags FIND_EXPORT textDocumentFlagsForFindFlags(FindFlags flags);
|
||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Find::FindFlags)
|
||||||
|
|
||||||
#endif // TEXTFINDCONSTANTS_H
|
#endif // TEXTFINDCONSTANTS_H
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void CentralWidget::setCurrentPage(HelpViewer *page)
|
|||||||
emit currentViewerChanged();
|
emit currentViewerChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CentralWidget::find(const QString &txt, Find::IFindSupport::FindFlags flags,
|
bool CentralWidget::find(const QString &txt, Find::FindFlags flags,
|
||||||
bool incremental)
|
bool incremental)
|
||||||
{
|
{
|
||||||
return currentHelpViewer()->findText(txt, flags, incremental, false);
|
return currentHelpViewer()->findText(txt, flags, incremental, false);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
void setCurrentPage(HelpViewer *page);
|
void setCurrentPage(HelpViewer *page);
|
||||||
|
|
||||||
bool find(const QString &txt, Find::IFindSupport::FindFlags findFlags,
|
bool find(const QString &txt, Find::FindFlags findFlags,
|
||||||
bool incremental);
|
bool incremental);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ bool HelpFindSupport::isEnabled() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::FindFlags HelpFindSupport::supportedFindFlags() const
|
Find::FindFlags HelpFindSupport::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return Find::IFindSupport::FindBackward | Find::IFindSupport::FindCaseSensitively
|
return Find::FindBackward | Find::FindCaseSensitively
|
||||||
| Find::IFindSupport::FindWholeWords;
|
| Find::FindWholeWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HelpFindSupport::currentFindString() const
|
QString HelpFindSupport::currentFindString() const
|
||||||
@@ -69,15 +69,15 @@ QString HelpFindSupport::completedFindString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt,
|
Find::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt,
|
||||||
Find::IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_centralWidget, return NotFound);
|
QTC_ASSERT(m_centralWidget, return NotFound);
|
||||||
findFlags &= ~Find::IFindSupport::FindBackward;
|
findFlags &= ~Find::FindBackward;
|
||||||
return m_centralWidget->find(txt, findFlags, true) ? Found : NotFound;
|
return m_centralWidget->find(txt, findFlags, true) ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::Result HelpFindSupport::findStep(const QString &txt,
|
Find::IFindSupport::Result HelpFindSupport::findStep(const QString &txt,
|
||||||
Find::IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_centralWidget, return NotFound);
|
QTC_ASSERT(m_centralWidget, return NotFound);
|
||||||
return m_centralWidget->find(txt, findFlags, false) ? Found : NotFound;
|
return m_centralWidget->find(txt, findFlags, false) ? Found : NotFound;
|
||||||
@@ -90,10 +90,10 @@ HelpViewerFindSupport::HelpViewerFindSupport(HelpViewer *viewer)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::FindFlags HelpViewerFindSupport::supportedFindFlags() const
|
Find::FindFlags HelpViewerFindSupport::supportedFindFlags() const
|
||||||
{
|
{
|
||||||
return Find::IFindSupport::FindBackward | Find::IFindSupport::FindCaseSensitively
|
return Find::FindBackward | Find::FindCaseSensitively
|
||||||
| Find::IFindSupport::FindWholeWords;
|
| Find::FindWholeWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HelpViewerFindSupport::currentFindString() const
|
QString HelpViewerFindSupport::currentFindString() const
|
||||||
@@ -103,22 +103,22 @@ QString HelpViewerFindSupport::currentFindString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::Result HelpViewerFindSupport::findIncremental(const QString &txt,
|
Find::IFindSupport::Result HelpViewerFindSupport::findIncremental(const QString &txt,
|
||||||
Find::IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_viewer, return NotFound);
|
QTC_ASSERT(m_viewer, return NotFound);
|
||||||
findFlags &= ~Find::IFindSupport::FindBackward;
|
findFlags &= ~Find::FindBackward;
|
||||||
return find(txt, findFlags, true) ? Found : NotFound;
|
return find(txt, findFlags, true) ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
Find::IFindSupport::Result HelpViewerFindSupport::findStep(const QString &txt,
|
Find::IFindSupport::Result HelpViewerFindSupport::findStep(const QString &txt,
|
||||||
Find::IFindSupport::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_viewer, return NotFound);
|
QTC_ASSERT(m_viewer, return NotFound);
|
||||||
return find(txt, findFlags, false) ? Found : NotFound;
|
return find(txt, findFlags, false) ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HelpViewerFindSupport::find(const QString &txt,
|
bool HelpViewerFindSupport::find(const QString &txt,
|
||||||
Find::IFindSupport::FindFlags findFlags, bool incremental)
|
Find::FindFlags findFlags, bool incremental)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_viewer, return false);
|
QTC_ASSERT(m_viewer, return false);
|
||||||
return m_viewer->findText(txt, findFlags, incremental, false);
|
return m_viewer->findText(txt, findFlags, incremental, false);
|
||||||
|
|||||||
@@ -49,24 +49,24 @@ public:
|
|||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool supportsReplace() const { return false; }
|
bool supportsReplace() const { return false; }
|
||||||
IFindSupport::FindFlags supportedFindFlags() const;
|
Find::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::IFindSupport::FindFlags findFlags);
|
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||||
Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags);
|
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||||
void replace(const QString &, const QString &,
|
void replace(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { }
|
Find::FindFlags ) { }
|
||||||
bool replaceStep(const QString &, const QString &,
|
bool replaceStep(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { return false; }
|
Find::FindFlags ) { return false; }
|
||||||
int replaceAll(const QString &, const QString &,
|
int replaceAll(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { return 0; }
|
Find::FindFlags ) { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool find(const QString &ttf, Find::IFindSupport::FindFlags findFlags, bool incremental);
|
bool find(const QString &ttf, Find::FindFlags findFlags, bool incremental);
|
||||||
|
|
||||||
CentralWidget *m_centralWidget;
|
CentralWidget *m_centralWidget;
|
||||||
};
|
};
|
||||||
@@ -79,23 +79,23 @@ public:
|
|||||||
|
|
||||||
bool isEnabled() const { return true; }
|
bool isEnabled() const { return true; }
|
||||||
bool supportsReplace() const { return false; }
|
bool supportsReplace() const { return false; }
|
||||||
IFindSupport::FindFlags supportedFindFlags() const;
|
Find::FindFlags supportedFindFlags() const;
|
||||||
void resetIncrementalSearch() {}
|
void resetIncrementalSearch() {}
|
||||||
void clearResults() {}
|
void clearResults() {}
|
||||||
QString currentFindString() const;
|
QString currentFindString() const;
|
||||||
QString completedFindString() const { return QString(); }
|
QString completedFindString() const { return QString(); }
|
||||||
|
|
||||||
Result findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags);
|
Result findIncremental(const QString &txt, Find::FindFlags findFlags);
|
||||||
Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags);
|
Result findStep(const QString &txt, Find::FindFlags findFlags);
|
||||||
void replace(const QString &, const QString &,
|
void replace(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { }
|
Find::FindFlags ) { }
|
||||||
bool replaceStep(const QString &, const QString &,
|
bool replaceStep(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { return false; }
|
Find::FindFlags ) { return false; }
|
||||||
int replaceAll(const QString &, const QString &,
|
int replaceAll(const QString &, const QString &,
|
||||||
Find::IFindSupport::FindFlags ) { return 0; }
|
Find::FindFlags ) { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool find(const QString &ttf, Find::IFindSupport::FindFlags findFlags, bool incremental);
|
bool find(const QString &ttf, Find::FindFlags findFlags, bool incremental);
|
||||||
HelpViewer *m_viewer;
|
HelpViewer *m_viewer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public:
|
|||||||
bool isForwardAvailable() const;
|
bool isForwardAvailable() const;
|
||||||
bool isBackwardAvailable() const;
|
bool isBackwardAvailable() const;
|
||||||
|
|
||||||
bool findText(const QString &text, Find::IFindSupport::FindFlags flags,
|
bool findText(const QString &text, Find::FindFlags flags,
|
||||||
bool incremental, bool fromSearch);
|
bool incremental, bool fromSearch);
|
||||||
|
|
||||||
static const QString NsNokia;
|
static const QString NsNokia;
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ bool HelpViewer::isBackwardAvailable() const
|
|||||||
return QTextBrowser::isBackwardAvailable();
|
return QTextBrowser::isBackwardAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HelpViewer::findText(const QString &text, IFindSupport::FindFlags flags,
|
bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||||
bool incremental, bool fromSearch)
|
bool incremental, bool fromSearch)
|
||||||
{
|
{
|
||||||
QTextDocument *doc = document();
|
QTextDocument *doc = document();
|
||||||
@@ -198,10 +198,10 @@ bool HelpViewer::findText(const QString &text, IFindSupport::FindFlags flags,
|
|||||||
if (incremental)
|
if (incremental)
|
||||||
cursor.setPosition(position);
|
cursor.setPosition(position);
|
||||||
|
|
||||||
QTextDocument::FindFlags f = IFindSupport::textDocumentFlagsForFindFlags(flags);
|
QTextDocument::FindFlags f = Find::textDocumentFlagsForFindFlags(flags);
|
||||||
QTextCursor found = doc->find(text, cursor, f);
|
QTextCursor found = doc->find(text, cursor, f);
|
||||||
if (found.isNull()) {
|
if (found.isNull()) {
|
||||||
if ((flags & Find::IFindSupport::FindBackward) == 0)
|
if ((flags & Find::FindBackward) == 0)
|
||||||
cursor.movePosition(QTextCursor::Start);
|
cursor.movePosition(QTextCursor::Start);
|
||||||
else
|
else
|
||||||
cursor.movePosition(QTextCursor::End);
|
cursor.movePosition(QTextCursor::End);
|
||||||
|
|||||||
@@ -338,14 +338,14 @@ bool HelpViewer::isBackwardAvailable() const
|
|||||||
return pageAction(QWebPage::Back)->isEnabled();
|
return pageAction(QWebPage::Back)->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HelpViewer::findText(const QString &text, IFindSupport::FindFlags flags,
|
bool HelpViewer::findText(const QString &text, Find::FindFlags flags,
|
||||||
bool incremental, bool fromSearch)
|
bool incremental, bool fromSearch)
|
||||||
{
|
{
|
||||||
Q_UNUSED((incremental && fromSearch))
|
Q_UNUSED((incremental && fromSearch))
|
||||||
QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
|
QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
|
||||||
if (flags & Find::IFindSupport::FindBackward)
|
if (flags & Find::FindBackward)
|
||||||
options |= QWebPage::FindBackward;
|
options |= QWebPage::FindBackward;
|
||||||
if (flags & Find::IFindSupport::FindCaseSensitively)
|
if (flags & Find::FindCaseSensitively)
|
||||||
options |= QWebPage::FindCaseSensitively;
|
options |= QWebPage::FindCaseSensitively;
|
||||||
|
|
||||||
bool found = QWebView::findText(text, options);
|
bool found = QWebView::findText(text, options);
|
||||||
|
|||||||
@@ -2137,7 +2137,7 @@ void BaseTextEditorPrivate::highlightSearchResults(const QTextBlock &block,
|
|||||||
l = m_searchExpr.matchedLength();
|
l = m_searchExpr.matchedLength();
|
||||||
if (l == 0)
|
if (l == 0)
|
||||||
break;
|
break;
|
||||||
if ((m_findFlags & Find::IFindSupport::FindWholeWords)
|
if ((m_findFlags & Find::FindWholeWords)
|
||||||
&& ((idx && text.at(idx-1).isLetterOrNumber())
|
&& ((idx && text.at(idx-1).isLetterOrNumber())
|
||||||
|| (idx + l < text.length() && text.at(idx + l).isLetterOrNumber())))
|
|| (idx + l < text.length() && text.at(idx + l).isLetterOrNumber())))
|
||||||
continue;
|
continue;
|
||||||
@@ -4254,7 +4254,7 @@ void BaseTextEditor::markBlocksAsChanged(QList<int> blockNumbers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseTextEditor::highlightSearchResults(const QString &txt, Find::IFindSupport::FindFlags findFlags)
|
void BaseTextEditor::highlightSearchResults(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QString pattern = txt;
|
QString pattern = txt;
|
||||||
if (pattern.size() < 2)
|
if (pattern.size() < 2)
|
||||||
@@ -4263,9 +4263,9 @@ void BaseTextEditor::highlightSearchResults(const QString &txt, Find::IFindSuppo
|
|||||||
if (d->m_searchExpr.pattern() == pattern)
|
if (d->m_searchExpr.pattern() == pattern)
|
||||||
return;
|
return;
|
||||||
d->m_searchExpr.setPattern(pattern);
|
d->m_searchExpr.setPattern(pattern);
|
||||||
d->m_searchExpr.setPatternSyntax((findFlags & Find::IFindSupport::FindRegularExpression) ?
|
d->m_searchExpr.setPatternSyntax((findFlags & Find::FindRegularExpression) ?
|
||||||
QRegExp::RegExp : QRegExp::FixedString);
|
QRegExp::RegExp : QRegExp::FixedString);
|
||||||
d->m_searchExpr.setCaseSensitivity((findFlags & Find::IFindSupport::FindCaseSensitively) ?
|
d->m_searchExpr.setCaseSensitivity((findFlags & Find::FindCaseSensitively) ?
|
||||||
Qt::CaseSensitive : Qt::CaseInsensitive);
|
Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
d->m_findFlags = findFlags;
|
d->m_findFlags = findFlags;
|
||||||
|
|
||||||
@@ -5323,8 +5323,8 @@ BaseTextEditorEditable::BaseTextEditorEditable(BaseTextEditor *editor)
|
|||||||
using namespace Find;
|
using namespace Find;
|
||||||
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
|
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
|
||||||
BaseTextFind *baseTextFind = new BaseTextFind(editor);
|
BaseTextFind *baseTextFind = new BaseTextFind(editor);
|
||||||
connect(baseTextFind, SIGNAL(highlightAll(QString, Find::IFindSupport::FindFlags)),
|
connect(baseTextFind, SIGNAL(highlightAll(QString, Find::FindFlags)),
|
||||||
editor, SLOT(highlightSearchResults(QString, Find::IFindSupport::FindFlags)));
|
editor, SLOT(highlightSearchResults(QString, Find::FindFlags)));
|
||||||
connect(baseTextFind, SIGNAL(findScopeChanged(QTextCursor, QTextCursor, int)),
|
connect(baseTextFind, SIGNAL(findScopeChanged(QTextCursor, QTextCursor, int)),
|
||||||
editor, SLOT(setFindScope(QTextCursor, QTextCursor, int)));
|
editor, SLOT(setFindScope(QTextCursor, QTextCursor, int)));
|
||||||
aggregate->add(baseTextFind);
|
aggregate->add(baseTextFind);
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ private slots:
|
|||||||
void editorContentsChange(int position, int charsRemoved, int charsAdded);
|
void editorContentsChange(int position, int charsRemoved, int charsAdded);
|
||||||
void documentAboutToBeReloaded();
|
void documentAboutToBeReloaded();
|
||||||
void documentReloaded();
|
void documentReloaded();
|
||||||
void highlightSearchResults(const QString &txt, Find::IFindSupport::FindFlags findFlags);
|
void highlightSearchResults(const QString &txt, Find::FindFlags findFlags);
|
||||||
void setFindScope(const QTextCursor &start, const QTextCursor &end, int);
|
void setFindScope(const QTextCursor &start, const QTextCursor &end, int);
|
||||||
void currentEditorChanged(Core::IEditor *editor);
|
void currentEditorChanged(Core::IEditor *editor);
|
||||||
void maybeEmitContentsChangedBecauseOfUndo();
|
void maybeEmitContentsChangedBecauseOfUndo();
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public:
|
|||||||
QTextCharFormat m_ifdefedOutFormat;
|
QTextCharFormat m_ifdefedOutFormat;
|
||||||
|
|
||||||
QRegExp m_searchExpr;
|
QRegExp m_searchExpr;
|
||||||
Find::IFindSupport::FindFlags m_findFlags;
|
Find::FindFlags m_findFlags;
|
||||||
QTextCharFormat m_searchResultFormat;
|
QTextCharFormat m_searchResultFormat;
|
||||||
QTextCharFormat m_searchScopeFormat;
|
QTextCharFormat m_searchScopeFormat;
|
||||||
QTextCharFormat m_currentLineFormat;
|
QTextCharFormat m_currentLineFormat;
|
||||||
|
|||||||
Reference in New Issue
Block a user