Valgrind: Do not put html links in clipboard

...but plain, canonical and absolute paths if possible.

Change-Id: Ib559f00a55646929b2e548e7e671c1cb5e1d4a79
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Nikolai Kosjar
2014-11-25 10:49:47 +01:00
committed by hjk
parent c5d86757a1
commit c7c8f88303

View File

@@ -137,7 +137,8 @@ static QString relativeToPath()
}
static QString errorLocation(const QModelIndex &index, const Error &error,
bool link = false, const QString &linkAttr = QString())
bool link = false, bool absolutePath = false,
const QString &linkAttr = QString())
{
if (!index.isValid())
return QString();
@@ -149,8 +150,9 @@ static QString errorLocation(const QModelIndex &index, const Error &error,
}
QTC_ASSERT(model, return QString());
const QString relativePath = absolutePath ? QString() : relativeToPath();
return QCoreApplication::translate("Valgrind::Internal", "in %1").
arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(),
arg(makeFrameName(model->findRelevantFrame(error), relativePath,
link, linkAttr));
}
@@ -181,7 +183,9 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font,
p.setBrush(QPalette::Text, p.highlightedText());
errorLabel->setPalette(p);
errorLabel->setText(QString::fromLatin1("%1&nbsp;&nbsp;<span %4>%2</span>")
.arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
.arg(error.what(),
errorLocation(errorIndex, error, /*link=*/ true,
/*absolutePath=*/ false, linkStyle),
linkStyle));
connect(errorLabel, &QLabel::linkActivated,
this, &MemcheckErrorDelegate::openLinkInEditor);
@@ -265,17 +269,16 @@ void MemcheckErrorDelegate::copy()
const Error error = m_detailsIndex.data(ErrorListModel::ErrorRole).value<Error>();
stream << error.what() << "\n";
stream << " " << errorLocation(m_detailsIndex, error) << "\n";
const QString relativeTo = relativeToPath();
stream << " "
<< errorLocation(m_detailsIndex, error, /*link=*/ false, /*absolutePath=*/ true)
<< "\n";
foreach (const Stack &stack, error.stacks()) {
if (!stack.auxWhat().isEmpty())
stream << stack.auxWhat();
int i = 1;
foreach (const Frame &frame, stack.frames()) {
stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n";
}
foreach (const Frame &frame, stack.frames())
stream << " " << i++ << ": " << makeFrameName(frame, QString(), false) << "\n";
}
stream.flush();