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