diff --git a/src/plugins/baremetal/CMakeLists.txt b/src/plugins/baremetal/CMakeLists.txt index 5d91191edef..d1cac1f8c8d 100644 --- a/src/plugins/baremetal/CMakeLists.txt +++ b/src/plugins/baremetal/CMakeLists.txt @@ -15,7 +15,6 @@ add_qtc_plugin(BareMetal debugserverproviderchooser.cpp debugserverproviderchooser.h debugserverprovidermanager.cpp debugserverprovidermanager.h debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h - debugservers/gdb/defaultgdbserverprovider.cpp debugservers/gdb/defaultgdbserverprovider.h debugservers/gdb/gdbserverprovider.cpp debugservers/gdb/gdbserverprovider.h debugservers/gdb/openocdgdbserverprovider.cpp debugservers/gdb/openocdgdbserverprovider.h debugservers/gdb/stlinkutilgdbserverprovider.cpp debugservers/gdb/stlinkutilgdbserverprovider.h diff --git a/src/plugins/baremetal/baremetal.qbs b/src/plugins/baremetal/baremetal.qbs index a5cd429ce82..9b8711e6264 100644 --- a/src/plugins/baremetal/baremetal.qbs +++ b/src/plugins/baremetal/baremetal.qbs @@ -42,7 +42,6 @@ QtcPlugin { name: "GDB Servers" prefix: "debugservers/gdb/" files: [ - "defaultgdbserverprovider.cpp", "defaultgdbserverprovider.h", "gdbserverprovider.cpp", "gdbserverprovider.h", "openocdgdbserverprovider.cpp", "openocdgdbserverprovider.h", "stlinkutilgdbserverprovider.cpp", "stlinkutilgdbserverprovider.h", diff --git a/src/plugins/baremetal/debugserverprovidermanager.cpp b/src/plugins/baremetal/debugserverprovidermanager.cpp index c663af49887..37c03d059e2 100644 --- a/src/plugins/baremetal/debugserverprovidermanager.cpp +++ b/src/plugins/baremetal/debugserverprovidermanager.cpp @@ -27,7 +27,6 @@ #include "idebugserverprovider.h" // GDB debug servers. -#include "debugservers/gdb/defaultgdbserverprovider.h" #include "debugservers/gdb/openocdgdbserverprovider.h" #include "debugservers/gdb/stlinkutilgdbserverprovider.h" #include "debugservers/gdb/jlinkgdbserverprovider.h" @@ -56,8 +55,7 @@ static DebugServerProviderManager *m_instance = nullptr; DebugServerProviderManager::DebugServerProviderManager() : m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) - , m_factories({new DefaultGdbServerProviderFactory, - new JLinkGdbServerProviderFactory, + , m_factories({new JLinkGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory, new StLinkUtilGdbServerProviderFactory}) { diff --git a/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.cpp deleted file mode 100644 index b626da90b0a..00000000000 --- a/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Denis Shienkov -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "defaultgdbserverprovider.h" - -#include -#include - -#include - -#include - -#include -#include -#include - -namespace BareMetal { -namespace Internal { - -// DefaultGdbServerProvider - -DefaultGdbServerProvider::DefaultGdbServerProvider() - : GdbServerProvider(Constants::DEFAULT_PROVIDER_ID) -{ - setDefaultChannel("localhost", 3333); - setSettingsKeyBase("BareMetal.DefaultGdbServerProvider"); - setTypeDisplayName(DefaultGdbServerProviderFactory::tr("Default")); -} - -GdbServerProvider *DefaultGdbServerProvider::clone() const -{ - return new DefaultGdbServerProvider(*this); -} - -GdbServerProviderConfigWidget *DefaultGdbServerProvider::configurationWidget() -{ - return new DefaultGdbServerProviderConfigWidget(this); -} - -// DefaultGdbServerProviderFactory - -DefaultGdbServerProviderFactory::DefaultGdbServerProviderFactory() -{ - setId(Constants::DEFAULT_PROVIDER_ID); - setDisplayName(tr("Default")); -} - -GdbServerProvider *DefaultGdbServerProviderFactory::create() -{ - return new DefaultGdbServerProvider; -} - -bool DefaultGdbServerProviderFactory::canRestore(const QVariantMap &data) const -{ - const auto id = idFromMap(data); - return id.startsWith(Constants::DEFAULT_PROVIDER_ID + QLatin1Char(':')); -} - -GdbServerProvider *DefaultGdbServerProviderFactory::restore(const QVariantMap &data) -{ - const auto p = new DefaultGdbServerProvider; - const auto updated = data; - if (p->fromMap(updated)) - return p; - delete p; - return nullptr; -} - -// GdbServerProviderConfigWidget - -DefaultGdbServerProviderConfigWidget::DefaultGdbServerProviderConfigWidget( - DefaultGdbServerProvider *provider) - : GdbServerProviderConfigWidget(provider) -{ - Q_ASSERT(provider); - - m_hostWidget = new HostWidget(this); - m_mainLayout->addRow(tr("Host:"), m_hostWidget); - - m_useExtendedRemoteCheckBox = new QCheckBox(this); - m_useExtendedRemoteCheckBox->setToolTip("Use GDB target extended-remote"); - m_mainLayout->addRow(tr("Extended mode:"), m_useExtendedRemoteCheckBox); - m_initCommandsTextEdit = new QPlainTextEdit(this); - m_initCommandsTextEdit->setToolTip(defaultInitCommandsTooltip()); - m_mainLayout->addRow(tr("Init commands:"), m_initCommandsTextEdit); - m_resetCommandsTextEdit = new QPlainTextEdit(this); - m_resetCommandsTextEdit->setToolTip(defaultResetCommandsTooltip()); - m_mainLayout->addRow(tr("Reset commands:"), m_resetCommandsTextEdit); - - addErrorLabel(); - setFromProvider(); - - const auto chooser = new Core::VariableChooser(this); - chooser->addSupportedWidget(m_initCommandsTextEdit); - chooser->addSupportedWidget(m_resetCommandsTextEdit); - - connect(m_hostWidget, &HostWidget::dataChanged, - this, &GdbServerProviderConfigWidget::dirty); - connect(m_useExtendedRemoteCheckBox, &QCheckBox::stateChanged, - this, &GdbServerProviderConfigWidget::dirty); - connect(m_initCommandsTextEdit, &QPlainTextEdit::textChanged, - this, &GdbServerProviderConfigWidget::dirty); - connect(m_resetCommandsTextEdit, &QPlainTextEdit::textChanged, - this, &GdbServerProviderConfigWidget::dirty); -} - -void DefaultGdbServerProviderConfigWidget::apply() -{ - const auto p = static_cast(m_provider); - Q_ASSERT(p); - - p->setChannel(m_hostWidget->channel()); - p->setUseExtendedRemote(m_useExtendedRemoteCheckBox->isChecked()); - p->setInitCommands(m_initCommandsTextEdit->toPlainText()); - p->setResetCommands(m_resetCommandsTextEdit->toPlainText()); - IDebugServerProviderConfigWidget::apply(); -} - -void DefaultGdbServerProviderConfigWidget::discard() -{ - setFromProvider(); - IDebugServerProviderConfigWidget::discard(); -} - -void DefaultGdbServerProviderConfigWidget::setFromProvider() -{ - const auto p = static_cast(m_provider); - Q_ASSERT(p); - - const QSignalBlocker blocker(this); - m_hostWidget->setChannel(p->channel()); - m_useExtendedRemoteCheckBox->setChecked(p->useExtendedRemote()); - m_initCommandsTextEdit->setPlainText(p->initCommands()); - m_resetCommandsTextEdit->setPlainText(p->resetCommands()); -} - -} // namespace Internal -} // namespace ProjectExplorer diff --git a/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.h b/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.h deleted file mode 100644 index ef385af8630..00000000000 --- a/src/plugins/baremetal/debugservers/gdb/defaultgdbserverprovider.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Denis Shienkov -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "gdbserverprovider.h" - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QPlainTextEdit; -QT_END_NAMESPACE - -namespace BareMetal { -namespace Internal { - -// DefaultGdbServerProvider - -class DefaultGdbServerProvider final : public GdbServerProvider -{ -public: - GdbServerProviderConfigWidget *configurationWidget() final; - GdbServerProvider *clone() const final; - -private: - explicit DefaultGdbServerProvider(); - - friend class DefaultGdbServerProviderConfigWidget; - friend class DefaultGdbServerProviderFactory; - friend class BareMetalDevice; -}; - -// DefaultGdbServerProviderFactory - -class DefaultGdbServerProviderFactory final - : public IDebugServerProviderFactory -{ - Q_OBJECT - -public: - explicit DefaultGdbServerProviderFactory(); - - GdbServerProvider *create() final; - - bool canRestore(const QVariantMap &data) const final; - GdbServerProvider *restore(const QVariantMap &data) final; -}; - -// DefaultGdbServerProviderConfigWidget - -class DefaultGdbServerProviderConfigWidget final - : public GdbServerProviderConfigWidget -{ - Q_OBJECT - -public: - explicit DefaultGdbServerProviderConfigWidget( - DefaultGdbServerProvider *provider); - -private: - void apply() final; - void discard() final; - - void setFromProvider(); - - HostWidget *m_hostWidget = nullptr; - QCheckBox *m_useExtendedRemoteCheckBox = nullptr; - QPlainTextEdit *m_initCommandsTextEdit = nullptr; - QPlainTextEdit *m_resetCommandsTextEdit = nullptr; -}; - -} // namespace Internal -} // namespace BareMetal diff --git a/src/plugins/baremetal/debugservers/gdb/gdbservers.pri b/src/plugins/baremetal/debugservers/gdb/gdbservers.pri index d1371172116..13ba5dc139a 100644 --- a/src/plugins/baremetal/debugservers/gdb/gdbservers.pri +++ b/src/plugins/baremetal/debugservers/gdb/gdbservers.pri @@ -1,12 +1,10 @@ HEADERS += \ - $$PWD/defaultgdbserverprovider.h \ $$PWD/gdbserverprovider.h \ $$PWD/openocdgdbserverprovider.h \ $$PWD/stlinkutilgdbserverprovider.h \ $$PWD/jlinkgdbserverprovider.h \ SOURCES += \ - $$PWD/defaultgdbserverprovider.cpp \ $$PWD/gdbserverprovider.cpp \ $$PWD/openocdgdbserverprovider.cpp \ $$PWD/stlinkutilgdbserverprovider.cpp \