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
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.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-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.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
|
|
|
|
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 "qt4nodes.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
#include "qt4project.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "qt4target.h"
|
2009-11-25 18:50:20 +01:00
|
|
|
#include "qt4buildconfiguration.h"
|
2010-02-25 16:51:27 +01:00
|
|
|
#include "qt4projectmanagerconstants.h"
|
2011-01-12 16:24:00 +01:00
|
|
|
#include "qmakestep.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-30 22:16:59 +02:00
|
|
|
#include <coreplugin/coreconstants.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>
|
2011-02-24 14:58:37 +01:00
|
|
|
#include <coreplugin/helpmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/buildstep.h>
|
2011-01-13 11:41:45 +01:00
|
|
|
#include <projectexplorer/environmentwidget.h>
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
#include <utils/detailswidget.h>
|
2011-08-18 13:46:52 +02:00
|
|
|
#include <utils/stringutils.h>
|
2011-08-16 10:45:23 +02:00
|
|
|
#include <utils/persistentsettings.h>
|
2010-09-01 11:34:34 +02:00
|
|
|
#include <utils/debuggerlanguagechooser.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtoutputformatter.h>
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
#include <qtsupport/profilereader.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>
|
2010-08-18 15:42:01 +02:00
|
|
|
#include <QtGui/QLineEdit>
|
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>
|
2011-08-10 12:13:31 +02:00
|
|
|
#include <QtCore/QFileInfo>
|
|
|
|
#include <QtCore/QDir>
|
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;
|
2011-08-16 10:45:23 +02:00
|
|
|
using Utils::PersistentSettingsReader;
|
|
|
|
using Utils::PersistentSettingsWriter;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
namespace {
|
|
|
|
const char * const QT4_RC_ID("Qt4ProjectManager.Qt4RunConfiguration");
|
|
|
|
const char * const QT4_RC_PREFIX("Qt4ProjectManager.Qt4RunConfiguration.");
|
|
|
|
|
|
|
|
const char * const COMMAND_LINE_ARGUMENTS_KEY("Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments");
|
|
|
|
const char * const PRO_FILE_KEY("Qt4ProjectManager.Qt4RunConfiguration.ProFile");
|
|
|
|
const char * const USE_TERMINAL_KEY("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal");
|
|
|
|
const char * const USE_DYLD_IMAGE_SUFFIX_KEY("Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix");
|
|
|
|
const char * const USER_ENVIRONMENT_CHANGES_KEY("Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges");
|
|
|
|
const char * const BASE_ENVIRONMENT_BASE_KEY("Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase");
|
|
|
|
const char * const USER_WORKING_DIRECTORY_KEY("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory");
|
|
|
|
|
|
|
|
QString pathFromId(const QString &id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-19 13:41:02 +01:00
|
|
|
if (!id.startsWith(QLatin1String(QT4_RC_PREFIX)))
|
|
|
|
return QString();
|
|
|
|
return id.mid(QString::fromLatin1(QT4_RC_PREFIX).size());
|
|
|
|
}
|
2009-03-19 15:04:43 +01:00
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
} // namespace
|
2009-05-27 14:41:07 +02:00
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
//
|
|
|
|
// Qt4RunConfiguration
|
|
|
|
//
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4RunConfiguration::Qt4RunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath) :
|
2010-01-19 13:41:02 +01:00
|
|
|
LocalApplicationRunConfiguration(parent, QLatin1String(QT4_RC_ID)),
|
|
|
|
m_proFilePath(proFilePath),
|
|
|
|
m_runMode(Gui),
|
|
|
|
m_isUsingDyldImageSuffix(false),
|
2010-10-27 16:27:22 +02:00
|
|
|
m_baseEnvironmentBase(Qt4RunConfiguration::BuildEnvironmentBase),
|
2011-06-10 15:37:10 +02:00
|
|
|
m_parseSuccess(parent->qt4Project()->validParse(m_proFilePath)),
|
|
|
|
m_parseInProgress(parent->qt4Project()->parseInProgress(m_proFilePath))
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
|
|
|
ctor();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4RunConfiguration::Qt4RunConfiguration(Qt4BaseTarget *parent, Qt4RunConfiguration *source) :
|
2010-01-19 13:41:02 +01:00
|
|
|
LocalApplicationRunConfiguration(parent, source),
|
|
|
|
m_commandLineArguments(source->m_commandLineArguments),
|
|
|
|
m_proFilePath(source->m_proFilePath),
|
|
|
|
m_runMode(source->m_runMode),
|
|
|
|
m_isUsingDyldImageSuffix(source->m_isUsingDyldImageSuffix),
|
|
|
|
m_userWorkingDirectory(source->m_userWorkingDirectory),
|
|
|
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
2010-10-27 16:27:22 +02:00
|
|
|
m_baseEnvironmentBase(source->m_baseEnvironmentBase),
|
2011-06-10 15:37:10 +02:00
|
|
|
m_parseSuccess(source->m_parseSuccess),
|
|
|
|
m_parseInProgress(source->m_parseInProgress)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-19 13:41:02 +01:00
|
|
|
ctor();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
Qt4RunConfiguration::~Qt4RunConfiguration()
|
2009-11-26 14:43:27 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *Qt4RunConfiguration::qt4Target() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-07-14 14:09:19 +02:00
|
|
|
return static_cast<Qt4BaseTarget *>(target());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2011-05-26 15:33:24 +02:00
|
|
|
bool Qt4RunConfiguration::isEnabled() const
|
2009-06-12 12:58:02 +02:00
|
|
|
{
|
2011-06-10 15:37:10 +02:00
|
|
|
return m_parseSuccess && !m_parseInProgress;
|
2009-06-12 12:58:02 +02:00
|
|
|
}
|
2009-01-27 18:23:02 +01:00
|
|
|
|
2011-05-26 16:30:35 +02:00
|
|
|
QString Qt4RunConfiguration::disabledReason() const
|
|
|
|
{
|
2011-06-10 15:37:10 +02:00
|
|
|
if (m_parseInProgress)
|
|
|
|
return tr("The .pro file is currently being parsed.");
|
2011-05-26 16:30:35 +02:00
|
|
|
if (!m_parseSuccess)
|
2011-06-10 15:37:10 +02:00
|
|
|
return tr("The .pro file could not be parsed.");
|
2011-05-26 16:30:35 +02:00
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2011-06-10 15:37:10 +02:00
|
|
|
void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
|
2009-12-03 18:37:27 +01:00
|
|
|
{
|
2011-06-10 15:37:10 +02:00
|
|
|
if (m_proFilePath != pro->path())
|
|
|
|
return;
|
|
|
|
|
2010-10-27 16:27:22 +02:00
|
|
|
bool enabled = isEnabled();
|
|
|
|
m_parseSuccess = success;
|
2011-06-10 15:37:10 +02:00
|
|
|
m_parseInProgress = parseInProgress;
|
2010-10-27 16:27:22 +02:00
|
|
|
if (enabled != isEnabled())
|
|
|
|
emit isEnabledChanged(!enabled);
|
|
|
|
|
2011-06-10 15:37:10 +02:00
|
|
|
if (!parseInProgress) {
|
|
|
|
emit effectiveTargetInformationChanged();
|
|
|
|
emit baseEnvironmentChanged();
|
|
|
|
}
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
void Qt4RunConfiguration::ctor()
|
|
|
|
{
|
2010-08-19 12:26:21 +02:00
|
|
|
setDefaultDisplayName(defaultDisplayName());
|
2010-08-18 15:42:01 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
connect(qt4Target(), SIGNAL(environmentChanged()),
|
2010-01-19 13:41:02 +01:00
|
|
|
this, SIGNAL(baseEnvironmentChanged()));
|
2011-06-10 15:37:10 +02:00
|
|
|
connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
|
|
|
|
this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
|
2010-01-19 13:41:02 +01:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2011-06-10 15:37:10 +02:00
|
|
|
QHBoxLayout *hl = new QHBoxLayout();
|
|
|
|
hl->addStretch();
|
|
|
|
m_disabledIcon = new QLabel(this);
|
|
|
|
m_disabledIcon->setPixmap(QPixmap(QString::fromUtf8(":/projectexplorer/images/compile_warning.png")));
|
|
|
|
hl->addWidget(m_disabledIcon);
|
|
|
|
m_disabledReason = new QLabel(this);
|
|
|
|
m_disabledReason->setVisible(false);
|
|
|
|
hl->addWidget(m_disabledReason);
|
|
|
|
hl->addStretch();
|
|
|
|
vboxTopLayout->addLayout(hl);
|
|
|
|
|
2009-10-01 14:24:44 +02:00
|
|
|
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
|
|
|
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);
|
|
|
|
|
2010-08-18 15:42:01 +02:00
|
|
|
m_executableLineEdit = new QLineEdit(m_qt4RunConfiguration->executable(), this);
|
|
|
|
m_executableLineEdit->setEnabled(false);
|
|
|
|
toplayout->addRow(tr("Executable:"), m_executableLineEdit);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-23 14:33:41 +01:00
|
|
|
QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
|
2010-11-12 17:23:55 +01:00
|
|
|
m_argumentsLineEdit = new QLineEdit(qt4RunConfiguration->rawCommandLineArguments(), this);
|
2010-02-01 17:22:05 +01:00
|
|
|
argumentsLabel->setBuddy(m_argumentsLineEdit);
|
|
|
|
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
|
|
|
|
|
2010-02-23 14:33:41 +01:00
|
|
|
m_workingDirectoryEdit = new Utils::PathChooser(this);
|
2011-03-08 18:26:15 +01:00
|
|
|
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
2010-09-27 15:04:58 +01:00
|
|
|
m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->baseWorkingDirectory());
|
2010-09-17 14:58:07 +02:00
|
|
|
m_workingDirectoryEdit->setBaseDirectory(m_qt4RunConfiguration->target()->project()->projectDirectory());
|
2010-09-24 12:39:25 +02:00
|
|
|
m_workingDirectoryEdit->setEnvironment(m_qt4RunConfiguration->environment());
|
2010-05-14 15:45:43 +02:00
|
|
|
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));
|
2009-05-13 17:08:48 +02:00
|
|
|
|
2010-02-23 14:33:41 +01:00
|
|
|
QToolButton *resetButton = new QToolButton(this);
|
2009-05-13 17:08:48 +02:00
|
|
|
resetButton->setToolTip(tr("Reset to default"));
|
2010-07-30 22:16:59 +02:00
|
|
|
resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));
|
2009-05-13 17:08:48 +02:00
|
|
|
|
|
|
|
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);
|
2010-05-14 15:45:43 +02:00
|
|
|
toplayout->addRow(tr("Working directory:"), boxlayout);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-05-14 15:45:43 +02:00
|
|
|
m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this);
|
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);
|
2011-04-13 13:12:02 +02:00
|
|
|
m_useTerminalCheck->setVisible(qt4RunConfiguration->target()->id() != Constants::QT_SIMULATOR_TARGET_ID);
|
2009-02-18 17:04:04 +01:00
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
QLabel *debuggerLabel = new QLabel(tr("Debugger:"), this);
|
2011-05-17 14:43:01 +02:00
|
|
|
debuggerLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
|
2010-09-10 17:26:02 +02:00
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
m_debuggerLanguageChooser = new Utils::DebuggerLanguageChooser(this);
|
2011-05-17 14:43:01 +02:00
|
|
|
toplayout->addRow(debuggerLabel, m_debuggerLanguageChooser);
|
2010-09-01 11:34:34 +02:00
|
|
|
|
|
|
|
m_debuggerLanguageChooser->setCppChecked(m_qt4RunConfiguration->useCppDebugger());
|
|
|
|
m_debuggerLanguageChooser->setQmlChecked(m_qt4RunConfiguration->useQmlDebugger());
|
2010-09-02 17:17:35 +02:00
|
|
|
m_debuggerLanguageChooser->setQmlDebugServerPort(m_qt4RunConfiguration->qmlDebugServerPort());
|
2010-09-01 11:34:34 +02:00
|
|
|
|
2009-03-26 12:01:08 +01:00
|
|
|
#ifdef Q_OS_MAC
|
2010-02-23 14:33:41 +01:00
|
|
|
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
|
2009-03-26 12:01:08 +01:00
|
|
|
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
|
|
|
|
2010-02-23 14:33:41 +01:00
|
|
|
QWidget *baseEnvironmentWidget = new QWidget(this);
|
2009-07-23 15:57:45 +02:00
|
|
|
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
|
|
|
|
2011-06-10 15:37:10 +02:00
|
|
|
runConfigurationEnabledChange(m_qt4RunConfiguration->isEnabled());
|
2010-10-27 16:27:22 +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-02-18 17:04:04 +01:00
|
|
|
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(termToggled(bool)));
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
|
|
|
|
this, SLOT(useCppDebuggerToggled(bool)));
|
|
|
|
connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
|
|
|
|
this, SLOT(useQmlDebuggerToggled(bool)));
|
2010-09-02 17:17:35 +02:00
|
|
|
connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
|
|
|
|
this, SLOT(qmlDebugServerPortChanged(uint)));
|
2011-02-24 14:58:37 +01:00
|
|
|
connect(m_debuggerLanguageChooser, SIGNAL(openHelpUrl(QString)),
|
|
|
|
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
|
2010-09-01 11:34:34 +02:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
|
|
|
this, SLOT(userChangesEdited()));
|
2009-05-27 13:37:21 +02:00
|
|
|
|
2010-09-27 18:09:54 +01:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
|
2009-05-13 17:08:48 +02:00
|
|
|
this, SLOT(workingDirectoryChanged(QString)));
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)),
|
2009-01-27 18:23:02 +01:00
|
|
|
this, SLOT(commandLineArgumentsChanged(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
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
|
|
|
|
this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
|
2009-05-27 13:37:21 +02:00
|
|
|
|
2009-05-27 14:41:07 +02:00
|
|
|
connect(qt4RunConfiguration, SIGNAL(baseEnvironmentChanged()),
|
|
|
|
this, SLOT(baseEnvironmentChanged()));
|
2010-10-27 16:27:22 +02:00
|
|
|
|
|
|
|
connect(qt4RunConfiguration, SIGNAL(isEnabledChanged(bool)),
|
|
|
|
this, SLOT(runConfigurationEnabledChange(bool)));
|
2009-05-27 14:41:07 +02:00
|
|
|
}
|
|
|
|
|
2010-02-23 14:33:41 +01:00
|
|
|
Qt4RunConfigurationWidget::~Qt4RunConfigurationWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
void Qt4RunConfigurationWidget::useCppDebuggerToggled(bool toggled)
|
|
|
|
{
|
|
|
|
m_qt4RunConfiguration->setUseCppDebugger(toggled);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt4RunConfigurationWidget::useQmlDebuggerToggled(bool toggled)
|
|
|
|
{
|
|
|
|
m_qt4RunConfiguration->setUseQmlDebugger(toggled);
|
|
|
|
}
|
|
|
|
|
2010-09-02 17:17:35 +02:00
|
|
|
void Qt4RunConfigurationWidget::qmlDebugServerPortChanged(uint port)
|
|
|
|
{
|
|
|
|
m_qt4RunConfiguration->setQmlDebugServerPort(port);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
void Qt4RunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges)
|
2009-05-27 13:37:21 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-10-27 16:27:22 +02:00
|
|
|
void Qt4RunConfigurationWidget::runConfigurationEnabledChange(bool enabled)
|
|
|
|
{
|
2011-06-10 15:37:10 +02:00
|
|
|
m_detailsContainer->setEnabled(enabled);
|
|
|
|
m_environmentWidget->setEnabled(enabled);
|
|
|
|
m_disabledIcon->setVisible(!enabled);
|
|
|
|
m_disabledReason->setVisible(!enabled);
|
|
|
|
m_disabledReason->setText(m_qt4RunConfiguration->disabledReason());
|
2010-10-27 16:27:22 +02: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;
|
2010-09-27 15:11:26 +01:00
|
|
|
m_qt4RunConfiguration->setBaseWorkingDirectory(m_workingDirectoryEdit->rawPath());
|
2009-05-13 17:08:48 +02:00
|
|
|
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
|
2010-09-27 15:11:26 +01:00
|
|
|
m_qt4RunConfiguration->setBaseWorkingDirectory("");
|
2009-05-13 17:08:48 +02:00
|
|
|
}
|
|
|
|
|
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;
|
2010-10-19 11:14:03 +02:00
|
|
|
m_qt4RunConfiguration->setCommandLineArguments(args);
|
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
|
|
|
if (m_ignoreChange)
|
|
|
|
return;
|
|
|
|
m_argumentsLineEdit->setText(args);
|
2009-01-27 18:23:02 +01:00
|
|
|
}
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
|
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-03-19 15:04:43 +01:00
|
|
|
if (m_isShown) {
|
2010-08-18 15:42:01 +02:00
|
|
|
m_executableLineEdit->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable()));
|
2009-05-13 17:08:48 +02:00
|
|
|
m_ignoreChange = true;
|
2010-09-27 15:04:58 +01:00
|
|
|
m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->baseWorkingDirectory()));
|
2009-05-13 17:08:48 +02:00
|
|
|
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
|
2010-04-16 11:46:47 +02:00
|
|
|
QWidget *Qt4RunConfiguration::createConfigurationWidget()
|
2009-01-27 18:23:02 +01:00
|
|
|
{
|
|
|
|
return new Qt4RunConfigurationWidget(this, 0);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
QVariantMap Qt4RunConfiguration::toMap() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-25 13:19:27 +01:00
|
|
|
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
2010-01-19 13:41:02 +01:00
|
|
|
QVariantMap map(LocalApplicationRunConfiguration::toMap());
|
|
|
|
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments);
|
|
|
|
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
|
|
|
|
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console);
|
|
|
|
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
|
2010-09-23 10:35:23 +02:00
|
|
|
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
2010-01-19 13:41:02 +01:00
|
|
|
map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), m_baseEnvironmentBase);
|
|
|
|
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
|
|
|
|
return map;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
bool Qt4RunConfiguration::fromMap(const QVariantMap &map)
|
2010-01-29 21:33:57 +01:00
|
|
|
{
|
2010-03-25 13:19:27 +01:00
|
|
|
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
2010-10-19 11:14:03 +02:00
|
|
|
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString();
|
2011-10-04 12:52:29 +02:00
|
|
|
m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
|
2010-01-19 13:41:02 +01:00
|
|
|
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ? Console : Gui;
|
|
|
|
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
|
|
|
|
|
|
|
m_userWorkingDirectory = map.value(QLatin1String(USER_WORKING_DIRECTORY_KEY)).toString();
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
2010-01-19 13:41:02 +01:00
|
|
|
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(Qt4RunConfiguration::BuildEnvironmentBase)).toInt());
|
|
|
|
|
2010-11-02 12:26:55 +01:00
|
|
|
m_parseSuccess = qt4Target()->qt4Project()->validParse(m_proFilePath);
|
2011-06-10 15:37:10 +02:00
|
|
|
m_parseInProgress = qt4Target()->qt4Project()->parseInProgress(m_proFilePath);
|
2010-11-02 12:26:55 +01:00
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
return RunConfiguration::fromMap(map);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Qt4RunConfiguration::executable() const
|
|
|
|
{
|
2010-03-10 16:55:37 +01:00
|
|
|
Qt4Project *pro = qt4Target()->qt4Project();
|
2011-08-18 16:46:44 +02:00
|
|
|
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
|
2010-03-10 16:55:37 +01:00
|
|
|
if (!ti.valid)
|
|
|
|
return QString();
|
|
|
|
return ti.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
|
2010-09-27 15:04:58 +01:00
|
|
|
{
|
2010-11-12 17:23:55 +01:00
|
|
|
return QDir::cleanPath(environment().expandVariables(
|
|
|
|
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
2010-09-27 15:04:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Qt4RunConfiguration::baseWorkingDirectory() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-05-13 17:08:48 +02:00
|
|
|
// if the user overrode us, then return his working directory
|
2010-11-12 14:36:54 +01:00
|
|
|
if (!m_userWorkingDirectory.isEmpty())
|
2009-05-13 17:08:48 +02:00
|
|
|
return m_userWorkingDirectory;
|
|
|
|
|
|
|
|
// else what the pro file reader tells us
|
2010-03-10 16:55:37 +01:00
|
|
|
Qt4Project *pro = qt4Target()->qt4Project();
|
2011-08-18 16:46:44 +02:00
|
|
|
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
|
2011-09-19 10:02:45 +02:00
|
|
|
if (!ti.valid)
|
2010-03-10 16:55:37 +01:00
|
|
|
return QString();
|
|
|
|
return ti.workingDir;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
QString Qt4RunConfiguration::commandLineArguments() const
|
2010-11-12 17:23:55 +01:00
|
|
|
{
|
|
|
|
return Utils::QtcProcess::expandMacros(m_commandLineArguments, macroExpander());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Qt4RunConfiguration::rawCommandLineArguments() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
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");
|
2010-02-02 17:09:41 +01:00
|
|
|
return QString();
|
2009-12-14 13:40:17 +01:00
|
|
|
}
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment Qt4RunConfiguration::baseEnvironment() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment env;
|
2009-05-28 16:34:31 +02:00
|
|
|
if (m_baseEnvironmentBase == Qt4RunConfiguration::CleanEnvironmentBase) {
|
|
|
|
// Nothing
|
|
|
|
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
|
2010-09-23 10:35:23 +02:00
|
|
|
env = Utils::Environment::systemEnvironment();
|
2009-05-28 16:34:31 +02:00
|
|
|
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
|
2010-02-08 15:50:06 +01:00
|
|
|
env = target()->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");
|
|
|
|
}
|
2010-03-29 15:17:04 +02:00
|
|
|
|
2011-04-27 13:21:24 +02:00
|
|
|
// The user could be linking to a library found via a -L/some/dir switch
|
2010-03-29 15:17:04 +02:00
|
|
|
// to find those libraries while actually running we explicitly prepend those
|
2011-04-29 13:25:25 +02:00
|
|
|
// dirs to the library search path
|
2011-08-18 16:46:44 +02:00
|
|
|
const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootQt4ProjectNode()->findProFileFor(m_proFilePath);
|
2011-08-10 12:13:31 +02:00
|
|
|
if (node) {
|
|
|
|
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
|
|
|
|
if (!libDirectories.isEmpty()) {
|
|
|
|
const QString proDirectory = QFileInfo(node->path()).absolutePath();
|
|
|
|
foreach (QString dir, libDirectories) {
|
|
|
|
// Fix up relative entries like "LIBS+=-L.."
|
|
|
|
const QFileInfo fi(dir);
|
|
|
|
if (!fi.isAbsolute())
|
|
|
|
dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir);
|
|
|
|
env.prependOrSetLibrarySearchPath(dir);
|
|
|
|
} // foreach
|
|
|
|
} // libDirectories
|
|
|
|
} // node
|
2009-03-26 12:01:08 +01:00
|
|
|
return env;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment Qt4RunConfiguration::environment() const
|
2009-05-27 13:37:21 +02:00
|
|
|
{
|
2010-09-23 10:35:23 +02:00
|
|
|
Utils::Environment env = baseEnvironment();
|
2009-05-27 13:37:21 +02:00
|
|
|
env.modify(userEnvironmentChanges());
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
QList<Utils::EnvironmentItem> Qt4RunConfiguration::userEnvironmentChanges() const
|
2009-05-27 13:37:21 +02:00
|
|
|
{
|
|
|
|
return m_userEnvironmentChanges;
|
|
|
|
}
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
void Qt4RunConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
|
2009-05-27 13:37:21 +02:00
|
|
|
{
|
|
|
|
if (m_userEnvironmentChanges != diff) {
|
|
|
|
m_userEnvironmentChanges = diff;
|
|
|
|
emit userEnvironmentChangesChanged(diff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-27 15:11:26 +01:00
|
|
|
void Qt4RunConfiguration::setBaseWorkingDirectory(const QString &wd)
|
2009-05-13 17:08:48 +02:00
|
|
|
{
|
2010-11-12 14:36:54 +01:00
|
|
|
const QString &oldWorkingDirectory = workingDirectory();
|
|
|
|
|
|
|
|
m_userWorkingDirectory = wd;
|
|
|
|
|
|
|
|
const QString &newWorkingDirectory = workingDirectory();
|
|
|
|
if (oldWorkingDirectory != newWorkingDirectory)
|
|
|
|
emit baseWorkingDirectoryChanged(newWorkingDirectory);
|
2009-05-13 17:08:48 +02:00
|
|
|
}
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-10-19 11:14:03 +02:00
|
|
|
m_commandLineArguments = argumentsString;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QString Qt4RunConfiguration::proFilePath() const
|
|
|
|
{
|
|
|
|
return m_proFilePath;
|
|
|
|
}
|
|
|
|
|
2009-03-25 15:18:37 +01:00
|
|
|
QString Qt4RunConfiguration::dumperLibrary() const
|
|
|
|
{
|
2011-08-18 16:46:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
|
2010-02-08 15:50:06 +01:00
|
|
|
if (version)
|
2011-02-24 10:12:52 +01:00
|
|
|
return version->gdbDebuggingHelperLibrary();
|
2010-02-02 17:09:41 +01:00
|
|
|
return QString();
|
2009-03-25 15:18:37 +01:00
|
|
|
}
|
|
|
|
|
2009-07-15 17:41:45 +02:00
|
|
|
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
|
|
|
|
{
|
2011-08-18 16:46:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
|
2010-02-08 15:50:06 +01:00
|
|
|
if (version)
|
2009-08-28 17:20:37 +02:00
|
|
|
return version->debuggingHelperLibraryLocations();
|
2010-02-02 17:09:41 +01:00
|
|
|
return QStringList();
|
2009-07-15 17:41:45 +02:00
|
|
|
}
|
|
|
|
|
2010-08-18 15:42:01 +02:00
|
|
|
QString Qt4RunConfiguration::defaultDisplayName()
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
2010-08-18 15:42:01 +02:00
|
|
|
QString defaultName;
|
2010-01-19 13:41:02 +01:00
|
|
|
if (!m_proFilePath.isEmpty())
|
2010-08-18 15:42:01 +02:00
|
|
|
defaultName = QFileInfo(m_proFilePath).completeBaseName();
|
2010-01-19 13:41:02 +01:00
|
|
|
else
|
2010-08-18 15:42:01 +02:00
|
|
|
defaultName = tr("Qt4 RunConfiguration");
|
|
|
|
return defaultName;
|
2010-01-19 13:41:02 +01: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-03-25 15:18:37 +01:00
|
|
|
|
2011-04-15 12:59:44 +02:00
|
|
|
Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
|
2010-07-13 15:02:37 +02:00
|
|
|
{
|
2011-05-20 21:40:53 +02:00
|
|
|
return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project());
|
2010-07-13 15:02:37 +02:00
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
|
|
|
/// Qt4RunConfigurationFactory
|
|
|
|
/// This class is used to restore run settings (saved in .user files)
|
|
|
|
///
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
Qt4RunConfigurationFactory::Qt4RunConfigurationFactory(QObject *parent) :
|
|
|
|
ProjectExplorer::IRunConfigurationFactory(parent)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt4RunConfigurationFactory::~Qt4RunConfigurationFactory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool Qt4RunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const QString &id) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!t)
|
|
|
|
return false;
|
2011-07-14 14:09:19 +02:00
|
|
|
if (t->id() != QLatin1String(Constants::DESKTOP_TARGET_ID)
|
|
|
|
&& t->id() != QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
|
2010-01-19 13:41:02 +01:00
|
|
|
return false;
|
2010-02-08 15:50:06 +01:00
|
|
|
return t->qt4Project()->hasApplicationProFile(pathFromId(id));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::create(ProjectExplorer::Target *parent, const QString &id)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-19 13:41:02 +01:00
|
|
|
if (!canCreate(parent, id))
|
|
|
|
return 0;
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
|
2010-02-08 15:50:06 +01:00
|
|
|
return new Qt4RunConfiguration(t, pathFromId(id));
|
2010-01-19 13:41:02 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
2011-07-14 14:09:19 +02:00
|
|
|
if (!qobject_cast<Qt4BaseTarget *>(parent))
|
2010-02-08 15:50:06 +01:00
|
|
|
return false;
|
2011-07-14 14:09:19 +02:00
|
|
|
if (parent->id() != QLatin1String(Constants::DESKTOP_TARGET_ID)
|
|
|
|
&& parent->id() != QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
|
2010-01-19 13:41:02 +01:00
|
|
|
return false;
|
|
|
|
QString id(ProjectExplorer::idFromMap(map));
|
|
|
|
return id.startsWith(QLatin1String(QT4_RC_ID));
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
|
|
|
if (!canRestore(parent, map))
|
|
|
|
return 0;
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4RunConfiguration *rc = new Qt4RunConfiguration(t, QString());
|
2010-01-19 13:41:02 +01:00
|
|
|
if (rc->fromMap(map))
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
delete rc;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool Qt4RunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
return canCreate(parent, source->id());
|
2010-01-19 13:41:02 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source)
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
|
|
|
if (!canClone(parent, source))
|
|
|
|
return 0;
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4RunConfiguration *old = static_cast<Qt4RunConfiguration *>(source);
|
2010-02-08 15:50:06 +01:00
|
|
|
return new Qt4RunConfiguration(t, old);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QStringList Qt4RunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-07-14 14:09:19 +02:00
|
|
|
Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!t)
|
|
|
|
return QStringList();
|
2011-07-14 14:09:19 +02:00
|
|
|
if (t->id() != Constants::DESKTOP_TARGET_ID
|
|
|
|
&& t->id() != QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
|
2008-12-02 12:01:29 +01:00
|
|
|
return QStringList();
|
2010-02-08 15:50:06 +01:00
|
|
|
return t->qt4Project()->applicationProFilePathes(QLatin1String(QT4_RC_PREFIX));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
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-19 13:41:02 +01:00
|
|
|
return QFileInfo(pathFromId(id)).completeBaseName();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|