OSDN Git Service

debugger: minor cleanup
authorhjk <qtc-committer@nokia.com>
Fri, 10 Dec 2010 08:37:31 +0000 (09:37 +0100)
committerhjk <qtc-committer@nokia.com>
Fri, 10 Dec 2010 11:42:40 +0000 (12:42 +0100)
src/plugins/debugger/debuggerengine.cpp
src/plugins/debugger/debuggerengine.h
src/plugins/debugger/debuggerplugin.cpp
src/plugins/debugger/debuggerrunner.cpp
src/plugins/debugger/debuggerrunner.h

index db42229..3fc8de9 100644 (file)
@@ -52,6 +52,7 @@
 #include <coreplugin/progressmanager/progressmanager.h>
 #include <coreplugin/progressmanager/futureprogress.h>
 
+#include <projectexplorer/toolchain.h>
 #include <projectexplorer/toolchaintype.h>
 
 #include <texteditor/itexteditor.h>
@@ -67,7 +68,6 @@
 #include <QtGui/QMessageBox>
 
 using namespace Core;
-using namespace Debugger;
 using namespace Debugger::Internal;
 using namespace ProjectExplorer;
 using namespace TextEditor;
@@ -103,9 +103,9 @@ DebuggerStartParameters::DebuggerStartParameters() :
     executableUid(0)
 {}
 
-void DebuggerStartParameters::clear()
+QString DebuggerStartParameters::toolChainName() const
 {
-    *this = DebuggerStartParameters();
+    return ToolChain::toolChainName(ProjectExplorer::ToolChainType(toolChainType));
 }
 
 QDebug operator<<(QDebug d, DebuggerState state)
index 2cacceb..f99033d 100644 (file)
@@ -65,7 +65,7 @@ class DEBUGGER_EXPORT DebuggerStartParameters
 {
 public:
     DebuggerStartParameters();
-    void clear();
+    QString toolChainName() const;
 
     QString executable;
     QString displayName;
@@ -77,17 +77,20 @@ public:
     qint64 attachPID;
     bool useTerminal;
     bool breakAtMain;
-    QString crashParameter; // for AttachCrashedExternal
 
-    // for qml debugging
+    // Used by AttachCrashedExternal.
+    QString crashParameter;
+
+    // Used by Qml debugging.
     QString qmlServerAddress;
     quint16 qmlServerPort;
     QString projectBuildDir;
     QString projectDir;
-    // for cpp+qml debugging
+
+    // Used by combined cpp+qml debugging.
     DebuggerEngineType cppEngineType;
 
-    // for remote debugging
+    // Used by remote debugging.
     QString remoteChannel;
     QString remoteArchitecture;
     QString gnuTarget;
index e9bfb66..e8fcfaa 100644 (file)
@@ -2581,11 +2581,14 @@ void DebuggerPluginPrivate::createNewDock(QWidget *widget)
 void DebuggerPluginPrivate::runControlStarted(DebuggerRunControl *runControl)
 {
     activateDebugMode();
-    const QString message = runControl->idString();
+    DebuggerEngine *engine = runControl->engine();
+    const QString message = tr("Starting debugger '%1' for tool chain '%2'...")
+            .arg(engine->objectName())
+            .arg(engine->startParameters().toolChainName());
     showMessage(message, StatusBar);
     showMessage(m_debuggerSettings->dump(), LogDebug);
     m_snapshotHandler->appendSnapshot(runControl);
-    connectEngine(runControl->engine());
+    connectEngine(engine);
 }
 
 void DebuggerPluginPrivate::runControlFinished(DebuggerRunControl *runControl)
index f8133fb..7ee2644 100644 (file)
@@ -67,6 +67,20 @@ using namespace ProjectExplorer;
 using namespace Debugger::Internal;
 
 namespace Debugger {
+
+namespace Cdb {
+DebuggerEngine *createCdbEngine(const DebuggerStartParameters &, QString *error);
+bool isCdbEngineEnabled(); // Check the configuration page
+}
+
+/*
+static QString toolChainName(int toolChainType)
+{
+    return ToolChain::toolChainName(ProjectExplorer::ToolChainType(toolChainType));
+}
+*/
+
+
 namespace Internal {
 
 DebuggerEngine *createGdbEngine(const DebuggerStartParameters &);
@@ -105,20 +119,6 @@ bool checkCdbConfiguration(int, QString *, QString *)
 
 #endif
 
-} // namespace Internal
-
-
-namespace Cdb {
-DebuggerEngine *createCdbEngine(const DebuggerStartParameters &, QString *error);
-bool isCdbEngineEnabled(); // Check the configuration page
-}
-
-static QString toolChainName(int toolChainType)
-{
-    return ToolChain::toolChainName(ProjectExplorer::ToolChainType(toolChainType));
-}
-
-
 ////////////////////////////////////////////////////////////////////////
 //
 // DebuggerRunControlFactory
@@ -251,7 +251,6 @@ QWidget *DebuggerRunControlFactory::createConfigurationWidget
     return 0;
 }
 
-
 ////////////////////////////////////////////////////////////////////////
 //
 // DebuggerRunControlPrivate
@@ -416,6 +415,9 @@ AbstractGdbAdapter *DebuggerRunControlPrivate::gdbAdapter() const
     return engine->gdbAdapter();
 }
 
