forked from qt-creator/qt-creator
BareMetal: De-Q_OBJECT-ify RunConfigurations
And move to a common .cpp. Change-Id: I288ff21abff4a51251a0c3a0206c852a8862df75 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -3,7 +3,6 @@ add_qtc_plugin(BareMetal
|
|||||||
SOURCES
|
SOURCES
|
||||||
baremetal.qrc
|
baremetal.qrc
|
||||||
baremetalconstants.h
|
baremetalconstants.h
|
||||||
baremetalcustomrunconfiguration.cpp baremetalcustomrunconfiguration.h
|
|
||||||
baremetaldebugsupport.cpp baremetaldebugsupport.h
|
baremetaldebugsupport.cpp baremetaldebugsupport.h
|
||||||
baremetaldevice.cpp baremetaldevice.h
|
baremetaldevice.cpp baremetaldevice.h
|
||||||
baremetaldeviceconfigurationwidget.cpp baremetaldeviceconfigurationwidget.h
|
baremetaldeviceconfigurationwidget.cpp baremetaldeviceconfigurationwidget.h
|
||||||
|
@@ -9,7 +9,6 @@ include(debugservers/uvsc/uvscservers.pri)
|
|||||||
# BareMetal files
|
# BareMetal files
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
baremetalcustomrunconfiguration.cpp\
|
|
||||||
baremetaldebugsupport.cpp \
|
baremetaldebugsupport.cpp \
|
||||||
baremetaldevice.cpp \
|
baremetaldevice.cpp \
|
||||||
baremetaldeviceconfigurationwidget.cpp \
|
baremetaldeviceconfigurationwidget.cpp \
|
||||||
@@ -30,7 +29,6 @@ SOURCES += \
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
baremetalconstants.h \
|
baremetalconstants.h \
|
||||||
baremetalcustomrunconfiguration.h \
|
|
||||||
baremetaldebugsupport.h \
|
baremetaldebugsupport.h \
|
||||||
baremetaldevice.h \
|
baremetaldevice.h \
|
||||||
baremetaldeviceconfigurationwidget.h \
|
baremetaldeviceconfigurationwidget.h \
|
||||||
|
@@ -16,7 +16,6 @@ QtcPlugin {
|
|||||||
files: [
|
files: [
|
||||||
"baremetal.qrc",
|
"baremetal.qrc",
|
||||||
"baremetalconstants.h",
|
"baremetalconstants.h",
|
||||||
"baremetalcustomrunconfiguration.cpp", "baremetalcustomrunconfiguration.h",
|
|
||||||
"baremetaldebugsupport.cpp", "baremetaldebugsupport.h",
|
"baremetaldebugsupport.cpp", "baremetaldebugsupport.h",
|
||||||
"baremetaldevice.cpp", "baremetaldevice.h",
|
"baremetaldevice.cpp", "baremetaldevice.h",
|
||||||
"baremetaldeviceconfigurationwidget.cpp", "baremetaldeviceconfigurationwidget.h",
|
"baremetaldeviceconfigurationwidget.cpp", "baremetaldeviceconfigurationwidget.h",
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Tim Sander <tim@krieglstein.org>
|
|
||||||
** 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 "baremetalcustomrunconfiguration.h"
|
|
||||||
#include "baremetalconstants.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
|
|
||||||
#include <qtsupport/qtoutputformatter.h>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
namespace BareMetal {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
// BareMetalCustomRunConfiguration
|
|
||||||
|
|
||||||
BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(Target *target, Core::Id id)
|
|
||||||
: RunConfiguration(target, id)
|
|
||||||
{
|
|
||||||
const auto exeAspect = addAspect<ExecutableAspect>();
|
|
||||||
exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable");
|
|
||||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
|
||||||
exeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay);
|
|
||||||
exeAspect->setHistoryCompleter("BareMetal.CustomRunConfig.History");
|
|
||||||
exeAspect->setExpectedKind(PathChooser::Any);
|
|
||||||
|
|
||||||
addAspect<ArgumentsAspect>();
|
|
||||||
addAspect<WorkingDirectoryAspect>();
|
|
||||||
|
|
||||||
setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target));
|
|
||||||
}
|
|
||||||
|
|
||||||
Tasks BareMetalCustomRunConfiguration::checkForIssues() const
|
|
||||||
{
|
|
||||||
Tasks tasks;
|
|
||||||
if (aspect<ExecutableAspect>()->executable().isEmpty()) {
|
|
||||||
tasks << createConfigurationIssue(tr("The remote executable must be set in order to run "
|
|
||||||
"a custom remote run configuration."));
|
|
||||||
}
|
|
||||||
return tasks;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BareMetalCustomRunConfigurationFactory
|
|
||||||
|
|
||||||
BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory()
|
|
||||||
: FixedRunConfigurationFactory(BareMetalCustomRunConfiguration::tr("Custom Executable"), true)
|
|
||||||
{
|
|
||||||
registerRunConfiguration<BareMetalCustomRunConfiguration>("BareMetal");
|
|
||||||
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace BareMetal
|
|
@@ -1,57 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Tim Sander <tim@krieglstein.org>
|
|
||||||
** 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 <projectexplorer/runconfiguration.h>
|
|
||||||
|
|
||||||
namespace BareMetal {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
// BareMetalCustomRunConfiguration
|
|
||||||
|
|
||||||
class BareMetalCustomRunConfiguration final
|
|
||||||
: public ProjectExplorer::RunConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
|
||||||
|
|
||||||
public:
|
|
||||||
ProjectExplorer::Tasks checkForIssues() const final;
|
|
||||||
};
|
|
||||||
|
|
||||||
// BareMetalCustomRunConfigurationFactory
|
|
||||||
|
|
||||||
class BareMetalCustomRunConfigurationFactory final
|
|
||||||
: public ProjectExplorer::FixedRunConfigurationFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit BareMetalCustomRunConfigurationFactory();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace BareMetal
|
|
@@ -25,7 +25,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "baremetalconstants.h"
|
#include "baremetalconstants.h"
|
||||||
#include "baremetalcustomrunconfiguration.h"
|
|
||||||
#include "baremetaldebugsupport.h"
|
#include "baremetaldebugsupport.h"
|
||||||
#include "baremetaldevice.h"
|
#include "baremetaldevice.h"
|
||||||
#include "baremetalplugin.h"
|
#include "baremetalplugin.h"
|
||||||
|
@@ -38,9 +38,14 @@ using namespace Utils;
|
|||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// BareMetalRunConfiguration
|
// RunConfigurations
|
||||||
|
|
||||||
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id)
|
class BareMetalRunConfiguration final : public RunConfiguration
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::BareMetalRunConfiguration)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BareMetalRunConfiguration(Target *target, Core::Id id)
|
||||||
: RunConfiguration(target, id)
|
: RunConfiguration(target, id)
|
||||||
{
|
{
|
||||||
const auto exeAspect = addAspect<ExecutableAspect>();
|
const auto exeAspect = addAspect<ExecutableAspect>();
|
||||||
@@ -57,6 +62,42 @@ BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id
|
|||||||
|
|
||||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class BareMetalCustomRunConfiguration final : public RunConfiguration
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::BareMetalCustomRunConfiguration)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BareMetalCustomRunConfiguration(Target *target, Core::Id id)
|
||||||
|
: RunConfiguration(target, id)
|
||||||
|
{
|
||||||
|
const auto exeAspect = addAspect<ExecutableAspect>();
|
||||||
|
exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable");
|
||||||
|
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||||
|
exeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay);
|
||||||
|
exeAspect->setHistoryCompleter("BareMetal.CustomRunConfig.History");
|
||||||
|
exeAspect->setExpectedKind(PathChooser::Any);
|
||||||
|
|
||||||
|
addAspect<ArgumentsAspect>();
|
||||||
|
addAspect<WorkingDirectoryAspect>();
|
||||||
|
|
||||||
|
setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target));
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
Tasks checkForIssues() const final;
|
||||||
|
};
|
||||||
|
|
||||||
|
Tasks BareMetalCustomRunConfiguration::checkForIssues() const
|
||||||
|
{
|
||||||
|
Tasks tasks;
|
||||||
|
if (aspect<ExecutableAspect>()->executable().isEmpty()) {
|
||||||
|
tasks << createConfigurationIssue(tr("The remote executable must be set in order to run "
|
||||||
|
"a custom remote run configuration."));
|
||||||
|
}
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
// BareMetalRunConfigurationFactory
|
// BareMetalRunConfigurationFactory
|
||||||
|
|
||||||
@@ -67,6 +108,15 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory()
|
|||||||
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BaseMetalCustomRunConfigurationFactory
|
||||||
|
|
||||||
|
BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory()
|
||||||
|
: FixedRunConfigurationFactory(BareMetalCustomRunConfiguration::tr("Custom Executable"), true)
|
||||||
|
{
|
||||||
|
registerRunConfiguration<BareMetalCustomRunConfiguration>("BareMetal");
|
||||||
|
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace BareMetal
|
} // namespace BareMetal
|
||||||
|
|
||||||
|
@@ -30,23 +30,18 @@
|
|||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// BareMetalRunConfiguration
|
|
||||||
|
|
||||||
class BareMetalRunConfiguration final : public ProjectExplorer::RunConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit BareMetalRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
|
||||||
};
|
|
||||||
|
|
||||||
// BareMetalRunConfigurationFactory
|
|
||||||
|
|
||||||
class BareMetalRunConfigurationFactory final
|
class BareMetalRunConfigurationFactory final
|
||||||
: public ProjectExplorer::RunConfigurationFactory
|
: public ProjectExplorer::RunConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BareMetalRunConfigurationFactory();
|
BareMetalRunConfigurationFactory();
|
||||||
|
};
|
||||||
|
|
||||||
|
class BareMetalCustomRunConfigurationFactory final
|
||||||
|
: public ProjectExplorer::FixedRunConfigurationFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BareMetalCustomRunConfigurationFactory();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user