forked from qt-creator/qt-creator
BareMetal: Code cosmetics
Change-Id: I99efd9b9e73efb17bbf3a9f81c5be6c57c325db7 Reviewed-by: Tim Sander <tim@krieglstein.org> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ void BareMetalDevice::fromMap(const QVariantMap &map)
|
|||||||
QVariantMap BareMetalDevice::toMap() const
|
QVariantMap BareMetalDevice::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = IDevice::toMap();
|
QVariantMap map = IDevice::toMap();
|
||||||
map.insert(QLatin1String(GdbCommandsKey), getGdbInitCommands());
|
map.insert(QLatin1String(GdbCommandsKey), gdbInitCommands());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ BareMetalDevice::BareMetalDevice(const QString &name, Core::Id type, MachineType
|
|||||||
BareMetalDevice::BareMetalDevice(const BareMetalDevice &other)
|
BareMetalDevice::BareMetalDevice(const BareMetalDevice &other)
|
||||||
: IDevice(other)
|
: IDevice(other)
|
||||||
{
|
{
|
||||||
setGdbInitCommands(other.getGdbInitCommands());
|
setGdbInitCommands(other.gdbInitCommands());
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace Internal
|
} //namespace Internal
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#define BAREMETALDEVICE_H
|
#define BAREMETALDEVICE_H
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -46,6 +45,7 @@ public:
|
|||||||
static Ptr create(const QString &name, Core::Id type, MachineType machineType,
|
static Ptr create(const QString &name, Core::Id type, MachineType machineType,
|
||||||
Origin origin = ManuallyAdded, Core::Id id = Core::Id());
|
Origin origin = ManuallyAdded, Core::Id id = Core::Id());
|
||||||
static Ptr create(const BareMetalDevice &other);
|
static Ptr create(const BareMetalDevice &other);
|
||||||
|
|
||||||
QString displayType() const;
|
QString displayType() const;
|
||||||
ProjectExplorer::IDeviceWidget *createWidget();
|
ProjectExplorer::IDeviceWidget *createWidget();
|
||||||
QList<Core::Id> actionIds() const;
|
QList<Core::Id> actionIds() const;
|
||||||
@@ -55,16 +55,18 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const;
|
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const;
|
||||||
|
|
||||||
QString getGdbInitCommands() const {return m_gdbInitCommands;}
|
QString gdbInitCommands() const { return m_gdbInitCommands; }
|
||||||
void setGdbInitCommands(const QString &gdbCommands) { m_gdbInitCommands=gdbCommands; }
|
void setGdbInitCommands(const QString &gdbCommands) { m_gdbInitCommands=gdbCommands; }
|
||||||
|
|
||||||
virtual void fromMap(const QVariantMap &map);
|
virtual void fromMap(const QVariantMap &map);
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BareMetalDevice() {}
|
BareMetalDevice() {}
|
||||||
BareMetalDevice(const QString &name, Core::Id type,
|
BareMetalDevice(const QString &name, Core::Id type,
|
||||||
MachineType machineType, Origin origin, Core::Id id);
|
MachineType machineType, Origin origin, Core::Id id);
|
||||||
BareMetalDevice(const BareMetalDevice &other);
|
BareMetalDevice(const BareMetalDevice &other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BareMetalDevice &operator=(const BareMetalDevice &);
|
BareMetalDevice &operator=(const BareMetalDevice &);
|
||||||
QString m_gdbInitCommands;
|
QString m_gdbInitCommands;
|
||||||
@@ -72,4 +74,5 @@ private:
|
|||||||
|
|
||||||
} //namespace Internal
|
} //namespace Internal
|
||||||
} //namespace BareMetal
|
} //namespace BareMetal
|
||||||
|
|
||||||
#endif // BAREMETALDEVICE_H
|
#endif // BAREMETALDEVICE_H
|
||||||
|
|||||||
@@ -35,9 +35,11 @@
|
|||||||
#include <coreplugin/variablechooser.h>
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
using namespace QSsh;
|
using namespace QSsh;
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ void BareMetalDeviceConfigurationWidget::initGui()
|
|||||||
m_ui->gdbPortSpinBox->setValue(sshParams.port);
|
m_ui->gdbPortSpinBox->setValue(sshParams.port);
|
||||||
QSharedPointer<BareMetalDevice> p = qSharedPointerCast<BareMetalDevice>(device());
|
QSharedPointer<BareMetalDevice> p = qSharedPointerCast<BareMetalDevice>(device());
|
||||||
QTC_ASSERT(!p.isNull(), return);
|
QTC_ASSERT(!p.isNull(), return);
|
||||||
m_ui->gdbCommandsTextEdit->setPlainText(p->getGdbInitCommands());
|
m_ui->gdbCommandsTextEdit->setPlainText(p->gdbInitCommands());
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace BareMetal
|
} //namespace BareMetal
|
||||||
|
|||||||
@@ -40,10 +40,12 @@ class BareMetalDeviceConfigurationWidget
|
|||||||
: public ProjectExplorer::IDeviceWidget
|
: public ProjectExplorer::IDeviceWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BareMetalDeviceConfigurationWidget(
|
explicit BareMetalDeviceConfigurationWidget(
|
||||||
const ProjectExplorer::IDevice::Ptr &deviceConfig, QWidget *parent = 0);
|
const ProjectExplorer::IDevice::Ptr &deviceConfig, QWidget *parent = 0);
|
||||||
~BareMetalDeviceConfigurationWidget();
|
~BareMetalDeviceConfigurationWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void hostnameChanged();
|
void hostnameChanged();
|
||||||
void portChanged();
|
void portChanged();
|
||||||
@@ -56,4 +58,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} //namespace BareMetal
|
} //namespace BareMetal
|
||||||
|
|
||||||
#endif // BAREMETALDEVICECONFIGURATIONWIDGET_H
|
#endif // BAREMETALDEVICECONFIGURATIONWIDGET_H
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "baremetalgdbcommandsdeploystep.h"
|
#include "baremetalgdbcommandsdeploystep.h"
|
||||||
|
|
||||||
using namespace BareMetal::Internal;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -42,10 +42,9 @@ BareMetalGdbCommandsDeployStepWidget::BareMetalGdbCommandsDeployStepWidget(BareM
|
|||||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
setLayout(fl);
|
setLayout(fl);
|
||||||
m_commands = new QPlainTextEdit(this);
|
m_commands = new QPlainTextEdit(this);
|
||||||
fl->addRow(tr("GDB commands:"),m_commands);
|
fl->addRow(tr("GDB commands:"), m_commands);
|
||||||
m_commands->setPlainText(m_step.gdbCommands());
|
m_commands->setPlainText(m_step.gdbCommands());
|
||||||
if (!connect(m_commands,SIGNAL(textChanged()),SLOT(update())))
|
connect(m_commands, SIGNAL(textChanged()), SLOT(update()));
|
||||||
qDebug()<<"BareMetalGdbCommandsDeployStepWidget connect failed.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalGdbCommandsDeployStepWidget::update()
|
void BareMetalGdbCommandsDeployStepWidget::update()
|
||||||
@@ -94,7 +93,8 @@ void BareMetalGdbCommandsDeployStep::run(QFutureInterface<bool> &fi)
|
|||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BareMetalGdbCommandsDeployStep::fromMap(const QVariantMap &map) {
|
bool BareMetalGdbCommandsDeployStep::fromMap(const QVariantMap &map)
|
||||||
|
{
|
||||||
if (!BuildStep::fromMap(map))
|
if (!BuildStep::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
m_gdbCommands = map.value(QLatin1String(Internal::GdbCommandsKey)).toString();
|
m_gdbCommands = map.value(QLatin1String(Internal::GdbCommandsKey)).toString();
|
||||||
|
|||||||
@@ -36,13 +36,12 @@
|
|||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
|
|
||||||
class BareMetalGdbCommandsDeployStep : public ProjectExplorer::BuildStep
|
class BareMetalGdbCommandsDeployStep : public ProjectExplorer::BuildStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl, const Core::Id id);
|
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl, const Core::Id id);
|
||||||
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl,
|
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl,
|
||||||
@@ -63,12 +62,14 @@ public:
|
|||||||
|
|
||||||
void updateGdbCommands(const QString &newCommands);
|
void updateGdbCommands(const QString &newCommands);
|
||||||
QString gdbCommands() const;
|
QString gdbCommands() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
void ctor();
|
||||||
QString m_gdbCommands;
|
QString m_gdbCommands;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char GdbCommandsKey[] = "BareMetal.GdbCommandsStep.Commands";
|
const char GdbCommandsKey[] = "BareMetal.GdbCommandsStep.Commands";
|
||||||
|
|
||||||
class BareMetalGdbCommandsDeployStepWidget: public ProjectExplorer::BuildStepConfigWidget
|
class BareMetalGdbCommandsDeployStepWidget: public ProjectExplorer::BuildStepConfigWidget
|
||||||
@@ -85,7 +86,7 @@ private:
|
|||||||
QPlainTextEdit *m_commands;
|
QPlainTextEdit *m_commands;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal namespace
|
} // namespace Internal
|
||||||
|
|
||||||
} // namespace BareMetal
|
} // namespace BareMetal
|
||||||
|
|
||||||
#endif // BAREMETALGDBCOMMANDSDEPLOYSTEP_H
|
#endif // BAREMETALGDBCOMMANDSDEPLOYSTEP_H
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ DebuggerStartParameters BareMetalRunControlFactory::startParameters(const BareMe
|
|||||||
}
|
}
|
||||||
params.remoteChannel = device->sshParameters().host + QLatin1String(":") + QString::number(device->sshParameters().port);
|
params.remoteChannel = device->sshParameters().host + QLatin1String(":") + QString::number(device->sshParameters().port);
|
||||||
params.remoteSetupNeeded = false; // qml stuff, not needed
|
params.remoteSetupNeeded = false; // qml stuff, not needed
|
||||||
params.commandsAfterConnect = device->getGdbInitCommands().toLatin1();
|
params.commandsAfterConnect = device->gdbInitCommands().toLatin1();
|
||||||
BuildConfiguration *bc = target->activeBuildConfiguration();
|
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||||
BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId());
|
BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId());
|
||||||
if (bsl) {
|
if (bsl) {
|
||||||
foreach (BuildStep *bs,bsl->steps()) {
|
foreach (BuildStep *bs, bsl->steps()) {
|
||||||
BareMetalGdbCommandsDeployStep *ds = qobject_cast<BareMetalGdbCommandsDeployStep *>(bs);
|
BareMetalGdbCommandsDeployStep *ds = qobject_cast<BareMetalGdbCommandsDeployStep *>(bs);
|
||||||
if (ds) {
|
if (ds) {
|
||||||
if (!params.commandsAfterConnect.endsWith("\n"))
|
if (!params.commandsAfterConnect.endsWith("\n"))
|
||||||
|
|||||||
@@ -29,7 +29,9 @@
|
|||||||
|
|
||||||
#ifndef BAREMETALRUNCONTROLFACTORY_H
|
#ifndef BAREMETALRUNCONTROLFACTORY_H
|
||||||
#define BAREMETALRUNCONTROLFACTORY_H
|
#define BAREMETALRUNCONTROLFACTORY_H
|
||||||
|
|
||||||
#include "baremetalrunconfiguration.h"
|
#include "baremetalrunconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <debugger/debuggerstartparameters.h>
|
#include <debugger/debuggerstartparameters.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user