Commit 7b04fc45 authored by con's avatar con
Browse files

Make it possible to actually select a tool chain.

parent dc5fcfcc
......@@ -181,4 +181,6 @@ private:
}
}
Q_DECLARE_METATYPE(ProjectExplorer::ToolChain::ToolChainType);
#endif // TOOLCHAIN_H
......@@ -288,10 +288,12 @@ void Qt4Project::restoreSettingsImpl(PersistentSettingsReader &settingsReader)
addDefaultBuild();
// Ensure that the qt version in each build configuration is valid
// Ensure that the qt version and tool chain in each build configuration is valid
// or if not, is reset to the default
foreach (const QString &bc, buildConfigurations())
foreach (const QString &bc, buildConfigurations()) {
qtVersionId(bc);
toolChainType(bc);
}
m_rootProjectNode = new Qt4ProFileNode(this, m_fileInfo->fileName(), this);
m_rootProjectNode->registerWatcher(m_nodesWatcher);
......@@ -377,7 +379,7 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
{
return qtVersion(buildConfiguration)->toolChain(qtVersion(buildConfiguration)->defaultToolchainType());
return qtVersion(buildConfiguration)->toolChain(toolChainType(buildConfiguration));
}
QString Qt4Project::makeCommand(const QString &buildConfiguration) const
......@@ -817,6 +819,22 @@ void Qt4Project::setQtVersion(const QString &buildConfiguration, int id)
setValue(buildConfiguration, "QtVersionId", id);
}
void Qt4Project::setToolChainType(const QString &buildConfiguration, ProjectExplorer::ToolChain::ToolChainType type)
{
setValue(buildConfiguration, "ToolChain", (int)type);
}
ProjectExplorer::ToolChain::ToolChainType Qt4Project::toolChainType(const QString &buildConfiguration) const
{
ProjectExplorer::ToolChain::ToolChainType type =
(ProjectExplorer::ToolChain::ToolChainType)value(buildConfiguration, "ToolChain").toInt();
const QtVersion *version = qtVersion(buildConfiguration);
if (!version->possibleToolChainTypes().contains(type)) // use default tool chain
type = version->defaultToolchainType();
const_cast<Qt4Project *>(this)->setToolChainType(buildConfiguration, type);
return type;
}
BuildStepConfigWidget *Qt4Project::createConfigWidget()
{
return new Qt4ProjectConfigWidget(this);
......
......@@ -163,6 +163,8 @@ public:
// qtVersion is in general the better method to use
QString qtVersionName(const QString &buildConfiguration) const;
ProjectExplorer::ToolChain *toolChain(const QString &buildConfiguration) const;
void setToolChainType(const QString &buildConfiguration, ProjectExplorer::ToolChain::ToolChainType type);
ProjectExplorer::ToolChain::ToolChainType toolChainType(const QString &buildConfiguration) const;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets();
......
......@@ -75,6 +75,9 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
this, SLOT(qtVersionComboBoxCurrentIndexChanged(QString)));
connect(m_ui->toolChainComboBox, SIGNAL(activated(int)),
this, SLOT(selectToolChain(int)));
connect(m_ui->importLabel, SIGNAL(linkActivated(QString)),
this, SLOT(importLabelClicked()));
......@@ -120,6 +123,7 @@ void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
m_ui->shadowBuildDirEdit->setPath(m_pro->buildDirectory(buildConfiguration));
updateImportLabel();
updateToolChainCombo();
}
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
......@@ -282,29 +286,38 @@ void Qt4ProjectConfigWidget::updateToolChainCombo()
foreach (ProjectExplorer::ToolChain::ToolChainType toolchain, toolchains) {
switch (toolchain) {
case ProjectExplorer::ToolChain::GCC:
m_ui->toolChainComboBox->addItem(tr("gcc"), ProjectExplorer::ToolChain::GCC);
m_ui->toolChainComboBox->addItem(tr("gcc"), qVariantFromValue(ProjectExplorer::ToolChain::GCC));
break;
case ProjectExplorer::ToolChain::LinuxICC:
m_ui->toolChainComboBox->addItem(tr("icc"), ProjectExplorer::ToolChain::LinuxICC);
m_ui->toolChainComboBox->addItem(tr("icc"), qVariantFromValue(ProjectExplorer::ToolChain::LinuxICC));
break;
case ProjectExplorer::ToolChain::MinGW:
m_ui->toolChainComboBox->addItem(tr("mingw"), ProjectExplorer::ToolChain::MinGW);
m_ui->toolChainComboBox->addItem(tr("mingw"), qVariantFromValue(ProjectExplorer::ToolChain::MinGW));
break;
case ProjectExplorer::ToolChain::MSVC:
m_ui->toolChainComboBox->addItem(tr("msvc"), ProjectExplorer::ToolChain::MSVC);
m_ui->toolChainComboBox->addItem(tr("msvc"), qVariantFromValue(ProjectExplorer::ToolChain::MSVC));
break;
case ProjectExplorer::ToolChain::WINCE:
m_ui->toolChainComboBox->addItem(tr("wince"), ProjectExplorer::ToolChain::WINCE);
m_ui->toolChainComboBox->addItem(tr("wince"), qVariantFromValue(ProjectExplorer::ToolChain::WINCE));
break;
#ifdef QTCREATOR_WITH_S60
case ProjectExplorer::ToolChain::WINSCW:
m_ui->toolChainComboBox->addItem(tr("winscw"), ProjectExplorer::ToolChain::WINSCW);
m_ui->toolChainComboBox->addItem(tr("winscw"), qVariantFromValue(ProjectExplorer::ToolChain::WINSCW));
break;
case ProjectExplorer::ToolChain::GCCE:
m_ui->toolChainComboBox->addItem(tr("gcce"), ProjectExplorer::ToolChain::GCCE);
m_ui->toolChainComboBox->addItem(tr("gcce"), qVariantFromValue(ProjectExplorer::ToolChain::GCCE));
break;
#endif
}
}
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
selectToolChain(toolchains.indexOf(m_pro->toolChainType(m_buildConfiguration)));
}
void Qt4ProjectConfigWidget::selectToolChain(int index)
{
m_pro->setToolChainType(m_buildConfiguration, m_ui->toolChainComboBox->itemData(index,
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>());
if (m_ui->toolChainComboBox->currentIndex() != index)
m_ui->toolChainComboBox->setCurrentIndex(index);
}
......@@ -61,6 +61,7 @@ private slots:
void importLabelClicked();
void qtVersionComboBoxCurrentIndexChanged(const QString &);
void manageQtVersions();
void selectToolChain(int index);
private:
void updateToolChainCombo();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment