2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-06-17 00:01:27 +10:00
|
|
|
** contact the sales department at http://www.qtsoftware.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
#include "qt4projectconfigwidget.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
|
|
|
|
#include "makestep.h"
|
|
|
|
|
#include "qmakestep.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4project.h"
|
2009-01-20 11:52:04 +01:00
|
|
|
#include "qt4projectmanagerconstants.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4projectmanager.h"
|
2009-04-20 16:38:10 +02:00
|
|
|
#include "ui_qt4projectconfigwidget.h"
|
2009-01-20 11:52:04 +01:00
|
|
|
|
2009-01-23 13:03:36 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2009-01-16 15:26:34 +01:00
|
|
|
#include <coreplugin/mainwindow.h>
|
2009-04-22 14:52:35 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2009-04-22 16:51:38 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <QtGui/QFileDialog>
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
bool debug = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
using namespace Qt4ProjectManager::Internal;
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
|
2008-12-02 12:01:29 +01:00
|
|
|
: BuildStepConfigWidget(),
|
|
|
|
|
m_pro(project)
|
|
|
|
|
{
|
2009-04-20 16:38:10 +02:00
|
|
|
m_ui = new Ui::Qt4ProjectConfigWidget();
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->setupUi(this);
|
2009-07-22 15:18:42 +02:00
|
|
|
|
|
|
|
|
// fix the layout
|
|
|
|
|
QAbstractButton *browseButton = m_ui->shadowBuildDirEdit->buttonAtIndex(0);
|
2009-07-23 15:21:39 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2009-07-22 18:50:02 +02:00
|
|
|
browseButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2009-07-23 15:21:39 +02:00
|
|
|
#endif
|
2009-07-22 15:18:42 +02:00
|
|
|
m_ui->gridLayout->addWidget(browseButton, 4, 2);
|
|
|
|
|
int minimumHeight = qMax(m_ui->qtVersionComboBox->sizeHint().height(), m_ui->manageQtVersionPushButtons->sizeHint().height());
|
|
|
|
|
Qt::Alignment labelAlignment = Qt::Alignment(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
|
|
|
|
|
for (int i = 0; i < m_ui->gridLayout->rowCount(); ++i) {
|
|
|
|
|
m_ui->gridLayout->setRowMinimumHeight(i, minimumHeight);
|
|
|
|
|
QLayoutItem *item = m_ui->gridLayout->itemAtPosition(i, 0);
|
|
|
|
|
if (item)
|
|
|
|
|
item->setAlignment(labelAlignment);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
|
|
|
|
|
m_ui->shadowBuildDirEdit->setExpectedKind(Core::Utils::PathChooser::Directory);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->invalidQtWarningLabel->setVisible(false);
|
|
|
|
|
|
|
|
|
|
connect(m_ui->nameLineEdit, SIGNAL(textEdited(QString)),
|
|
|
|
|
this, SLOT(changeConfigName(QString)));
|
|
|
|
|
|
|
|
|
|
connect(m_ui->shadowBuildCheckBox, SIGNAL(clicked(bool)),
|
|
|
|
|
this, SLOT(shadowBuildCheckBoxClicked(bool)));
|
|
|
|
|
|
2008-12-19 18:25:20 +01:00
|
|
|
connect(m_ui->shadowBuildDirEdit, SIGNAL(beforeBrowsing()),
|
|
|
|
|
this, SLOT(onBeforeBeforeShadowBuildDirBrowsed()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-06-19 17:55:47 +02:00
|
|
|
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed(QString)),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(shadowBuildLineEditTextChanged()));
|
|
|
|
|
|
|
|
|
|
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
|
this, SLOT(qtVersionComboBoxCurrentIndexChanged(QString)));
|
|
|
|
|
|
2009-06-10 15:39:16 +02:00
|
|
|
connect(m_ui->toolChainComboBox, SIGNAL(activated(int)),
|
|
|
|
|
this, SLOT(selectToolChain(int)));
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
connect(m_ui->importLabel, SIGNAL(linkActivated(QString)),
|
|
|
|
|
this, SLOT(importLabelClicked()));
|
|
|
|
|
|
2009-01-16 15:26:34 +01:00
|
|
|
connect(m_ui->manageQtVersionPushButtons, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(manageQtVersions()));
|
|
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2009-04-22 16:51:38 +02:00
|
|
|
|
|
|
|
|
connect(vm, SIGNAL(qtVersionsChanged()),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(setupQtVersionsComboBox()));
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::manageQtVersions()
|
2009-01-16 15:26:34 +01:00
|
|
|
{
|
2009-01-20 11:52:04 +01:00
|
|
|
Core::ICore *core = Core::ICore::instance();
|
2009-04-28 12:43:04 +02:00
|
|
|
core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE);
|
2009-01-16 15:26:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
QString Qt4ProjectConfigWidget::displayName() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
return tr("General");
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
if (debug)
|
2009-04-20 16:38:10 +02:00
|
|
|
qDebug() << "Qt4ProjectConfigWidget::init()";
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
m_buildConfiguration = buildConfiguration;
|
|
|
|
|
|
|
|
|
|
m_ui->nameLineEdit->setText(m_pro->displayNameFor(m_buildConfiguration));
|
|
|
|
|
|
|
|
|
|
setupQtVersionsComboBox();
|
|
|
|
|
|
|
|
|
|
bool shadowBuild = m_pro->value(buildConfiguration, "useShadowBuild").toBool();
|
|
|
|
|
m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
|
|
|
|
|
m_ui->shadowBuildDirEdit->setPath(m_pro->buildDirectory(buildConfiguration));
|
2009-03-19 15:04:43 +01:00
|
|
|
updateImportLabel();
|
2009-06-10 15:39:16 +02:00
|
|
|
updateToolChainCombo();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
m_pro->setDisplayNameFor(m_buildConfiguration, newName);
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
if (m_buildConfiguration.isEmpty()) // not yet initialized
|
|
|
|
|
return;
|
|
|
|
|
|
2008-12-09 11:07:24 +01:00
|
|
|
disconnect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
|
this, SLOT(qtVersionComboBoxCurrentIndexChanged(QString)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
m_ui->qtVersionComboBox->clear();
|
|
|
|
|
m_ui->qtVersionComboBox->addItem(tr("Default Qt Version"), 0);
|
|
|
|
|
|
2008-12-09 11:07:24 +01:00
|
|
|
if (m_pro->qtVersionId(m_buildConfiguration) == 0) {
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(0);
|
|
|
|
|
m_ui->invalidQtWarningLabel->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
// Add Qt Versions to the combo box
|
2009-04-22 16:51:38 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2008-12-02 12:01:29 +01:00
|
|
|
const QList<QtVersion *> &versions = vm->versions();
|
2008-12-09 11:07:24 +01:00
|
|
|
for (int i = 0; i < versions.size(); ++i) {
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->qtVersionComboBox->addItem(versions.at(i)->name(), versions.at(i)->uniqueId());
|
|
|
|
|
|
2008-12-09 11:07:24 +01:00
|
|
|
if (versions.at(i)->uniqueId() == m_pro->qtVersionId(m_buildConfiguration)) {
|
|
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(i + 1);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->invalidQtWarningLabel->setVisible(!versions.at(i)->isValid());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// And connect again
|
2008-12-09 11:07:24 +01:00
|
|
|
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
|
this, SLOT(qtVersionComboBoxCurrentIndexChanged(QString)));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-19 18:25:20 +01:00
|
|
|
QString initialDirectory = QFileInfo(m_pro->file()->fileName()).absolutePath();
|
|
|
|
|
if (!initialDirectory.isEmpty())
|
|
|
|
|
m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::shadowBuildCheckBoxClicked(bool checked)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(checked);
|
2008-12-02 12:01:29 +01:00
|
|
|
bool b = m_ui->shadowBuildCheckBox->isChecked();
|
|
|
|
|
m_pro->setValue(m_buildConfiguration, "useShadowBuild", b);
|
|
|
|
|
if (b)
|
2008-12-19 18:25:20 +01:00
|
|
|
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
|
2008-12-02 12:01:29 +01:00
|
|
|
else
|
|
|
|
|
m_pro->setValue(m_buildConfiguration, "buildDirectory", QVariant(QString::null));
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::updateImportLabel()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-07-24 16:27:29 +02:00
|
|
|
bool visible = false;
|
|
|
|
|
|
|
|
|
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(m_pro->buildDirectory(m_buildConfiguration));
|
|
|
|
|
QtVersion *version = m_pro->qtVersion(m_buildConfiguration);
|
|
|
|
|
if (!qtPath.isEmpty()) {
|
|
|
|
|
if (qtPath != (version ? version->path() : QString())) {
|
|
|
|
|
visible = true;
|
|
|
|
|
} else {
|
|
|
|
|
visible = !m_pro->compareBuildConfigurationToImportFrom(m_buildConfiguration, m_pro->buildDirectory(m_buildConfiguration));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-07-24 16:27:29 +02:00
|
|
|
} else {
|
|
|
|
|
visible = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-07-24 16:27:29 +02:00
|
|
|
|
|
|
|
|
m_ui->importLabel->setVisible(visible);
|
2009-03-19 15:04:43 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
|
2009-03-19 15:04:43 +01:00
|
|
|
{
|
|
|
|
|
if (m_pro->value(m_buildConfiguration, "buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
|
2009-03-23 15:35:01 +01:00
|
|
|
return;
|
2009-03-19 15:04:43 +01:00
|
|
|
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
|
|
|
|
|
// if the directory already exists
|
|
|
|
|
// check if we have a build in there and
|
|
|
|
|
// offer to import it
|
|
|
|
|
updateImportLabel();
|
|
|
|
|
|
|
|
|
|
m_pro->invalidateCachedTargetInformation();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::importLabelClicked()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-07-24 18:12:19 +02:00
|
|
|
QString directory = m_pro->buildDirectory(m_buildConfiguration);
|
|
|
|
|
if (!directory.isEmpty()) {
|
|
|
|
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
|
|
|
|
|
if (!qtPath.isEmpty()) {
|
|
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
|
|
|
|
QtVersion *version = vm->qtVersionForDirectory(qtPath);
|
|
|
|
|
if (!version) {
|
|
|
|
|
version = new QtVersion(QFileInfo(qtPath).baseName(), qtPath);
|
|
|
|
|
vm->addVersion(version);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-07-24 18:12:19 +02:00
|
|
|
|
|
|
|
|
QPair<QtVersion::QmakeBuildConfig, QStringList> result =
|
|
|
|
|
QtVersionManager::scanMakeFile(directory, version->defaultBuildConfig());
|
|
|
|
|
QtVersion::QmakeBuildConfig qmakeBuildConfig = result.first;
|
|
|
|
|
QStringList additionalArguments = result.second;
|
|
|
|
|
|
|
|
|
|
QString versionSpec = version->sourcePath() + "/mkspecs/" + version->mkspec();
|
|
|
|
|
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(additionalArguments);
|
|
|
|
|
QString parsedSpecOrginal = parsedSpec;
|
|
|
|
|
if (QFileInfo(parsedSpec).isRelative())
|
|
|
|
|
parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec);
|
|
|
|
|
additionalArguments = Qt4Project::removeSpecFromArgumentList(additionalArguments);
|
|
|
|
|
if (parsedSpec != versionSpec) {
|
|
|
|
|
additionalArguments.prepend(parsedSpecOrginal);
|
|
|
|
|
additionalArguments.prepend("-spec");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// So we got all the information now apply it...
|
|
|
|
|
m_pro->setQtVersion(m_buildConfiguration, version->uniqueId());
|
|
|
|
|
// Combo box will be updated at the end
|
|
|
|
|
|
|
|
|
|
QMakeStep *qmakeStep = m_pro->qmakeStep();
|
2009-07-24 18:53:54 +02:00
|
|
|
qmakeStep->setQMakeArguments(m_buildConfiguration, additionalArguments);
|
2009-07-24 18:12:19 +02:00
|
|
|
MakeStep *makeStep = m_pro->makeStep();
|
|
|
|
|
|
|
|
|
|
m_pro->setValue(m_buildConfiguration, "buildConfiguration", int(qmakeBuildConfig));
|
|
|
|
|
// Adjust command line arguments, this is ugly as hell
|
|
|
|
|
// If we are switching to BuildAll we want "release" in there and no "debug"
|
|
|
|
|
// or "debug" in there and no "release"
|
|
|
|
|
// If we are switching to not BuildAl we want neither "release" nor "debug" in there
|
|
|
|
|
QStringList makeCmdArguments = makeStep->value(m_buildConfiguration, "makeargs").toStringList();
|
|
|
|
|
bool debug = qmakeBuildConfig & QtVersion::DebugBuild;
|
|
|
|
|
if (qmakeBuildConfig & QtVersion::BuildAll) {
|
|
|
|
|
makeCmdArguments.removeAll(debug ? "release" : "debug");
|
|
|
|
|
if (!makeCmdArguments.contains(debug ? "debug" : "release"))
|
|
|
|
|
makeCmdArguments.append(debug ? "debug" : "release");
|
|
|
|
|
} else {
|
|
|
|
|
makeCmdArguments.removeAll("debug");
|
|
|
|
|
makeCmdArguments.removeAll("release");
|
|
|
|
|
}
|
2009-07-24 18:53:54 +02:00
|
|
|
makeStep->setMakeArguments(m_buildConfiguration, makeCmdArguments);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setupQtVersionsComboBox();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString &)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
//Qt Version
|
|
|
|
|
int newQtVersion;
|
|
|
|
|
if (m_ui->qtVersionComboBox->currentIndex() == 0) {
|
|
|
|
|
newQtVersion = 0;
|
|
|
|
|
} else {
|
|
|
|
|
newQtVersion = m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->currentIndex()).toInt();
|
|
|
|
|
}
|
2009-04-28 12:43:04 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2009-04-22 16:51:38 +02:00
|
|
|
bool isValid = vm->version(newQtVersion)->isValid();
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->invalidQtWarningLabel->setVisible(!isValid);
|
2008-12-09 11:07:24 +01:00
|
|
|
if (newQtVersion != m_pro->qtVersionId(m_buildConfiguration)) {
|
2008-12-02 12:01:29 +01:00
|
|
|
m_pro->setQtVersion(m_buildConfiguration, newQtVersion);
|
2009-06-09 18:55:04 +02:00
|
|
|
updateToolChainCombo();
|
2009-06-10 19:30:27 +02:00
|
|
|
m_pro->update();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2009-06-09 18:55:04 +02:00
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::updateToolChainCombo()
|
|
|
|
|
{
|
|
|
|
|
m_ui->toolChainComboBox->clear();
|
|
|
|
|
QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_pro->qtVersion(m_buildConfiguration)->possibleToolChainTypes();
|
|
|
|
|
foreach (ProjectExplorer::ToolChain::ToolChainType toolchain, toolchains) {
|
|
|
|
|
switch (toolchain) {
|
|
|
|
|
case ProjectExplorer::ToolChain::GCC:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("gcc"), qVariantFromValue(ProjectExplorer::ToolChain::GCC));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::ToolChain::LinuxICC:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("icc"), qVariantFromValue(ProjectExplorer::ToolChain::LinuxICC));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::ToolChain::MinGW:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("mingw"), qVariantFromValue(ProjectExplorer::ToolChain::MinGW));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::ToolChain::MSVC:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("msvc"), qVariantFromValue(ProjectExplorer::ToolChain::MSVC));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::ToolChain::WINCE:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("wince"), qVariantFromValue(ProjectExplorer::ToolChain::WINCE));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
#ifdef QTCREATOR_WITH_S60
|
|
|
|
|
case ProjectExplorer::ToolChain::WINSCW:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("winscw"), qVariantFromValue(ProjectExplorer::ToolChain::WINSCW));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::ToolChain::GCCE:
|
2009-06-10 15:39:16 +02:00
|
|
|
m_ui->toolChainComboBox->addItem(tr("gcce"), qVariantFromValue(ProjectExplorer::ToolChain::GCCE));
|
2009-06-09 18:55:04 +02:00
|
|
|
break;
|
|
|
|
|
#endif
|
2009-06-30 09:04:48 +02:00
|
|
|
case ProjectExplorer::ToolChain::OTHER:
|
|
|
|
|
case ProjectExplorer::ToolChain::INVALID:
|
|
|
|
|
case ProjectExplorer::ToolChain::UNKNOWN:
|
|
|
|
|
break;
|
2009-06-09 18:55:04 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
|
2009-06-10 19:30:27 +02:00
|
|
|
setToolChain(toolchains.indexOf(m_pro->toolChainType(m_buildConfiguration)));
|
2009-06-10 15:39:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::selectToolChain(int index)
|
|
|
|
|
{
|
2009-06-10 19:30:27 +02:00
|
|
|
setToolChain(index);
|
|
|
|
|
m_pro->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::setToolChain(int index)
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorer::ToolChain::ToolChainType selectedToolChainType =
|
|
|
|
|
m_ui->toolChainComboBox->itemData(index,
|
|
|
|
|
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>();
|
2009-06-19 17:55:47 +02:00
|
|
|
m_pro->setToolChainType(m_buildConfiguration, selectedToolChainType);
|
2009-06-10 15:39:16 +02:00
|
|
|
if (m_ui->toolChainComboBox->currentIndex() != index)
|
|
|
|
|
m_ui->toolChainComboBox->setCurrentIndex(index);
|
2009-06-09 18:55:04 +02:00
|
|
|
}
|