forked from qt-creator/qt-creator
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
@@ -50,10 +50,7 @@ using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *target) :
|
||||
m_target(target),
|
||||
m_pathChooser(0),
|
||||
m_toolChainChooser(0),
|
||||
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget() :
|
||||
m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
@@ -63,23 +60,8 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *targ
|
||||
m_pathChooser = new Utils::PathChooser(this);
|
||||
m_pathChooser->setEnabled(true);
|
||||
m_pathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_pathChooser->setBaseDirectory(m_target->autotoolsProject()->projectDirectory());
|
||||
fl->addRow(tr("Build directory:"), m_pathChooser);
|
||||
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
|
||||
|
||||
// tool chain
|
||||
m_toolChainChooser = new QComboBox;
|
||||
m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
updateToolChainList();
|
||||
|
||||
fl->addRow(tr("Tool chain:"), m_toolChainChooser);
|
||||
connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
|
||||
connect(m_target->autotoolsProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
|
||||
this, SLOT(updateToolChainList()));
|
||||
}
|
||||
|
||||
QString AutotoolsBuildSettingsWidget::displayName() const
|
||||
@@ -90,6 +72,7 @@ QString AutotoolsBuildSettingsWidget::displayName() const
|
||||
void AutotoolsBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = static_cast<AutotoolsBuildConfiguration *>(bc);
|
||||
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
|
||||
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
|
||||
@@ -97,39 +80,3 @@ void AutotoolsBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::toolChainSelected(int index)
|
||||
{
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
|
||||
m_target->autotoolsProject()->setToolChain(tc);
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
for (int i = 0; i < m_toolChainChooser->count(); ++i) {
|
||||
ToolChain *currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
|
||||
if (currentTc != tc)
|
||||
continue;
|
||||
m_toolChainChooser->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AutotoolsBuildSettingsWidget::updateToolChainList()
|
||||
{
|
||||
m_toolChainChooser->clear();
|
||||
|
||||
QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
|
||||
if (!m_target->autotoolsProject()->toolChain()) {
|
||||
m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
|
||||
m_toolChainChooser->setCurrentIndex(0);
|
||||
}
|
||||
foreach (ToolChain *tc, tcs) {
|
||||
m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
|
||||
if (m_target->autotoolsProject()->toolChain()
|
||||
&& m_target->autotoolsProject()->toolChain()->id() == tc->id())
|
||||
m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user