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
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qt4runconfiguration.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-09 15:25:01 +01:00
|
|
|
#include "makestep.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "profilereader.h"
|
|
|
|
#include "qt4nodes.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
#include "qt4project.h"
|
2009-11-25 18:50:20 +01:00
|
|
|
#include "qt4buildconfiguration.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/messagemanager.h>
|
|
|
|
#include <coreplugin/variablemanager.h>
|
2009-04-06 15:23:27 +02:00
|
|
|
#include <coreplugin/ifile.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/buildstep.h>
|
2009-05-27 13:37:21 +02:00
|
|
|
#include <projectexplorer/environmenteditmodel.h>
|
2009-09-29 11:39:55 +02:00
|
|
|
#include <projectexplorer/persistentsettings.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
#include <QtGui/QFormLayout>
|
|
|
|
#include <QtGui/QInputDialog>
|
2009-01-27 18:23:02 +01:00
|
|
|
#include <QtGui/QLabel>
|
2009-02-18 17:04:04 +01:00
|
|
|
#include <QtGui/QCheckBox>
|
2009-05-13 17:08:48 +02:00
|
|
|
#include <QtGui/QToolButton>
|
2009-07-20 15:46:11 +02:00
|
|
|
#include <QtGui/QComboBox>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
using namespace Qt4ProjectManager::Internal;
|
|
|
|
using namespace Qt4ProjectManager;
|
2009-09-25 11:35:44 +02:00
|
|
|
using ProjectExplorer::LocalApplicationRunConfiguration;
|
2008-12-02 12:01:29 +01:00
|
|
|
using ProjectExplorer::PersistentSettingsReader;
|
|
|
|
using ProjectExplorer::PersistentSettingsWriter;
|
|
|
|
|
2009-03-20 16:13:46 +01:00
|
|
|
Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath)
|
2009-09-25 11:35:44 +02:00
|
|
|
: LocalApplicationRunConfiguration(pro),
|
2009-01-27 18:23:02 +01:00
|
|
|
m_proFilePath(proFilePath),
|
2009-03-18 17:43:55 +01:00
|
|
|
m_runMode(Gui),
|
2009-01-27 18:23:02 +01:00
|
|
|
m_userSetName(false),
|
2009-03-26 12:01:08 +01:00
|
|
|
m_cachedTargetInformationValid(false),
|
2009-05-13 17:08:48 +02:00
|
|
|
m_isUsingDyldImageSuffix(false),
|
2009-05-28 16:34:31 +02:00
|
|
|
m_userSetWokingDirectory(false),
|
|
|
|
m_baseEnvironmentBase(Qt4RunConfiguration::BuildEnvironmentBase)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-03-20 16:13:46 +01:00
|
|
|
if (!m_proFilePath.isEmpty())
|
2010-01-07 18:17:24 +01:00
|
|
|
setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
|
2009-03-20 16:13:46 +01:00
|
|
|
else
|
2010-01-07 18:17:24 +01:00
|
|
|
setDisplayName(tr("Qt4RunConfiguration"));
|
2009-03-19 15:04:43 +01:00
|
|
|
|
2009-06-22 15:51:21 +02:00
|
|
|
connect(pro, SIGNAL(targetInformationChanged()),
|
|
|
|
this, SLOT(invalidateCachedTargetInformation()));
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
connect(pro, SIGNAL(environmentChanged()),
|
2009-05-27 14:41:07 +02:00
|
|
|
this, SIGNAL(baseEnvironmentChanged()));
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
|
|
|
|
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*)));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Qt4RunConfiguration::~Qt4RunConfiguration()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-26 14:43:27 +01:00
|
|
|
Qt4Project *Qt4RunConfiguration::qt4Project() const
|
|
|
|
{
|
|
|
|
return static_cast<Qt4Project *>(project());
|
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString Qt4RunConfiguration::id() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
return "Qt4ProjectManager.Qt4RunConfiguration";
|
|
|
|
}
|
|
|
|
|
2009-10-28 17:21:27 +01:00
|
|
|
bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
|
2009-06-12 12:58:02 +02:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(configuration);
|
|
|
|
QTC_ASSERT(qt4bc, return false);
|
|
|
|
ProjectExplorer::ToolChain::ToolChainType type = qt4bc->toolChainType();
|
2009-10-16 16:46:41 +02:00
|
|
|
if (type == ProjectExplorer::ToolChain::WINSCW
|
|
|
|
|| type == ProjectExplorer::ToolChain::GCCE
|
|
|
|
|| type == ProjectExplorer::ToolChain::RVCT_ARMV5
|
|
|
|
|| type == ProjectExplorer::ToolChain::RVCT_ARMV6)
|
|
|
|
return false;
|
2009-10-16 17:33:12 +02:00
|
|
|
#ifdef QTCREATOR_WITH_MAEMO
|
|
|
|
if (type == ProjectExplorer::ToolChain::GCC_MAEMO)
|
|
|
|
return false;
|
2009-06-12 12:58:02 +02:00
|
|
|
#endif
|
2009-10-16 16:46:41 +02:00
|
|
|
return true;
|
2009-06-12 12:58:02 +02:00
|
|
|
}
|
2009-01-27 18:23:02 +01:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro)
|
|
|
|
{
|
|
|
|
if (m_proFilePath == pro->path())
|
|
|
|
invalidateCachedTargetInformation();
|
|
|
|
}
|
|
|
|
|
2009-01-27 18:23:02 +01:00
|
|
|
//////
|
|
|
|
/// Qt4RunConfigurationWidget
|
|
|
|
/////
|
|
|
|
|
|
|
|
Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4RunConfiguration, QWidget *parent)
|
2009-03-26 12:01:08 +01:00
|
|
|
: QWidget(parent),
|
|
|
|
m_qt4RunConfiguration(qt4RunConfiguration),
|
|
|
|
m_ignoreChange(false),
|
2009-03-26 15:33:32 +01:00
|
|
|
m_usingDyldImageSuffix(0),
|
|
|
|
m_isShown(false)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-10-01 14:24:44 +02:00
|
|
|
QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
|
|
|
|
vboxTopLayout->setMargin(0);
|
|
|
|
|
|
|
|
m_detailsContainer = new Utils::DetailsWidget(this);
|
|
|
|
vboxTopLayout->addWidget(m_detailsContainer);
|
|
|
|
QWidget *detailsWidget = new QWidget(m_detailsContainer);
|
|
|
|
m_detailsContainer->setWidget(detailsWidget);
|
|
|
|
QFormLayout *toplayout = new QFormLayout(detailsWidget);
|
2009-07-22 17:02:12 +02:00
|
|
|
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
2008-12-02 12:01:29 +01:00
|
|
|
toplayout->setMargin(0);
|
|
|
|
|
|
|
|
QLabel *nameLabel = new QLabel(tr("Name:"));
|
2010-01-07 18:17:24 +01:00
|
|
|
m_nameLineEdit = new QLineEdit(m_qt4RunConfiguration->displayName());
|
2009-01-27 18:23:02 +01:00
|
|
|
nameLabel->setBuddy(m_nameLineEdit);
|
|
|
|
toplayout->addRow(nameLabel, m_nameLineEdit);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-27 18:23:02 +01:00
|
|
|
m_executableLabel = new QLabel(m_qt4RunConfiguration->executable());
|
|
|
|
toplayout->addRow(tr("Executable:"), m_executableLabel);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-05 11:06:05 +02:00
|
|
|
m_workingDirectoryEdit = new Utils::PathChooser();
|
2009-05-13 17:08:48 +02:00
|
|
|
m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->workingDirectory());
|
2009-10-05 11:06:05 +02:00
|
|
|
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
2009-05-13 17:08:48 +02:00
|
|
|
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select the working directory"));
|
|
|
|
|
|
|
|
QToolButton *resetButton = new QToolButton();
|
|
|
|
resetButton->setToolTip(tr("Reset to default"));
|
|
|
|
resetButton->setIcon(QIcon(":/core/images/reset.png"));
|
|
|
|
|
|
|
|
QHBoxLayout *boxlayout = new QHBoxLayout();
|
2009-09-23 17:16:09 +02:00
|
|
|
boxlayout->setMargin(0);
|
2009-05-13 17:08:48 +02:00
|
|
|
boxlayout->addWidget(m_workingDirectoryEdit);
|
|
|
|
boxlayout->addWidget(resetButton);
|
|
|
|
toplayout->addRow(tr("Working Directory:"), boxlayout);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
QLabel *argumentsLabel = new QLabel(tr("Arguments:"));
|
2009-01-27 18:23:02 +01:00
|
|
|
m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()));
|
|
|
|
argumentsLabel->setBuddy(m_argumentsLineEdit);
|
|
|
|
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
m_useTerminalCheck = new QCheckBox(tr("Run in Terminal"));
|
2009-09-25 11:35:44 +02:00
|
|
|
m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console);
|
2009-02-18 17:04:04 +01:00
|
|
|
toplayout->addRow(QString(), m_useTerminalCheck);
|
|
|
|
|
2009-03-26 12:01:08 +01:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"));
|
|
|
|
m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix());
|
|
|
|
toplayout->addRow(QString(), m_usingDyldImageSuffix);
|
|
|
|
connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(usingDyldImageSuffixToggled(bool)));
|
|
|
|
#endif
|
|
|
|
|
2009-07-20 16:50:05 +02:00
|
|
|
QLabel *environmentLabel = new QLabel(this);
|
|
|
|
environmentLabel->setText(tr("Run Environment"));
|
|
|
|
QFont f = environmentLabel->font();
|
|
|
|
f.setBold(true);
|
|
|
|
f.setPointSizeF(f.pointSizeF() *1.2);
|
|
|
|
environmentLabel->setFont(f);
|
2009-09-17 13:59:10 +02:00
|
|
|
vboxTopLayout->addWidget(environmentLabel);
|
2009-05-28 16:34:31 +02:00
|
|
|
|
2009-07-23 15:57:45 +02:00
|
|
|
QWidget *baseEnvironmentWidget = new QWidget;
|
|
|
|
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
|
|
|
|
baseEnvironmentLayout->setMargin(0);
|
2009-05-28 16:34:31 +02:00
|
|
|
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
|
2009-07-23 15:57:45 +02:00
|
|
|
baseEnvironmentLayout->addWidget(label);
|
2009-07-20 16:50:05 +02:00
|
|
|
m_baseEnvironmentComboBox = new QComboBox(this);
|
2009-07-20 15:46:11 +02:00
|
|
|
m_baseEnvironmentComboBox->addItems(QStringList()
|
|
|
|
<< tr("Clean Environment")
|
|
|
|
<< tr("System Environment")
|
|
|
|
<< tr("Build Environment"));
|
|
|
|
m_baseEnvironmentComboBox->setCurrentIndex(qt4RunConfiguration->baseEnvironmentBase());
|
|
|
|
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(baseEnvironmentSelected(int)));
|
2009-07-23 15:57:45 +02:00
|
|
|
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
|
|
|
|
baseEnvironmentLayout->addStretch(10);
|
2009-05-27 14:02:47 +02:00
|
|
|
|
2009-07-23 15:57:45 +02:00
|
|
|
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
|
2009-05-27 13:37:21 +02:00
|
|
|
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_environmentWidget->setBaseEnvironmentText(m_qt4RunConfiguration->baseEnvironmentText());
|
2009-05-27 13:37:21 +02:00
|
|
|
m_environmentWidget->setUserChanges(m_qt4RunConfiguration->userEnvironmentChanges());
|
2009-05-27 14:02:47 +02:00
|
|
|
m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2009-09-17 13:59:10 +02:00
|
|
|
vboxTopLayout->addWidget(m_environmentWidget);
|
2009-05-28 16:34:31 +02:00
|
|
|
|
2009-06-19 17:55:47 +02:00
|
|
|
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(workDirectoryEdited()));
|
2009-05-13 17:08:48 +02:00
|
|
|
|
|
|
|
connect(resetButton, SIGNAL(clicked()),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(workingDirectoryReseted()));
|
2009-05-13 17:08:48 +02:00
|
|
|
|
2009-03-18 17:43:55 +01:00
|
|
|
connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(argumentsEdited(QString)));
|
2009-03-18 17:43:55 +01:00
|
|
|
connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
|
2010-01-07 18:17:24 +01:00
|
|
|
this, SLOT(displayNameEdited(QString)));
|
2009-02-18 17:04:04 +01:00
|
|
|
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(termToggled(bool)));
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
|
|
|
this, SLOT(userChangesEdited()));
|
2009-05-27 13:37:21 +02:00
|
|
|
|
2009-05-13 17:08:48 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(workingDirectoryChanged(QString)),
|
|
|
|
this, SLOT(workingDirectoryChanged(QString)));
|
|
|
|
|
2009-01-27 18:23:02 +01:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)),
|
|
|
|
this, SLOT(commandLineArgumentsChanged(QString)));
|
2010-01-07 18:17:24 +01:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(displayNameChanged(QString)),
|
|
|
|
this, SLOT(displayNameChanged(QString)));
|
2009-09-25 11:35:44 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)),
|
|
|
|
this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)));
|
2009-03-26 12:01:08 +01:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)),
|
|
|
|
this, SLOT(usingDyldImageSuffixChanged(bool)));
|
2009-03-19 15:04:43 +01:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
|
|
|
|
this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection);
|
2009-05-27 13:37:21 +02:00
|
|
|
|
|
|
|
connect(qt4RunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)),
|
|
|
|
this, SLOT(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)));
|
|
|
|
|
2009-05-27 14:41:07 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(baseEnvironmentChanged()),
|
|
|
|
this, SLOT(baseEnvironmentChanged()));
|
|
|
|
}
|
|
|
|
|
2009-09-17 13:59:10 +02:00
|
|
|
void Qt4RunConfigurationWidget::updateSummary()
|
|
|
|
{
|
|
|
|
const QString &filename = QFileInfo(m_qt4RunConfiguration->executable()).fileName();
|
|
|
|
const QString &arguments = ProjectExplorer::Environment::joinArgumentList(m_qt4RunConfiguration->commandLineArguments());
|
2009-10-12 12:33:12 +02:00
|
|
|
const bool terminal = m_qt4RunConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
|
|
|
|
const QString text = terminal ?
|
|
|
|
tr("Running executable: <b>%1</b> %2 (in terminal)").arg(filename, arguments) :
|
|
|
|
tr("Running executable: <b>%1</b> %2").arg(filename, arguments);
|
2009-10-01 14:24:44 +02:00
|
|
|
m_detailsContainer->setSummaryText(text);
|
2009-09-17 13:59:10 +02:00
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfigurationWidget::baseEnvironmentSelected(int index)
|
2009-05-28 16:34:31 +02:00
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
2009-07-20 15:46:11 +02:00
|
|
|
m_qt4RunConfiguration->setBaseEnvironmentBase(Qt4RunConfiguration::BaseEnvironmentBase(index));
|
2009-05-28 16:34:31 +02:00
|
|
|
|
|
|
|
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_environmentWidget->setBaseEnvironmentText(m_qt4RunConfiguration->baseEnvironmentText());
|
2009-05-28 16:34:31 +02:00
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2009-05-27 14:41:07 +02:00
|
|
|
void Qt4RunConfigurationWidget::baseEnvironmentChanged()
|
|
|
|
{
|
2009-05-28 16:34:31 +02:00
|
|
|
if (m_ignoreChange)
|
|
|
|
return;
|
|
|
|
|
2009-07-20 15:46:11 +02:00
|
|
|
m_baseEnvironmentComboBox->setCurrentIndex(m_qt4RunConfiguration->baseEnvironmentBase());
|
2009-05-27 14:41:07 +02:00
|
|
|
m_environmentWidget->setBaseEnvironment(m_qt4RunConfiguration->baseEnvironment());
|
2009-12-14 13:40:17 +01:00
|
|
|
m_environmentWidget->setBaseEnvironmentText(m_qt4RunConfiguration->baseEnvironmentText());
|
2009-05-27 13:37:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfigurationWidget::userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges)
|
|
|
|
{
|
|
|
|
if (m_ignoreChange)
|
|
|
|
return;
|
|
|
|
m_environmentWidget->setUserChanges(userChanges);
|
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfigurationWidget::userChangesEdited()
|
2009-05-27 13:37:21 +02:00
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_qt4RunConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
|
|
|
m_ignoreChange = false;
|
2009-01-27 18:23:02 +01:00
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfigurationWidget::workDirectoryEdited()
|
2009-05-13 17:08:48 +02:00
|
|
|
{
|
|
|
|
if (m_ignoreChange)
|
|
|
|
return;
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_qt4RunConfiguration->setWorkingDirectory(m_workingDirectoryEdit->path());
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfigurationWidget::workingDirectoryReseted()
|
2009-05-13 17:08:48 +02:00
|
|
|
{
|
|
|
|
// This emits a signal connected to workingDirectoryChanged()
|
|
|
|
// that sets the m_workingDirectoryEdit
|
|
|
|
m_qt4RunConfiguration->setWorkingDirectory("");
|
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfigurationWidget::argumentsEdited(const QString &args)
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
2009-12-03 18:37:27 +01:00
|
|
|
m_qt4RunConfiguration->setArguments(args);
|
2009-01-27 18:23:02 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
void Qt4RunConfigurationWidget::displayNameEdited(const QString &name)
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
2009-12-03 18:37:27 +01:00
|
|
|
m_qt4RunConfiguration->setUserName(name);
|
2009-01-27 18:23:02 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2009-02-18 17:04:04 +01:00
|
|
|
void Qt4RunConfigurationWidget::termToggled(bool on)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
2009-09-25 11:35:44 +02:00
|
|
|
m_qt4RunConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
|
|
|
|
: LocalApplicationRunConfiguration::Gui);
|
2009-02-18 17:04:04 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2009-03-26 12:01:08 +01:00
|
|
|
void Qt4RunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
|
|
|
|
{
|
|
|
|
m_ignoreChange = true;
|
|
|
|
m_qt4RunConfiguration->setUsingDyldImageSuffix(state);
|
|
|
|
m_ignoreChange = false;
|
|
|
|
}
|
|
|
|
|
2009-05-13 17:08:48 +02:00
|
|
|
void Qt4RunConfigurationWidget::workingDirectoryChanged(const QString &workingDirectory)
|
|
|
|
{
|
|
|
|
if (!m_ignoreChange)
|
|
|
|
m_workingDirectoryEdit->setPath(workingDirectory);
|
|
|
|
}
|
|
|
|
|
2009-01-27 18:23:02 +01:00
|
|
|
void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
|
|
|
|
{
|
2009-09-17 13:59:10 +02:00
|
|
|
updateSummary();
|
|
|
|
if (m_ignoreChange)
|
|
|
|
return;
|
|
|
|
m_argumentsLineEdit->setText(args);
|
2009-01-27 18:23:02 +01:00
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
void Qt4RunConfigurationWidget::displayNameChanged(const QString &name)
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
|
|
|
if (!m_ignoreChange)
|
|
|
|
m_nameLineEdit->setText(name);
|
|
|
|
}
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
|
2009-02-18 17:04:04 +01:00
|
|
|
{
|
2009-09-17 13:59:10 +02:00
|
|
|
updateSummary();
|
2009-02-18 17:04:04 +01:00
|
|
|
if (!m_ignoreChange)
|
2009-09-25 11:35:44 +02:00
|
|
|
m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console);
|
2009-02-18 17:04:04 +01:00
|
|
|
}
|
|
|
|
|
2009-03-26 12:01:08 +01:00
|
|
|
void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
|
|
|
|
{
|
|
|
|
if (!m_ignoreChange && m_usingDyldImageSuffix)
|
|
|
|
m_usingDyldImageSuffix->setChecked(state);
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
void Qt4RunConfigurationWidget::effectiveTargetInformationChanged()
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
2009-09-17 13:59:10 +02:00
|
|
|
updateSummary();
|
2009-03-19 15:04:43 +01:00
|
|
|
if (m_isShown) {
|
2009-04-15 18:44:41 +02:00
|
|
|
m_executableLabel->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable()));
|
2009-05-13 17:08:48 +02:00
|
|
|
m_ignoreChange = true;
|
|
|
|
m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->workingDirectory()));
|
|
|
|
m_ignoreChange = false;
|
2009-03-19 15:04:43 +01:00
|
|
|
}
|
2009-01-27 18:23:02 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
void Qt4RunConfigurationWidget::showEvent(QShowEvent *event)
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
2009-03-19 15:04:43 +01:00
|
|
|
m_isShown = true;
|
|
|
|
effectiveTargetInformationChanged();
|
|
|
|
QWidget::showEvent(event);
|
2009-01-27 18:23:02 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
void Qt4RunConfigurationWidget::hideEvent(QHideEvent *event)
|
|
|
|
{
|
|
|
|
m_isShown = false;
|
|
|
|
QWidget::hideEvent(event);
|
|
|
|
}
|
2009-01-27 18:23:02 +01:00
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
////// TODO c&p above
|
2009-01-27 18:23:02 +01:00
|
|
|
QWidget *Qt4RunConfiguration::configurationWidget()
|
|
|
|
{
|
|
|
|
return new Qt4RunConfigurationWidget(this, 0);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const
|
|
|
|
{
|
2009-04-08 16:10:32 +02:00
|
|
|
const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
2008-12-02 12:01:29 +01:00
|
|
|
writer.saveValue("CommandLineArguments", m_commandLineArguments);
|
2009-04-06 15:23:27 +02:00
|
|
|
writer.saveValue("ProFile", projectDir.relativeFilePath(m_proFilePath));
|
2008-12-02 12:01:29 +01:00
|
|
|
writer.saveValue("UserSetName", m_userSetName);
|
2009-02-18 17:04:04 +01:00
|
|
|
writer.saveValue("UseTerminal", m_runMode == Console);
|
2009-03-26 12:01:08 +01:00
|
|
|
writer.saveValue("UseDyldImageSuffix", m_isUsingDyldImageSuffix);
|
2009-05-27 13:37:21 +02:00
|
|
|
writer.saveValue("UserEnvironmentChanges", ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
2009-05-28 16:34:31 +02:00
|
|
|
writer.saveValue("BaseEnvironmentBase", m_baseEnvironmentBase);
|
2009-07-21 13:27:33 +02:00
|
|
|
writer.saveValue("UserSetWorkingDirectory", m_userSetWokingDirectory);
|
|
|
|
writer.saveValue("UserWorkingDirectory", m_userWorkingDirectory);
|
2009-09-25 11:35:44 +02:00
|
|
|
LocalApplicationRunConfiguration::save(writer);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader)
|
2010-01-29 21:33:57 +01:00
|
|
|
{
|
2009-09-25 11:35:44 +02:00
|
|
|
LocalApplicationRunConfiguration::restore(reader);
|
2009-04-08 16:10:32 +02:00
|
|
|
const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
2008-12-02 12:01:29 +01:00
|
|
|
m_commandLineArguments = reader.restoreValue("CommandLineArguments").toStringList();
|
2009-04-06 15:23:27 +02:00
|
|
|
m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString());
|
2008-12-02 12:01:29 +01:00
|
|
|
m_userSetName = reader.restoreValue("UserSetName").toBool();
|
2009-02-18 17:04:04 +01:00
|
|
|
m_runMode = reader.restoreValue("UseTerminal").toBool() ? Console : Gui;
|
2009-03-26 12:01:08 +01:00
|
|
|
m_isUsingDyldImageSuffix = reader.restoreValue("UseDyldImageSuffix").toBool();
|
2009-07-21 13:27:33 +02:00
|
|
|
QVariant v = reader.restoreValue("UserSetWorkingDirectory");
|
|
|
|
m_userSetWokingDirectory = v.isValid() ? v.toBool() : false;
|
|
|
|
m_userWorkingDirectory = reader.restoreValue("UserWorkingDirectory").toString();
|
2008-12-02 12:01:29 +01:00
|
|
|
if (!m_proFilePath.isEmpty()) {
|
2009-03-19 15:04:43 +01:00
|
|
|
m_cachedTargetInformationValid = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
if (!m_userSetName)
|
2010-01-07 18:17:24 +01:00
|
|
|
setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-05-27 13:37:21 +02:00
|
|
|
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(reader.restoreValue("UserEnvironmentChanges").toStringList());
|
2009-05-28 16:34:31 +02:00
|
|
|
QVariant tmp = reader.restoreValue("BaseEnvironmentBase");
|
|
|
|
m_baseEnvironmentBase = tmp.isValid() ? BaseEnvironmentBase(tmp.toInt()) : Qt4RunConfiguration::BuildEnvironmentBase;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Qt4RunConfiguration::executable() const
|
|
|
|
{
|
2009-03-19 15:04:43 +01:00
|
|
|
const_cast<Qt4RunConfiguration *>(this)->updateTarget();
|
|
|
|
return m_executable;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
LocalApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
return m_runMode;
|
|
|
|
}
|
|
|
|
|
2009-03-26 12:01:08 +01:00
|
|
|
bool Qt4RunConfiguration::isUsingDyldImageSuffix() const
|
|
|
|
{
|
|
|
|
return m_isUsingDyldImageSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfiguration::setUsingDyldImageSuffix(bool state)
|
|
|
|
{
|
|
|
|
m_isUsingDyldImageSuffix = state;
|
|
|
|
emit usingDyldImageSuffixChanged(state);
|
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QString Qt4RunConfiguration::workingDirectory() const
|
|
|
|
{
|
2009-05-13 17:08:48 +02:00
|
|
|
// if the user overrode us, then return his working directory
|
|
|
|
if (m_userSetWokingDirectory)
|
|
|
|
return m_userWorkingDirectory;
|
|
|
|
|
|
|
|
// else what the pro file reader tells us
|
2009-03-19 15:04:43 +01:00
|
|
|
const_cast<Qt4RunConfiguration *>(this)->updateTarget();
|
|
|
|
return m_workingDir;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList Qt4RunConfiguration::commandLineArguments() const
|
|
|
|
{
|
|
|
|
return m_commandLineArguments;
|
|
|
|
}
|
|
|
|
|
2009-12-14 13:40:17 +01:00
|
|
|
QString Qt4RunConfiguration::baseEnvironmentText() const
|
|
|
|
{
|
|
|
|
if (m_baseEnvironmentBase == Qt4RunConfiguration::CleanEnvironmentBase)
|
|
|
|
return tr("Clean Environment");
|
|
|
|
else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase)
|
|
|
|
return tr("System Environment");
|
|
|
|
else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase)
|
|
|
|
return tr("Build Environment");
|
|
|
|
return QString::null;
|
|
|
|
}
|
|
|
|
|
2009-05-27 13:37:21 +02:00
|
|
|
ProjectExplorer::Environment Qt4RunConfiguration::baseEnvironment() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-05-28 16:34:31 +02:00
|
|
|
ProjectExplorer::Environment env;
|
|
|
|
if (m_baseEnvironmentBase == Qt4RunConfiguration::CleanEnvironmentBase) {
|
|
|
|
// Nothing
|
|
|
|
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
|
|
|
|
env = ProjectExplorer::Environment::systemEnvironment();
|
|
|
|
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
|
2009-11-25 18:50:20 +01:00
|
|
|
env = project()->activeBuildConfiguration()->environment();
|
2009-05-28 16:34:31 +02:00
|
|
|
}
|
2009-03-26 12:01:08 +01:00
|
|
|
if (m_isUsingDyldImageSuffix) {
|
|
|
|
env.set("DYLD_IMAGE_SUFFIX", "_debug");
|
|
|
|
}
|
|
|
|
return env;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-05-27 13:37:21 +02:00
|
|
|
ProjectExplorer::Environment Qt4RunConfiguration::environment() const
|
|
|
|
{
|
|
|
|
ProjectExplorer::Environment env = baseEnvironment();
|
|
|
|
env.modify(userEnvironmentChanges());
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<ProjectExplorer::EnvironmentItem> Qt4RunConfiguration::userEnvironmentChanges() const
|
|
|
|
{
|
|
|
|
return m_userEnvironmentChanges;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
|
|
|
{
|
|
|
|
if (m_userEnvironmentChanges != diff) {
|
|
|
|
m_userEnvironmentChanges = diff;
|
|
|
|
emit userEnvironmentChangesChanged(diff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-13 17:08:48 +02:00
|
|
|
void Qt4RunConfiguration::setWorkingDirectory(const QString &wd)
|
|
|
|
{
|
|
|
|
if (wd== "") {
|
|
|
|
m_userSetWokingDirectory = false;
|
|
|
|
m_userWorkingDirectory = QString::null;
|
|
|
|
emit workingDirectoryChanged(workingDirectory());
|
|
|
|
} else {
|
|
|
|
m_userSetWokingDirectory = true;
|
|
|
|
m_userWorkingDirectory = wd;
|
|
|
|
emit workingDirectoryChanged(m_userWorkingDirectory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfiguration::setArguments(const QString &argumentsString)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString);
|
2009-01-27 18:23:02 +01:00
|
|
|
emit commandLineArgumentsChanged(argumentsString);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-02-18 17:04:04 +01:00
|
|
|
void Qt4RunConfiguration::setRunMode(RunMode runMode)
|
|
|
|
{
|
|
|
|
m_runMode = runMode;
|
|
|
|
emit runModeChanged(runMode);
|
|
|
|
}
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void Qt4RunConfiguration::setUserName(const QString &name)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-07 18:17:24 +01:00
|
|
|
if (name.isEmpty()) {
|
2008-12-02 12:01:29 +01:00
|
|
|
m_userSetName = false;
|
2010-01-07 18:17:24 +01:00
|
|
|
setDisplayName(tr("Qt4RunConfiguration"));
|
2008-12-02 12:01:29 +01:00
|
|
|
} else {
|
|
|
|
m_userSetName = true;
|
2010-01-07 18:17:24 +01:00
|
|
|
setDisplayName(name);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2010-01-07 18:17:24 +01:00
|
|
|
emit displayNameChanged(name);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Qt4RunConfiguration::proFilePath() const
|
|
|
|
{
|
|
|
|
return m_proFilePath;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
void Qt4RunConfiguration::updateTarget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-03-19 15:04:43 +01:00
|
|
|
if (m_cachedTargetInformationValid)
|
|
|
|
return;
|
2009-12-22 14:52:36 +01:00
|
|
|
Qt4TargetInformation info = qt4Project()->targetInformation(qt4Project()->activeQt4BuildConfiguration(),
|
|
|
|
m_proFilePath);
|
|
|
|
if (info.error != Qt4TargetInformation::NoError) {
|
|
|
|
if (info.error == Qt4TargetInformation::ProParserError) {
|
|
|
|
Core::ICore::instance()->messageManager()->printToOutputPane(
|
|
|
|
tr("Could not parse %1. The Qt4 run configuration %2 can not be started.")
|
2010-01-07 18:17:24 +01:00
|
|
|
.arg(m_proFilePath).arg(displayName()));
|
2009-12-22 14:52:36 +01:00
|
|
|
}
|
2009-05-04 18:55:31 +02:00
|
|
|
m_workingDir = QString::null;
|
|
|
|
m_executable = QString::null;
|
|
|
|
m_cachedTargetInformationValid = true;
|
|
|
|
emit effectiveTargetInformationChanged();
|
|
|
|
return;
|
|
|
|
}
|
2009-12-22 14:52:36 +01:00
|
|
|
m_workingDir = info.workingDir;
|
|
|
|
m_executable = info.executable;
|
2009-01-27 18:23:02 +01:00
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
m_cachedTargetInformationValid = true;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
emit effectiveTargetInformationChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:04:43 +01:00
|
|
|
void Qt4RunConfiguration::invalidateCachedTargetInformation()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-03-19 15:04:43 +01:00
|
|
|
m_cachedTargetInformationValid = false;
|
|
|
|
emit effectiveTargetInformationChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-03-25 15:18:37 +01:00
|
|
|
QString Qt4RunConfiguration::dumperLibrary() const
|
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
QtVersion *version = qt4Project()->activeQt4BuildConfiguration()->qtVersion();
|
2009-08-28 17:20:37 +02:00
|
|
|
if (version)
|
|
|
|
return version->debuggingHelperLibrary();
|
|
|
|
else
|
|
|
|
return QString::null;
|
2009-03-25 15:18:37 +01:00
|
|
|
}
|
|
|
|
|
2009-07-15 17:41:45 +02:00
|
|
|
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
|
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
QtVersion *version = qt4Project()->activeQt4BuildConfiguration()->qtVersion();
|
2009-08-28 17:20:37 +02:00
|
|
|
if (version)
|
|
|
|
return version->debuggingHelperLibraryLocations();
|
|
|
|
else
|
|
|
|
return QStringList();
|
2009-07-15 17:41:45 +02:00
|
|
|
}
|
|
|
|
|
2009-05-28 16:34:31 +02:00
|
|
|
void Qt4RunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env)
|
|
|
|
{
|
|
|
|
if (m_baseEnvironmentBase == env)
|
|
|
|
return;
|
|
|
|
m_baseEnvironmentBase = env;
|
|
|
|
emit baseEnvironmentChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBase() const
|
|
|
|
{
|
|
|
|
return m_baseEnvironmentBase;
|
|
|
|
}
|
2009-06-17 17:56:40 +02:00
|
|
|
ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const
|
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
2009-11-25 18:50:20 +01:00
|
|
|
return qt4bc->toolChainType();
|
2009-06-17 17:56:40 +02:00
|
|
|
}
|
2009-03-25 15:18:37 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
|
|
|
/// Qt4RunConfigurationFactory
|
|
|
|
/// This class is used to restore run settings (saved in .user files)
|
|
|
|
///
|
|
|
|
|
|
|
|
Qt4RunConfigurationFactory::Qt4RunConfigurationFactory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt4RunConfigurationFactory::~Qt4RunConfigurationFactory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// used to recreate the runConfigurations when restoring settings
|
2010-01-07 18:17:24 +01:00
|
|
|
bool Qt4RunConfigurationFactory::canRestore(const QString &id) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-07 18:17:24 +01:00
|
|
|
return id == "Qt4ProjectManager.Qt4RunConfiguration";
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
Qt4Project *p = qobject_cast<Qt4Project *>(project);
|
2008-12-17 15:51:48 +01:00
|
|
|
Q_ASSERT(p);
|
2010-01-07 18:17:24 +01:00
|
|
|
if (id.startsWith("Qt4RunConfiguration.")) {
|
|
|
|
QString fileName = id.mid(QString("Qt4RunConfiguration.").size());
|
2009-10-08 18:37:18 +02:00
|
|
|
return new Qt4RunConfiguration(p, fileName);
|
2009-06-12 17:57:03 +02:00
|
|
|
}
|
2010-01-07 18:17:24 +01:00
|
|
|
Q_ASSERT(id == "Qt4ProjectManager.Qt4RunConfiguration");
|
2008-12-02 12:01:29 +01:00
|
|
|
// The right path is set in restoreSettings
|
2009-10-08 18:37:18 +02:00
|
|
|
return new Qt4RunConfiguration(p, QString::null);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QStringList Qt4RunConfigurationFactory::availableCreationIds(ProjectExplorer::Project *pro) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
Qt4Project *qt4project = qobject_cast<Qt4Project *>(pro);
|
|
|
|
if (qt4project) {
|
|
|
|
QStringList applicationProFiles;
|
|
|
|
QList<Qt4ProFileNode *> list = qt4project->applicationProFiles();
|
2008-12-09 11:07:24 +01:00
|
|
|
foreach (Qt4ProFileNode * node, list) {
|
2008-12-02 12:01:29 +01:00
|
|
|
applicationProFiles.append("Qt4RunConfiguration." + node->path());
|
|
|
|
}
|
|
|
|
return applicationProFiles;
|
|
|
|
} else {
|
|
|
|
return QStringList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString Qt4RunConfigurationFactory::displayNameForId(const QString &id) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-07 18:17:24 +01:00
|
|
|
QString fileName = id.mid(QString("Qt4RunConfiguration.").size());
|
2009-03-20 16:13:46 +01:00
|
|
|
return QFileInfo(fileName).completeBaseName();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|