forked from qt-creator/qt-creator
bare-metal: Refactor the plugin code a bit more
* An include files and forward declarations are sorted in an alphabetical order. * Used the 'final' keywords for the methods and classes which not should be overridden. * Used the 'auto' and 'explicit' keywords more. * A class members are initialized in an initializier list. Change-Id: Ia74783e47aff92467d696d471760b5a97bca3d7a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -24,11 +24,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalcustomrunconfiguration.h"
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtoutputformatter.h>
|
||||
|
||||
@@ -38,10 +37,12 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// BareMetalCustomRunConfiguration
|
||||
|
||||
BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto exeAspect = addAspect<ExecutableAspect>();
|
||||
const auto exeAspect = addAspect<ExecutableAspect>();
|
||||
exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable");
|
||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||
exeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay);
|
||||
|
@@ -30,23 +30,29 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class BareMetalCustomRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
// BareMetalCustomRunConfiguration
|
||||
|
||||
class BareMetalCustomRunConfiguration final
|
||||
: public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BareMetalCustomRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
public:
|
||||
static const char *Id;
|
||||
bool isConfigured() const override;
|
||||
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
||||
bool isConfigured() const final;
|
||||
ConfigurationState ensureConfigured(QString *errorMessage) final;
|
||||
};
|
||||
|
||||
class BareMetalCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
||||
// BareMetalCustomRunConfigurationFactory
|
||||
|
||||
class BareMetalCustomRunConfigurationFactory final
|
||||
: public ProjectExplorer::FixedRunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
BareMetalCustomRunConfigurationFactory();
|
||||
explicit BareMetalCustomRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -30,8 +30,8 @@
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
@@ -52,10 +52,12 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// BareMetalDebugSupport
|
||||
|
||||
BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
|
||||
: Debugger::DebuggerRunTool(runControl)
|
||||
{
|
||||
auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
if (!dev) {
|
||||
reportFailure(tr("Cannot debug: Kit has no device."));
|
||||
return;
|
||||
|
@@ -30,15 +30,17 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class BareMetalDebugSupport : public Debugger::DebuggerRunTool
|
||||
// BareMetalDebugSupport
|
||||
|
||||
class BareMetalDebugSupport final : public Debugger::DebuggerRunTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BareMetalDebugSupport(ProjectExplorer::RunControl *runControl);
|
||||
explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
void start() final;
|
||||
|
||||
ProjectExplorer::SimpleTargetRunner *m_gdbServer = nullptr;
|
||||
};
|
||||
|
@@ -24,12 +24,13 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetaldevice.h"
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaldeviceconfigurationwidget.h"
|
||||
#include "baremetaldeviceconfigurationwizard.h"
|
||||
|
||||
#include "defaultgdbserverprovider.h"
|
||||
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "gdbserverproviderprocess.h"
|
||||
|
||||
@@ -47,6 +48,8 @@ namespace Internal {
|
||||
|
||||
const char gdbServerProviderIdKeyC[] = "GdbServerProviderId";
|
||||
|
||||
// BareMetalDevice
|
||||
|
||||
BareMetalDevice::~BareMetalDevice()
|
||||
{
|
||||
if (GdbServerProvider *provider = GdbServerProviderManager::findProvider(m_gdbServerProviderId))
|
||||
@@ -163,8 +166,7 @@ BareMetalDevice::BareMetalDevice(const BareMetalDevice &other)
|
||||
setGdbServerProviderId(other.gdbServerProviderId());
|
||||
}
|
||||
|
||||
|
||||
// Factory
|
||||
// BareMetalDeviceFactory
|
||||
|
||||
BareMetalDeviceFactory::BareMetalDeviceFactory()
|
||||
: IDeviceFactory(Constants::BareMetalOsType)
|
||||
|
@@ -34,50 +34,54 @@ namespace Internal {
|
||||
|
||||
class GdbServerProvider;
|
||||
|
||||
class BareMetalDevice : public ProjectExplorer::IDevice
|
||||
// BareMetalDevice
|
||||
|
||||
class BareMetalDevice final : public ProjectExplorer::IDevice
|
||||
{
|
||||
public:
|
||||
using Ptr = QSharedPointer<BareMetalDevice>;
|
||||
using ConstPtr = QSharedPointer<const BareMetalDevice>;
|
||||
|
||||
static Ptr create() { return Ptr(new BareMetalDevice); }
|
||||
~BareMetalDevice() override;
|
||||
~BareMetalDevice() final;
|
||||
|
||||
QString displayType() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
Utils::OsType osType() const override;
|
||||
ProjectExplorer::IDevice::Ptr clone() const override;
|
||||
QString displayType() const final;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() final;
|
||||
Utils::OsType osType() const final;
|
||||
ProjectExplorer::IDevice::Ptr clone() const final;
|
||||
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const final;
|
||||
|
||||
bool canCreateProcess() const override { return true; }
|
||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
||||
bool canCreateProcess() const final { return true; }
|
||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const final;
|
||||
|
||||
QString gdbServerProviderId() const;
|
||||
void setGdbServerProviderId(const QString &id);
|
||||
void unregisterProvider(GdbServerProvider *provider);
|
||||
void providerUpdated(GdbServerProvider *provider);
|
||||
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
void fromMap(const QVariantMap &map) final;
|
||||
QVariantMap toMap() const final;
|
||||
|
||||
private:
|
||||
BareMetalDevice() = default;
|
||||
BareMetalDevice(const BareMetalDevice &other);
|
||||
explicit BareMetalDevice() = default;
|
||||
explicit BareMetalDevice(const BareMetalDevice &other);
|
||||
|
||||
void setChannelByServerProvider(GdbServerProvider *provider);
|
||||
BareMetalDevice &operator=(const BareMetalDevice &);
|
||||
QString m_gdbServerProviderId;
|
||||
};
|
||||
|
||||
class BareMetalDeviceFactory : public ProjectExplorer::IDeviceFactory
|
||||
// BareMetalDeviceFactory
|
||||
|
||||
class BareMetalDeviceFactory final : public ProjectExplorer::IDeviceFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BareMetalDeviceFactory();
|
||||
explicit BareMetalDeviceFactory();
|
||||
|
||||
ProjectExplorer::IDevice::Ptr create() const override;
|
||||
ProjectExplorer::IDevice::Ptr create() const final;
|
||||
};
|
||||
|
||||
} //namespace Internal
|
||||
|
@@ -24,11 +24,11 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetaldeviceconfigurationwidget.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaldeviceconfigurationwidget.h"
|
||||
|
||||
#include "gdbserverproviderchooser.h"
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverproviderchooser.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// BareMetalDeviceConfigurationWidget
|
||||
|
||||
BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
||||
const ProjectExplorer::IDevice::Ptr &deviceConfig, QWidget *parent)
|
||||
: IDeviceWidget(deviceConfig, parent)
|
||||
@@ -44,7 +46,7 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, return);
|
||||
|
||||
auto formLayout = new QFormLayout(this);
|
||||
const auto formLayout = new QFormLayout(this);
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
m_gdbServerProviderChooser = new GdbServerProviderChooser(true, this);
|
||||
@@ -58,7 +60,7 @@ BareMetalDeviceConfigurationWidget::BareMetalDeviceConfigurationWidget(
|
||||
|
||||
void BareMetalDeviceConfigurationWidget::gdbServerProviderChanged()
|
||||
{
|
||||
auto dev = qSharedPointerCast<BareMetalDevice>(device());
|
||||
const auto dev = qSharedPointerCast<BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, return);
|
||||
dev->setGdbServerProviderId(m_gdbServerProviderChooser->currentProviderId());
|
||||
}
|
||||
|
@@ -33,7 +33,9 @@ namespace Internal {
|
||||
|
||||
class GdbServerProviderChooser;
|
||||
|
||||
class BareMetalDeviceConfigurationWidget
|
||||
// BareMetalDeviceConfigurationWidget
|
||||
|
||||
class BareMetalDeviceConfigurationWidget final
|
||||
: public ProjectExplorer::IDeviceWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -44,9 +46,9 @@ public:
|
||||
|
||||
private:
|
||||
void gdbServerProviderChanged();
|
||||
void updateDeviceFromUi() override;
|
||||
void updateDeviceFromUi() final;
|
||||
|
||||
GdbServerProviderChooser *m_gdbServerProviderChooser;
|
||||
GdbServerProviderChooser *m_gdbServerProviderChooser = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -24,16 +24,18 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaldeviceconfigurationwizard.h"
|
||||
#include "baremetaldeviceconfigurationwizardpages.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
enum PageId { SetupPageId };
|
||||
|
||||
// BareMetalDeviceConfigurationWizard
|
||||
|
||||
BareMetalDeviceConfigurationWizard::BareMetalDeviceConfigurationWizard(QWidget *parent) :
|
||||
Utils::Wizard(parent),
|
||||
m_setupPage(new BareMetalDeviceConfigurationWizardSetupPage(this))
|
||||
@@ -45,7 +47,7 @@ BareMetalDeviceConfigurationWizard::BareMetalDeviceConfigurationWizard(QWidget *
|
||||
|
||||
ProjectExplorer::IDevice::Ptr BareMetalDeviceConfigurationWizard::device() const
|
||||
{
|
||||
auto dev = BareMetalDevice::create();
|
||||
const auto dev = BareMetalDevice::create();
|
||||
dev->setupId(ProjectExplorer::IDevice::ManuallyAdded, Core::Id());
|
||||
dev->setDisplayName(m_setupPage->configurationName());
|
||||
dev->setType(Constants::BareMetalOsType);
|
||||
|
@@ -33,17 +33,19 @@ namespace Internal {
|
||||
|
||||
class BareMetalDeviceConfigurationWizardSetupPage;
|
||||
|
||||
class BareMetalDeviceConfigurationWizard : public Utils::Wizard
|
||||
// BareMetalDeviceConfigurationWizard
|
||||
|
||||
class BareMetalDeviceConfigurationWizard final : public Utils::Wizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BareMetalDeviceConfigurationWizard(QWidget *parent = nullptr);
|
||||
explicit BareMetalDeviceConfigurationWizard(QWidget *parent = nullptr);
|
||||
|
||||
ProjectExplorer::IDevice::Ptr device() const;
|
||||
|
||||
private:
|
||||
BareMetalDeviceConfigurationWizardSetupPage *m_setupPage;
|
||||
BareMetalDeviceConfigurationWizardSetupPage *m_setupPage = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -24,8 +24,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetaldeviceconfigurationwizardpages.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaldeviceconfigurationwizardpages.h"
|
||||
|
||||
#include "gdbserverproviderchooser.h"
|
||||
|
||||
@@ -38,13 +38,15 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// BareMetalDeviceConfigurationWizardSetupPage
|
||||
|
||||
BareMetalDeviceConfigurationWizardSetupPage::BareMetalDeviceConfigurationWizardSetupPage(
|
||||
QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Set up GDB Server or Hardware Debugger"));
|
||||
|
||||
auto formLayout = new QFormLayout(this);
|
||||
const auto formLayout = new QFormLayout(this);
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
m_nameLineEdit = new QLineEdit(this);
|
||||
formLayout->addRow(tr("Name:"), m_nameLineEdit);
|
||||
|
@@ -37,23 +37,25 @@ namespace Internal {
|
||||
|
||||
class GdbServerProviderChooser;
|
||||
|
||||
class BareMetalDeviceConfigurationWizardSetupPage : public QWizardPage
|
||||
// BareMetalDeviceConfigurationWizardSetupPage
|
||||
|
||||
class BareMetalDeviceConfigurationWizardSetupPage final : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BareMetalDeviceConfigurationWizardSetupPage(QWidget *parent = nullptr);
|
||||
|
||||
void initializePage() override;
|
||||
bool isComplete() const override;
|
||||
void initializePage() final;
|
||||
bool isComplete() const final;
|
||||
QString configurationName() const;
|
||||
QString gdbServerProviderId() const;
|
||||
|
||||
virtual QString defaultConfigurationName() const;
|
||||
|
||||
private:
|
||||
QLineEdit *m_nameLineEdit;
|
||||
GdbServerProviderChooser *m_gdbServerProviderChooser;
|
||||
QLineEdit *m_nameLineEdit = nullptr;
|
||||
GdbServerProviderChooser *m_gdbServerProviderChooser = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -34,10 +34,12 @@ namespace Internal {
|
||||
|
||||
const char GdbCommandsKey[] = "BareMetal.GdbCommandsStep.Commands";
|
||||
|
||||
// BareMetalGdbCommandsDeployStepWidget
|
||||
|
||||
BareMetalGdbCommandsDeployStepWidget::BareMetalGdbCommandsDeployStepWidget(BareMetalGdbCommandsDeployStep &step)
|
||||
: BuildStepConfigWidget(&step), m_step(step)
|
||||
{
|
||||
auto fl = new QFormLayout(this);
|
||||
const auto fl = new QFormLayout(this);
|
||||
fl->setMargin(0);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
@@ -62,6 +64,8 @@ QString BareMetalGdbCommandsDeployStepWidget::summaryText() const
|
||||
return displayName();
|
||||
}
|
||||
|
||||
// BareMetalGdbCommandsDeployStep
|
||||
|
||||
BareMetalGdbCommandsDeployStep::BareMetalGdbCommandsDeployStep(BuildStepList *bsl)
|
||||
: BuildStep(bsl, stepId())
|
||||
{
|
||||
|
@@ -27,23 +27,25 @@
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class BareMetalGdbCommandsDeployStep : public ProjectExplorer::BuildStep
|
||||
// BareMetalGdbCommandsDeployStep
|
||||
|
||||
class BareMetalGdbCommandsDeployStep final : public ProjectExplorer::BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
QVariantMap toMap() const final;
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() final;
|
||||
|
||||
static Core::Id stepId();
|
||||
static QString displayName();
|
||||
@@ -52,13 +54,16 @@ public:
|
||||
QString gdbCommands() const;
|
||||
|
||||
private:
|
||||
bool init() override;
|
||||
void doRun() override;
|
||||
bool init() final;
|
||||
void doRun() final;
|
||||
|
||||
QString m_gdbCommands;
|
||||
};
|
||||
|
||||
class BareMetalGdbCommandsDeployStepWidget: public ProjectExplorer::BuildStepConfigWidget
|
||||
// BareMetalGdbCommandsDeployStepWidget
|
||||
|
||||
class BareMetalGdbCommandsDeployStepWidget final
|
||||
: public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -71,7 +76,7 @@ private:
|
||||
QString summaryText() const;
|
||||
|
||||
BareMetalGdbCommandsDeployStep &m_step;
|
||||
QPlainTextEdit *m_commands;
|
||||
QPlainTextEdit *m_commands = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -24,32 +24,34 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalplugin.h"
|
||||
#include "baremetalconstants.h"
|
||||
#include "baremetalcustomrunconfiguration.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaldebugsupport.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetalplugin.h"
|
||||
#include "baremetalrunconfiguration.h"
|
||||
|
||||
#include "gdbserverproviderssettingspage.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "gdbserverproviderssettingspage.h"
|
||||
|
||||
#include "iarewtoolchain.h"
|
||||
#include "keiltoolchain.h"
|
||||
#include "sdcctoolchain.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// BareMetalPluginPrivate
|
||||
|
||||
class BareMetalPluginPrivate
|
||||
{
|
||||
public:
|
||||
@@ -63,6 +65,8 @@ public:
|
||||
GdbServerProviderManager gdbServerProviderManager;
|
||||
};
|
||||
|
||||
// BareMetalPlugin
|
||||
|
||||
BareMetalPlugin::~BareMetalPlugin()
|
||||
{
|
||||
delete d;
|
||||
|
@@ -31,7 +31,9 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class BareMetalPlugin : public ExtensionSystem::IPlugin
|
||||
// BareMetalPlugin
|
||||
|
||||
class BareMetalPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "BareMetal.json")
|
||||
@@ -41,7 +43,7 @@ class BareMetalPlugin : public ExtensionSystem::IPlugin
|
||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
class BareMetalPluginPrivate *d;
|
||||
class BareMetalPluginPrivate *d = nullptr;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
|
@@ -23,9 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalrunconfiguration.h"
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
#include "baremetalrunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildtargetinfo.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -43,7 +42,7 @@ namespace Internal {
|
||||
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto exeAspect = addAspect<ExecutableAspect>();
|
||||
const auto exeAspect = addAspect<ExecutableAspect>();
|
||||
exeAspect->setDisplayStyle(BaseStringAspect::LabelDisplay);
|
||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||
|
||||
|
@@ -30,12 +30,14 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class BareMetalRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
// BareMetalRunConfiguration
|
||||
|
||||
class BareMetalRunConfiguration final : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BareMetalRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
explicit BareMetalRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
static const char *IdPrefix;
|
||||
|
||||
@@ -43,10 +45,13 @@ private:
|
||||
void updateTargetInformation();
|
||||
};
|
||||
|
||||
class BareMetalRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
// BareMetalRunConfigurationFactory
|
||||
|
||||
class BareMetalRunConfigurationFactory final
|
||||
: public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
BareMetalRunConfigurationFactory();
|
||||
explicit BareMetalRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "defaultgdbserverprovider.h"
|
||||
#include "baremetalconstants.h"
|
||||
#include "defaultgdbserverprovider.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -40,10 +40,10 @@ namespace Internal {
|
||||
static const char hostKeyC[] = "BareMetal.DefaultGdbServerProvider.Host";
|
||||
static const char portKeyC[] = "BareMetal.DefaultGdbServerProvider.Port";
|
||||
|
||||
// DefaultGdbServerProvider
|
||||
|
||||
DefaultGdbServerProvider::DefaultGdbServerProvider()
|
||||
: GdbServerProvider(QLatin1String(Constants::DEFAULT_PROVIDER_ID))
|
||||
, m_host(QLatin1String("localhost"))
|
||||
, m_port(3333)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -132,6 +132,8 @@ GdbServerProviderConfigWidget *DefaultGdbServerProvider::configurationWidget()
|
||||
return new DefaultGdbServerProviderConfigWidget(this);
|
||||
}
|
||||
|
||||
// DefaultGdbServerProviderFactory
|
||||
|
||||
DefaultGdbServerProviderFactory::DefaultGdbServerProviderFactory()
|
||||
{
|
||||
setId(QLatin1String(Constants::DEFAULT_PROVIDER_ID));
|
||||
@@ -152,7 +154,7 @@ bool DefaultGdbServerProviderFactory::canRestore(const QVariantMap &data) const
|
||||
|
||||
GdbServerProvider *DefaultGdbServerProviderFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto p = new DefaultGdbServerProvider;
|
||||
const auto p = new DefaultGdbServerProvider;
|
||||
auto updated = data;
|
||||
if (p->fromMap(updated))
|
||||
return p;
|
||||
@@ -160,6 +162,8 @@ GdbServerProvider *DefaultGdbServerProviderFactory::restore(const QVariantMap &d
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// GdbServerProviderConfigWidget
|
||||
|
||||
DefaultGdbServerProviderConfigWidget::DefaultGdbServerProviderConfigWidget(
|
||||
DefaultGdbServerProvider *provider)
|
||||
: GdbServerProviderConfigWidget(provider)
|
||||
@@ -179,7 +183,7 @@ DefaultGdbServerProviderConfigWidget::DefaultGdbServerProviderConfigWidget(
|
||||
addErrorLabel();
|
||||
setFromProvider();
|
||||
|
||||
auto chooser = new Core::VariableChooser(this);
|
||||
const auto chooser = new Core::VariableChooser(this);
|
||||
chooser->addSupportedWidget(m_initCommandsTextEdit);
|
||||
chooser->addSupportedWidget(m_resetCommandsTextEdit);
|
||||
|
||||
|
@@ -33,7 +33,9 @@ namespace Internal {
|
||||
class DefaultGdbServerProviderConfigWidget;
|
||||
class DefaultGdbServerProviderFactory;
|
||||
|
||||
class DefaultGdbServerProvider : public GdbServerProvider
|
||||
// DefaultGdbServerProvider
|
||||
|
||||
class DefaultGdbServerProvider final : public GdbServerProvider
|
||||
{
|
||||
public:
|
||||
QString typeDisplayName() const final;
|
||||
@@ -60,15 +62,17 @@ private:
|
||||
explicit DefaultGdbServerProvider();
|
||||
explicit DefaultGdbServerProvider(const DefaultGdbServerProvider &);
|
||||
|
||||
QString m_host;
|
||||
quint16 m_port;
|
||||
QString m_host = QLatin1String("localhost");
|
||||
quint16 m_port = 3333;
|
||||
|
||||
friend class DefaultGdbServerProviderConfigWidget;
|
||||
friend class DefaultGdbServerProviderFactory;
|
||||
friend class BareMetalDevice;
|
||||
};
|
||||
|
||||
class DefaultGdbServerProviderFactory : public GdbServerProviderFactory
|
||||
// DefaultGdbServerProviderFactory
|
||||
|
||||
class DefaultGdbServerProviderFactory final : public GdbServerProviderFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -81,7 +85,9 @@ public:
|
||||
GdbServerProvider *restore(const QVariantMap &data) final;
|
||||
};
|
||||
|
||||
class DefaultGdbServerProviderConfigWidget : public GdbServerProviderConfigWidget
|
||||
// DefaultGdbServerProviderConfigWidget
|
||||
|
||||
class DefaultGdbServerProviderConfigWidget final : public GdbServerProviderConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -94,9 +100,9 @@ private:
|
||||
|
||||
void setFromProvider();
|
||||
|
||||
HostWidget *m_hostWidget;
|
||||
QPlainTextEdit *m_initCommandsTextEdit;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit;
|
||||
HostWidget *m_hostWidget = nullptr;
|
||||
QPlainTextEdit *m_initCommandsTextEdit = nullptr;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -23,22 +23,21 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetaldevice.h"
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "baremetaldevice.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QUuid>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QUuid>
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
@@ -56,9 +55,10 @@ static QString createId(const QString &id)
|
||||
return newId;
|
||||
}
|
||||
|
||||
// GdbServerProvider
|
||||
|
||||
GdbServerProvider::GdbServerProvider(const QString &id)
|
||||
: m_id(createId(id))
|
||||
, m_startupMode(NoStartup)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ bool GdbServerProvider::fromMap(const QVariantMap &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
// GdbServerProviderFactory
|
||||
|
||||
QString GdbServerProviderFactory::id() const
|
||||
{
|
||||
return m_id;
|
||||
@@ -234,6 +236,8 @@ void GdbServerProviderFactory::idToMap(QVariantMap &data, const QString &id)
|
||||
data.insert(QLatin1String(idKeyC), id);
|
||||
}
|
||||
|
||||
// GdbServerProviderConfigWidget
|
||||
|
||||
GdbServerProviderConfigWidget::GdbServerProviderConfigWidget(
|
||||
GdbServerProvider *provider)
|
||||
: m_provider(provider)
|
||||
@@ -373,6 +377,8 @@ QString GdbServerProviderConfigWidget::defaultResetCommandsTooltip()
|
||||
"The MCU should be halted after these commands.");
|
||||
}
|
||||
|
||||
// HostWidget
|
||||
|
||||
HostWidget::HostWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@@ -383,7 +389,7 @@ HostWidget::HostWidget(QWidget *parent)
|
||||
m_portSpinBox->setRange(0, 65535);
|
||||
m_portSpinBox->setToolTip(tr("Enter TCP/IP port which will be listened by "
|
||||
"the GDB server provider."));
|
||||
auto layout = new QHBoxLayout(this);
|
||||
const auto layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_hostLineEdit);
|
||||
layout->addWidget(m_portSpinBox);
|
||||
|
@@ -33,12 +33,12 @@
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QFormLayout;
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
class QFormLayout;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPlainTextEdit;
|
||||
class QSpinBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace BareMetal {
|
||||
@@ -48,6 +48,8 @@ class BareMetalDevice;
|
||||
class GdbServerProviderConfigWidget;
|
||||
class GdbServerProviderManager;
|
||||
|
||||
// GdbServerProvider
|
||||
|
||||
class GdbServerProvider
|
||||
{
|
||||
public:
|
||||
@@ -104,7 +106,7 @@ protected:
|
||||
private:
|
||||
QString m_id;
|
||||
mutable QString m_displayName;
|
||||
StartupMode m_startupMode;
|
||||
StartupMode m_startupMode = NoStartup;
|
||||
QString m_initCommands;
|
||||
QString m_resetCommands;
|
||||
QSet<BareMetalDevice *> m_devices;
|
||||
@@ -112,6 +114,8 @@ private:
|
||||
friend class GdbServerProviderConfigWidget;
|
||||
};
|
||||
|
||||
// GdbServerProviderFactory
|
||||
|
||||
class GdbServerProviderFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -137,6 +141,8 @@ private:
|
||||
QString m_id;
|
||||
};
|
||||
|
||||
// GdbServerProviderConfigWidget
|
||||
|
||||
class GdbServerProviderConfigWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -166,18 +172,20 @@ protected:
|
||||
static QString defaultInitCommandsTooltip();
|
||||
static QString defaultResetCommandsTooltip();
|
||||
|
||||
QFormLayout *m_mainLayout;
|
||||
QLineEdit *m_nameLineEdit;
|
||||
QComboBox *m_startupModeComboBox;
|
||||
QFormLayout *m_mainLayout = nullptr;
|
||||
QLineEdit *m_nameLineEdit = nullptr;
|
||||
QComboBox *m_startupModeComboBox = nullptr;
|
||||
|
||||
private:
|
||||
void setFromProvider();
|
||||
|
||||
GdbServerProvider *m_provider;
|
||||
GdbServerProvider *m_provider = nullptr;
|
||||
QLabel *m_errorLabel = nullptr;
|
||||
};
|
||||
|
||||
class HostWidget : public QWidget
|
||||
// HostWidget
|
||||
|
||||
class HostWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -193,8 +201,8 @@ signals:
|
||||
void dataChanged();
|
||||
|
||||
private:
|
||||
QLineEdit *m_hostLineEdit;
|
||||
QSpinBox *m_portSpinBox;
|
||||
QLineEdit *m_hostLineEdit = nullptr;
|
||||
QSpinBox *m_portSpinBox = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -23,12 +23,12 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverproviderchooser.h"
|
||||
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "gdbserverprovider.h"
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverproviderchooser.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QComboBox>
|
||||
@@ -39,6 +39,8 @@
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// GdbServerProviderChooser
|
||||
|
||||
GdbServerProviderChooser::GdbServerProviderChooser(
|
||||
bool useManageButton, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@@ -49,7 +51,7 @@ GdbServerProviderChooser::GdbServerProviderChooser(
|
||||
m_manageButton->setEnabled(useManageButton);
|
||||
m_manageButton->setVisible(useManageButton);
|
||||
|
||||
auto layout = new QHBoxLayout(this);
|
||||
const auto layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_chooser);
|
||||
layout->addWidget(m_manageButton);
|
||||
|
@@ -39,7 +39,9 @@ namespace Internal {
|
||||
|
||||
class GdbServerProvider;
|
||||
|
||||
class GdbServerProviderChooser : public QWidget
|
||||
// GdbServerProviderChooser
|
||||
|
||||
class GdbServerProviderChooser final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -60,8 +62,8 @@ private:
|
||||
bool providerMatches(const GdbServerProvider *) const;
|
||||
QString providerText(const GdbServerProvider *) const;
|
||||
|
||||
QComboBox *m_chooser;
|
||||
QPushButton *m_manageButton;
|
||||
QComboBox *m_chooser = nullptr;
|
||||
QPushButton *m_manageButton = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -23,11 +23,11 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include "openocdgdbserverprovider.h"
|
||||
#include "defaultgdbserverprovider.h"
|
||||
#include "openocdgdbserverprovider.h"
|
||||
#include "stlinkutilgdbserverprovider.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -35,8 +35,8 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/persistentsettings.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@@ -50,6 +50,8 @@ const char fileNameKeyC[] = "/gdbserverproviders.xml";
|
||||
|
||||
static GdbServerProviderManager *m_instance = nullptr;
|
||||
|
||||
// GdbServerProviderManager
|
||||
|
||||
GdbServerProviderManager::GdbServerProviderManager()
|
||||
: m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
||||
, m_factories({new DefaultGdbServerProviderFactory,
|
||||
|
@@ -25,8 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
@@ -40,13 +40,15 @@ class BareMetalPluginPrivate;
|
||||
class GdbServerProvider;
|
||||
class GdbServerProviderFactory;
|
||||
|
||||
class GdbServerProviderManager : public QObject
|
||||
// GdbServerProviderManager
|
||||
|
||||
class GdbServerProviderManager final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static GdbServerProviderManager *instance();
|
||||
~GdbServerProviderManager() override;
|
||||
~GdbServerProviderManager() final;
|
||||
|
||||
static QList<GdbServerProvider *> providers();
|
||||
static QList<GdbServerProviderFactory *> factories();
|
||||
@@ -69,7 +71,7 @@ private:
|
||||
void restoreProviders();
|
||||
static void notifyAboutUpdate(GdbServerProvider *);
|
||||
|
||||
Utils::PersistentSettingsWriter *m_writer;
|
||||
Utils::PersistentSettingsWriter *m_writer = nullptr;
|
||||
QList<GdbServerProvider *> m_providers;
|
||||
const Utils::FileName m_configFile;
|
||||
const QList<GdbServerProviderFactory *> m_factories;
|
||||
|
@@ -29,14 +29,16 @@
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// GdbServerProviderProcess
|
||||
|
||||
GdbServerProviderProcess::GdbServerProviderProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent)
|
||||
|
@@ -32,7 +32,9 @@ namespace Utils { class QtcProcess; }
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class GdbServerProviderProcess : public ProjectExplorer::DeviceProcess
|
||||
// GdbServerProviderProcess
|
||||
|
||||
class GdbServerProviderProcess final : public ProjectExplorer::DeviceProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -40,23 +42,23 @@ public:
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
void start(const ProjectExplorer::Runnable &runnable) override;
|
||||
void interrupt() override;
|
||||
void terminate() override;
|
||||
void kill() override;
|
||||
void start(const ProjectExplorer::Runnable &runnable) final;
|
||||
void interrupt() final;
|
||||
void terminate() final;
|
||||
void kill() final;
|
||||
|
||||
QProcess::ProcessState state() const override;
|
||||
QProcess::ExitStatus exitStatus() const override;
|
||||
int exitCode() const override;
|
||||
QString errorString() const override;
|
||||
QProcess::ProcessState state() const final;
|
||||
QProcess::ExitStatus exitStatus() const final;
|
||||
int exitCode() const final;
|
||||
QString errorString() const final;
|
||||
|
||||
QByteArray readAllStandardOutput() override;
|
||||
QByteArray readAllStandardError() override;
|
||||
QByteArray readAllStandardOutput() final;
|
||||
QByteArray readAllStandardError() final;
|
||||
|
||||
qint64 write(const QByteArray &data) override;
|
||||
qint64 write(const QByteArray &data) final;
|
||||
|
||||
private:
|
||||
Utils::QtcProcess *m_process;
|
||||
Utils::QtcProcess *m_process = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -23,21 +23,23 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverproviderssettingspage.h"
|
||||
#include "gdbserverprovider.h"
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include "gdbserverprovider.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "gdbserverproviderssettingspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QItemSelectionModel>
|
||||
@@ -48,22 +50,23 @@
|
||||
#include <QTextStream>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class GdbServerProviderNode : public TreeItem
|
||||
// GdbServerProviderNode
|
||||
|
||||
class GdbServerProviderNode final : public TreeItem
|
||||
{
|
||||
public:
|
||||
GdbServerProviderNode(GdbServerProvider *provider, bool changed = false)
|
||||
explicit GdbServerProviderNode(GdbServerProvider *provider, bool changed = false)
|
||||
: provider(provider), changed(changed)
|
||||
{
|
||||
}
|
||||
|
||||
QVariant data(int column, int role) const override
|
||||
QVariant data(int column, int role) const final
|
||||
{
|
||||
if (role == Qt::FontRole) {
|
||||
QFont f = QApplication::font();
|
||||
@@ -77,7 +80,7 @@ public:
|
||||
}
|
||||
|
||||
// FIXME: Need to handle ToolTipRole role?
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
GdbServerProvider *provider = nullptr;
|
||||
@@ -85,6 +88,8 @@ public:
|
||||
bool changed = false;
|
||||
};
|
||||
|
||||
// GdbServerProviderModel
|
||||
|
||||
GdbServerProviderModel::GdbServerProviderModel()
|
||||
{
|
||||
setHeader({tr("Name"), tr("Type")});
|
||||
@@ -195,7 +200,7 @@ void GdbServerProviderModel::markForAddition(GdbServerProvider *provider)
|
||||
GdbServerProviderNode *GdbServerProviderModel::createNode(
|
||||
GdbServerProvider *provider, bool changed)
|
||||
{
|
||||
auto node = new GdbServerProviderNode(provider, changed);
|
||||
const auto node = new GdbServerProviderNode(provider, changed);
|
||||
node->widget = provider->configurationWidget();
|
||||
connect(node->widget, &GdbServerProviderConfigWidget::dirty, this, [node] {
|
||||
node->changed = true;
|
||||
@@ -223,12 +228,14 @@ void GdbServerProviderModel::removeProvider(GdbServerProvider *provider)
|
||||
emit providerStateChanged();
|
||||
}
|
||||
|
||||
class GdbServerProvidersSettingsWidget : public QWidget
|
||||
// GdbServerProvidersSettingsWidget
|
||||
|
||||
class GdbServerProvidersSettingsWidget final : public QWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::GdbServerProvidersSettingsPage)
|
||||
|
||||
public:
|
||||
GdbServerProvidersSettingsWidget(GdbServerProvidersSettingsPage *page);
|
||||
explicit GdbServerProvidersSettingsWidget(GdbServerProvidersSettingsPage *page);
|
||||
|
||||
void providerSelectionChanged();
|
||||
void removeProvider();
|
||||
@@ -238,14 +245,14 @@ public:
|
||||
QModelIndex currentIndex() const;
|
||||
|
||||
public:
|
||||
GdbServerProvidersSettingsPage *m_page;
|
||||
GdbServerProvidersSettingsPage *m_page = nullptr;
|
||||
GdbServerProviderModel m_model;
|
||||
QItemSelectionModel *m_selectionModel;
|
||||
QTreeView *m_providerView;
|
||||
Utils::DetailsWidget *m_container;
|
||||
QPushButton *m_addButton;
|
||||
QPushButton *m_cloneButton;
|
||||
QPushButton *m_delButton;
|
||||
QItemSelectionModel *m_selectionModel = nullptr;
|
||||
QTreeView *m_providerView = nullptr;
|
||||
Utils::DetailsWidget *m_container = nullptr;
|
||||
QPushButton *m_addButton = nullptr;
|
||||
QPushButton *m_cloneButton = nullptr;
|
||||
QPushButton *m_delButton = nullptr;
|
||||
};
|
||||
|
||||
GdbServerProvidersSettingsWidget::GdbServerProvidersSettingsWidget
|
||||
@@ -265,27 +272,27 @@ GdbServerProvidersSettingsWidget::GdbServerProvidersSettingsWidget
|
||||
m_container->setMinimumWidth(500);
|
||||
m_container->setVisible(false);
|
||||
|
||||
auto buttonLayout = new QHBoxLayout();
|
||||
const auto buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->setSpacing(6);
|
||||
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
||||
buttonLayout->addWidget(m_addButton);
|
||||
buttonLayout->addWidget(m_cloneButton);
|
||||
buttonLayout->addWidget(m_delButton);
|
||||
auto spacerItem = new QSpacerItem(40, 10, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
const auto spacerItem = new QSpacerItem(40, 10, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
buttonLayout->addItem(spacerItem);
|
||||
|
||||
auto verticalLayout = new QVBoxLayout();
|
||||
const auto verticalLayout = new QVBoxLayout;
|
||||
verticalLayout->addWidget(m_providerView);
|
||||
verticalLayout->addLayout(buttonLayout);
|
||||
|
||||
auto horizontalLayout = new QHBoxLayout();
|
||||
const auto horizontalLayout = new QHBoxLayout;
|
||||
horizontalLayout->addLayout(verticalLayout);
|
||||
horizontalLayout->addWidget(m_container);
|
||||
|
||||
auto groupBox = new QGroupBox(tr("GDB Server Providers"), this);
|
||||
const auto groupBox = new QGroupBox(tr("GDB Server Providers"), this);
|
||||
groupBox->setLayout(horizontalLayout);
|
||||
|
||||
auto topLayout = new QVBoxLayout(this);
|
||||
const auto topLayout = new QVBoxLayout(this);
|
||||
topLayout->addWidget(groupBox);
|
||||
|
||||
connect(&m_model, &GdbServerProviderModel::providerStateChanged,
|
||||
@@ -293,7 +300,7 @@ GdbServerProvidersSettingsWidget::GdbServerProvidersSettingsWidget
|
||||
|
||||
m_providerView->setModel(&m_model);
|
||||
|
||||
auto headerView = m_providerView->header();
|
||||
const auto headerView = m_providerView->header();
|
||||
headerView->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
headerView->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
m_providerView->expandAll();
|
||||
@@ -307,10 +314,10 @@ GdbServerProvidersSettingsWidget::GdbServerProvidersSettingsWidget
|
||||
this, &GdbServerProvidersSettingsWidget::providerSelectionChanged);
|
||||
|
||||
// Set up add menu:
|
||||
auto addMenu = new QMenu(m_addButton);
|
||||
const auto addMenu = new QMenu(m_addButton);
|
||||
|
||||
for (const auto f : GdbServerProviderManager::factories()) {
|
||||
auto action = new QAction(addMenu);
|
||||
const auto action = new QAction(addMenu);
|
||||
action->setText(f->displayName());
|
||||
connect(action, &QAction::triggered, this, [this, f] { createProvider(f); });
|
||||
addMenu->addAction(action);
|
||||
@@ -390,11 +397,11 @@ void GdbServerProvidersSettingsWidget::updateState()
|
||||
QModelIndex GdbServerProvidersSettingsWidget::currentIndex() const
|
||||
{
|
||||
if (!m_selectionModel)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
const QModelIndexList rows = m_selectionModel->selectedRows();
|
||||
if (rows.count() != 1)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
return rows.at(0);
|
||||
}
|
||||
|
||||
|
@@ -46,13 +46,15 @@ class GdbServerProviderFactory;
|
||||
class GdbServerProviderNode;
|
||||
class GdbServerProvidersSettingsWidget;
|
||||
|
||||
class GdbServerProviderModel
|
||||
// GdbServerProviderModel
|
||||
|
||||
class GdbServerProviderModel final
|
||||
: public Utils::TreeModel<Utils::TypedTreeItem<GdbServerProviderNode>, GdbServerProviderNode>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GdbServerProviderModel();
|
||||
explicit GdbServerProviderModel();
|
||||
|
||||
GdbServerProvider *provider(const QModelIndex &) const;
|
||||
GdbServerProviderConfigWidget *widget(const QModelIndex &) const;
|
||||
@@ -78,7 +80,9 @@ private:
|
||||
QList<GdbServerProvider *> m_providersToRemove;
|
||||
};
|
||||
|
||||
class GdbServerProvidersSettingsPage : public Core::IOptionsPage
|
||||
// GdbServerProvidersSettingsPage
|
||||
|
||||
class GdbServerProvidersSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -86,9 +90,9 @@ public:
|
||||
explicit GdbServerProvidersSettingsPage(QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
QWidget *widget() final;
|
||||
void apply() final;
|
||||
void finish() final;
|
||||
|
||||
GdbServerProvidersSettingsWidget *m_configWidget = nullptr;
|
||||
};
|
||||
|
@@ -38,6 +38,8 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// Helpers:
|
||||
|
||||
static Task::TaskType taskType(const QString &msgType)
|
||||
{
|
||||
if (msgType == "Warning")
|
||||
@@ -47,6 +49,8 @@ static Task::TaskType taskType(const QString &msgType)
|
||||
return Task::TaskType::Unknown;
|
||||
}
|
||||
|
||||
// IarParser
|
||||
|
||||
IarParser::IarParser()
|
||||
{
|
||||
setObjectName("IarParser");
|
||||
|
@@ -38,7 +38,7 @@ class IarParser final : public ProjectExplorer::IOutputParser
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IarParser();
|
||||
explicit IarParser();
|
||||
static Core::Id id();
|
||||
|
||||
private:
|
||||
@@ -46,9 +46,9 @@ private:
|
||||
void amendDescription();
|
||||
void amendFilePath();
|
||||
|
||||
void stdError(const QString &line) override;
|
||||
void stdOutput(const QString &line) override;
|
||||
void doFlush() override;
|
||||
void stdError(const QString &line) final;
|
||||
void stdOutput(const QString &line) final;
|
||||
void doFlush() final;
|
||||
|
||||
ProjectExplorer::Task m_lastTask;
|
||||
int m_lines = 0;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include "iarewparser.h"
|
||||
#include "iarewtoolchain.h"
|
||||
|
||||
|
@@ -53,40 +53,40 @@ class IarToolChain final : public ProjectExplorer::ToolChain
|
||||
Q_DECLARE_TR_FUNCTIONS(IarToolChain)
|
||||
|
||||
public:
|
||||
QString typeDisplayName() const override;
|
||||
QString typeDisplayName() const final;
|
||||
|
||||
void setTargetAbi(const ProjectExplorer::Abi &abi);
|
||||
ProjectExplorer::Abi targetAbi() const override;
|
||||
ProjectExplorer::Abi targetAbi() const final;
|
||||
|
||||
bool isValid() const override;
|
||||
bool isValid() const final;
|
||||
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
MacroInspectionRunner createMacroInspectionRunner() const final;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const override;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const override;
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const final;
|
||||
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
||||
const Utils::FileName &) const override;
|
||||
void addToEnvironment(Utils::Environment &env) const override;
|
||||
ProjectExplorer::IOutputParser *outputParser() const override;
|
||||
const Utils::FileName &) const final;
|
||||
void addToEnvironment(Utils::Environment &env) const final;
|
||||
ProjectExplorer::IOutputParser *outputParser() const final;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &data) override;
|
||||
QVariantMap toMap() const final;
|
||||
bool fromMap(const QVariantMap &data) final;
|
||||
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() override;
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() final;
|
||||
|
||||
bool operator ==(const ToolChain &other) const override;
|
||||
bool operator ==(const ToolChain &other) const final;
|
||||
|
||||
void setCompilerCommand(const Utils::FileName &file);
|
||||
Utils::FileName compilerCommand() const override;
|
||||
Utils::FileName compilerCommand() const final;
|
||||
|
||||
QString makeCommand(const Utils::Environment &env) const override;
|
||||
QString makeCommand(const Utils::Environment &env) const final;
|
||||
|
||||
ToolChain *clone() const override;
|
||||
ToolChain *clone() const final;
|
||||
|
||||
void toolChainUpdated() override;
|
||||
void toolChainUpdated() final;
|
||||
|
||||
protected:
|
||||
IarToolChain(const IarToolChain &tc) = default;
|
||||
@@ -116,17 +116,17 @@ class IarToolChainFactory final : public ProjectExplorer::ToolChainFactory
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IarToolChainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const override;
|
||||
explicit IarToolChainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const final;
|
||||
|
||||
QList<ProjectExplorer::ToolChain *> autoDetect(
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) override;
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) final;
|
||||
|
||||
bool canCreate() override;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) override;
|
||||
bool canCreate() final;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) final;
|
||||
|
||||
bool canRestore(const QVariantMap &data) override;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) override;
|
||||
bool canRestore(const QVariantMap &data) final;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) final;
|
||||
|
||||
private:
|
||||
// File path + version.
|
||||
@@ -149,10 +149,10 @@ public:
|
||||
explicit IarToolChainConfigWidget(IarToolChain *tc);
|
||||
|
||||
private:
|
||||
void applyImpl() override;
|
||||
void discardImpl() override { setFromToolchain(); }
|
||||
bool isDirtyImpl() const override;
|
||||
void makeReadOnlyImpl() override;
|
||||
void applyImpl() final;
|
||||
void discardImpl() final { setFromToolchain(); }
|
||||
bool isDirtyImpl() const final;
|
||||
void makeReadOnlyImpl() final;
|
||||
|
||||
void setFromToolchain();
|
||||
void handleCompilerCommandChange();
|
||||
|
@@ -38,6 +38,8 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// Helpers:
|
||||
|
||||
static Task::TaskType taskType(const QString &msgType)
|
||||
{
|
||||
if (msgType == "Warning" || msgType == "WARNING") {
|
||||
@@ -49,6 +51,8 @@ static Task::TaskType taskType(const QString &msgType)
|
||||
return Task::TaskType::Unknown;
|
||||
}
|
||||
|
||||
// KeilParser
|
||||
|
||||
KeilParser::KeilParser()
|
||||
{
|
||||
setObjectName("KeilParser");
|
||||
|
@@ -38,16 +38,16 @@ class KeilParser final : public ProjectExplorer::IOutputParser
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KeilParser();
|
||||
explicit KeilParser();
|
||||
static Core::Id id();
|
||||
|
||||
private:
|
||||
void newTask(const ProjectExplorer::Task &task);
|
||||
void amendDescription(const QString &desc);
|
||||
|
||||
void stdError(const QString &line) override;
|
||||
void stdOutput(const QString &line) override;
|
||||
void doFlush() override;
|
||||
void stdError(const QString &line) final;
|
||||
void stdOutput(const QString &line) final;
|
||||
void doFlush() final;
|
||||
|
||||
ProjectExplorer::Task m_lastTask;
|
||||
int m_lines = 0;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include "keilparser.h"
|
||||
#include "keiltoolchain.h"
|
||||
|
||||
|
@@ -53,40 +53,40 @@ class KeilToolchain final : public ProjectExplorer::ToolChain
|
||||
Q_DECLARE_TR_FUNCTIONS(KeilToolchain)
|
||||
|
||||
public:
|
||||
QString typeDisplayName() const override;
|
||||
QString typeDisplayName() const final;
|
||||
|
||||
void setTargetAbi(const ProjectExplorer::Abi &abi);
|
||||
ProjectExplorer::Abi targetAbi() const override;
|
||||
ProjectExplorer::Abi targetAbi() const final;
|
||||
|
||||
bool isValid() const override;
|
||||
bool isValid() const final;
|
||||
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
MacroInspectionRunner createMacroInspectionRunner() const final;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const override;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const override;
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const final;
|
||||
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
||||
const Utils::FileName &) const override;
|
||||
void addToEnvironment(Utils::Environment &env) const override;
|
||||
ProjectExplorer::IOutputParser *outputParser() const override;
|
||||
const Utils::FileName &) const final;
|
||||
void addToEnvironment(Utils::Environment &env) const final;
|
||||
ProjectExplorer::IOutputParser *outputParser() const final;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &data) override;
|
||||
QVariantMap toMap() const final;
|
||||
bool fromMap(const QVariantMap &data) final;
|
||||
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() override;
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() final;
|
||||
|
||||
bool operator ==(const ToolChain &other) const override;
|
||||
bool operator ==(const ToolChain &other) const final;
|
||||
|
||||
void setCompilerCommand(const Utils::FileName &file);
|
||||
Utils::FileName compilerCommand() const override;
|
||||
Utils::FileName compilerCommand() const final;
|
||||
|
||||
QString makeCommand(const Utils::Environment &env) const override;
|
||||
QString makeCommand(const Utils::Environment &env) const final;
|
||||
|
||||
ToolChain *clone() const override;
|
||||
ToolChain *clone() const final;
|
||||
|
||||
void toolChainUpdated() override;
|
||||
void toolChainUpdated() final;
|
||||
|
||||
protected:
|
||||
KeilToolchain(const KeilToolchain &tc) = default;
|
||||
@@ -116,17 +116,17 @@ class KeilToolchainFactory final : public ProjectExplorer::ToolChainFactory
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KeilToolchainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const override;
|
||||
explicit KeilToolchainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const final;
|
||||
|
||||
QList<ProjectExplorer::ToolChain *> autoDetect(
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) override;
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) final;
|
||||
|
||||
bool canCreate() override;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) override;
|
||||
bool canCreate() final;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) final;
|
||||
|
||||
bool canRestore(const QVariantMap &data) override;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) override;
|
||||
bool canRestore(const QVariantMap &data) final;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) final;
|
||||
|
||||
private:
|
||||
// File path + version.
|
||||
@@ -149,10 +149,10 @@ public:
|
||||
explicit KeilToolchainConfigWidget(KeilToolchain *tc);
|
||||
|
||||
private:
|
||||
void applyImpl() override;
|
||||
void discardImpl() override { setFromToolchain(); }
|
||||
bool isDirtyImpl() const override;
|
||||
void makeReadOnlyImpl() override;
|
||||
void applyImpl() final;
|
||||
void discardImpl() final { setFromToolchain(); }
|
||||
bool isDirtyImpl() const final;
|
||||
void makeReadOnlyImpl() final;
|
||||
|
||||
void setFromToolchain();
|
||||
void handleCompilerCommandChange();
|
||||
|
@@ -23,24 +23,24 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "openocdgdbserverprovider.h"
|
||||
#include "baremetalconstants.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "openocdgdbserverprovider.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <coreplugin/variablechooser.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QComboBox>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QString>
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
@@ -52,11 +52,10 @@ const char rootScriptsDirKeyC[] = "BareMetal.OpenOcdGdbServerProvider.RootScript
|
||||
const char configurationFileKeyC[] = "BareMetal.OpenOcdGdbServerProvider.ConfigurationPath";
|
||||
const char additionalArgumentsKeyC[] = "BareMetal.OpenOcdGdbServerProvider.AdditionalArguments";
|
||||
|
||||
// OpenOcdGdbServerProvider
|
||||
|
||||
OpenOcdGdbServerProvider::OpenOcdGdbServerProvider()
|
||||
: GdbServerProvider(QLatin1String(Constants::OPENOCD_PROVIDER_ID))
|
||||
, m_host(QLatin1String("localhost"))
|
||||
, m_port(3333)
|
||||
, m_executableFile(QLatin1String("openocd"))
|
||||
{
|
||||
setInitCommands(defaultInitCommands());
|
||||
setResetCommands(defaultResetCommands());
|
||||
@@ -212,6 +211,8 @@ GdbServerProviderConfigWidget *OpenOcdGdbServerProvider::configurationWidget()
|
||||
return new OpenOcdGdbServerProviderConfigWidget(this);
|
||||
}
|
||||
|
||||
// OpenOcdGdbServerProviderFactory
|
||||
|
||||
OpenOcdGdbServerProviderFactory::OpenOcdGdbServerProviderFactory()
|
||||
{
|
||||
setId(QLatin1String(Constants::OPENOCD_PROVIDER_ID));
|
||||
@@ -232,7 +233,7 @@ bool OpenOcdGdbServerProviderFactory::canRestore(const QVariantMap &data) const
|
||||
|
||||
GdbServerProvider *OpenOcdGdbServerProviderFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto p = new OpenOcdGdbServerProvider;
|
||||
const auto p = new OpenOcdGdbServerProvider;
|
||||
auto updated = data;
|
||||
if (p->fromMap(updated))
|
||||
return p;
|
||||
@@ -240,6 +241,8 @@ GdbServerProvider *OpenOcdGdbServerProviderFactory::restore(const QVariantMap &d
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// OpenOcdGdbServerProviderConfigWidget
|
||||
|
||||
OpenOcdGdbServerProviderConfigWidget::OpenOcdGdbServerProviderConfigWidget(
|
||||
OpenOcdGdbServerProvider *p)
|
||||
: GdbServerProviderConfigWidget(p)
|
||||
@@ -276,7 +279,7 @@ OpenOcdGdbServerProviderConfigWidget::OpenOcdGdbServerProviderConfigWidget(
|
||||
addErrorLabel();
|
||||
setFromProvider();
|
||||
|
||||
auto chooser = new Core::VariableChooser(this);
|
||||
const auto chooser = new Core::VariableChooser(this);
|
||||
chooser->addSupportedWidget(m_initCommandsTextEdit);
|
||||
chooser->addSupportedWidget(m_resetCommandsTextEdit);
|
||||
|
||||
@@ -318,7 +321,7 @@ void OpenOcdGdbServerProviderConfigWidget::startupModeChanged()
|
||||
|
||||
void OpenOcdGdbServerProviderConfigWidget::applyImpl()
|
||||
{
|
||||
auto p = static_cast<OpenOcdGdbServerProvider *>(provider());
|
||||
const auto p = static_cast<OpenOcdGdbServerProvider *>(provider());
|
||||
Q_ASSERT(p);
|
||||
|
||||
p->m_host = m_hostWidget->host();
|
||||
|
@@ -35,7 +35,9 @@ namespace Internal {
|
||||
class OpenOcdGdbServerProviderConfigWidget;
|
||||
class OpenOcdGdbServerProviderFactory;
|
||||
|
||||
class OpenOcdGdbServerProvider : public GdbServerProvider
|
||||
// OpenOcdGdbServerProvider
|
||||
|
||||
class OpenOcdGdbServerProvider final : public GdbServerProvider
|
||||
{
|
||||
public:
|
||||
QString typeDisplayName() const final;
|
||||
@@ -62,9 +64,9 @@ private:
|
||||
static QString defaultInitCommands();
|
||||
static QString defaultResetCommands();
|
||||
|
||||
QString m_host;
|
||||
quint16 m_port;
|
||||
QString m_executableFile;
|
||||
QString m_host = QLatin1String("localhost");
|
||||
quint16 m_port = 3333;
|
||||
QString m_executableFile = QLatin1String("openocd");
|
||||
QString m_rootScriptsDir;
|
||||
QString m_configurationFile;
|
||||
QString m_additionalArguments;
|
||||
@@ -73,7 +75,9 @@ private:
|
||||
friend class OpenOcdGdbServerProviderFactory;
|
||||
};
|
||||
|
||||
class OpenOcdGdbServerProviderFactory : public GdbServerProviderFactory
|
||||
// OpenOcdGdbServerProviderFactory
|
||||
|
||||
class OpenOcdGdbServerProviderFactory final : public GdbServerProviderFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -88,7 +92,9 @@ public:
|
||||
GdbServerProviderConfigWidget *configurationWidget(GdbServerProvider *);
|
||||
};
|
||||
|
||||
class OpenOcdGdbServerProviderConfigWidget : public GdbServerProviderConfigWidget
|
||||
// OpenOcdGdbServerProviderConfigWidget
|
||||
|
||||
class OpenOcdGdbServerProviderConfigWidget final : public GdbServerProviderConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -103,13 +109,13 @@ private:
|
||||
|
||||
void setFromProvider();
|
||||
|
||||
HostWidget *m_hostWidget;
|
||||
Utils::PathChooser *m_executableFileChooser;
|
||||
Utils::PathChooser *m_rootScriptsDirChooser;
|
||||
Utils::PathChooser *m_configurationFileChooser;
|
||||
QLineEdit *m_additionalArgumentsLineEdit;
|
||||
QPlainTextEdit *m_initCommandsTextEdit;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit;
|
||||
HostWidget *m_hostWidget = nullptr;
|
||||
Utils::PathChooser *m_executableFileChooser = nullptr;
|
||||
Utils::PathChooser *m_rootScriptsDirChooser = nullptr;
|
||||
Utils::PathChooser *m_configurationFileChooser = nullptr;
|
||||
QLineEdit *m_additionalArgumentsLineEdit = nullptr;
|
||||
QPlainTextEdit *m_initCommandsTextEdit = nullptr;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -38,6 +38,8 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// Helpers:
|
||||
|
||||
static Task::TaskType taskType(const QString &msgType)
|
||||
{
|
||||
if (msgType == "warning" || msgType == "Warning") {
|
||||
@@ -49,6 +51,8 @@ static Task::TaskType taskType(const QString &msgType)
|
||||
return Task::TaskType::Unknown;
|
||||
}
|
||||
|
||||
// SdccParser
|
||||
|
||||
SdccParser::SdccParser()
|
||||
{
|
||||
setObjectName("SdccParser");
|
||||
|
@@ -38,16 +38,16 @@ class SdccParser final : public ProjectExplorer::IOutputParser
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SdccParser();
|
||||
explicit SdccParser();
|
||||
static Core::Id id();
|
||||
|
||||
private:
|
||||
void newTask(const ProjectExplorer::Task &task);
|
||||
void amendDescription(const QString &desc);
|
||||
|
||||
void stdError(const QString &line) override;
|
||||
void stdOutput(const QString &line) override;
|
||||
void doFlush() override;
|
||||
void stdError(const QString &line) final;
|
||||
void stdOutput(const QString &line) final;
|
||||
void doFlush() final;
|
||||
|
||||
ProjectExplorer::Task m_lastTask;
|
||||
int m_lines = 0;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
|
||||
#include "sdccparser.h"
|
||||
#include "sdcctoolchain.h"
|
||||
|
||||
|
@@ -53,40 +53,40 @@ class SdccToolChain final : public ProjectExplorer::ToolChain
|
||||
Q_DECLARE_TR_FUNCTIONS(SdccToolChain)
|
||||
|
||||
public:
|
||||
QString typeDisplayName() const override;
|
||||
QString typeDisplayName() const final;
|
||||
|
||||
void setTargetAbi(const ProjectExplorer::Abi &abi);
|
||||
ProjectExplorer::Abi targetAbi() const override;
|
||||
ProjectExplorer::Abi targetAbi() const final;
|
||||
|
||||
bool isValid() const override;
|
||||
bool isValid() const final;
|
||||
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
MacroInspectionRunner createMacroInspectionRunner() const final;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const override;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const override;
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner() const final;
|
||||
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
||||
const Utils::FileName &) const override;
|
||||
void addToEnvironment(Utils::Environment &env) const override;
|
||||
ProjectExplorer::IOutputParser *outputParser() const override;
|
||||
const Utils::FileName &) const final;
|
||||
void addToEnvironment(Utils::Environment &env) const final;
|
||||
ProjectExplorer::IOutputParser *outputParser() const final;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &data) override;
|
||||
QVariantMap toMap() const final;
|
||||
bool fromMap(const QVariantMap &data) final;
|
||||
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() override;
|
||||
std::unique_ptr<ProjectExplorer::ToolChainConfigWidget> createConfigurationWidget() final;
|
||||
|
||||
bool operator ==(const ToolChain &other) const override;
|
||||
bool operator ==(const ToolChain &other) const final;
|
||||
|
||||
void setCompilerCommand(const Utils::FileName &file);
|
||||
Utils::FileName compilerCommand() const override;
|
||||
Utils::FileName compilerCommand() const final;
|
||||
|
||||
QString makeCommand(const Utils::Environment &env) const override;
|
||||
QString makeCommand(const Utils::Environment &env) const final;
|
||||
|
||||
ToolChain *clone() const override;
|
||||
ToolChain *clone() const final;
|
||||
|
||||
void toolChainUpdated() override;
|
||||
void toolChainUpdated() final;
|
||||
|
||||
protected:
|
||||
SdccToolChain(const SdccToolChain &tc) = default;
|
||||
@@ -116,17 +116,17 @@ class SdccToolChainFactory final : public ProjectExplorer::ToolChainFactory
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SdccToolChainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const override;
|
||||
explicit SdccToolChainFactory();
|
||||
QSet<Core::Id> supportedLanguages() const final;
|
||||
|
||||
QList<ProjectExplorer::ToolChain *> autoDetect(
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) override;
|
||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown) final;
|
||||
|
||||
bool canCreate() override;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) override;
|
||||
bool canCreate() final;
|
||||
ProjectExplorer::ToolChain *create(Core::Id language) final;
|
||||
|
||||
bool canRestore(const QVariantMap &data) override;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) override;
|
||||
bool canRestore(const QVariantMap &data) final;
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data) final;
|
||||
|
||||
private:
|
||||
// File path + version.
|
||||
@@ -149,10 +149,10 @@ public:
|
||||
explicit SdccToolChainConfigWidget(SdccToolChain *tc);
|
||||
|
||||
private:
|
||||
void applyImpl() override;
|
||||
void discardImpl() override { setFromToolchain(); }
|
||||
bool isDirtyImpl() const override;
|
||||
void makeReadOnlyImpl() override;
|
||||
void applyImpl() final;
|
||||
void discardImpl() final { setFromToolchain(); }
|
||||
bool isDirtyImpl() const final;
|
||||
void makeReadOnlyImpl() final;
|
||||
|
||||
void setFromToolchain();
|
||||
void handleCompilerCommandChange();
|
||||
|
@@ -23,25 +23,25 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "stlinkutilgdbserverprovider.h"
|
||||
#include "baremetalconstants.h"
|
||||
#include "gdbserverprovidermanager.h"
|
||||
|
||||
#include "gdbserverprovidermanager.h"
|
||||
#include "stlinkutilgdbserverprovider.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <coreplugin/variablechooser.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QString>
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
@@ -54,15 +54,10 @@ const char extendedModeKeyC[] = "BareMetal.StLinkUtilGdbServerProvider.ExtendedM
|
||||
const char resetBoardKeyC[] = "BareMetal.StLinkUtilGdbServerProvider.ResetBoard";
|
||||
const char transportLayerKeyC[] = "BareMetal.StLinkUtilGdbServerProvider.TransportLayer";
|
||||
|
||||
// StLinkUtilGdbServerProvider
|
||||
|
||||
StLinkUtilGdbServerProvider::StLinkUtilGdbServerProvider()
|
||||
: GdbServerProvider(QLatin1String(Constants::STLINK_UTIL_PROVIDER_ID))
|
||||
, m_host(QLatin1String("localhost"))
|
||||
, m_port(4242)
|
||||
, m_executableFile(QLatin1String("st-util"))
|
||||
, m_verboseLevel(0)
|
||||
, m_extendedMode(false)
|
||||
, m_resetBoard(true)
|
||||
, m_transport(RawUsb)
|
||||
{
|
||||
setInitCommands(defaultInitCommands());
|
||||
setResetCommands(defaultResetCommands());
|
||||
@@ -213,6 +208,8 @@ GdbServerProviderConfigWidget *StLinkUtilGdbServerProvider::configurationWidget(
|
||||
return new StLinkUtilGdbServerProviderConfigWidget(this);
|
||||
}
|
||||
|
||||
// StLinkUtilGdbServerProviderFactory
|
||||
|
||||
StLinkUtilGdbServerProviderFactory::StLinkUtilGdbServerProviderFactory()
|
||||
{
|
||||
setId(QLatin1String(Constants::STLINK_UTIL_PROVIDER_ID));
|
||||
@@ -233,7 +230,7 @@ bool StLinkUtilGdbServerProviderFactory::canRestore(const QVariantMap &data) con
|
||||
|
||||
GdbServerProvider *StLinkUtilGdbServerProviderFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
auto p = new StLinkUtilGdbServerProvider;
|
||||
const auto p = new StLinkUtilGdbServerProvider;
|
||||
auto updated = data;
|
||||
if (p->fromMap(updated))
|
||||
return p;
|
||||
@@ -241,6 +238,8 @@ GdbServerProvider *StLinkUtilGdbServerProviderFactory::restore(const QVariantMap
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// StLinkUtilGdbServerProviderConfigWidget
|
||||
|
||||
StLinkUtilGdbServerProviderConfigWidget::StLinkUtilGdbServerProviderConfigWidget(
|
||||
StLinkUtilGdbServerProvider *p)
|
||||
: GdbServerProviderConfigWidget(p)
|
||||
@@ -283,7 +282,7 @@ StLinkUtilGdbServerProviderConfigWidget::StLinkUtilGdbServerProviderConfigWidget
|
||||
addErrorLabel();
|
||||
setFromProvider();
|
||||
|
||||
auto chooser = new Core::VariableChooser(this);
|
||||
const auto chooser = new Core::VariableChooser(this);
|
||||
chooser->addSupportedWidget(m_initCommandsTextEdit);
|
||||
chooser->addSupportedWidget(m_resetCommandsTextEdit);
|
||||
|
||||
@@ -332,7 +331,7 @@ void StLinkUtilGdbServerProviderConfigWidget::startupModeChanged()
|
||||
|
||||
void StLinkUtilGdbServerProviderConfigWidget::applyImpl()
|
||||
{
|
||||
auto p = static_cast<StLinkUtilGdbServerProvider *>(provider());
|
||||
const auto p = static_cast<StLinkUtilGdbServerProvider *>(provider());
|
||||
Q_ASSERT(p);
|
||||
|
||||
p->m_host = m_hostWidget->host();
|
||||
|
@@ -39,7 +39,9 @@ namespace Internal {
|
||||
class StLinkUtilGdbServerProviderConfigWidget;
|
||||
class StLinkUtilGdbServerProviderFactory;
|
||||
|
||||
class StLinkUtilGdbServerProvider : public GdbServerProvider
|
||||
// StLinkUtilGdbServerProvider
|
||||
|
||||
class StLinkUtilGdbServerProvider final : public GdbServerProvider
|
||||
{
|
||||
public:
|
||||
enum TransportLayer { ScsiOverUsb = 1, RawUsb = 2 };
|
||||
@@ -67,19 +69,21 @@ private:
|
||||
static QString defaultInitCommands();
|
||||
static QString defaultResetCommands();
|
||||
|
||||
QString m_host;
|
||||
quint16 m_port;
|
||||
QString m_executableFile;
|
||||
int m_verboseLevel; // 0..99
|
||||
bool m_extendedMode; // Listening for connections after disconnect
|
||||
bool m_resetBoard;
|
||||
TransportLayer m_transport;
|
||||
QString m_host = QLatin1String("localhost");
|
||||
quint16 m_port = 4242;
|
||||
QString m_executableFile = QLatin1String("st-util");
|
||||
int m_verboseLevel = 0; // 0..99
|
||||
bool m_extendedMode = false; // Listening for connections after disconnect
|
||||
bool m_resetBoard = true;
|
||||
TransportLayer m_transport = RawUsb;
|
||||
|
||||
friend class StLinkUtilGdbServerProviderConfigWidget;
|
||||
friend class StLinkUtilGdbServerProviderFactory;
|
||||
};
|
||||
|
||||
class StLinkUtilGdbServerProviderFactory : public GdbServerProviderFactory
|
||||
// StLinkUtilGdbServerProviderFactory
|
||||
|
||||
class StLinkUtilGdbServerProviderFactory final : public GdbServerProviderFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -94,7 +98,10 @@ public:
|
||||
GdbServerProviderConfigWidget *configurationWidget(GdbServerProvider *);
|
||||
};
|
||||
|
||||
class StLinkUtilGdbServerProviderConfigWidget : public GdbServerProviderConfigWidget
|
||||
// StLinkUtilGdbServerProviderConfigWidget
|
||||
|
||||
class StLinkUtilGdbServerProviderConfigWidget final
|
||||
: public GdbServerProviderConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -114,14 +121,14 @@ private:
|
||||
void populateTransportLayers();
|
||||
void setFromProvider();
|
||||
|
||||
HostWidget *m_hostWidget;
|
||||
Utils::PathChooser *m_executableFileChooser;
|
||||
QSpinBox *m_verboseLevelSpinBox;
|
||||
QCheckBox *m_extendedModeCheckBox;
|
||||
QCheckBox *m_resetBoardCheckBox;
|
||||
QComboBox *m_transportLayerComboBox;
|
||||
QPlainTextEdit *m_initCommandsTextEdit;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit;
|
||||
HostWidget *m_hostWidget = nullptr;
|
||||
Utils::PathChooser *m_executableFileChooser = nullptr;
|
||||
QSpinBox *m_verboseLevelSpinBox = nullptr;
|
||||
QCheckBox *m_extendedModeCheckBox = nullptr;
|
||||
QCheckBox *m_resetBoardCheckBox = nullptr;
|
||||
QComboBox *m_transportLayerComboBox = nullptr;
|
||||
QPlainTextEdit *m_initCommandsTextEdit = nullptr;
|
||||
QPlainTextEdit *m_resetCommandsTextEdit = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user