Commit f3875c7e authored by con's avatar con
Browse files

Merge commit 'origin/1.2'

parents fca2dcfe ffb0fe65
......@@ -708,12 +708,15 @@
\row
\i \bold{git}
\i \l{http://git-scm.com/}
\i
\row
\i \bold{Subversion}
\i \l{http://subversion.tigris.org/}
\i
\row
\i \bold{Perforce}
\i \l{http://www.perforce.com}
\i Server version 2006.1 and later
\endtable
......
......@@ -2915,6 +2915,7 @@ void *qDumpObjectData440(
d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
d.exp = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
d.innertype = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
handleProtocolVersion2and3(d);
}
......
......@@ -1270,6 +1270,8 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
inBuffer->append('\0');
inBuffer->append(inner.toUtf8());
inBuffer->append('\0');
inBuffer->append(data.iname.toUtf8());
inBuffer->append('\0');
if (debug)
qDebug() << '\n' << Q_FUNC_INFO << '\n' << data.toString() << "\n-->" << outertype << td.type << extraArgs;
......
......@@ -142,14 +142,53 @@ bool BaseTextFind::findStep(const QString &txt, IFindSupport::FindFlags findFlag
return found;
}
namespace {
QString expandRegExpReplacement(const QString &replaceText, const QRegExp &regexp)
{
QString result;
for (int i = 0; i < replaceText.length(); ++i) {
QChar c = replaceText.at(i);
if (c == QLatin1Char('\\') && i < replaceText.length() - 1) {
c = replaceText.at(++i);
if (c == QLatin1Char('\\')) {
result += QLatin1Char('\\');
} else if (c == QLatin1Char('&')) {
result += QLatin1Char('&');
} else if (c.isDigit()) {
int index = c.unicode()-'1';
if (index < regexp.numCaptures()) {
result += regexp.cap(index+1);
} else {
result += QLatin1Char('\\');
result += c;
}
} else {
result += QLatin1Char('\\');
result += c;
}
} else if (c == QLatin1Char('&')) {
result += regexp.cap(0);
} else {
result += c;
}
}
return result;
}
}
bool BaseTextFind::replaceStep(const QString &before, const QString &after,
IFindSupport::FindFlags findFlags)
{
QTextCursor cursor = textCursor();
if (cursor.selectedText().compare(before,
((findFlags&IFindSupport::FindCaseSensitively)!=0) ? Qt::CaseSensitive : Qt::CaseInsensitive) == 0) {
bool usesRegExp = (findFlags & IFindSupport::FindRegularExpression);
QRegExp regexp(before,
(findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive,
usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
if (regexp.exactMatch(cursor.selectedText())) {
QString realAfter = usesRegExp ? expandRegExpReplacement(after, regexp) : after;
int start = cursor.selectionStart();
cursor.insertText(after);
cursor.insertText(realAfter);
if ((findFlags&IFindSupport::FindBackward) != 0)
cursor.setPosition(start);
}
......@@ -166,15 +205,18 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
editCursor.movePosition(QTextCursor::Start);
editCursor.beginEditBlock();
int count = 0;
bool usesRegExp = (findFlags & IFindSupport::FindRegularExpression);
QRegExp regexp(before);
regexp.setPatternSyntax((findFlags&IFindSupport::FindRegularExpression) ? QRegExp::RegExp : QRegExp::FixedString);
regexp.setCaseSensitivity((findFlags&IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
regexp.setCaseSensitivity((findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
QTextCursor found = document()->find(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
while (!found.isNull() && inScope(found.selectionStart(), found.selectionEnd())) {
++count;
editCursor.setPosition(found.selectionStart());
editCursor.setPosition(found.selectionEnd(), QTextCursor::KeepAnchor);
editCursor.insertText(after);
regexp.exactMatch(found.selectedText());
QString realAfter = usesRegExp ? expandRegExpReplacement(after, regexp) : after;
editCursor.insertText(realAfter);
found = document()->find(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags));
}
editCursor.endEditBlock();
......
......@@ -3,5 +3,6 @@
<file>images/casesensitively.png</file>
<file>images/wholewords.png</file>
<file>images/regexp.png</file>
<file>images/expand.png</file>
</qresource>
</RCC>
......@@ -2431,7 +2431,6 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
if (drawBox) {
bool expanded = nextBlock.isVisible();
int margin = 2;
int size = boxWidth/4;
QRect box(extraAreaWidth + size, top + size,
2 * (size) + 1, 2 * (size) + 1);
......@@ -2487,36 +2486,57 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal,
{
Q_UNUSED(active);
Q_UNUSED(hovered);
painter->save();
painter->setPen(Qt::NoPen);
int size = rect.size().width();
int sqsize = 2*(size/2);
QColor textColor = pal.buttonText().color();
QColor brushColor = textColor;
textColor.setAlpha(100);
brushColor.setAlpha(40);
QPolygon a;
if (expanded) {
// down arrow
a.setPoints(3, 0, sqsize/3, sqsize/2, sqsize - sqsize/3, sqsize, sqsize/3);
QStyle *s = style();
if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s))
s = ms->systemStyle();
if (!qstrcmp(s->metaObject()->className(), "OxygenStyle")) {
painter->save();
painter->setPen(Qt::NoPen);
int size = rect.size().width();
int sqsize = 2*(size/2);
QColor textColor = pal.buttonText().color();
QColor brushColor = textColor;
textColor.setAlpha(100);
brushColor.setAlpha(100);
QPolygon a;
if (expanded) {
// down arrow
a.setPoints(3, 0, sqsize/3, sqsize/2, sqsize - sqsize/3, sqsize, sqsize/3);
} else {
// right arrow
a.setPoints(3, sqsize - sqsize/3, sqsize/2, sqsize/2 - sqsize/3, 0, sqsize/2 - sqsize/3, sqsize);
painter->setBrush(brushColor);
}
painter->translate(0.5, 0.5);
painter->setRenderHint(QPainter::Antialiasing);
painter->translate(rect.topLeft());
painter->setPen(textColor);
painter->setBrush(textColor);
painter->drawPolygon(a);
painter->restore();
} else {
// right arrow
a.setPoints(3, sqsize - sqsize/3, sqsize/2, sqsize/2 - sqsize/3, 0, sqsize/2 - sqsize/3, sqsize);
painter->setBrush(brushColor);
QStyleOptionViewItemV2 opt;
opt.rect = rect;
opt.state = QStyle::State_Active | QStyle::State_Item | QStyle::State_Children;
if (expanded)
opt.state |= QStyle::State_Open;
if (active)
opt.state |= QStyle::State_MouseOver | QStyle::State_Enabled | QStyle::State_Selected;
if (hovered)
opt.palette.setBrush(QPalette::Window, pal.highlight());
// QGtkStyle needs a small correction to draw the marker in the right place
if (!qstrcmp(s->metaObject()->className(), "QGtkStyle"))
opt.rect.translate(-2, 0);
else if (!qstrcmp(s->metaObject()->className(), "QMacStyle"))
opt.rect.translate(-1, 0);
s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
}
painter->translate(0.5, 0.5);
painter->setRenderHint(QPainter::Antialiasing);
painter->translate(rect.topLeft());
painter->setPen(textColor);
painter->drawPolygon(a);
painter->restore();
}
void BaseTextEditor::slotModificationChanged(bool m)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment