forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -31,6 +31,7 @@ public:
|
||||
static QmlProfilerTool *instance();
|
||||
|
||||
void finalizeRunControl(QmlProfilerRunner *runWorker);
|
||||
void handleStop();
|
||||
|
||||
bool prepareTool();
|
||||
ProjectExplorer::RunControl *attachToWaitingApplication();
|
||||
|
Reference in New Issue
Block a user