forked from qt-creator/qt-creator
PerfConfigWidget: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals. Change-Id: Ib83c0f94eafe401b458732217f8b34cffe7b2d05 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -149,11 +149,8 @@ void PerfConfigWidget::setTarget(ProjectExplorer::Target *target)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_process.get(), &QtcProcess::finished,
|
connect(m_process.get(), &QtcProcess::done,
|
||||||
this, &PerfConfigWidget::handleProcessFinished);
|
this, &PerfConfigWidget::handleProcessDone);
|
||||||
|
|
||||||
connect(m_process.get(), &QtcProcess::errorOccurred,
|
|
||||||
this, &PerfConfigWidget::handleProcessError);
|
|
||||||
|
|
||||||
useTracePointsButton->setEnabled(true);
|
useTracePointsButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -182,8 +179,15 @@ void PerfConfigWidget::readTracePoints()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfConfigWidget::handleProcessFinished()
|
void PerfConfigWidget::handleProcessDone()
|
||||||
{
|
{
|
||||||
|
if (m_process->error() == QProcess::FailedToStart) {
|
||||||
|
Core::AsynchronousMessageBox::warning(
|
||||||
|
tr("Cannot List Trace Points"),
|
||||||
|
tr("\"perf probe -l\" failed to start. Is perf installed?"));
|
||||||
|
useTracePointsButton->setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const QList<QByteArray> lines =
|
const QList<QByteArray> lines =
|
||||||
m_process->readAllStandardOutput().append(m_process->readAllStandardError())
|
m_process->readAllStandardOutput().append(m_process->readAllStandardError())
|
||||||
.split('\n');
|
.split('\n');
|
||||||
@@ -220,16 +224,6 @@ void PerfConfigWidget::handleProcessFinished()
|
|||||||
useTracePointsButton->setEnabled(true);
|
useTracePointsButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfConfigWidget::handleProcessError(QProcess::ProcessError error)
|
|
||||||
{
|
|
||||||
if (error == QProcess::FailedToStart) {
|
|
||||||
Core::AsynchronousMessageBox::warning(
|
|
||||||
tr("Cannot List Trace Points"),
|
|
||||||
tr("\"perf probe -l\" failed to start. Is perf installed?"));
|
|
||||||
useTracePointsButton->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *SettingsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
QWidget *SettingsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ private:
|
|||||||
void apply() final;
|
void apply() final;
|
||||||
|
|
||||||
void readTracePoints();
|
void readTracePoints();
|
||||||
void handleProcessFinished();
|
void handleProcessDone();
|
||||||
void handleProcessError(QProcess::ProcessError error);
|
|
||||||
|
|
||||||
PerfSettings *m_settings;
|
PerfSettings *m_settings;
|
||||||
std::unique_ptr<Utils::QtcProcess> m_process;
|
std::unique_ptr<Utils::QtcProcess> m_process;
|
||||||
|
|||||||
Reference in New Issue
Block a user