2013-09-12 18:46:35 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 Tim Sander <tim@krieglstein.org>
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-09-12 18:46:35 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-09-12 18:46:35 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-09-12 18:46:35 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "baremetalrunconfiguration.h"
|
|
|
|
|
|
2018-03-20 17:00:19 +01:00
|
|
|
#include "baremetalconstants.h"
|
2013-09-12 18:46:35 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/buildtargetinfo.h>
|
|
|
|
|
#include <projectexplorer/project.h>
|
2015-12-15 17:05:51 +01:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
2013-09-12 18:46:35 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
|
2018-03-20 17:00:19 +01:00
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
|
2013-09-12 18:46:35 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
namespace BareMetal {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2018-03-20 17:00:19 +01:00
|
|
|
// BareMetalRunConfigurationWidget
|
|
|
|
|
|
|
|
|
|
class BareMetalRunConfigurationWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit BareMetalRunConfigurationWidget(BareMetalRunConfiguration *runConfiguration);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateTargetInformation();
|
|
|
|
|
|
|
|
|
|
BareMetalRunConfiguration * const m_runConfiguration;
|
|
|
|
|
QLabel m_localExecutableLabel;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BareMetalRunConfigurationWidget::BareMetalRunConfigurationWidget(BareMetalRunConfiguration *runConfiguration)
|
|
|
|
|
: m_runConfiguration(runConfiguration)
|
|
|
|
|
{
|
|
|
|
|
auto formLayout = new QFormLayout(this);
|
|
|
|
|
formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
|
|
|
|
|
|
|
|
|
m_localExecutableLabel.setText(m_runConfiguration->localExecutableFilePath());
|
|
|
|
|
formLayout->addRow(BareMetalRunConfiguration::tr("Executable:"), &m_localExecutableLabel);
|
|
|
|
|
|
|
|
|
|
//d->genericWidgetsLayout.addRow(tr("Debugger host:"),d->runConfiguration);
|
|
|
|
|
//d->genericWidgetsLayout.addRow(tr("Debugger port:"),d->runConfiguration);
|
2018-04-16 11:49:25 +02:00
|
|
|
runConfiguration->extraAspect<ArgumentsAspect>()->addToConfigurationLayout(formLayout);
|
|
|
|
|
runConfiguration->extraAspect<WorkingDirectoryAspect>()->addToConfigurationLayout(formLayout);
|
2018-03-20 17:00:19 +01:00
|
|
|
|
|
|
|
|
connect(m_runConfiguration, &BareMetalRunConfiguration::targetInformationChanged,
|
|
|
|
|
this, &BareMetalRunConfigurationWidget::updateTargetInformation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BareMetalRunConfigurationWidget::updateTargetInformation()
|
|
|
|
|
{
|
|
|
|
|
const QString regularText = QDir::toNativeSeparators(m_runConfiguration->localExecutableFilePath());
|
|
|
|
|
const QString errorMessage = "<font color=\"red\">" + tr("Unknown") + "</font>";
|
|
|
|
|
m_localExecutableLabel.setText(regularText.isEmpty() ? errorMessage : regularText);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BareMetalRunConfiguration
|
|
|
|
|
|
2018-04-25 10:26:08 +02:00
|
|
|
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id)
|
|
|
|
|
: RunConfiguration(target, id)
|
2013-09-12 18:46:35 +02:00
|
|
|
{
|
2017-09-01 13:23:02 +02:00
|
|
|
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.MaemoRunConfiguration.Arguments"));
|
2018-03-21 12:48:43 +01:00
|
|
|
addExtraAspect(new WorkingDirectoryAspect(this, "BareMetal.RunConfig.WorkingDirectory"));
|
|
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
connect(target, &Target::deploymentDataChanged,
|
|
|
|
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
|
|
|
|
connect(target, &Target::applicationTargetsChanged,
|
|
|
|
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
|
|
|
|
connect(target, &Target::kitChanged,
|
|
|
|
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
2013-09-12 18:46:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
|
|
|
|
{
|
2018-03-20 17:00:19 +01:00
|
|
|
return wrapWidget(new BareMetalRunConfigurationWidget(this));
|
2013-09-12 18:46:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap BareMetalRunConfiguration::toMap() const
|
|
|
|
|
{
|
2018-03-21 12:48:43 +01:00
|
|
|
return RunConfiguration::toMap();
|
2013-09-12 18:46:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BareMetalRunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!RunConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BareMetalRunConfiguration::localExecutableFilePath() const
|
|
|
|
|
{
|
2018-04-09 12:33:10 +02:00
|
|
|
const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
2018-03-21 09:44:33 +01:00
|
|
|
return bti.targetFilePath.toString();
|
2013-09-12 18:46:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BareMetalRunConfiguration::handleBuildSystemDataUpdated()
|
|
|
|
|
{
|
|
|
|
|
emit targetInformationChanged();
|
2017-01-27 14:26:58 +01:00
|
|
|
emit enabledChanged();
|
2013-09-12 18:46:35 +02:00
|
|
|
}
|
|
|
|
|
|
2015-02-06 01:05:28 +01:00
|
|
|
const char *BareMetalRunConfiguration::IdPrefix = "BareMetal";
|
2013-09-12 18:46:35 +02:00
|
|
|
|
2018-03-20 17:00:19 +01:00
|
|
|
|
|
|
|
|
// BareMetalRunConfigurationFactory
|
|
|
|
|
|
|
|
|
|
BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory()
|
|
|
|
|
{
|
|
|
|
|
registerRunConfiguration<BareMetalRunConfiguration>(BareMetalRunConfiguration::IdPrefix);
|
|
|
|
|
setDecorateDisplayNames(true);
|
|
|
|
|
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-19 19:14:56 +02:00
|
|
|
} // namespace Internal
|
2013-09-12 18:46:35 +02:00
|
|
|
} // namespace BareMetal
|
|
|
|
|
|