forked from qt-creator/qt-creator
PerfProfiler: Handle failure to read trace point script file
We can just write an error message into the text edit in that case. Change-Id: I9ab0ab226bd8f171ab1a693884053a8c759cec2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -59,8 +59,12 @@ PerfTracePointDialog::PerfTracePointDialog() :
|
|||||||
QTC_ASSERT(m_device, return);
|
QTC_ASSERT(m_device, return);
|
||||||
|
|
||||||
QFile file(":/perfprofiler/tracepoints.sh");
|
QFile file(":/perfprofiler/tracepoints.sh");
|
||||||
file.open(QIODevice::ReadOnly);
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll()));
|
m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll()));
|
||||||
|
} else {
|
||||||
|
m_ui->textEdit->setPlainText(tr("Error: Failed to load trace point script %1: %2.")
|
||||||
|
.arg(file.fileName()).arg(file.errorString()));
|
||||||
|
}
|
||||||
|
|
||||||
m_ui->privilegesChooser->setCurrentText(m_device->type() == Constants::DESKTOP_DEVICE_TYPE
|
m_ui->privilegesChooser->setCurrentText(m_device->type() == Constants::DESKTOP_DEVICE_TYPE
|
||||||
? QLatin1String("pkexec") : QLatin1String("n.a."));
|
? QLatin1String("pkexec") : QLatin1String("n.a."));
|
||||||
|
Reference in New Issue
Block a user