2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-05-26 15:22:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-05-26 15:22:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-05-26 15:22:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-05-26 15:22:11 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02: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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-05-26 15:22:11 +02:00
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
#include "buildenvironmentwidget.h"
|
|
|
|
|
|
|
|
|
|
#include "buildconfiguration.h"
|
2011-01-13 11:41:45 +01:00
|
|
|
#include "environmentwidget.h"
|
2010-03-11 17:47:09 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2010-03-11 17:47:09 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QCheckBox>
|
2009-05-26 15:22:11 +02:00
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
using namespace ProjectExplorer;
|
2009-05-26 15:22:11 +02:00
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
BuildEnvironmentWidget::BuildEnvironmentWidget()
|
|
|
|
|
: m_buildConfiguration(0)
|
2009-05-26 15:22:11 +02:00
|
|
|
{
|
|
|
|
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
2009-07-23 15:57:45 +02:00
|
|
|
vbox->setMargin(0);
|
2009-05-26 17:21:02 +02:00
|
|
|
m_clearSystemEnvironmentCheckBox = new QCheckBox(this);
|
2009-08-07 11:07:41 +02:00
|
|
|
m_clearSystemEnvironmentCheckBox->setText(tr("Clear system environment"));
|
2009-07-20 16:54:59 +02:00
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
m_buildEnvironmentWidget = new EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
2009-05-26 15:22:11 +02:00
|
|
|
vbox->addWidget(m_buildEnvironmentWidget);
|
|
|
|
|
|
2009-12-03 19:45:09 +01:00
|
|
|
connect(m_buildEnvironmentWidget, SIGNAL(userChangesChanged()),
|
|
|
|
|
this, SLOT(environmentModelUserChangesChanged()));
|
2009-05-26 17:21:02 +02:00
|
|
|
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
2009-05-26 15:22:11 +02:00
|
|
|
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
QString BuildEnvironmentWidget::displayName() const
|
2009-05-26 15:22:11 +02:00
|
|
|
{
|
|
|
|
|
return tr("Build Environment");
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
void BuildEnvironmentWidget::init(BuildConfiguration *bc)
|
2009-05-26 15:22:11 +02:00
|
|
|
{
|
2010-07-16 16:01:57 +02:00
|
|
|
Q_ASSERT(bc);
|
2009-05-26 15:22:11 +02:00
|
|
|
|
2009-12-08 14:41:56 +01:00
|
|
|
if (m_buildConfiguration) {
|
2012-04-24 15:49:09 +02:00
|
|
|
disconnect(m_buildConfiguration->target(), SIGNAL(environmentChanged()),
|
2011-04-19 11:43:28 +02:00
|
|
|
this, SLOT(environmentChanged()));
|
2009-12-08 14:41:56 +01:00
|
|
|
}
|
2010-03-11 17:47:09 +01:00
|
|
|
|
2010-07-16 16:01:57 +02:00
|
|
|
m_buildConfiguration = bc;
|
2009-12-08 15:44:17 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
connect(m_buildConfiguration->target(), SIGNAL(environmentChanged()),
|
2011-04-19 11:43:28 +02:00
|
|
|
this, SLOT(environmentChanged()));
|
2009-12-08 14:41:56 +01:00
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
|
|
|
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
2009-05-26 15:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
void BuildEnvironmentWidget::environmentModelUserChangesChanged()
|
2009-05-26 15:22:11 +02:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
2009-05-26 15:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
void BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
2009-05-26 15:22:11 +02:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
|
|
|
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
2009-05-26 15:22:11 +02:00
|
|
|
}
|
2009-12-08 14:41:56 +01:00
|
|
|
|
2010-03-11 17:47:09 +01:00
|
|
|
void BuildEnvironmentWidget::environmentChanged()
|
2009-12-08 14:41:56 +01:00
|
|
|
{
|
|
|
|
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_buildEnvironmentWidget->setBaseEnvironmentText(m_buildConfiguration->baseEnvironmentText());
|
2009-12-08 14:41:56 +01:00
|
|
|
}
|