From eb5821aa6b86a8e60026c91633e133b6bbc15dfd Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 22 Apr 2015 16:11:00 +0200 Subject: [PATCH] Debugger: Remove use of non-base RunControl object Change-Id: I72c6f66662a82b29d831631fdb2f152d8541cf09 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerruncontrol.cpp | 27 ++++++++++----------- src/plugins/debugger/debuggerruncontrol.h | 8 +++--- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 4162ca16298..760fc6555db 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -101,8 +101,8 @@ static const char *engineTypeName(DebuggerEngineType et) return "No engine"; } -DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, DebuggerEngine *engine) - : RunControl(runConfiguration, DebugRunMode), +DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, DebuggerEngine *engine) + : RunControl(runConfig, DebugRunMode), m_engine(engine), m_running(false) { @@ -283,27 +283,27 @@ DebuggerRunControlFactory::DebuggerRunControlFactory(QObject *parent) : IRunControlFactory(parent) {} -bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const +bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfig, RunMode mode) const { return (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain) - && qobject_cast(runConfiguration); + && qobject_cast(runConfig); } bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration - (DebuggerStartParameters *sp, const RunConfiguration *runConfiguration, QString *errorMessage) + (DebuggerStartParameters *sp, const RunConfiguration *runConfig, QString *errorMessage) { - QTC_ASSERT(runConfiguration, return false); - auto rc = qobject_cast(runConfiguration); - QTC_ASSERT(rc, return false); - EnvironmentAspect *environmentAspect = rc->extraAspect(); + QTC_ASSERT(runConfig, return false); + EnvironmentAspect *environmentAspect = runConfig->extraAspect(); QTC_ASSERT(environmentAspect, return false); - Target *target = runConfiguration->target(); + Target *target = runConfig->target(); Kit *kit = target ? target->kit() : KitManager::defaultKit(); if (!fillParametersFromKit(sp, kit, errorMessage)) return false; sp->environment = environmentAspect->environment(); + auto rc = qobject_cast(runConfig); + QTC_ASSERT(rc, return false); // Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...) sp->workingDirectory = FileUtils::normalizePathName(rc->workingDirectory()); @@ -323,7 +323,7 @@ bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration } } - DebuggerRunConfigurationAspect *debuggerAspect = runConfiguration->extraAspect(); + DebuggerRunConfigurationAspect *debuggerAspect = runConfig->extraAspect(); QTC_ASSERT(debuggerAspect, return false); sp->multiProcess = debuggerAspect->useMultiProcess(); @@ -331,8 +331,7 @@ bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration sp->languages |= CppLanguage; if (debuggerAspect->useQmlDebugger()) { - const IDevice::ConstPtr device = - DeviceKitInformation::device(runConfiguration->target()->kit()); + const IDevice::ConstPtr device = DeviceKitInformation::device(runConfig->target()->kit()); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp); QTcpServer server; const bool canListen = server.listen(QHostAddress::LocalHost) @@ -356,7 +355,7 @@ bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration } sp->startMode = StartInternal; - sp->displayName = rc->displayName(); + sp->displayName = runConfig->displayName(); return true; } diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 1f1c43e6043..031ab923ede 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -82,7 +82,7 @@ signals: private: void handleFinished(); friend class DebuggerRunControlFactory; - DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, + DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Internal::DebuggerEngine *engine); Internal::DebuggerEngine *m_engine; @@ -97,11 +97,11 @@ public: // FIXME: Used by qmljsinspector.cpp:469 ProjectExplorer::RunControl *create( - ProjectExplorer::RunConfiguration *runConfiguration, + ProjectExplorer::RunConfiguration *runConfig, ProjectExplorer::RunMode mode, QString *errorMessage); - bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, + bool canRun(ProjectExplorer::RunConfiguration *runConfig, ProjectExplorer::RunMode mode) const; static Internal::DebuggerEngine *createEngine(DebuggerEngineType et, @@ -112,7 +112,7 @@ public: const ProjectExplorer::Kit *kit, QString *errorMessage = 0); static bool fillParametersFromLocalRunConfiguration(DebuggerStartParameters *sp, - const ProjectExplorer::RunConfiguration *rc, QString *errorMessage = 0); + const ProjectExplorer::RunConfiguration *runConfig, QString *errorMessage = 0); static DebuggerRunControl *createAndScheduleRun(const DebuggerStartParameters &sp);