QmlProfilerTool: Expose handleStop()

Change-Id: I23cc902881899046580e83bc71810a73ca586c1b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Jarek Kobus
2025-01-06 13:16:25 +01:00
parent be2c138dcc
commit b404aa8c06
3 changed files with 20 additions and 17 deletions

View File

@@ -64,6 +64,8 @@ void QmlProfilerRunner::start()
disconnect(d->m_profilerState, &QmlProfilerStateManager::stateChanged, this, nullptr);
QmlProfilerTool::instance()->finalizeRunControl(this);
connect(this, &QmlProfilerRunner::stopped,
QmlProfilerTool::instance(), &QmlProfilerTool::handleStop);
d->m_profilerState = QmlProfilerTool::instance()->stateManager();
QTC_ASSERT(d->m_profilerState, return);

View File

@@ -362,23 +362,6 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
}
}
auto handleStop = [this, runControl] {
if (!d->m_toolBusy)
return;
d->m_toolBusy = false;
updateRunActions();
disconnect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop);
// If we're still trying to connect, stop now.
if (d->m_profilerConnections->isConnecting()) {
showNonmodalWarning(Tr::tr("The application finished before a connection could be "
"established. No data was loaded."));
}
d->m_profilerConnections->disconnectFromServer();
};
connect(runWorker, &QmlProfilerRunner::stopped, this, handleStop);
connect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop);
updateRunActions();
@@ -432,6 +415,23 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
}
void QmlProfilerTool::handleStop()
{
if (!d->m_toolBusy)
return;
d->m_toolBusy = false;
updateRunActions();
disconnect(d->m_stopAction, &QAction::triggered, nullptr, nullptr);
// If we're still trying to connect, stop now.
if (d->m_profilerConnections->isConnecting()) {
showNonmodalWarning(Tr::tr("The application finished before a connection could be "
"established. No data was loaded."));
}
d->m_profilerConnections->disconnectFromServer();
}
void QmlProfilerTool::recordingButtonChanged(bool recording)
{
// clientRecording is our intention for new sessions. That may differ from the state of the

View File

@@ -31,6 +31,7 @@ public:
static QmlProfilerTool *instance();
void finalizeRunControl(QmlProfilerRunner *runWorker);
void handleStop();
bool prepareTool();
ProjectExplorer::RunControl *attachToWaitingApplication();