Commit c9da1d95 authored by hjk's avatar hjk

debugger: code cosmetics

parent 7f256855
......@@ -43,7 +43,8 @@
#include <QtGui/QTextDocument>
using namespace Debugger::Internal;
namespace Debugger {
namespace Internal {
using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl;
......@@ -120,10 +121,10 @@ QWidget *DebuggerRunner::configurationWidget(RunConfigurationPtr runConfiguratio
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &startParameters,
QSharedPointer<ApplicationRunConfiguration> runConfiguration) :
RunControl(runConfiguration),
DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &startParameters,
QSharedPointer<ApplicationRunConfiguration> runConfiguration)
: RunControl(runConfiguration),
m_mode(mode),
m_startParameters(startParameters),
m_manager(manager),
......@@ -140,32 +141,36 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
Qt::QueuedConnection);
connect(this, SIGNAL(stopRequested()),
m_manager, SLOT(exitDebugger()));
if (runConfiguration) {
// Enhance parameters by info from the project, but do not clobber
// arguments given in the dialogs
if (m_startParameters->executable.isEmpty())
m_startParameters->executable = runConfiguration->executable();
if (m_startParameters->environment.empty())
m_startParameters->environment = runConfiguration->environment().toStringList();
if (m_startParameters->workingDir.isEmpty())
m_startParameters->workingDir = runConfiguration->workingDirectory();
if (m_mode != StartExternal)
m_startParameters->processArgs = runConfiguration->commandLineArguments();
switch (m_startParameters->toolChainType) {
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
m_startParameters->toolChainType = runConfiguration->toolChainType();
break;
default:
break;
}
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration());
}
m_startParameters->useTerminal = runConfiguration->runMode() == ApplicationRunConfiguration::Console;
m_dumperLibrary = runConfiguration->dumperLibrary();
m_dumperLibraryLocations = runConfiguration->dumperLibraryLocations();
if (!runConfiguration)
return;
// Enhance parameters by info from the project, but do not clobber
// arguments given in the dialogs
if (m_startParameters->executable.isEmpty())
m_startParameters->executable = runConfiguration->executable();
if (m_startParameters->environment.empty())
m_startParameters->environment = runConfiguration->environment().toStringList();
if (m_startParameters->workingDir.isEmpty())
m_startParameters->workingDir = runConfiguration->workingDirectory();
if (m_mode != StartExternal)
m_startParameters->processArgs = runConfiguration->commandLineArguments();
switch (m_startParameters->toolChainType) {
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
m_startParameters->toolChainType = runConfiguration->toolChainType();
break;
default:
break;
}
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
m_startParameters->buildDir =
project->buildDirectory(project->activeBuildConfiguration());
}
m_startParameters->useTerminal =
runConfiguration->runMode() == ApplicationRunConfiguration::Console;
m_dumperLibrary = runConfiguration->dumperLibrary();
m_dumperLibraryLocations = runConfiguration->dumperLibraryLocations();
}
void DebuggerRunControl::start()
......@@ -173,11 +178,8 @@ void DebuggerRunControl::start()
m_running = true;
m_manager->setQtDumperLibraryName(m_dumperLibrary);
m_manager->setQtDumperLibraryLocations(m_dumperLibraryLocations);
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
m_manager->startNewDebugger(this, m_startParameters);
emit started();
//debuggingFinished();
}
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
......@@ -187,7 +189,6 @@ void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
void DebuggerRunControl::stop()
{
//qDebug() << "DebuggerRunControl::stop";
m_running = false;
emit stopRequested();
}
......@@ -195,13 +196,13 @@ void DebuggerRunControl::stop()
void DebuggerRunControl::debuggingFinished()
{
m_running = false;
//qDebug() << "DebuggerRunControl::finished";
//emit addToOutputWindow(this, tr("Debugging %1 finished").arg(m_executable));
emit finished();
}
bool DebuggerRunControl::isRunning() const
{
//qDebug() << "DebuggerRunControl::isRunning" << m_running;
return m_running;
}
} // namespace Internal
} // namespace Debugger
......@@ -51,7 +51,8 @@ typedef QSharedPointer<ProjectExplorer::RunConfiguration>
typedef QSharedPointer<ProjectExplorer::ApplicationRunConfiguration>
ApplicationRunConfigurationPtr;
class DebuggerRunner : public ProjectExplorer::IRunConfigurationRunner
class DebuggerRunner
: public ProjectExplorer::IRunConfigurationRunner
{
Q_OBJECT
......@@ -59,7 +60,7 @@ public:
explicit DebuggerRunner(DebuggerManager *manager);
// ProjectExplorer::IRunConfigurationRunner
virtual bool canRun(RunConfigurationPtr runConfiguration, const QString &mode);
bool canRun(RunConfigurationPtr runConfiguration, const QString &mode);
virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration, const QString &mode);
virtual QString displayName() const;
......@@ -79,15 +80,16 @@ private:
};
// This is a job description
class DebuggerRunControl : public ProjectExplorer::RunControl
class DebuggerRunControl
: public ProjectExplorer::RunControl
{
Q_OBJECT
public:
explicit DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &sp,
ApplicationRunConfigurationPtr runConfiguration);
DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &sp,
ApplicationRunConfigurationPtr runConfiguration);
DebuggerStartMode startMode() const { return m_mode; }
......@@ -115,23 +117,24 @@ private:
// A default run configuration for external executables or attaching to
// running processes by id.
class DefaultApplicationRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
class DefaultApplicationRunConfiguration
: public ProjectExplorer::ApplicationRunConfiguration
{
Q_OBJECT
public:
explicit DefaultApplicationRunConfiguration(const QString &executable = QString());
virtual QString executable() const { return m_executable; }
virtual RunMode runMode() const { return Gui; }
virtual QString workingDirectory() const { return QString(); }
virtual QStringList commandLineArguments() const { return QStringList(); }
virtual QString executable() const { return m_executable; }
virtual RunMode runMode() const { return Gui; }
virtual QString workingDirectory() const { return QString(); }
virtual QStringList commandLineArguments() const { return QStringList(); }
virtual ProjectExplorer::Environment environment() const
{ return ProjectExplorer::Environment(); }
virtual QString dumperLibrary() const { return QString(); }
virtual QString dumperLibrary() const { return QString(); }
virtual QStringList dumperLibraryLocations() const { return QStringList(); }
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const
{ return ProjectExplorer::ToolChain::UNKNOWN; }
virtual QWidget *configurationWidget() { return 0; }
virtual QWidget *configurationWidget() { return 0; }
private:
const QString m_executable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment