2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
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
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** 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"
|
2011-05-20 21:40:53 +02:00
|
|
|
#include "qt4basetargetfactory.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>
|
2011-08-18 16:46:44 +02:00
|
|
|
#include <coreplugin/ifile.h>
|
2010-11-01 16:29:45 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2011-08-18 13:46:52 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
|
|
|
|
#include <projectexplorer/task.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>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtversionfactory.h>
|
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
2011-08-18 16:46:44 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.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
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QPushButton>
|
2010-03-17 17:45:33 +01:00
|
|
|
#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()));
|
2011-04-12 10:53:42 +02:00
|
|
|
|
2011-09-15 13:30:54 +02:00
|
|
|
connect(target->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
|
2011-12-07 17:52:59 +01:00
|
|
|
this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
|
2011-09-15 13:30:54 +02:00
|
|
|
|
2011-04-12 10:53:42 +02:00
|
|
|
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
|
|
|
|
|
this, SLOT(updateToolChainCombo()));
|
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()
|
|
|
|
|
{
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
|
2010-01-12 15:46:23 +01:00
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QString versionString;
|
2011-05-04 13:14:46 +02:00
|
|
|
if (version)
|
|
|
|
|
versionString = version->displayName();
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
|
2011-05-04 13:14:46 +02:00
|
|
|
m_ui->shadowBuildCheckBox->setEnabled(version && version->supportsShadowBuilds());
|
2010-08-17 17:46:54 +02:00
|
|
|
bool isShadowbuilding = m_buildConfiguration->shadowBuild();
|
2011-05-04 13:14:46 +02:00
|
|
|
m_ui->shadowBuildDirEdit->setEnabled(isShadowbuilding && version && version->supportsShadowBuilds());
|
|
|
|
|
m_browseButton->setEnabled(isShadowbuilding && version && version->supportsShadowBuilds());
|
2010-08-17 17:46:54 +02:00
|
|
|
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
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
|
2012-01-13 14:20:45 +01:00
|
|
|
QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
2009-01-16 15:26:34 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
void Qt4ProjectConfigWidget::manageToolChains()
|
|
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
|
2012-01-13 14:20:45 +01:00
|
|
|
QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
|
2011-02-01 18:36:00 +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
|
|
|
{
|
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();
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
|
2010-06-22 14:38:50 +02:00
|
|
|
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);
|
2011-05-04 13:14:46 +02:00
|
|
|
m_ui->shadowBuildCheckBox->setEnabled(m_buildConfiguration->qtVersion()
|
|
|
|
|
&& 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
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
int versionId = -1;
|
|
|
|
|
if (m_buildConfiguration->qtVersion())
|
|
|
|
|
versionId = m_buildConfiguration->qtVersion()->uniqueId();
|
2010-06-22 14:16:49 +02:00
|
|
|
int comboBoxIndex = m_ui->qtVersionComboBox->findData(QVariant(versionId), Qt::UserRole);
|
2011-05-04 13:14:46 +02:00
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(comboBoxIndex);
|
2010-06-22 14:16:49 +02:00
|
|
|
|
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;
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
|
2009-08-26 15:42:24 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->qtVersionComboBox->clear();
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *qtVersion = m_buildConfiguration->qtVersion();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
QList<QtSupport::BaseQtVersion *> 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) {
|
2011-05-20 21:40:53 +02:00
|
|
|
const QtSupport::BaseQtVersion *version = validVersions.at(i);
|
2011-05-20 15:46:03 +02:00
|
|
|
m_ui->qtVersionComboBox->addItem(version->displayName(),
|
|
|
|
|
version->uniqueId());
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2011-05-20 15:46:03 +02:00
|
|
|
if (version == qtVersion) {
|
2010-02-08 15:50:06 +01:00
|
|
|
m_ui->qtVersionComboBox->setCurrentIndex(i);
|
2011-05-20 15:46:03 +02:00
|
|
|
m_ui->qtVersionComboBox->setToolTip(version->toHtml(false));
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!qtVersion || !qtVersion->isValid()) {
|
2010-09-09 17:00:26 +02:00
|
|
|
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;
|
2011-04-19 19:24:30 +02:00
|
|
|
bool couldnotparse = false;
|
2009-07-24 16:27:29 +02:00
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::QtVersionManager *vm = QtSupport::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())
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1String("/Makefile"));
|
2010-10-05 17:38:45 +02:00
|
|
|
else
|
|
|
|
|
makefile.append(m_buildConfiguration->makefile());
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *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?
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::QtVersionManager::MakefileCompatible mc =
|
|
|
|
|
QtSupport::QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->file()->fileName());
|
|
|
|
|
if (mc == QtSupport::QtVersionManager::DifferentProject) {
|
2010-10-07 12:08:46 +02:00
|
|
|
incompatibleBuild = true;
|
2011-05-20 21:40:53 +02:00
|
|
|
} else if (mc == QtSupport::QtVersionManager::SameProject) {
|
2011-11-25 13:19:58 +01:00
|
|
|
if (qmakePath != (version ? version->qmakeCommand() : Utils::FileName())) {
|
2011-04-19 19:24:30 +02:00
|
|
|
// and that the qmake path is different from the current version
|
|
|
|
|
// import enable
|
|
|
|
|
visible = true;
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *newVersion = vm->qtVersionForQMakeBinary(qmakePath);
|
2011-04-19 19:24:30 +02:00
|
|
|
bool mustDelete(false);
|
|
|
|
|
if (!newVersion) {
|
2011-05-20 21:40:53 +02:00
|
|
|
newVersion = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakePath);
|
2011-04-19 19:24:30 +02:00
|
|
|
mustDelete = true;
|
|
|
|
|
}
|
2011-07-26 10:15:28 +00:00
|
|
|
targetMatches = newVersion ? newVersion->supportsTargetId(m_buildConfiguration->target()->id()) : false;
|
2011-04-19 19:24:30 +02:00
|
|
|
if (mustDelete)
|
|
|
|
|
delete newVersion;
|
|
|
|
|
} else {
|
|
|
|
|
// check that the qmake flags, arguments match
|
|
|
|
|
visible = !m_buildConfiguration->compareToImportFrom(makefile);
|
|
|
|
|
targetMatches = true;
|
2010-02-11 11:48:05 +01:00
|
|
|
}
|
2011-05-20 21:40:53 +02:00
|
|
|
} else if (mc == QtSupport::QtVersionManager::CouldNotParse) {
|
2011-04-19 19:24:30 +02:00
|
|
|
couldnotparse = 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();
|
2011-05-04 13:14:46 +02:00
|
|
|
QList<ProjectExplorer::Task> issues;
|
2011-05-25 09:25:04 +02:00
|
|
|
if (QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion()) {
|
2011-05-20 21:40:53 +02:00
|
|
|
issues = version->reportIssues(m_buildConfiguration->target()->project()->file()->fileName(),
|
2011-05-25 09:25:04 +02:00
|
|
|
buildDirectory);
|
|
|
|
|
foreach (Qt4BaseTargetFactory *factory,
|
|
|
|
|
Qt4BaseTargetFactory::qt4BaseTargetFactoriesForIds(version->supportedTargetIds().toList()))
|
|
|
|
|
issues.append(factory->reportIssues(m_buildConfiguration->target()->project()->file()->fileName()));
|
2011-05-20 21:40:53 +02:00
|
|
|
|
2011-05-25 09:25:04 +02:00
|
|
|
qSort(issues);
|
|
|
|
|
}
|
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);
|
2011-10-05 20:13:49 +02:00
|
|
|
m_ui->problemLabel->setText(tr("A build for a different project exists in %1, which will be overwritten.",
|
2010-10-07 12:08:46 +02:00
|
|
|
"%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);
|
2012-01-13 14:20:45 +01:00
|
|
|
QString text = QLatin1String("<nobr>");
|
2010-08-19 14:45:21 +02:00
|
|
|
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);
|
2011-04-19 19:24:30 +02:00
|
|
|
} else if (couldnotparse) {
|
|
|
|
|
m_ui->problemLabel->setVisible(false);
|
|
|
|
|
m_ui->warningLabel->setVisible(false);
|
|
|
|
|
m_ui->importLabel->setVisible(false);
|
|
|
|
|
} else { // target did not match
|
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);
|
|
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
|
|
|
|
|
QtSupport::BaseQtVersion *newQtVersion = vm->version(newQtVersionId);
|
2010-04-14 13:37:08 +02:00
|
|
|
|
2011-05-20 12:52:59 +02:00
|
|
|
if (newQtVersion) {
|
|
|
|
|
const QString qtVersionName = newQtVersion->displayName();
|
|
|
|
|
QString defaultConfigName = (m_buildConfiguration->buildType() & BuildConfiguration::Debug) ?
|
|
|
|
|
//: Name of a debug build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
|
|
|
|
|
tr("%1 Debug").arg(qtVersionName) :
|
|
|
|
|
//: Name of a release build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
|
|
|
|
|
tr("%1 Release").arg(qtVersionName);
|
|
|
|
|
|
|
|
|
|
// make name unique
|
|
|
|
|
QStringList displayNames;
|
|
|
|
|
foreach (const BuildConfiguration *bc, m_buildConfiguration->target()->buildConfigurations()) {
|
|
|
|
|
if (bc != m_buildConfiguration)
|
|
|
|
|
displayNames << bc->displayName();
|
|
|
|
|
}
|
|
|
|
|
defaultConfigName = Project::makeUnique(defaultConfigName, displayNames);
|
|
|
|
|
|
|
|
|
|
m_buildConfiguration->setDefaultDisplayName(defaultConfigName);
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-14 13:37:08 +02:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_buildConfiguration->setQtVersion(newQtVersion);
|
|
|
|
|
m_ignoreChange = false;
|
2011-05-20 12:52:59 +02:00
|
|
|
|
2011-05-20 15:46:03 +02:00
|
|
|
m_ui->qtVersionComboBox->setToolTip(newQtVersion ? newQtVersion->toHtml(false) : QString());
|
2010-04-14 13:37:08 +02:00
|
|
|
|
|
|
|
|
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-04-14 14:48:14 +02:00
|
|
|
bool foundTc = false;
|
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-04-14 14:48:14 +02:00
|
|
|
foundTc = true;
|
|
|
|
|
break;
|
2010-04-14 13:37:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-04-14 14:48:14 +02:00
|
|
|
if (foundTc) {
|
|
|
|
|
int index = m_ui->toolChainComboBox->findData(qVariantFromValue(static_cast<void *>(0)));
|
|
|
|
|
if (index >= 0)
|
|
|
|
|
m_ui->toolChainComboBox->removeItem(index);
|
|
|
|
|
} else {
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2011-12-13 12:08:37 +01:00
|
|
|
void Qt4ProjectConfigWidget::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode * /*node*/, bool success, bool parseInProgress)
|
2011-12-07 17:52:59 +01:00
|
|
|
{
|
|
|
|
|
if (!success || parseInProgress)
|
|
|
|
|
return;
|
|
|
|
|
updateToolChainCombo();
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|