forked from qt-creator/qt-creator
ProjectExplorer: Use a lambda to parametrize promptToStop handling
Less coupling than using virtual functions for better re-use. Change-Id: Ibbab38175538f65c0f563129c87e01736ed220af Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -115,6 +115,17 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, Core::Id run
|
||||
: RunControl(runConfig, runMode)
|
||||
{
|
||||
setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
||||
setPromptToStop([&](bool *optionalPrompt) {
|
||||
const QString question = tr("A debugging session is still in progress. "
|
||||
"Terminating the session in the current"
|
||||
" state can leave the target in an inconsistent state."
|
||||
" Would you still like to terminate it?");
|
||||
bool result = showPromptToStopDialog(tr("Close Debugging Session"), question,
|
||||
QString(), QString(), optionalPrompt);
|
||||
if (result)
|
||||
disconnect(this);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
DebuggerRunControl::~DebuggerRunControl()
|
||||
@@ -194,24 +205,6 @@ void DebuggerRunControl::notifyEngineRemoteSetupFinished(const RemoteSetupResult
|
||||
engine(this)->notifyEngineRemoteSetupFinished(result);
|
||||
}
|
||||
|
||||
bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const
|
||||
{
|
||||
QTC_ASSERT(isRunning(), return true);
|
||||
|
||||
if (optionalPrompt && !*optionalPrompt)
|
||||
return true;
|
||||
|
||||
const QString question = tr("A debugging session is still in progress. "
|
||||
"Terminating the session in the current"
|
||||
" state can leave the target in an inconsistent state."
|
||||
" Would you still like to terminate it?");
|
||||
bool result = showPromptToStopDialog(tr("Close Debugging Session"), question,
|
||||
QString(), QString(), optionalPrompt);
|
||||
if (result)
|
||||
disconnect(this);
|
||||
return result;
|
||||
}
|
||||
|
||||
void DebuggerRunControl::stop()
|
||||
{
|
||||
QTC_ASSERT(engine(this), return);
|
||||
|
Reference in New Issue
Block a user