+} // namespace Internal
+
+
 ////////////////////////////////////////////////////////////////////////
 //
 // DebuggerRunControl
@@ -553,7 +555,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
         debuggingFinished();
         // Create Message box with possibility to go to settings.
         const QString msg = tr("Cannot debug '%1' (tool chain: '%2'): %3")
-            .arg(sp.executable, toolChainName(sp.toolChainType), d->m_errorMessage);
+            .arg(sp.executable, sp.toolChainName(), d->m_errorMessage);
         Core::ICore::instance()->showWarningWithOptions(tr("Warning"),
             msg, QString(), QLatin1String(Constants::DEBUGGER_SETTINGS_CATEGORY),
             d->m_settingsIdHint);
@@ -669,13 +671,6 @@ void DebuggerRunControl::start()
     }
 }
 
-QString DebuggerRunControl::idString() const
-{
-    return tr("Starting debugger '%1' for tool chain '%2'...")
-        .arg(d->m_engine->objectName())
-        .arg(toolChainName(d->m_engine->startParameters().toolChainType));
-}
-
 void DebuggerRunControl::startFailed()
 {
     emit addToOutputWindowInline(this, tr("Debugging has failed"), false);
index 7112155..10562df 100644 (file)
@@ -44,9 +44,12 @@ class Environment;
 namespace Debugger {
 class DebuggerEngine;
 class DebuggerRunControl;
-class DebuggerRunControlPrivate;
 class DebuggerStartParameters;
 
+namespace Internal {
+
+class DebuggerRunControlPrivate;
+
 class DebuggerRunControlFactory
     : public ProjectExplorer::IRunControlFactory
 {
@@ -72,6 +75,8 @@ private:
     unsigned m_enabledEngines;
 };
 
+} // namespace Internal
+
 
 // This is a job description containing all data "local" to the jobs, including
 // the models of the individual debugger views.
@@ -108,8 +113,6 @@ public:
                                  QString *errorMessage,
                                  QString *settingsCategory = 0,
                                  QString *settingsPage = 0);
-    QString idString() const;
-
 signals:
     void engineRequestSetup();
 
@@ -120,7 +123,7 @@ protected:
     const DebuggerStartParameters &startParameters() const;
 
 private:
-    QScopedPointer<DebuggerRunControlPrivate> d;
+    QScopedPointer<Internal::DebuggerRunControlPrivate> d;
 };
 
 } // namespace Debugger