forked from qt-creator/qt-creator
ProjectExplorer: Run RunControl::{start,stop} always asynchronously
This introduces a mini-state-"machine" to handle RunControl states Intialized->[Starting->Running->Stopping->Stopped->]*->Finished. Needing time between trying to start and getting feedback is nowadays the normal setup for all remote targets as well as for most local tools. Making that the default for all runs simplifies the code and provides an opportunity to (a) fix some currently wrong reports of "stopped immediately" and (b) to remove target-specific (WinRT) or tool-specific (Valgrind, GammaRay) state members doing essentially the same. Change-Id: I7f52fee41144188ee8389e922fdc265f8c0a6459 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -506,7 +506,7 @@ void AppOutputPane::reRunRunControl()
|
||||
|
||||
handleOldOutput(tab.window);
|
||||
tab.window->scrollToBottom();
|
||||
tab.runControl->start();
|
||||
tab.runControl->initiateStart();
|
||||
}
|
||||
|
||||
void AppOutputPane::attachToRunControl()
|
||||
@@ -525,7 +525,7 @@ void AppOutputPane::stopRunControl()
|
||||
|
||||
RunControl *rc = m_runControlTabs.at(index).runControl;
|
||||
if (rc->isRunning() && optionallyPromptToStop(rc))
|
||||
rc->stop();
|
||||
rc->initiateStop();
|
||||
|
||||
if (debug)
|
||||
qDebug() << "OutputPane::stopRunControl " << rc;
|
||||
@@ -556,7 +556,7 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
||||
|
||||
if (debug)
|
||||
qDebug() << "OutputPane::closeTab tab " << tabIndex << m_runControlTabs[index].runControl
|
||||
<< m_runControlTabs[index].window << m_runControlTabs[index].asyncClosing;
|
||||
<< m_runControlTabs[index].window;
|
||||
// Prompt user to stop
|
||||
if (m_runControlTabs[index].runControl->isRunning()) {
|
||||
switch (closeTabMode) {
|
||||
@@ -575,15 +575,8 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
|
||||
break;
|
||||
}
|
||||
if (m_runControlTabs[index].runControl->isRunning()) { // yes it might have stopped already, then just close
|
||||
QWidget *tabWidget = m_tabWidget->widget(tabIndex);
|
||||
if (m_runControlTabs[index].runControl->stop() == RunControl::AsynchronousStop) {
|
||||
m_runControlTabs[index].asyncClosing = true;
|
||||
return false;
|
||||
}
|
||||
tabIndex = m_tabWidget->indexOf(tabWidget);
|
||||
index = indexOf(tabWidget);
|
||||
if (tabIndex == -1 || index == -1)
|
||||
return false;
|
||||
m_runControlTabs[index].runControl->initiateStop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,10 +734,6 @@ void AppOutputPane::slotRunControlFinished2(RunControl *sender)
|
||||
|
||||
m_runControlTabs.at(senderIndex).window->setFormatter(nullptr); // Reset formater for this RC
|
||||
|
||||
// Check for asynchronous close. Close the tab.
|
||||
if (m_runControlTabs.at(senderIndex).asyncClosing)
|
||||
closeTab(tabWidgetIndexOf(senderIndex), CloseTabNoPrompt);
|
||||
|
||||
emit runControlFinished(sender);
|
||||
|
||||
if (!isRunning())
|
||||
|
||||
Reference in New Issue
Block a user