From e952470bcd818792835f39ce840ceb0a691cdcd1 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 20 Jul 2010 16:02:55 +0200 Subject: [PATCH] debugger: move coreAboutToClose() check to DebuggerPlugin --- src/plugins/debugger/debuggerplugin.cpp | 53 +++++++++++++------------ src/plugins/debugger/debuggerplugin.h | 1 + 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 904345b0e33..babdbfc7432 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2721,34 +2721,12 @@ bool DebuggerPlugin::isRegisterViewVisible() const return d->m_registerDock->toggleViewAction()->isChecked(); } - -////////////////////////////////////////////////////////////////////// -// -// Testing -// -////////////////////////////////////////////////////////////////////// - -/* -void DebuggerPlugin::runTest(const QString &fileName) +bool DebuggerPlugin::coreAboutToClose() { - DebuggerStartParameters sp; - sp.executable = fileName; - sp.processArgs = QStringList() << "--run-debuggee"; - sp.workingDirectory.clear(); - startDebugger(m_debuggerRunControlFactory->create(sp)); -} -*/ - -bool DebuggerListener::coreAboutToClose() -{ - DebuggerPlugin *plugin = DebuggerPlugin::instance(); - if (!plugin) - return true; - // FIXME: Iterate over all running debuggers. // Ask to terminate the session. bool cleanTermination = false; - switch (plugin->state()) { + switch (state()) { case DebuggerNotReady: case DebuggerFinished: case InferiorUnrunnable: @@ -2784,7 +2762,7 @@ bool DebuggerListener::coreAboutToClose() "Terminating the session in the current" " state (%1) can leave the target in an inconsistent state." " Would you still like to terminate it?") - .arg(_(DebuggerEngine::stateName(plugin->state()))); + .arg(_(DebuggerEngine::stateName(state()))); const QString title = QCoreApplication::translate("Debugger::Internal::DebuggerListener", @@ -2796,11 +2774,34 @@ bool DebuggerListener::coreAboutToClose() if (answer != QMessageBox::Yes) return false; - plugin->d->exitDebugger(); + d->exitDebugger(); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); return true; } +////////////////////////////////////////////////////////////////////// +// +// Testing +// +////////////////////////////////////////////////////////////////////// + +/* +void DebuggerPlugin::runTest(const QString &fileName) +{ + DebuggerStartParameters sp; + sp.executable = fileName; + sp.processArgs = QStringList() << "--run-debuggee"; + sp.workingDirectory.clear(); + startDebugger(m_debuggerRunControlFactory->create(sp)); +} +*/ + +bool DebuggerListener::coreAboutToClose() +{ + DebuggerPlugin *plugin = DebuggerPlugin::instance(); + return plugin && plugin->coreAboutToClose(); +} + } // namespace Debugger #include "debuggerplugin.moc" diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 2cb55de74d5..750e293e1c0 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -73,6 +73,7 @@ public: QVariant sessionValue(const QString &name); void setSessionValue(const QString &name, const QVariant &value); void setConfigValue(const QString &name, const QVariant &value); + bool coreAboutToClose(); void resetLocation(); void gotoLocation(const QString &fileName, int lineNumber, bool setMarker); -- GitLab