2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 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
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
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
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
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"
|
2010-12-06 12:45:05 +01:00
|
|
|
#include "qt4target.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>
|
2010-11-01 16:29:45 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/toolchainmanager.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>
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2009-04-22 16:51:38 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <QtGui/QFileDialog>
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <QtGui/QPushButton>
|
|
|
|
|
#include <utils/detailswidget.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
bool debug = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
using namespace Qt4ProjectManager::Internal;
|
2011-02-01 18:36:00 +01:00
|
|
|
using namespace ProjectExplorer;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4BaseTarget *target)
|
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-10-01 14:24:44 +02:00
|
|
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
|
|
|
|
vbox->setMargin(0);
|
|
|
|
|
m_detailsContainer = new Utils::DetailsWidget(this);
|
2010-02-01 17:22:05 +01:00
|
|
|
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
|
2009-10-01 14:24:44 +02:00
|
|
|
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-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"));
|
2011-02-21 12:42:20 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
2010-12-06 12:45:05 +01:00
|
|
|
m_ui->shadowBuildDirEdit->setBaseDirectory(target->qt4Project()->projectDirectory());
|
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()));
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
connect(m_ui->manageToolChainPushButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(manageToolChains()));
|
|
|
|
|
|
2010-12-06 12:45:05 +01:00
|
|
|
connect(target->qt4Project(), SIGNAL(environmentChanged()),
|
2010-10-06 13:47:01 +02:00
|
|
|
this, SLOT(environmentChanged()));
|
|
|
|
|
|
2010-12-06 12:45:05 +01:00
|
|
|
connect(target->qt4Project(), SIGNAL(buildDirectoryInitialized()),
|
2010-02-12 12:25:00 +01:00
|
|
|
this, SLOT(updateImportLabel()));
|
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;
|
2010-02-08 15:50:06 +01:00
|
|
|
versionString = version->displayName();
|
|
|
|
|
|
|
|
|
|
if (!version || !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 ? version->invalidReason() : tr("No Qt Version found.")));
|
2009-08-28 17:20:37 +02:00
|
|
|
} else {
|
2011-03-16 17:59:43 +01:00
|
|
|
// Qt Version, Build Directory and tool chain
|
2010-02-08 15:50:06 +01:00
|
|
|
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,
|
2011-02-01 18:36:00 +01:00
|
|
|
m_buildConfiguration->toolChain() ? m_buildConfiguration->toolChain()->displayName() :
|
2011-03-16 17:59:43 +01:00
|
|
|
tr("<Invalid tool chain>"),
|
2010-02-08 15:50:06 +01:00
|
|
|
QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-06 13:47:01 +02:00
|
|
|
void Qt4ProjectConfigWidget::environmentChanged()
|
|
|
|
|
{
|
|
|
|
|
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-14 13:37:08 +02:00
|
|
|
void Qt4ProjectConfigWidget::updateShadowBuildUi()
|
|
|
|
|
{
|
|
|
|
|
m_ui->shadowBuildCheckBox->setEnabled(m_buildConfiguration->qtVersion()->supportsShadowBuilds());
|
2010-08-17 17:46:54 +02:00
|
|
|
bool isShadowbuilding = m_buildConfiguration->shadowBuild();
|
|
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(isShadowbuilding && m_buildConfiguration->qtVersion()->supportsShadowBuilds());
|
|
|
|
|
m_browseButton->setEnabled(isShadowbuilding && m_buildConfiguration->qtVersion()->supportsShadowBuilds());
|
|
|
|
|
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory());
|
2010-04-14 13:37:08 +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
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
void Qt4ProjectConfigWidget::manageToolChains()
|
|
|
|
|
{
|
|
|
|
|
Core::ICore *core = Core::ICore::instance();
|
|
|
|
|
core->showOptionsDialog(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_CATEGORY,
|
|
|
|
|
ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
QTC_ASSERT(bc, return);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
if (debug)
|
2010-07-16 14:00:41 +02: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) {
|
2010-04-14 13:37:08 +02:00
|
|
|
disconnect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
|
|
|
|
|
this, SLOT(buildDirectoryChanged()));
|
2009-12-03 18:37:27 +01:00
|
|
|
disconnect(m_buildConfiguration, SIGNAL(qtVersionChanged()),
|
|
|
|
|
this, SLOT(qtVersionChanged()));
|
2009-12-08 14:07:01 +01:00
|
|
|
disconnect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
|
|
|
|
|
this, SLOT(updateImportLabel()));
|
2011-02-01 18:36:00 +01:00
|
|
|
disconnect(m_buildConfiguration, SIGNAL(toolChainChanged()),
|
|
|
|
|
this, SLOT(toolChainChanged()));
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
|
2010-10-06 13:47:01 +02:00
|
|
|
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
|
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()));
|
2011-02-01 18:36:00 +01:00
|
|
|
connect(m_buildConfiguration, SIGNAL(toolChainChanged()),
|
|
|
|
|
this, SLOT(toolChainChanged()));
|
2009-12-03 18:37:27 +01:00
|
|
|
|
|
|
|
|
qtVersionsChanged();
|
2010-06-22 14:38:50 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
|
|
|
|
connect(vm, SIGNAL(qtVersionsChanged(QList<int>)),
|
|
|
|
|
this, SLOT(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);
|
2010-04-13 16:36:32 +02:00
|
|
|
m_ui->shadowBuildCheckBox->setEnabled(m_buildConfiguration->qtVersion()->supportsShadowBuilds());
|
2010-05-19 15:28:37 +02:00
|
|
|
|
2010-08-17 17:46:54 +02:00
|
|
|
updateShadowBuildUi();
|
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();
|
2011-02-01 18:36:00 +01:00
|
|
|
|
|
|
|
|
connect(ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
|
|
|
|
this, SLOT(updateToolChainCombo()));
|
|
|
|
|
connect(ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
|
|
|
|
|
this, SLOT(updateToolChainCombo()));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4ProjectConfigWidget::qtVersionChanged()
|
|
|
|
|
{
|
2010-04-14 13:37:08 +02:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2010-04-13 16:36:32 +02:00
|
|
|
|
2010-06-22 14:16:49 +02:00
|
|
|
int versionId = m_buildConfiguration->qtVersion()->uniqueId();
|
|
|
|
|
int comboBoxIndex = m_ui->qtVersionComboBox->findData(QVariant(versionId), Qt::UserRole);
|
|
|
|
|
if (comboBoxIndex > -1)
|
|
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(comboBoxIndex);
|
|
|
|
|
|
2010-04-14 13:37:08 +02:00
|
|
|
updateShadowBuildUi();
|
2009-12-03 18:37:27 +01:00
|
|
|
updateImportLabel();
|
|
|
|
|
updateToolChainCombo();
|
|
|
|
|
updateDetails();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4ProjectConfigWidget::qtVersionsChanged()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-04-14 13:37:08 +02:00
|
|
|
m_ignoreChange = true;
|
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-02-08 15:50:06 +01:00
|
|
|
QtVersion * qtVersion = m_buildConfiguration->qtVersion();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
const QList<QtVersion *> validVersions(vm->versionsForTargetId(m_buildConfiguration->target()->id()));
|
2010-04-14 13:37:08 +02:00
|
|
|
if (!validVersions.isEmpty()) {
|
2010-02-08 15:50:06 +01:00
|
|
|
for (int i = 0; i < validVersions.size(); ++i) {
|
|
|
|
|
m_ui->qtVersionComboBox->addItem(validVersions.at(i)->displayName(),
|
|
|
|
|
validVersions.at(i)->uniqueId());
|
|
|
|
|
|
2010-09-09 17:00:26 +02:00
|
|
|
if (validVersions.at(i) == qtVersion)
|
2010-02-08 15:50:06 +01:00
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(i);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-09-09 17:00:26 +02:00
|
|
|
if (!qtVersion->isValid()) {
|
|
|
|
|
m_ui->qtVersionComboBox->addItem(tr("Invalid Qt version"), -1);
|
|
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(m_ui->qtVersionComboBox->count() - 1);
|
|
|
|
|
}
|
2010-10-12 18:10:25 +02:00
|
|
|
m_ui->qtVersionComboBox->setEnabled(m_ui->qtVersionComboBox->count() > 1);
|
2010-04-14 13:37:08 +02:00
|
|
|
m_ignoreChange = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-04-14 13:37:08 +02:00
|
|
|
updateToolChainCombo();
|
|
|
|
|
updateShadowBuildUi();
|
|
|
|
|
updateDetails();
|
|
|
|
|
updateImportLabel();
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2010-03-25 13:19:27 +01:00
|
|
|
QString initialDirectory = m_buildConfiguration->target()->project()->projectDirectory();
|
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;
|
2010-10-06 13:47:01 +02:00
|
|
|
m_buildConfiguration->setShadowBuildAndDirectory(b, m_ui->shadowBuildDirEdit->rawPath());
|
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()
|
|
|
|
|
{
|
2010-10-06 13:47:01 +02:00
|
|
|
if (m_buildConfiguration->shadowBuildDirectory() == m_ui->shadowBuildDirEdit->rawPath())
|
2009-12-03 18:37:27 +01:00
|
|
|
return;
|
|
|
|
|
m_ignoreChange = true;
|
2010-10-06 13:47:01 +02:00
|
|
|
m_buildConfiguration->setShadowBuildAndDirectory(m_buildConfiguration->shadowBuild(), m_ui->shadowBuildDirEdit->rawPath());
|
2009-12-03 18:37:27 +01:00
|
|
|
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;
|
2010-02-11 11:48:05 +01:00
|
|
|
bool targetMatches = false;
|
2010-10-07 12:08:46 +02:00
|
|
|
bool incompatibleBuild = false;
|
2009-07-24 16:27:29 +02:00
|
|
|
|
2010-02-11 11:48:05 +01:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
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()) {
|
2010-10-05 17:38:45 +02:00
|
|
|
QString makefile = m_buildConfiguration->buildDirectory();
|
|
|
|
|
if (m_buildConfiguration->makefile().isEmpty())
|
|
|
|
|
makefile.append("/Makefile");
|
|
|
|
|
else
|
|
|
|
|
makefile.append(m_buildConfiguration->makefile());
|
|
|
|
|
|
|
|
|
|
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
2009-11-25 18:50:20 +01:00
|
|
|
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()) {
|
2010-10-07 12:08:46 +02:00
|
|
|
// Is it from the same build?
|
|
|
|
|
if (!QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->file()->fileName())) {
|
|
|
|
|
incompatibleBuild = true;
|
|
|
|
|
} else if (qmakePath != (version ? version->qmakeCommand() : QString())) {
|
|
|
|
|
// and that the qmake path is different from the current version
|
2009-07-27 15:02:34 +02:00
|
|
|
// import enable
|
|
|
|
|
visible = true;
|
2010-02-11 11:48:05 +01:00
|
|
|
QtVersion *newVersion = vm->qtVersionForQMakeBinary(qmakePath);
|
|
|
|
|
bool mustDelete(false);
|
|
|
|
|
if (!newVersion) {
|
|
|
|
|
newVersion = new QtVersion(qmakePath);
|
|
|
|
|
mustDelete = true;
|
|
|
|
|
}
|
|
|
|
|
targetMatches = newVersion->supportsTargetId(m_buildConfiguration->target()->id());
|
|
|
|
|
if (mustDelete)
|
|
|
|
|
delete newVersion;
|
2009-07-27 15:02:34 +02:00
|
|
|
} else {
|
|
|
|
|
// check that the qmake flags, arguments match
|
2010-10-05 17:38:45 +02:00
|
|
|
visible = !m_buildConfiguration->compareToImportFrom(makefile);
|
2010-02-24 14:45:04 +01:00
|
|
|
targetMatches = true;
|
2009-07-27 15:02:34 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2009-07-24 16:27:29 +02:00
|
|
|
|
2010-08-19 14:45:21 +02:00
|
|
|
QString buildDirectory = m_buildConfiguration->target()->project()->projectDirectory();;
|
|
|
|
|
if (m_buildConfiguration->shadowBuild())
|
|
|
|
|
buildDirectory = m_buildConfiguration->buildDirectory();
|
|
|
|
|
QList<ProjectExplorer::Task> issues = m_buildConfiguration->qtVersion()->reportIssues(m_buildConfiguration->target()->project()->file()->fileName(),
|
2011-03-11 15:58:33 +01:00
|
|
|
buildDirectory,
|
|
|
|
|
true);
|
2010-08-19 14:45:21 +02:00
|
|
|
|
2010-10-07 12:08:46 +02:00
|
|
|
if (incompatibleBuild) {
|
|
|
|
|
m_ui->problemLabel->setVisible(true);
|
|
|
|
|
m_ui->warningLabel->setVisible(true);
|
|
|
|
|
m_ui->importLabel->setVisible(false);
|
|
|
|
|
m_ui->problemLabel->setText(tr("An build for a different project exists in %1, which will be overwritten.",
|
|
|
|
|
"%1 build directory").
|
|
|
|
|
arg(m_ui->shadowBuildDirEdit->path()));
|
|
|
|
|
} else if (!issues.isEmpty()) {
|
2010-03-23 16:02:59 +01:00
|
|
|
m_ui->problemLabel->setVisible(true);
|
|
|
|
|
m_ui->warningLabel->setVisible(true);
|
|
|
|
|
m_ui->importLabel->setVisible(visible);
|
2010-08-19 14:45:21 +02:00
|
|
|
QString text = "<nobr>";
|
|
|
|
|
foreach (const ProjectExplorer::Task &task, issues) {
|
|
|
|
|
QString type;
|
|
|
|
|
switch (task.type) {
|
|
|
|
|
case ProjectExplorer::Task::Error:
|
2010-09-13 16:51:18 +02:00
|
|
|
type = tr("Error:");
|
|
|
|
|
type += QLatin1Char(' ');
|
2010-08-19 14:45:21 +02:00
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Task::Warning:
|
2010-09-13 16:51:18 +02:00
|
|
|
type = tr("Warning:");
|
|
|
|
|
type += QLatin1Char(' ');
|
2010-08-19 14:45:21 +02:00
|
|
|
break;
|
2010-08-19 16:46:14 +02:00
|
|
|
case ProjectExplorer::Task::Unknown:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2010-08-19 14:45:21 +02:00
|
|
|
}
|
|
|
|
|
if (!text.endsWith(QLatin1String("br>")))
|
|
|
|
|
text.append(QLatin1String("<br>"));
|
|
|
|
|
text.append(type + task.description);
|
|
|
|
|
}
|
|
|
|
|
m_ui->problemLabel->setText(text);
|
2010-03-23 16:02:59 +01:00
|
|
|
} else if (targetMatches) {
|
|
|
|
|
m_ui->problemLabel->setVisible(false);
|
|
|
|
|
m_ui->warningLabel->setVisible(false);
|
2010-02-11 11:48:05 +01:00
|
|
|
m_ui->importLabel->setVisible(visible);
|
|
|
|
|
} else {
|
2010-03-23 16:02:59 +01:00
|
|
|
m_ui->warningLabel->setVisible(visible);
|
|
|
|
|
m_ui->problemLabel->setVisible(visible);
|
|
|
|
|
m_ui->problemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
|
|
|
|
|
"%1 build directory").
|
|
|
|
|
arg(m_ui->shadowBuildDirEdit->path()));
|
2010-02-11 11:48:05 +01:00
|
|
|
m_ui->importLabel->setVisible(false);
|
|
|
|
|
}
|
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-07-24 18:12:19 +02:00
|
|
|
|
2011-01-13 13:38:43 +01:00
|
|
|
// We do the importing via a single shot timer due to QTCREATORBUG-2723
|
|
|
|
|
// Adding a qtversion might trigger a supportedTargetIds changed signal
|
|
|
|
|
// which results in a recreation of all the widgets on the page
|
|
|
|
|
// That means also "this" gets deleted
|
|
|
|
|
QTimer::singleShot(0, m_buildConfiguration, SLOT(importFromBuildDirectory()));
|
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
|
|
|
{
|
2010-04-14 13:37:08 +02:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2010-09-09 17:00:26 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
int newQtVersionId = m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->currentIndex()).toInt();
|
2010-04-14 13:37:08 +02:00
|
|
|
|
2010-09-09 17:00:26 +02:00
|
|
|
if (m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->count() - 1).toInt() == -1)
|
|
|
|
|
m_ui->qtVersionComboBox->removeItem(m_ui->qtVersionComboBox->count() - 1);
|
|
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2010-02-08 15:50:06 +01:00
|
|
|
QtVersion *newQtVersion = vm->version(newQtVersionId);
|
2010-04-14 13:37:08 +02:00
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_buildConfiguration->setQtVersion(newQtVersion);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
updateShadowBuildUi();
|
|
|
|
|
updateToolChainCombo();
|
|
|
|
|
updateImportLabel();
|
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
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
void Qt4ProjectConfigWidget::toolChainChanged()
|
2010-04-14 13:37:08 +02:00
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2011-03-24 11:58:40 +01:00
|
|
|
for (int i = 0; i < m_ui->toolChainComboBox->count(); ++i) {
|
2011-02-01 18:36:00 +01:00
|
|
|
ProjectExplorer::ToolChain *tc =
|
|
|
|
|
static_cast<ProjectExplorer::ToolChain *>(m_ui->toolChainComboBox->itemData(i, Qt::UserRole).value<void *>());
|
|
|
|
|
if (tc == m_buildConfiguration->toolChain()) {
|
2010-04-14 13:37:08 +02:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_ui->toolChainComboBox->setCurrentIndex(i);
|
|
|
|
|
m_ignoreChange = false;
|
2011-03-24 11:58:40 +01:00
|
|
|
return;
|
2010-04-14 13:37:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-24 11:58:40 +01:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_ui->toolChainComboBox->addItem(tr("<No tool chain selected>"), qVariantFromValue(static_cast<void *>(0)));
|
|
|
|
|
m_ui->toolChainComboBox->setCurrentIndex(m_ui->toolChainComboBox->count() - 1);
|
|
|
|
|
m_ignoreChange = false;
|
2010-04-14 13:37:08 +02:00
|
|
|
}
|
|
|
|
|
|
2009-06-09 18:55:04 +02:00
|
|
|
void Qt4ProjectConfigWidget::updateToolChainCombo()
|
|
|
|
|
{
|
|
|
|
|
m_ui->toolChainComboBox->clear();
|
2011-02-01 18:36:00 +01:00
|
|
|
QList<ProjectExplorer::ToolChain *> toolchains =
|
|
|
|
|
m_buildConfiguration->qt4Target()->possibleToolChains(m_buildConfiguration);
|
2010-04-14 13:37:08 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
foreach (ProjectExplorer::ToolChain *toolchain, toolchains)
|
|
|
|
|
m_ui->toolChainComboBox->addItem(toolchain->displayName(),
|
|
|
|
|
qVariantFromValue(static_cast<void *>(toolchain)));
|
|
|
|
|
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
|
2011-03-24 11:58:40 +01:00
|
|
|
toolChainChanged();
|
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
|
|
|
{
|
2010-04-14 13:37:08 +02:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2011-02-01 18:36:00 +01:00
|
|
|
ProjectExplorer::ToolChain *selectedToolChain =
|
|
|
|
|
static_cast<ProjectExplorer::ToolChain *>(
|
|
|
|
|
m_ui->toolChainComboBox->itemData(index,
|
|
|
|
|
Qt::UserRole).value<void *>());
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = true;
|
2011-02-01 18:36:00 +01:00
|
|
|
m_buildConfiguration->setToolChain(selectedToolChain);
|
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
|
|
|
}
|