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