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-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.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-11-25 18:50:20 +01:00
|
|
|
#include "qt4buildconfiguration.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-09-21 17:54:02 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.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-12-03 18:37:27 +01:00
|
|
|
using ProjectExplorer::ToolChain;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
|
2009-08-06 15:31:32 +02:00
|
|
|
: BuildConfigWidget(),
|
2009-12-03 18:37:27 +01:00
|
|
|
m_buildConfiguration(0),
|
|
|
|
|
m_ignoreChange(false)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
Q_UNUSED(project);
|
2009-10-01 14:24:44 +02:00
|
|
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
|
|
|
|
vbox->setMargin(0);
|
|
|
|
|
m_detailsContainer = new Utils::DetailsWidget(this);
|
|
|
|
|
vbox->addWidget(m_detailsContainer);
|
|
|
|
|
QWidget *details = new QWidget(m_detailsContainer);
|
|
|
|
|
m_detailsContainer->setWidget(details);
|
2009-04-20 16:38:10 +02:00
|
|
|
m_ui = new Ui::Qt4ProjectConfigWidget();
|
2009-10-01 14:24:44 +02:00
|
|
|
m_ui->setupUi(details);
|
|
|
|
|
|
2009-07-22 15:18:42 +02:00
|
|
|
|
2009-08-05 12:50:15 +02:00
|
|
|
m_browseButton = m_ui->shadowBuildDirEdit->buttonAtIndex(0);
|
2009-10-01 14:24:44 +02:00
|
|
|
// TODO refix the layout
|
2009-07-22 15:18:42 +02:00
|
|
|
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
|
2009-10-05 11:06:05 +02:00
|
|
|
m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::Directory);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->invalidQtWarningLabel->setVisible(false);
|
|
|
|
|
|
|
|
|
|
connect(m_ui->nameLineEdit, SIGNAL(textEdited(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(configNameEdited(QString)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
connect(m_ui->shadowBuildCheckBox, SIGNAL(clicked(bool)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(shadowBuildClicked(bool)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
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)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(shadowBuildEdited()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(qtVersionSelected(QString)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-06-10 15:39:16 +02:00
|
|
|
connect(m_ui->toolChainComboBox, SIGNAL(activated(int)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(toolChainSelected(int)));
|
2009-06-10 15:39:16 +02:00
|
|
|
|
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-22 16:51:38 +02:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
|
|
|
|
connect(vm, SIGNAL(qtVersionsChanged(QList<int>)),
|
|
|
|
|
this, SLOT(qtVersionsChanged()));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:38:10 +02:00
|
|
|
Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
void Qt4ProjectConfigWidget::updateDetails()
|
|
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
QtVersion *version = m_buildConfiguration->qtVersion();
|
2010-01-12 15:46:23 +01:00
|
|
|
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QString versionString;
|
2009-11-25 18:50:20 +01:00
|
|
|
if (m_buildConfiguration->qtVersionId() == 0) {
|
2010-01-07 18:17:24 +01:00
|
|
|
versionString = tr("Default Qt Version (%1)").arg(version->displayName());
|
2009-08-28 17:20:37 +02:00
|
|
|
} else if(version){
|
2010-01-07 18:17:24 +01:00
|
|
|
versionString = version->displayName();
|
2009-08-28 17:20:37 +02:00
|
|
|
} else {
|
|
|
|
|
versionString = tr("No Qt Version set");
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
2010-01-12 15:46:23 +01:00
|
|
|
|
|
|
|
|
if (!version->isValid()) {
|
|
|
|
|
// Not a valid qt version
|
|
|
|
|
m_detailsContainer->setSummaryText(
|
|
|
|
|
tr("using <font color=\"#ff0000\">invalid</font> Qt Version: <b>%1</b><br>"
|
|
|
|
|
"%2")
|
|
|
|
|
.arg(versionString,
|
|
|
|
|
version->invalidReason()));
|
|
|
|
|
} else {
|
|
|
|
|
// Qt Version, Build Directory and Toolchain
|
|
|
|
|
m_detailsContainer->setSummaryText(
|
|
|
|
|
tr("using Qt version: <b>%1</b><br>"
|
|
|
|
|
"with tool chain <b>%2</b><br>"
|
|
|
|
|
"building in <b>%3</b>")
|
|
|
|
|
.arg(versionString,
|
|
|
|
|
ProjectExplorer::ToolChain::toolChainName(m_buildConfiguration->toolChainType()),
|
|
|
|
|
QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
|
|
|
|
|
}
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
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-11-27 16:12:12 +01:00
|
|
|
core->showOptionsDialog(Constants::QT_SETTINGS_CATEGORY, Constants::QTVERSION_SETTINGS_PAGE_ID);
|
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-11-24 15:36:31 +01:00
|
|
|
void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
if (debug)
|
2009-11-24 15:36:31 +01:00
|
|
|
qDebug() << "Qt4ProjectConfigWidget::init() for"<<bc->displayName();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
if (m_buildConfiguration) {
|
|
|
|
|
disconnect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
|
|
|
|
|
this, SLOT(buildDirectoryChanged()));
|
|
|
|
|
disconnect(m_buildConfiguration, SIGNAL(qtVersionChanged()),
|
|
|
|
|
this, SLOT(qtVersionChanged()));
|
2009-12-08 14:07:01 +01:00
|
|
|
disconnect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
|
|
|
|
|
this, SLOT(updateImportLabel()));
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
|
2009-12-03 18:37:27 +01:00
|
|
|
|
|
|
|
|
connect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
|
|
|
|
|
this, SLOT(buildDirectoryChanged()));
|
|
|
|
|
connect(m_buildConfiguration, SIGNAL(qtVersionChanged()),
|
|
|
|
|
this, SLOT(qtVersionChanged()));
|
2009-12-08 14:07:01 +01:00
|
|
|
connect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
|
|
|
|
|
this, SLOT(updateImportLabel()));
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2009-11-24 15:36:31 +01:00
|
|
|
m_ui->nameLineEdit->setText(m_buildConfiguration->displayName());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
qtVersionsChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-12-07 15:55:00 +01:00
|
|
|
bool shadowBuild = m_buildConfiguration->shadowBuild();
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
|
2009-08-05 12:50:15 +02:00
|
|
|
m_browseButton->setEnabled(shadowBuild);
|
2009-11-25 18:50:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->buildDirectory());
|
2009-03-19 15:04:43 +01:00
|
|
|
updateImportLabel();
|
2009-06-10 15:39:16 +02:00
|
|
|
updateToolChainCombo();
|
2009-08-06 15:31:32 +02:00
|
|
|
updateDetails();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::qtVersionChanged()
|
|
|
|
|
{
|
|
|
|
|
updateImportLabel();
|
|
|
|
|
updateToolChainCombo();
|
|
|
|
|
updateDetails();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::configNameEdited(const QString &newName)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-26 15:53:38 +01:00
|
|
|
m_buildConfiguration->setDisplayName(newName);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::qtVersionsChanged()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-24 15:36:31 +01:00
|
|
|
if (!m_buildConfiguration) // not yet initialized
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2008-12-09 11:07:24 +01:00
|
|
|
disconnect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(qtVersionSelected(QString)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-08-26 15:42:24 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->qtVersionComboBox->clear();
|
2010-01-07 18:17:24 +01:00
|
|
|
m_ui->qtVersionComboBox->addItem(tr("Default Qt Version (%1)").arg(vm->defaultVersion()->displayName()), 0);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
int qtVersionId = m_buildConfiguration->qtVersionId();
|
2009-10-06 17:16:18 +02:00
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
if (qtVersionId == 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
|
|
|
|
|
const QList<QtVersion *> &versions = vm->versions();
|
2008-12-09 11:07:24 +01:00
|
|
|
for (int i = 0; i < versions.size(); ++i) {
|
2010-01-07 18:17:24 +01:00
|
|
|
m_ui->qtVersionComboBox->addItem(versions.at(i)->displayName(), versions.at(i)->uniqueId());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
if (versions.at(i)->uniqueId() == qtVersionId) {
|
2008-12-09 11:07:24 +01:00
|
|
|
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)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(qtVersionSelected(QString)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::buildDirectoryChanged()
|
|
|
|
|
{
|
2009-12-10 19:21:34 +01:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2009-12-07 15:55:00 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory());
|
2009-12-03 18:37:27 +01:00
|
|
|
updateDetails();
|
|
|
|
|
updateImportLabel();
|
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
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
QString initialDirectory = QFileInfo(m_buildConfiguration->project()->file()->fileName()).absolutePath();
|
2008-12-19 18:25:20 +01:00
|
|
|
if (!initialDirectory.isEmpty())
|
|
|
|
|
m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::shadowBuildClicked(bool checked)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-19 18:25:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(checked);
|
2009-08-05 12:50:15 +02:00
|
|
|
m_browseButton->setEnabled(checked);
|
2008-12-02 12:01:29 +01:00
|
|
|
bool b = m_ui->shadowBuildCheckBox->isChecked();
|
2009-12-03 18:37:27 +01:00
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
2009-12-10 19:21:34 +01:00
|
|
|
m_buildConfiguration->setShadowBuildAndDirectory(b, m_ui->shadowBuildDirEdit->path());
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
updateDetails();
|
2009-11-09 18:59:11 +01:00
|
|
|
updateImportLabel();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::shadowBuildEdited()
|
|
|
|
|
{
|
2009-12-07 15:55:00 +01:00
|
|
|
if (m_buildConfiguration->shadowBuildDirectory() == m_ui->shadowBuildDirEdit->path())
|
2009-12-03 18:37:27 +01:00
|
|
|
return;
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_buildConfiguration->setShadowBuildAndDirectory(true, m_ui->shadowBuildDirEdit->path());
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
// if the directory already exists
|
|
|
|
|
// check if we have a build in there and
|
|
|
|
|
// offer to import it
|
|
|
|
|
updateImportLabel();
|
|
|
|
|
updateDetails();
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2009-07-27 15:02:34 +02:00
|
|
|
// we only show if we actually have a qmake and makestep
|
2009-11-25 18:50:20 +01:00
|
|
|
if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
|
|
|
|
|
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_buildConfiguration->buildDirectory());
|
|
|
|
|
QtVersion *version = m_buildConfiguration->qtVersion();
|
2009-07-27 15:02:34 +02:00
|
|
|
// check that there's a makefile
|
2009-09-03 19:16:22 +02:00
|
|
|
if (!qmakePath.isEmpty()) {
|
|
|
|
|
// and that the qmake path is different from the current version
|
|
|
|
|
if (qmakePath != (version ? version->qmakeCommand() : QString())) {
|
2009-07-27 15:02:34 +02:00
|
|
|
// import enable
|
|
|
|
|
visible = true;
|
|
|
|
|
} else {
|
|
|
|
|
// check that the qmake flags, arguments match
|
2009-11-27 13:47:27 +01:00
|
|
|
visible = !m_buildConfiguration->compareToImportFrom(m_buildConfiguration->buildDirectory());
|
2009-07-27 15:02:34 +02:00
|
|
|
}
|
2009-07-24 16:27:29 +02:00
|
|
|
} else {
|
2009-07-27 15:02:34 +02:00
|
|
|
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::importLabelClicked()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
if (!m_buildConfiguration->qmakeStep() || !m_buildConfiguration->makeStep())
|
2009-10-27 14:16:28 +01:00
|
|
|
return;
|
2009-11-25 18:50:20 +01:00
|
|
|
QString directory = m_buildConfiguration->buildDirectory();
|
2009-07-24 18:12:19 +02:00
|
|
|
if (!directory.isEmpty()) {
|
2009-09-03 19:16:22 +02:00
|
|
|
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory);
|
|
|
|
|
if (!qmakePath.isEmpty()) {
|
2009-07-24 18:12:19 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2009-09-03 19:16:22 +02:00
|
|
|
QtVersion *version = vm->qtVersionForQMakeBinary(qmakePath);
|
2009-07-24 18:12:19 +02:00
|
|
|
if (!version) {
|
2009-09-03 19:16:22 +02:00
|
|
|
version = new QtVersion(qmakePath);
|
2009-07-24 18:12:19 +02:00
|
|
|
vm->addVersion(version);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-07-24 18:12:19 +02:00
|
|
|
|
2009-10-13 13:44:13 +02:00
|
|
|
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
2009-07-24 18:12:19 +02:00
|
|
|
QtVersionManager::scanMakeFile(directory, version->defaultBuildConfig());
|
2009-10-13 13:44:13 +02:00
|
|
|
QtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
|
2009-11-26 16:49:45 +01:00
|
|
|
QStringList additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);
|
|
|
|
|
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, version);
|
2009-11-11 18:47:49 +01:00
|
|
|
QString versionSpec = version->mkspec();
|
2009-11-09 18:59:11 +01:00
|
|
|
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
|
|
|
|
|
// using the default spec, don't modify additional arguments
|
|
|
|
|
} else {
|
|
|
|
|
additionalArguments.prepend(parsedSpec);
|
|
|
|
|
additionalArguments.prepend("-spec");
|
|
|
|
|
}
|
2009-07-24 18:12:19 +02:00
|
|
|
|
|
|
|
|
// So we got all the information now apply it...
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->setQtVersion(version->uniqueId());
|
2009-07-24 18:12:19 +02:00
|
|
|
// Combo box will be updated at the end
|
|
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
QMakeStep *qmakeStep = m_buildConfiguration->qmakeStep();
|
2009-11-30 16:34:30 +01:00
|
|
|
qmakeStep->setUserArguments(additionalArguments);
|
2009-11-25 18:50:20 +01:00
|
|
|
MakeStep *makeStep = m_buildConfiguration->makeStep();
|
2009-07-24 18:12:19 +02:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
m_buildConfiguration->setQMakeBuildConfiguration(qmakeBuildConfig);
|
2009-07-24 18:12:19 +02:00
|
|
|
// 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
|
2009-11-30 19:30:51 +01:00
|
|
|
QStringList makeCmdArguments = makeStep->userArguments();
|
2009-07-24 18:12:19 +02:00
|
|
|
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-11-30 19:30:51 +01:00
|
|
|
makeStep->setUserArguments(makeCmdArguments);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2009-12-03 18:37:27 +01:00
|
|
|
// All our widgets are updated by signals from the buildconfiguration
|
|
|
|
|
// if not, there's either a signal missing
|
|
|
|
|
// or we don't respond to it correctly
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::qtVersionSelected(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);
|
2009-11-25 18:50:20 +01:00
|
|
|
if (newQtVersion != m_buildConfiguration->qtVersionId()) {
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = true;
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->setQtVersion(newQtVersion);
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = false;
|
2009-06-09 18:55:04 +02:00
|
|
|
updateToolChainCombo();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-08-06 15:31:32 +02:00
|
|
|
updateDetails();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-06-09 18:55:04 +02:00
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::updateToolChainCombo()
|
|
|
|
|
{
|
|
|
|
|
m_ui->toolChainComboBox->clear();
|
2009-11-25 18:50:20 +01:00
|
|
|
QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_buildConfiguration->qtVersion()->possibleToolChainTypes();
|
2009-08-13 16:42:17 +02:00
|
|
|
foreach (ToolChain::ToolChainType toolchain, toolchains) {
|
|
|
|
|
m_ui->toolChainComboBox->addItem(ToolChain::toolChainName(toolchain), qVariantFromValue(toolchain));
|
2009-06-09 18:55:04 +02:00
|
|
|
}
|
|
|
|
|
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ui->toolChainComboBox->setCurrentIndex(toolchains.indexOf(m_buildConfiguration->toolChainType()));
|
|
|
|
|
updateDetails();
|
2009-06-10 19:30:27 +02:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::toolChainSelected(int index)
|
2009-06-10 19:30:27 +02:00
|
|
|
{
|
|
|
|
|
ProjectExplorer::ToolChain::ToolChainType selectedToolChainType =
|
|
|
|
|
m_ui->toolChainComboBox->itemData(index,
|
|
|
|
|
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>();
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = true;
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->setToolChainType(selectedToolChainType);
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = false;
|
2009-08-06 15:31:32 +02:00
|
|
|
updateDetails();
|
2009-06-09 18:55:04 +02:00
|
|
|
}
|