Move ProjectExplorer::Environment to Utils::Environment

Reviewed-by: dt
This commit is contained in:
Tobias Hunger
2010-09-23 10:35:23 +02:00
parent 747f750370
commit f5c044fe48
70 changed files with 309 additions and 295 deletions

View File

@@ -33,7 +33,7 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QString> #include <QtCore/QString>
using namespace ProjectExplorer; using namespace Utils;
QList<EnvironmentItem> EnvironmentItem::fromStringList(QStringList list) QList<EnvironmentItem> EnvironmentItem::fromStringList(QStringList list)
{ {

View File

@@ -27,20 +27,21 @@
** **
**************************************************************************/ **************************************************************************/
#ifndef ENVIRONMENT_H #ifndef UTILS_ENVIRONMENT_H
#define ENVIRONMENT_H #define UTILS_ENVIRONMENT_H
#include "projectexplorer_export.h" #include "utils_global.h"
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QList> #include <QtCore/QList>
namespace ProjectExplorer { namespace Utils {
struct PROJECTEXPLORER_EXPORT EnvironmentItem class QTCREATOR_UTILS_EXPORT EnvironmentItem
{ {
public:
EnvironmentItem(QString n, QString v) EnvironmentItem(QString n, QString v)
: name(n), value(v), unset(false) : name(n), value(v), unset(false)
{} {}
@@ -58,7 +59,7 @@ struct PROJECTEXPLORER_EXPORT EnvironmentItem
static QStringList toStringList(QList<EnvironmentItem> list); static QStringList toStringList(QList<EnvironmentItem> list);
}; };
class PROJECTEXPLORER_EXPORT Environment { class QTCREATOR_UTILS_EXPORT Environment {
public: public:
typedef QMap<QString, QString>::const_iterator const_iterator; typedef QMap<QString, QString>::const_iterator const_iterator;
@@ -103,6 +104,6 @@ private:
QMap<QString, QString> m_values; QMap<QString, QString> m_values;
}; };
} // namespace ProjectExplorer } // namespace Utils
#endif // ENVIRONMENT_H #endif // UTILS_ENVIRONMENT_H

View File

@@ -6,7 +6,8 @@ dll {
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
SOURCES += $$PWD/reloadpromptutils.cpp \ SOURCES += $$PWD/environment.cpp \
$$PWD/reloadpromptutils.cpp \
$$PWD/stringutils.cpp \ $$PWD/stringutils.cpp \
$$PWD/filesearch.cpp \ $$PWD/filesearch.cpp \
$$PWD/pathchooser.cpp \ $$PWD/pathchooser.cpp \
@@ -61,7 +62,8 @@ unix:!macx {
HEADERS += $$PWD/unixutils.h HEADERS += $$PWD/unixutils.h
SOURCES += $$PWD/unixutils.cpp SOURCES += $$PWD/unixutils.cpp
} }
HEADERS += $$PWD/utils_global.h \ HEADERS += $$PWD/environment.h \
$$PWD/utils_global.h \
$$PWD/reloadpromptutils.h \ $$PWD/reloadpromptutils.h \
$$PWD/stringutils.h \ $$PWD/stringutils.h \
$$PWD/filesearch.h \ $$PWD/filesearch.h \

View File

@@ -40,7 +40,6 @@
#include "cmakeprojectmanager.h" #include "cmakeprojectmanager.h"
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
@@ -65,7 +64,7 @@ using namespace CMakeProjectManager::Internal;
// |--> Already existing cbp file (and new enough) --> Page: Ready to load the project // |--> Already existing cbp file (and new enough) --> Page: Ready to load the project
// |--> Page: Ask for cmd options, run generator // |--> Page: Ask for cmd options, run generator
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const ProjectExplorer::Environment &env) CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const Utils::Environment &env)
: m_cmakeManager(cmakeManager), : m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory), m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(false), m_creatingCbpFiles(false),
@@ -99,7 +98,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory,
const QString &buildDirectory, CMakeOpenProjectWizard::Mode mode, const QString &buildDirectory, CMakeOpenProjectWizard::Mode mode,
const ProjectExplorer::Environment &env) const Utils::Environment &env)
: m_cmakeManager(cmakeManager), : m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory), m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(true), m_creatingCbpFiles(true),
@@ -119,7 +118,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory,
const QString &oldBuildDirectory, const QString &oldBuildDirectory,
const ProjectExplorer::Environment &env) const Utils::Environment &env)
: m_cmakeManager(cmakeManager), : m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory), m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(true), m_creatingCbpFiles(true),
@@ -213,7 +212,7 @@ void CMakeOpenProjectWizard::setArguments(const QStringList &args)
m_arguments = args; m_arguments = args;
} }
ProjectExplorer::Environment CMakeOpenProjectWizard::environment() const Utils::Environment CMakeOpenProjectWizard::environment() const
{ {
return m_environment; return m_environment;
} }
@@ -422,7 +421,7 @@ void CMakeRunPage::runCMake()
{ {
m_runCMake->setEnabled(false); m_runCMake->setEnabled(false);
m_argumentsLineEdit->setEnabled(false); m_argumentsLineEdit->setEnabled(false);
QStringList arguments = ProjectExplorer::Environment::parseCombinedArgString(m_argumentsLineEdit->text()); QStringList arguments = Utils::Environment::parseCombinedArgString(m_argumentsLineEdit->text());
CMakeManager *cmakeManager = m_cmakeWizard->cmakeManager(); CMakeManager *cmakeManager = m_cmakeWizard->cmakeManager();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@@ -444,7 +443,7 @@ void CMakeRunPage::runCMake()
#else // Q_OS_WIN #else // Q_OS_WIN
QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles"); QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles");
#endif #endif
ProjectExplorer::Environment env = m_cmakeWizard->environment(); Utils::Environment env = m_cmakeWizard->environment();
if (!m_cmakeWizard->msvcVersion().isEmpty()) { if (!m_cmakeWizard->msvcVersion().isEmpty()) {
// Add the environment of that msvc version to environment // Add the environment of that msvc version to environment
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChain::createMSVCToolChain(m_cmakeWizard->msvcVersion(), false); ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChain::createMSVCToolChain(m_cmakeWizard->msvcVersion(), false);
@@ -482,7 +481,7 @@ void CMakeRunPage::cmakeFinished()
m_argumentsLineEdit->setEnabled(true); m_argumentsLineEdit->setEnabled(true);
m_cmakeProcess->deleteLater(); m_cmakeProcess->deleteLater();
m_cmakeProcess = 0; m_cmakeProcess = 0;
m_cmakeWizard->setArguments(ProjectExplorer::Environment::parseCombinedArgString(m_argumentsLineEdit->text())); m_cmakeWizard->setArguments(Utils::Environment::parseCombinedArgString(m_argumentsLineEdit->text()));
//TODO Actually test that running cmake was finished, for setting this bool //TODO Actually test that running cmake was finished, for setting this bool
m_complete = true; m_complete = true;
emit completeChanged(); emit completeChanged();

View File

@@ -30,7 +30,7 @@
#ifndef CMAKEOPENPROJECTWIZARD_H #ifndef CMAKEOPENPROJECTWIZARD_H
#define CMAKEOPENPROJECTWIZARD_H #define CMAKEOPENPROJECTWIZARD_H
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <utils/wizard.h> #include <utils/wizard.h>
#include <QtCore/QProcess> #include <QtCore/QProcess>
@@ -67,14 +67,14 @@ public:
}; };
// used at importing a project without a .user file // used at importing a project without a .user file
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const ProjectExplorer::Environment &env); CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const Utils::Environment &env);
/// used to update if we have already a .user file /// used to update if we have already a .user file
/// recreates or updates the cbp file /// recreates or updates the cbp file
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, const ProjectExplorer::Environment &env); CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, const Utils::Environment &env);
/// used to change the build directory of one buildconfiguration /// used to change the build directory of one buildconfiguration
/// shows a page for selecting a directory /// shows a page for selecting a directory
/// then the run cmake page /// then the run cmake page
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, const ProjectExplorer::Environment &env); CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, const Utils::Environment &env);
virtual int nextId() const; virtual int nextId() const;
QString buildDirectory() const; QString buildDirectory() const;
@@ -83,7 +83,7 @@ public:
CMakeManager *cmakeManager() const; CMakeManager *cmakeManager() const;
QStringList arguments() const; QStringList arguments() const;
void setArguments(const QStringList &args); void setArguments(const QStringList &args);
ProjectExplorer::Environment environment() const; Utils::Environment environment() const;
QString msvcVersion() const; QString msvcVersion() const;
void setMsvcVersion(const QString &version); void setMsvcVersion(const QString &version);
bool existsUpToDateXmlFile() const; bool existsUpToDateXmlFile() const;
@@ -96,7 +96,7 @@ private:
QStringList m_arguments; QStringList m_arguments;
QString m_msvcVersion; QString m_msvcVersion;
bool m_creatingCbpFiles; bool m_creatingCbpFiles;
ProjectExplorer::Environment m_environment; Utils::Environment m_environment;
}; };
class InSourceBuildPage : public QWizardPage class InSourceBuildPage : public QWizardPage

View File

@@ -56,8 +56,6 @@
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using ProjectExplorer::Environment;
using ProjectExplorer::EnvironmentItem;
// QtCreator CMake Generator wishlist: // QtCreator CMake Generator wishlist:
// Which make targets we need to build to get all executables // Which make targets we need to build to get all executables
@@ -478,7 +476,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
// Ask the user for where he wants to build it // Ask the user for where he wants to build it
// and the cmake command line // and the cmake command line
CMakeOpenProjectWizard copw(m_manager, projectDirectory(), ProjectExplorer::Environment::systemEnvironment()); CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
if (copw.exec() != QDialog::Accepted) if (copw.exec() != QDialog::Accepted)
return false; return false;

View File

@@ -36,7 +36,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/environment.h>
#include <qtconcurrent/QtConcurrentTools> #include <qtconcurrent/QtConcurrentTools>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
@@ -103,7 +102,9 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
// we probably want the process instead of this function // we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards // cmakeproject then could even run the cmake process in the background, adding the files afterwards
// sounds like a plan // sounds like a plan
void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory, const ProjectExplorer::Environment &env, const QString &generator) void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments,
const QString &sourceDirectory, const QDir &buildDirectory,
const Utils::Environment &env, const QString &generator)
{ {
// We create a cbp file, only if we didn't find a cbp file in the base directory // We create a cbp file, only if we didn't find a cbp file in the base directory
// Yet that can still override cbp files in subdirectories // Yet that can still override cbp files in subdirectories
@@ -119,7 +120,8 @@ void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments, c
proc->setProcessChannelMode(QProcess::MergedChannels); proc->setProcessChannelMode(QProcess::MergedChannels);
proc->setEnvironment(env.toStringList()); proc->setEnvironment(env.toStringList());
const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ? QString(QLatin1Char('.')) : sourceDirectory; const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ?
QString(QLatin1Char('.')) : sourceDirectory;
proc->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator); proc->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
} }
@@ -243,7 +245,7 @@ CMakeSettingsPage::~CMakeSettingsPage()
QString CMakeSettingsPage::findCmakeExecutable() const QString CMakeSettingsPage::findCmakeExecutable() const
{ {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
return env.searchInPath(QLatin1String("cmake")); return env.searchInPath(QLatin1String("cmake"));
} }

View File

@@ -32,7 +32,7 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <projectexplorer/iprojectmanager.h> #include <projectexplorer/iprojectmanager.h>
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <QtCore/QFuture> #include <QtCore/QFuture>
#include <QtCore/QStringList> #include <QtCore/QStringList>
@@ -67,15 +67,15 @@ public:
const QStringList &arguments, const QStringList &arguments,
const QString &sourceDirectory, const QString &sourceDirectory,
const QDir &buildDirectory, const QDir &buildDirectory,
const ProjectExplorer::Environment &env, const Utils::Environment &env,
const QString &generator); const QString &generator);
bool hasCodeBlocksMsvcGenerator() const; bool hasCodeBlocksMsvcGenerator() const;
static QString findCbpFile(const QDir &); static QString findCbpFile(const QDir &);
static QString findDumperLibrary(const ProjectExplorer::Environment &env); static QString findDumperLibrary(const Utils::Environment &env);
private: private:
static QString qtVersionForQMake(const QString &qmakePath); static QString qtVersionForQMake(const QString &qmakePath);
static QPair<QString, QString> findQtDir(const ProjectExplorer::Environment &env); static QPair<QString, QString> findQtDir(const Utils::Environment &env);
Core::Context m_projectContext; Core::Context m_projectContext;
Core::Context m_projectLanguage; Core::Context m_projectLanguage;
CMakeSettingsPage *m_settingsPage; CMakeSettingsPage *m_settingsPage;

View File

@@ -35,7 +35,6 @@
#include "cmaketarget.h" #include "cmaketarget.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/debuggerlanguagechooser.h> #include <utils/debuggerlanguagechooser.h>
@@ -141,7 +140,7 @@ QString CMakeRunConfiguration::workingDirectory() const
QStringList CMakeRunConfiguration::commandLineArguments() const QStringList CMakeRunConfiguration::commandLineArguments() const
{ {
return ProjectExplorer::Environment::parseCombinedArgString(m_arguments); return Utils::Environment::parseCombinedArgString(m_arguments);
} }
QString CMakeRunConfiguration::title() const QString CMakeRunConfiguration::title() const
@@ -186,7 +185,7 @@ QVariantMap CMakeRunConfiguration::toMap() const
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console); map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console);
map.insert(QLatin1String(TITLE_KEY), m_title); map.insert(QLatin1String(TITLE_KEY), m_title);
map.insert(QLatin1String(ARGUMENTS_KEY), m_arguments); map.insert(QLatin1String(ARGUMENTS_KEY), m_arguments);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges)); map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), m_baseEnvironmentBase); map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), m_baseEnvironmentBase);
return map; return map;
@@ -200,7 +199,7 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool() ? Console : Gui; m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool() ? Console : Gui;
m_title = map.value(QLatin1String(TITLE_KEY)).toString(); m_title = map.value(QLatin1String(TITLE_KEY)).toString();
m_arguments = map.value(QLatin1String(ARGUMENTS_KEY)).toString(); m_arguments = map.value(QLatin1String(ARGUMENTS_KEY)).toString();
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList()); m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(CMakeRunConfiguration::BuildEnvironmentBase)).toInt()); m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(CMakeRunConfiguration::BuildEnvironmentBase)).toInt());
return RunConfiguration::fromMap(map); return RunConfiguration::fromMap(map);
@@ -238,13 +237,13 @@ QStringList CMakeRunConfiguration::dumperLibraryLocations() const
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocationsByInstallData(qtInstallData); return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocationsByInstallData(qtInstallData);
} }
ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const Utils::Environment CMakeRunConfiguration::baseEnvironment() const
{ {
ProjectExplorer::Environment env; Utils::Environment env;
if (m_baseEnvironmentBase == CMakeRunConfiguration::CleanEnvironmentBase) { if (m_baseEnvironmentBase == CMakeRunConfiguration::CleanEnvironmentBase) {
// Nothing // Nothing
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = Utils::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
env = activeBuildConfiguration()->environment(); env = activeBuildConfiguration()->environment();
} }
@@ -276,19 +275,19 @@ CMakeRunConfiguration::BaseEnvironmentBase CMakeRunConfiguration::baseEnvironmen
return m_baseEnvironmentBase; return m_baseEnvironmentBase;
} }
ProjectExplorer::Environment CMakeRunConfiguration::environment() const Utils::Environment CMakeRunConfiguration::environment() const
{ {
ProjectExplorer::Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
QList<ProjectExplorer::EnvironmentItem> CMakeRunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> CMakeRunConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_userEnvironmentChanges;
} }
void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff) void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges != diff) { if (m_userEnvironmentChanges != diff) {
m_userEnvironmentChanges = diff; m_userEnvironmentChanges = diff;
@@ -327,7 +326,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
fl->setMargin(0); fl->setMargin(0);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QLineEdit *argumentsLineEdit = new QLineEdit(); QLineEdit *argumentsLineEdit = new QLineEdit();
argumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(cmakeRunConfiguration->commandLineArguments())); argumentsLineEdit->setText(Utils::Environment::joinArgumentList(cmakeRunConfiguration->commandLineArguments()));
connect(argumentsLineEdit, SIGNAL(textChanged(QString)), connect(argumentsLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(setArguments(QString))); this, SLOT(setArguments(QString)));
fl->addRow(tr("Arguments:"), argumentsLineEdit); fl->addRow(tr("Arguments:"), argumentsLineEdit);
@@ -426,7 +425,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
this, SLOT(workingDirectoryChanged(QString))); this, SLOT(workingDirectoryChanged(QString)));
connect(m_cmakeRunConfiguration, SIGNAL(baseEnvironmentChanged()), connect(m_cmakeRunConfiguration, SIGNAL(baseEnvironmentChanged()),
this, SLOT(baseEnvironmentChanged())); this, SLOT(baseEnvironmentChanged()));
connect(m_cmakeRunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)), connect(m_cmakeRunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged())); this, SLOT(userEnvironmentChangesChanged()));
} }

View File

@@ -31,9 +31,9 @@
#define CMAKERUNCONFIGURATION_H #define CMAKERUNCONFIGURATION_H
#include <projectexplorer/applicationrunconfiguration.h> #include <projectexplorer/applicationrunconfiguration.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/persistentsettings.h> #include <projectexplorer/persistentsettings.h>
#include <projectexplorer/environmenteditmodel.h> #include <projectexplorer/environmenteditmodel.h>
#include <utils/environment.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
@@ -69,7 +69,7 @@ public:
RunMode runMode() const; RunMode runMode() const;
QString workingDirectory() const; QString workingDirectory() const;
QStringList commandLineArguments() const; QStringList commandLineArguments() const;
ProjectExplorer::Environment environment() const; Utils::Environment environment() const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
void setExecutable(const QString &executable); void setExecutable(const QString &executable);
@@ -92,7 +92,7 @@ public:
signals: signals:
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
void workingDirectoryChanged(const QString&); void workingDirectoryChanged(const QString&);
private slots: private slots:
@@ -111,11 +111,11 @@ private:
BuildEnvironmentBase = 2}; BuildEnvironmentBase = 2};
void setBaseEnvironmentBase(BaseEnvironmentBase env); void setBaseEnvironmentBase(BaseEnvironmentBase env);
BaseEnvironmentBase baseEnvironmentBase() const; BaseEnvironmentBase baseEnvironmentBase() const;
ProjectExplorer::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
QString baseEnvironmentText() const; QString baseEnvironmentText() const;
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
RunMode m_runMode; RunMode m_runMode;
QString m_buildTarget; QString m_buildTarget;
@@ -123,7 +123,7 @@ private:
QString m_userWorkingDirectory; QString m_userWorkingDirectory;
QString m_title; QString m_title;
QString m_arguments; QString m_arguments;
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges; QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
BaseEnvironmentBase m_baseEnvironmentBase; BaseEnvironmentBase m_baseEnvironmentBase;
bool m_enabled; bool m_enabled;
}; };

View File

@@ -238,7 +238,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
void MakeStepConfigWidget::additionalArgumentsEdited() void MakeStepConfigWidget::additionalArgumentsEdited()
{ {
m_makeStep->setAdditionalArguments(Environment::parseCombinedArgString(m_additionalArguments->text())); m_makeStep->setAdditionalArguments(Utils::Environment::parseCombinedArgString(m_additionalArguments->text()));
updateDetails(); updateDetails();
} }
@@ -265,7 +265,7 @@ void MakeStepConfigWidget::init()
// and connect again // and connect again
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
m_additionalArguments->setText(Environment::joinArgumentList(m_makeStep->additionalArguments())); m_additionalArguments->setText(Utils::Environment::joinArgumentList(m_makeStep->additionalArguments()));
updateDetails(); updateDetails();
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject(); CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();

View File

@@ -53,7 +53,6 @@
#include <coreplugin/progressmanager/futureprogress.h> #include <coreplugin/progressmanager/futureprogress.h>
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -64,6 +63,7 @@
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <utils/environment.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -772,7 +772,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
? d->m_startParameters.attachPID : 0; ? d->m_startParameters.attachPID : 0;
if (d->m_startParameters.environment.empty()) if (d->m_startParameters.environment.empty())
d->m_startParameters.environment = Environment().toStringList(); d->m_startParameters.environment = Utils::Environment().toStringList();
if (d->m_startParameters.breakAtMain) if (d->m_startParameters.breakAtMain)
breakByFunctionMain(); breakByFunctionMain();

View File

@@ -46,7 +46,6 @@
#endif #endif
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -54,6 +53,7 @@
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication* #include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication*
#include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/fancymainwindow.h> #include <utils/fancymainwindow.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -479,7 +479,7 @@ QString DebuggerRunControl::displayName() const
return d->m_engine->startParameters().displayName; return d->m_engine->startParameters().displayName;
} }
void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env) void DebuggerRunControl::setCustomEnvironment(Utils::Environment env)
{ {
d->m_engine->startParameters().environment = env.toStringList(); d->m_engine->startParameters().environment = env.toStringList();
} }

View File

@@ -37,7 +37,7 @@
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
namespace ProjectExplorer { namespace Utils {
class Environment; class Environment;
} }
@@ -104,7 +104,7 @@ public:
void createEngine(const DebuggerStartParameters &startParameters); void createEngine(const DebuggerStartParameters &startParameters);
void setCustomEnvironment(ProjectExplorer::Environment env); void setCustomEnvironment(Utils::Environment env);
void setEnabledEngines(DebuggerEngineType enabledEngines); void setEnabledEngines(DebuggerEngineType enabledEngines);
void startFailed(); void startFailed();

View File

@@ -46,9 +46,9 @@
#include "watchutils.h" #include "watchutils.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/applicationlauncher.h> #include <projectexplorer/applicationlauncher.h>
#include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>

View File

@@ -84,9 +84,9 @@ bool GenericBuildConfiguration::fromMap(const QVariantMap &map)
return BuildConfiguration::fromMap(map); return BuildConfiguration::fromMap(map);
} }
ProjectExplorer::Environment GenericBuildConfiguration::environment() const Utils::Environment GenericBuildConfiguration::environment() const
{ {
return ProjectExplorer::Environment::systemEnvironment(); return Utils::Environment::systemEnvironment();
} }
QString GenericBuildConfiguration::buildDirectory() const QString GenericBuildConfiguration::buildDirectory() const

View File

@@ -49,7 +49,7 @@ public:
GenericTarget *genericTarget() const; GenericTarget *genericTarget() const;
virtual ProjectExplorer::Environment environment() const; virtual Utils::Environment environment() const;
virtual QString buildDirectory() const; virtual QString buildDirectory() const;
QString rawBuildDirectory() const; QString rawBuildDirectory() const;

View File

@@ -247,7 +247,7 @@ void GenericMakeStepConfigWidget::init()
m_ui->makeLineEdit->setText(makeCommand); m_ui->makeLineEdit->setText(makeCommand);
const QStringList &makeArguments = m_makeStep->m_makeArguments; const QStringList &makeArguments = m_makeStep->m_makeArguments;
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments)); m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
// Disconnect to make the changes to the items // Disconnect to make the changes to the items
disconnect(m_ui->targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); disconnect(m_ui->targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
@@ -267,7 +267,7 @@ void GenericMakeStepConfigWidget::updateDetails()
{ {
m_summaryText = tr("<b>Make:</b> %1 %2") m_summaryText = tr("<b>Make:</b> %1 %2")
.arg(m_makeStep->makeCommand(), .arg(m_makeStep->makeCommand(),
ProjectExplorer::Environment::joinArgumentList(m_makeStep->replacedArguments())); Utils::Environment::joinArgumentList(m_makeStep->replacedArguments()));
emit updateSummary(); emit updateSummary();
} }
@@ -291,7 +291,7 @@ void GenericMakeStepConfigWidget::makeLineEditTextEdited()
void GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited() void GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited()
{ {
m_makeStep->m_makeArguments = m_makeStep->m_makeArguments =
ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text()); Utils::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text());
updateDetails(); updateDetails();
} }

View File

@@ -54,8 +54,6 @@
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <vcsbase/vcsbaseplugin.h> #include <vcsbase/vcsbaseplugin.h>
#include <projectexplorer/environment.h>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtCore/QTemporaryFile> #include <QtCore/QTemporaryFile>
#include <QtCore/QTime> #include <QtCore/QTime>

View File

@@ -124,7 +124,7 @@ void AbstractProcessStep::setIgnoreReturnValue(bool b)
m_ignoreReturnValue = b; m_ignoreReturnValue = b;
} }
void AbstractProcessStep::setEnvironment(Environment env) void AbstractProcessStep::setEnvironment(Utils::Environment env)
{ {
m_environment = env; m_environment = env;
} }

View File

@@ -31,7 +31,8 @@
#define ABSTRACTPROCESSSTEP_H #define ABSTRACTPROCESSSTEP_H
#include "buildstep.h" #include "buildstep.h"
#include "environment.h"
#include <utils/environment.h>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QProcess> #include <QtCore/QProcess>
@@ -104,7 +105,7 @@ public:
void setIgnoreReturnValue(bool b); void setIgnoreReturnValue(bool b);
/// Set the Environment for running the command /// Set the Environment for running the command
/// should be called from init() /// should be called from init()
void setEnvironment(Environment env); void setEnvironment(Utils::Environment env);
QString workingDirectory() const; QString workingDirectory() const;
@@ -159,7 +160,7 @@ private:
bool m_ignoreReturnValue; bool m_ignoreReturnValue;
QProcess *m_process; QProcess *m_process;
QEventLoop *m_eventLoop; QEventLoop *m_eventLoop;
ProjectExplorer::Environment m_environment; Utils::Environment m_environment;
ProjectExplorer::IOutputParser *m_outputParserChain; ProjectExplorer::IOutputParser *m_outputParserChain;
}; };

View File

@@ -35,9 +35,11 @@
#include "runconfiguration.h" #include "runconfiguration.h"
#include "applicationlauncher.h" #include "applicationlauncher.h"
namespace ProjectExplorer { namespace Utils {
class Environment; class Environment;
}
namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT LocalApplicationRunConfiguration : public RunConfiguration class PROJECTEXPLORER_EXPORT LocalApplicationRunConfiguration : public RunConfiguration
{ {
@@ -53,7 +55,7 @@ public:
virtual RunMode runMode() const = 0; virtual RunMode runMode() const = 0;
virtual QString workingDirectory() const = 0; virtual QString workingDirectory() const = 0;
virtual QStringList commandLineArguments() const = 0; virtual QStringList commandLineArguments() const = 0;
virtual Environment environment() const = 0; virtual Utils::Environment environment() const = 0;
virtual QString dumperLibrary() const = 0; virtual QString dumperLibrary() const = 0;
virtual QStringList dumperLibraryLocations() const = 0; virtual QStringList dumperLibraryLocations() const = 0;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0;

View File

@@ -98,7 +98,7 @@ QVariantMap BuildConfiguration::toMap() const
{ {
QVariantMap map(ProjectConfiguration::toMap()); QVariantMap map(ProjectConfiguration::toMap());
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment); map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges)); map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), m_stepLists.count()); map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), m_stepLists.count());
for (int i = 0; i < m_stepLists.count(); ++i) for (int i = 0; i < m_stepLists.count(); ++i)
@@ -110,7 +110,7 @@ QVariantMap BuildConfiguration::toMap() const
bool BuildConfiguration::fromMap(const QVariantMap &map) bool BuildConfiguration::fromMap(const QVariantMap &map)
{ {
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool(); m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
m_userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList()); m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
qDeleteAll(m_stepLists); qDeleteAll(m_stepLists);
m_stepLists.clear(); m_stepLists.clear();
@@ -143,11 +143,11 @@ Target *BuildConfiguration::target() const
return static_cast<Target *>(parent()); return static_cast<Target *>(parent());
} }
Environment BuildConfiguration::baseEnvironment() const Utils::Environment BuildConfiguration::baseEnvironment() const
{ {
Environment result; Utils::Environment result;
if (useSystemEnvironment()) if (useSystemEnvironment())
result = Environment(QProcess::systemEnvironment()); result = Utils::Environment(QProcess::systemEnvironment());
result.set(QLatin1String("BUILDDIR"), QDir::toNativeSeparators(target()->project()->projectDirectory())); result.set(QLatin1String("BUILDDIR"), QDir::toNativeSeparators(target()->project()->projectDirectory()));
result.set(QLatin1String("SOURCEDIR"), QDir::toNativeSeparators(target()->project()->projectDirectory())); result.set(QLatin1String("SOURCEDIR"), QDir::toNativeSeparators(target()->project()->projectDirectory()));
@@ -163,9 +163,9 @@ QString BuildConfiguration::baseEnvironmentText() const
return tr("Clean Environment"); return tr("Clean Environment");
} }
Environment BuildConfiguration::environment() const Utils::Environment BuildConfiguration::environment() const
{ {
Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
@@ -183,12 +183,12 @@ bool BuildConfiguration::useSystemEnvironment() const
return !m_clearSystemEnvironment; return !m_clearSystemEnvironment;
} }
QList<EnvironmentItem> BuildConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> BuildConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_userEnvironmentChanges;
} }
void BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff) void BuildConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges == diff) if (m_userEnvironmentChanges == diff)
return; return;

View File

@@ -31,7 +31,8 @@
#define BUILDCONFIGURATION_H #define BUILDCONFIGURATION_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "environment.h"
#include <utils/environment.h>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
@@ -57,11 +58,11 @@ public:
virtual QString buildDirectory() const = 0; virtual QString buildDirectory() const = 0;
// TODO: Maybe the BuildConfiguration is not the best place for the environment // TODO: Maybe the BuildConfiguration is not the best place for the environment
virtual Environment baseEnvironment() const; virtual Utils::Environment baseEnvironment() const;
QString baseEnvironmentText() const; QString baseEnvironmentText() const;
Environment environment() const; Utils::Environment environment() const;
void setUserEnvironmentChanges(const QList<EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
QList<EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
bool useSystemEnvironment() const; bool useSystemEnvironment() const;
void setUseSystemEnvironment(bool b); void setUseSystemEnvironment(bool b);
@@ -93,7 +94,7 @@ protected:
private: private:
bool m_clearSystemEnvironment; bool m_clearSystemEnvironment;
QList<EnvironmentItem> m_userEnvironmentChanges; QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
QList<BuildStepList *> m_stepLists; QList<BuildStepList *> m_stepLists;
}; };

View File

@@ -28,7 +28,8 @@
**************************************************************************/ **************************************************************************/
#include "cesdkhandler.h" #include "cesdkhandler.h"
#include "environment.h"
#include <utils/environment.h>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -36,7 +37,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
using ProjectExplorer::Environment; using Utils::Environment;
CeSdkInfo::CeSdkInfo() CeSdkInfo::CeSdkInfo()
: m_major(0), m_minor(0) : m_major(0), m_minor(0)

View File

@@ -38,8 +38,11 @@
#define VCINSTALL_MACRO "$(VCInstallDir)" #define VCINSTALL_MACRO "$(VCInstallDir)"
#define VSINSTALL_MACRO "$(VSInstallDir)" #define VSINSTALL_MACRO "$(VSInstallDir)"
namespace ProjectExplorer { namespace Utils {
class Environment; class Environment;
}
namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT CeSdkInfo class PROJECTEXPLORER_EXPORT CeSdkInfo
{ {
@@ -49,7 +52,7 @@ public:
inline QString binPath(); inline QString binPath();
inline QString includePath(); inline QString includePath();
inline QString libPath(); inline QString libPath();
void addToEnvironment(ProjectExplorer::Environment &env); void addToEnvironment(Utils::Environment &env);
inline bool isValid(); inline bool isValid();
inline int majorVersion(); inline int majorVersion();
inline int minorVersion(); inline int minorVersion();

View File

@@ -28,7 +28,6 @@
**************************************************************************/ **************************************************************************/
#include "customexecutablerunconfiguration.h" #include "customexecutablerunconfiguration.h"
#include "environment.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
@@ -37,6 +36,7 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/environment.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/debuggerlanguagechooser.h> #include <utils/debuggerlanguagechooser.h>
@@ -187,7 +187,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()), connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()),
this, SLOT(baseEnvironmentChanged())); this, SLOT(baseEnvironmentChanged()));
connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)), connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged())); this, SLOT(userEnvironmentChangesChanged()));
} }
@@ -273,13 +273,12 @@ void CustomExecutableConfigurationWidget::changed()
if (!executable.isEmpty()) if (!executable.isEmpty())
text = tr("Running executable: <b>%1</b> %2"). text = tr("Running executable: <b>%1</b> %2").
arg(executable, arg(executable,
ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); Utils::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
// We triggered the change, don't update us // We triggered the change, don't update us
if (m_ignoreChange) if (m_ignoreChange)
return; return;
m_executableChooser->setPath(executable); m_executableChooser->setPath(executable);
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory()); m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console); m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
} }
@@ -347,7 +346,7 @@ QString CustomExecutableRunConfiguration::executable() const
{ {
QString exec; QString exec;
if (!m_executable.isEmpty() && QDir::isRelativePath(m_executable)) { if (!m_executable.isEmpty() && QDir::isRelativePath(m_executable)) {
Environment env = environment(); Utils::Environment env = environment();
exec = env.searchInPath(m_executable); exec = env.searchInPath(m_executable);
if (exec.isEmpty()) if (exec.isEmpty())
exec = QDir::cleanPath(workingDirectory() + QLatin1Char('/') + m_executable); exec = QDir::cleanPath(workingDirectory() + QLatin1Char('/') + m_executable);
@@ -431,13 +430,13 @@ QString CustomExecutableRunConfiguration::baseEnvironmentText() const
return QString(); return QString();
} }
ProjectExplorer::Environment CustomExecutableRunConfiguration::baseEnvironment() const Utils::Environment CustomExecutableRunConfiguration::baseEnvironment() const
{ {
ProjectExplorer::Environment env; Utils::Environment env;
if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::CleanEnvironmentBase) { if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::CleanEnvironmentBase) {
// Nothing // Nothing
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = Utils::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
if (activeBuildConfiguration()) if (activeBuildConfiguration())
env = activeBuildConfiguration()->environment(); env = activeBuildConfiguration()->environment();
@@ -458,19 +457,19 @@ CustomExecutableRunConfiguration::BaseEnvironmentBase CustomExecutableRunConfigu
return m_baseEnvironmentBase; return m_baseEnvironmentBase;
} }
ProjectExplorer::Environment CustomExecutableRunConfiguration::environment() const Utils::Environment CustomExecutableRunConfiguration::environment() const
{ {
ProjectExplorer::Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
QList<ProjectExplorer::EnvironmentItem> CustomExecutableRunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> CustomExecutableRunConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_userEnvironmentChanges;
} }
void CustomExecutableRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff) void CustomExecutableRunConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges != diff) { if (m_userEnvironmentChanges != diff) {
m_userEnvironmentChanges = diff; m_userEnvironmentChanges = diff;
@@ -493,7 +492,7 @@ QVariantMap CustomExecutableRunConfiguration::toMap() const
map.insert(QLatin1String(ARGUMENTS_KEY), m_cmdArguments); map.insert(QLatin1String(ARGUMENTS_KEY), m_cmdArguments);
map.insert(QLatin1String(WORKING_DIRECTORY_KEY), m_workingDirectory); map.insert(QLatin1String(WORKING_DIRECTORY_KEY), m_workingDirectory);
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console); map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges)); map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(m_baseEnvironmentBase)); map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(m_baseEnvironmentBase));
return map; return map;
} }
@@ -504,7 +503,7 @@ bool CustomExecutableRunConfiguration::fromMap(const QVariantMap &map)
m_cmdArguments = map.value(QLatin1String(ARGUMENTS_KEY)).toStringList(); m_cmdArguments = map.value(QLatin1String(ARGUMENTS_KEY)).toStringList();
m_workingDirectory = map.value(QLatin1String(WORKING_DIRECTORY_KEY)).toString(); m_workingDirectory = map.value(QLatin1String(WORKING_DIRECTORY_KEY)).toString();
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool() ? Console : Gui; m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool() ? Console : Gui;
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList()); m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(CustomExecutableRunConfiguration::BuildEnvironmentBase)).toInt()); m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(CustomExecutableRunConfiguration::BuildEnvironmentBase)).toInt());
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
@@ -522,7 +521,7 @@ void CustomExecutableRunConfiguration::setExecutable(const QString &executable)
void CustomExecutableRunConfiguration::setCommandLineArguments(const QString &commandLineArguments) void CustomExecutableRunConfiguration::setCommandLineArguments(const QString &commandLineArguments)
{ {
m_cmdArguments = ProjectExplorer::Environment::parseCombinedArgString(commandLineArguments); m_cmdArguments = Utils::Environment::parseCombinedArgString(commandLineArguments);
emit changed(); emit changed();
} }

View File

@@ -92,7 +92,7 @@ public:
QString workingDirectory() const; QString workingDirectory() const;
QString baseWorkingDirectory() const; QString baseWorkingDirectory() const;
QStringList commandLineArguments() const; QStringList commandLineArguments() const;
Environment environment() const; Utils::Environment environment() const;
QWidget *createConfigurationWidget(); QWidget *createConfigurationWidget();
QString dumperLibrary() const; QString dumperLibrary() const;
@@ -106,7 +106,7 @@ signals:
void changed(); void changed();
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
private slots: private slots:
void activeBuildConfigurationChanged(); void activeBuildConfigurationChanged();
@@ -124,10 +124,10 @@ private:
BuildEnvironmentBase = 2}; BuildEnvironmentBase = 2};
void setBaseEnvironmentBase(BaseEnvironmentBase env); void setBaseEnvironmentBase(BaseEnvironmentBase env);
BaseEnvironmentBase baseEnvironmentBase() const; BaseEnvironmentBase baseEnvironmentBase() const;
ProjectExplorer::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
QString baseEnvironmentText() const; QString baseEnvironmentText() const;
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
void setExecutable(const QString &executable); void setExecutable(const QString &executable);
void setCommandLineArguments(const QString &commandLineArguments); void setCommandLineArguments(const QString &commandLineArguments);
@@ -140,7 +140,7 @@ private:
RunMode m_runMode; RunMode m_runMode;
bool m_userSetName; bool m_userSetName;
QString m_userName; QString m_userName;
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges; QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
BaseEnvironmentBase m_baseEnvironmentBase; BaseEnvironmentBase m_baseEnvironmentBase;
ProjectExplorer::BuildConfiguration *m_lastActiveBuildConfiguration; ProjectExplorer::BuildConfiguration *m_lastActiveBuildConfiguration;
}; };

View File

@@ -43,7 +43,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
QString DebuggingHelperLibrary::findSystemQt(const Environment &env) QString DebuggingHelperLibrary::findSystemQt(const Utils::Environment &env)
{ {
QStringList paths = env.path(); QStringList paths = env.path();
foreach (const QString &path, paths) { foreach (const QString &path, paths) {
@@ -194,7 +194,7 @@ QString DebuggingHelperLibrary::copyDebuggingHelperLibrary(const QString &qtInst
QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec, const QString &qmakeCommand, const QString &mkspec,
const Environment &env, const QString &targetMode) const Utils::Environment &env, const QString &targetMode)
{ {
QString output; QString output;
const QChar newline = QLatin1Char('\n'); const QChar newline = QLatin1Char('\n');

View File

@@ -30,9 +30,10 @@
#ifndef DEBUGGINGHELPER_H #ifndef DEBUGGINGHELPER_H
#define DEBUGGINGHELPER_H #define DEBUGGINGHELPER_H
#include "environment.h"
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <utils/environment.h>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
@@ -42,7 +43,7 @@ class PROJECTEXPLORER_EXPORT DebuggingHelperLibrary
public: public:
// returns the full path to the first qmake, qmake-qt4, qmake4 that has // returns the full path to the first qmake, qmake-qt4, qmake4 that has
// at least version 2.0.0 and thus is a qt4 qmake // at least version 2.0.0 and thus is a qt4 qmake
static QString findSystemQt(const Environment &env); static QString findSystemQt(const Utils::Environment &env);
// returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
static QStringList possibleQMakeCommands(); static QStringList possibleQMakeCommands();
// return true if the qmake at qmakePath is qt4 (used by QtVersion) // return true if the qmake at qmakePath is qt4 (used by QtVersion)
@@ -53,7 +54,7 @@ public:
// Build the helpers and return the output log/errormessage. // Build the helpers and return the output log/errormessage.
static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec, const Environment &env, const QString &targetMode); const QString &qmakeCommand, const QString &mkspec, const Utils::Environment &env, const QString &targetMode);
// Copy the source files to a target location and return the chosen target location. // Copy the source files to a target location and return the chosen target location.
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, QString *errorMessage); static QString copyDebuggingHelperLibrary(const QString &qtInstallData, QString *errorMessage);

View File

@@ -31,7 +31,8 @@
#define PROJECTEXPLORER_DEPLOYCONFIGURATION_H #define PROJECTEXPLORER_DEPLOYCONFIGURATION_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "environment.h"
#include "projectconfiguration.h"
#include "namedwidget.h" #include "namedwidget.h"
#include <QtCore/QString> #include <QtCore/QString>
@@ -39,8 +40,6 @@
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QObject> #include <QtCore/QObject>
#include "projectconfiguration.h"
namespace ProjectExplorer { namespace ProjectExplorer {
class BuildStepList; class BuildStepList;

View File

@@ -28,9 +28,9 @@
**************************************************************************/ **************************************************************************/
#include "environmenteditmodel.h" #include "environmenteditmodel.h"
#include "environment.h"
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/environment.h>
#include <QtGui/QTextDocument> #include <QtGui/QTextDocument>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
@@ -64,7 +64,7 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex addVariable(); QModelIndex addVariable();
QModelIndex addVariable(const EnvironmentItem &item); QModelIndex addVariable(const Utils::EnvironmentItem &item);
void resetVariable(const QString &name); void resetVariable(const QString &name);
void unsetVariable(const QString &name); void unsetVariable(const QString &name);
bool canUnset(const QString &name); bool canUnset(const QString &name);
@@ -72,9 +72,9 @@ public:
QString indexToVariable(const QModelIndex &index) const; QString indexToVariable(const QModelIndex &index) const;
QModelIndex variableToIndex(const QString &name) const; QModelIndex variableToIndex(const QString &name) const;
bool changes(const QString &key) const; bool changes(const QString &key) const;
void setBaseEnvironment(const ProjectExplorer::Environment &env); void setBaseEnvironment(const Utils::Environment &env);
QList<EnvironmentItem> userChanges() const; QList<Utils::EnvironmentItem> userChanges() const;
void setUserChanges(QList<EnvironmentItem> list); void setUserChanges(QList<Utils::EnvironmentItem> list);
signals: signals:
void userChangesChanged(); void userChangesChanged();
@@ -89,9 +89,9 @@ private:
int findInResultInsertPosition(const QString &name) const; int findInResultInsertPosition(const QString &name) const;
int findInResult(const QString &name) const; int findInResult(const QString &name) const;
ProjectExplorer::Environment m_baseEnvironment; Utils::Environment m_baseEnvironment;
ProjectExplorer::Environment m_resultEnvironment; Utils::Environment m_resultEnvironment;
QList<EnvironmentItem> m_items; QList<Utils::EnvironmentItem> m_items;
}; };
QString EnvironmentModel::indexToVariable(const QModelIndex &index) const QString EnvironmentModel::indexToVariable(const QModelIndex &index) const
@@ -105,14 +105,14 @@ void EnvironmentModel::updateResultEnvironment()
m_resultEnvironment.modify(m_items); m_resultEnvironment.modify(m_items);
// Add removed variables again and mark them as "<UNSET>" so // Add removed variables again and mark them as "<UNSET>" so
// that the user can actually see those removals: // that the user can actually see those removals:
foreach (const EnvironmentItem &item, m_items) { foreach (const Utils::EnvironmentItem &item, m_items) {
if (item.unset) { if (item.unset) {
m_resultEnvironment.set(item.name, tr("<UNSET>")); m_resultEnvironment.set(item.name, tr("<UNSET>"));
} }
} }
} }
void EnvironmentModel::setBaseEnvironment(const ProjectExplorer::Environment &env) void EnvironmentModel::setBaseEnvironment(const Utils::Environment &env)
{ {
if (m_baseEnvironment == env) if (m_baseEnvironment == env)
return; return;
@@ -206,7 +206,7 @@ QModelIndex EnvironmentModel::variableToIndex(const QString &name) const
int EnvironmentModel::findInResult(const QString &name) const int EnvironmentModel::findInResult(const QString &name) const
{ {
Environment::const_iterator it; Utils::Environment::const_iterator it;
int i = 0; int i = 0;
for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i) for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
if (m_resultEnvironment.key(it) == name) if (m_resultEnvironment.key(it) == name)
@@ -216,7 +216,7 @@ int EnvironmentModel::findInResult(const QString &name) const
int EnvironmentModel::findInResultInsertPosition(const QString &name) const int EnvironmentModel::findInResultInsertPosition(const QString &name) const
{ {
Environment::const_iterator it; Utils::Environment::const_iterator it;
int i = 0; int i = 0;
for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i) for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
if (m_resultEnvironment.key(it) > name) if (m_resultEnvironment.key(it) > name)
@@ -248,7 +248,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
if (m_resultEnvironment.hasKey(newName)) if (m_resultEnvironment.hasKey(newName))
return false; return false;
EnvironmentItem newVariable(newName, oldValue); Utils::EnvironmentItem newVariable(newName, oldValue);
if (changesPos != -1) if (changesPos != -1)
resetVariable(oldName); // restore the original base variable again resetVariable(oldName); // restore the original base variable again
@@ -271,7 +271,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
} }
} else { } else {
// Add a new change item: // Add a new change item:
m_items.append(EnvironmentItem(oldName, stringValue)); m_items.append(Utils::EnvironmentItem(oldName, stringValue));
} }
updateResultEnvironment(); updateResultEnvironment();
emit dataChanged(index, index); emit dataChanged(index, index);
@@ -283,13 +283,13 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
QModelIndex EnvironmentModel::addVariable() QModelIndex EnvironmentModel::addVariable()
{ {
return addVariable(EnvironmentItem(tr("<VARIABLE>", //: Name when inserting a new variable
"Name when inserting a new variable"), return addVariable(Utils::EnvironmentItem(tr("<VARIABLE>"),
tr("<VALUE>", //: Value when inserting a new variable
"Value when inserting a new variable"))); tr("<VALUE>")));
} }
QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item) QModelIndex EnvironmentModel::addVariable(const Utils::EnvironmentItem &item)
{ {
int insertPos = findInResultInsertPosition(item.name); int insertPos = findInResultInsertPosition(item.name);
@@ -365,7 +365,7 @@ void EnvironmentModel::unsetVariable(const QString &name)
emit userChangesChanged(); emit userChangesChanged();
return; return;
} }
EnvironmentItem item(name, QString()); Utils::EnvironmentItem item(name, QString());
item.unset = true; item.unset = true;
m_items.append(item); m_items.append(item);
updateResultEnvironment(); updateResultEnvironment();
@@ -387,12 +387,12 @@ bool EnvironmentModel::canReset(const QString &name)
return m_baseEnvironment.hasKey(name); return m_baseEnvironment.hasKey(name);
} }
QList<EnvironmentItem> EnvironmentModel::userChanges() const QList<Utils::EnvironmentItem> EnvironmentModel::userChanges() const
{ {
return m_items; return m_items;
} }
void EnvironmentModel::setUserChanges(QList<EnvironmentItem> list) void EnvironmentModel::setUserChanges(QList<Utils::EnvironmentItem> list)
{ {
// We assume nobody is reordering the items here. // We assume nobody is reordering the items here.
if (list == m_items) if (list == m_items)
@@ -517,7 +517,7 @@ void EnvironmentWidget::focusIndex(const QModelIndex &index)
d->m_environmentView->setFocus(); d->m_environmentView->setFocus();
} }
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env) void EnvironmentWidget::setBaseEnvironment(const Utils::Environment &env)
{ {
d->m_model->setBaseEnvironment(env); d->m_model->setBaseEnvironment(env);
} }
@@ -528,12 +528,12 @@ void EnvironmentWidget::setBaseEnvironmentText(const QString &text)
updateSummaryText(); updateSummaryText();
} }
QList<EnvironmentItem> EnvironmentWidget::userChanges() const QList<Utils::EnvironmentItem> EnvironmentWidget::userChanges() const
{ {
return d->m_model->userChanges(); return d->m_model->userChanges();
} }
void EnvironmentWidget::setUserChanges(const QList<EnvironmentItem> &list) void EnvironmentWidget::setUserChanges(const QList<Utils::EnvironmentItem> &list)
{ {
d->m_model->setUserChanges(list); d->m_model->setUserChanges(list);
updateSummaryText(); updateSummaryText();
@@ -542,8 +542,8 @@ void EnvironmentWidget::setUserChanges(const QList<EnvironmentItem> &list)
void EnvironmentWidget::updateSummaryText() void EnvironmentWidget::updateSummaryText()
{ {
QString text; QString text;
const QList<EnvironmentItem> &list = d->m_model->userChanges(); const QList<Utils::EnvironmentItem> &list = d->m_model->userChanges();
foreach (const EnvironmentItem &item, list) { foreach (const Utils::EnvironmentItem &item, list) {
if (item.name != EnvironmentModel::tr("<VARIABLE>")) { if (item.name != EnvironmentModel::tr("<VARIABLE>")) {
text.append("<br>"); text.append("<br>");
if (item.unset) if (item.unset)

View File

@@ -36,10 +36,13 @@
QT_FORWARD_DECLARE_CLASS(QModelIndex) QT_FORWARD_DECLARE_CLASS(QModelIndex)
namespace Utils {
class Environment;
class EnvironmentItem;
}
namespace ProjectExplorer { namespace ProjectExplorer {
struct EnvironmentWidgetPrivate; struct EnvironmentWidgetPrivate;
class Environment;
struct EnvironmentItem;
class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QWidget class PROJECTEXPLORER_EXPORT EnvironmentWidget : public QWidget
{ {
@@ -49,10 +52,10 @@ public:
virtual ~EnvironmentWidget(); virtual ~EnvironmentWidget();
void setBaseEnvironmentText(const QString &text); void setBaseEnvironmentText(const QString &text);
void setBaseEnvironment(const ProjectExplorer::Environment &env); void setBaseEnvironment(const Utils::Environment &env);
QList<EnvironmentItem> userChanges() const; QList<Utils::EnvironmentItem> userChanges() const;
void setUserChanges(const QList<EnvironmentItem> &list); void setUserChanges(const QList<Utils::EnvironmentItem> &list);
signals: signals:
void userChangesChanged(); void userChangesChanged();

View File

@@ -30,7 +30,6 @@
#include "foldernavigationwidget.h" #include "foldernavigationwidget.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include "environment.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
@@ -38,6 +37,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <utils/environment.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/unixutils.h> #include <utils/unixutils.h>
@@ -391,7 +391,7 @@ void FolderNavigationWidget::showInGraphicalShell(QWidget *parent, const QString
{ {
// Mac, Windows support folder or file. // Mac, Windows support folder or file.
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); const QString explorer = Utils::Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
if (explorer.isEmpty()) { if (explorer.isEmpty()) {
QMessageBox::warning(parent, QMessageBox::warning(parent,
tr("Launching Windows Explorer Failed"), tr("Launching Windows Explorer Failed"),

View File

@@ -96,7 +96,7 @@ private:
QString m_command; QString m_command;
QStringList m_arguments; QStringList m_arguments;
QString m_workingDirectory; QString m_workingDirectory;
Environment m_env; Utils::Environment m_env;
bool m_enabled; bool m_enabled;
}; };

View File

@@ -47,7 +47,6 @@ HEADERS += projectexplorer.h \
allprojectsfind.h \ allprojectsfind.h \
buildstep.h \ buildstep.h \
buildconfiguration.h \ buildconfiguration.h \
environment.h \
iprojectproperties.h \ iprojectproperties.h \
buildsettingspropertiespage.h \ buildsettingspropertiespage.h \
environmenteditmodel.h \ environmenteditmodel.h \
@@ -126,7 +125,6 @@ SOURCES += projectexplorer.cpp \
pluginfilefactory.cpp \ pluginfilefactory.cpp \
buildstep.cpp \ buildstep.cpp \
buildconfiguration.cpp \ buildconfiguration.cpp \
environment.cpp \
buildsettingspropertiespage.cpp \ buildsettingspropertiespage.cpp \
environmenteditmodel.cpp \ environmenteditmodel.cpp \
processstep.cpp \ processstep.cpp \

View File

@@ -35,10 +35,12 @@
QT_FORWARD_DECLARE_CLASS(QIcon) QT_FORWARD_DECLARE_CLASS(QIcon)
namespace ProjectExplorer { namespace Utils {
class RunConfiguration;
class Environment; class Environment;
}
namespace ProjectExplorer {
class RunConfiguration;
class BuildConfiguration; class BuildConfiguration;
class DeployConfiguration; class DeployConfiguration;
class IBuildConfigurationFactory; class IBuildConfigurationFactory;

View File

@@ -224,14 +224,14 @@ static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env
QByteArray GccToolChain::predefinedMacros() QByteArray GccToolChain::predefinedMacros()
{ {
if (m_predefinedMacros.isEmpty()) { if (m_predefinedMacros.isEmpty()) {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
m_predefinedMacros = gccPredefinedMacros(m_gcc, env.toStringList()); m_predefinedMacros = gccPredefinedMacros(m_gcc, env.toStringList());
} }
return m_predefinedMacros; return m_predefinedMacros;
} }
static QList<HeaderPath> gccSystemHeaderPaths(const QString &gcc, ProjectExplorer::Environment env) static QList<HeaderPath> gccSystemHeaderPaths(const QString &gcc, Utils::Environment env)
{ {
QList<HeaderPath> systemHeaderPaths; QList<HeaderPath> systemHeaderPaths;
QStringList arguments; QStringList arguments;
@@ -300,14 +300,14 @@ static QList<HeaderPath> gccSystemHeaderPaths(const QString &gcc, ProjectExplore
QList<HeaderPath> GccToolChain::systemHeaderPaths() QList<HeaderPath> GccToolChain::systemHeaderPaths()
{ {
if (m_systemHeaderPaths.isEmpty()) { if (m_systemHeaderPaths.isEmpty()) {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
m_systemHeaderPaths = gccSystemHeaderPaths(m_gcc, env); m_systemHeaderPaths = gccSystemHeaderPaths(m_gcc, env);
} }
return m_systemHeaderPaths; return m_systemHeaderPaths;
} }
void GccToolChain::addToEnvironment(ProjectExplorer::Environment &env) void GccToolChain::addToEnvironment(Utils::Environment &env)
{ {
Q_UNUSED(env) Q_UNUSED(env)
} }
@@ -344,7 +344,7 @@ bool MinGWToolChain::equals(const ToolChain *other) const
return (m_mingwPath == o->m_mingwPath && this->GccToolChain::equals(other)); return (m_mingwPath == o->m_mingwPath && this->GccToolChain::equals(other));
} }
void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env) void MinGWToolChain::addToEnvironment(Utils::Environment &env)
{ {
if (debug) if (debug)
qDebug() << "MinGWToolChain::addToEnvironment" << m_mingwPath; qDebug() << "MinGWToolChain::addToEnvironment" << m_mingwPath;
@@ -696,7 +696,7 @@ static QByteArray msvcPredefinedMacros(const QStringList &env)
QByteArray MSVCToolChain::predefinedMacros() QByteArray MSVCToolChain::predefinedMacros()
{ {
if (m_predefinedMacros.isEmpty()) { if (m_predefinedMacros.isEmpty()) {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
m_predefinedMacros = msvcPredefinedMacros(env.toStringList()); m_predefinedMacros = msvcPredefinedMacros(env.toStringList());
} }
@@ -706,7 +706,7 @@ QByteArray MSVCToolChain::predefinedMacros()
QList<HeaderPath> MSVCToolChain::systemHeaderPaths() QList<HeaderPath> MSVCToolChain::systemHeaderPaths()
{ {
//TODO fix this code //TODO fix this code
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
QList<HeaderPath> headerPaths; QList<HeaderPath> headerPaths;
foreach(const QString &path, env.value("INCLUDE").split(QLatin1Char(';'))) { foreach(const QString &path, env.value("INCLUDE").split(QLatin1Char(';'))) {
@@ -717,7 +717,7 @@ QList<HeaderPath> MSVCToolChain::systemHeaderPaths()
MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSetting(const QString &varsBat, MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSetting(const QString &varsBat,
const QStringList &args, const QStringList &args,
const ProjectExplorer::Environment &env) const Utils::Environment &env)
{ {
const StringStringPairList rc = readEnvironmentSettingI(varsBat, args, env); const StringStringPairList rc = readEnvironmentSettingI(varsBat, args, env);
if (debug) { if (debug) {
@@ -736,7 +736,7 @@ MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSetting(const
// Windows: Expand the delayed evaluation references returned by the // Windows: Expand the delayed evaluation references returned by the
// SDK setup scripts: "PATH=!Path!;foo". Some values might expand // SDK setup scripts: "PATH=!Path!;foo". Some values might expand
// to empty and should not be added // to empty and should not be added
static inline QString winExpandDelayedEnvReferences(QString in, const ProjectExplorer::Environment &env) static inline QString winExpandDelayedEnvReferences(QString in, const Utils::Environment &env)
{ {
const QChar exclamationMark = QLatin1Char('!'); const QChar exclamationMark = QLatin1Char('!');
for (int pos = 0; pos < in.size(); ) { for (int pos = 0; pos < in.size(); ) {
@@ -757,7 +757,7 @@ static inline QString winExpandDelayedEnvReferences(QString in, const ProjectExp
MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSettingI(const QString &varsBat, MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSettingI(const QString &varsBat,
const QStringList &args, const QStringList &args,
const ProjectExplorer::Environment &env) const Utils::Environment &env)
{ {
// Run the setup script and extract the variables // Run the setup script and extract the variables
if (!QFileInfo(varsBat).exists()) if (!QFileInfo(varsBat).exists())
@@ -818,7 +818,7 @@ MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSettingI(const
return rc; return rc;
} }
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env) void MSVCToolChain::addToEnvironment(Utils::Environment &env)
{ {
if (debug) if (debug)
qDebug() << "MSVCToolChain::addToEnvironment" << m_installation.name; qDebug() << "MSVCToolChain::addToEnvironment" << m_installation.name;
@@ -890,7 +890,7 @@ QByteArray WinCEToolChain::predefinedMacros()
QList<HeaderPath> WinCEToolChain::systemHeaderPaths() QList<HeaderPath> WinCEToolChain::systemHeaderPaths()
{ {
//TODO fix this code //TODO fix this code
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
QList<HeaderPath> headerPaths; QList<HeaderPath> headerPaths;
@@ -905,7 +905,7 @@ QList<HeaderPath> WinCEToolChain::systemHeaderPaths()
return headerPaths; return headerPaths;
} }
void WinCEToolChain::addToEnvironment(ProjectExplorer::Environment &env) void WinCEToolChain::addToEnvironment(Utils::Environment &env)
{ {
MSVCToolChain::addToEnvironment(env); MSVCToolChain::addToEnvironment(env);
QSettings registry(MSVC_RegKey, QSettings::NativeFormat); QSettings registry(MSVC_RegKey, QSettings::NativeFormat);

View File

@@ -31,7 +31,8 @@
#define TOOLCHAIN_H #define TOOLCHAIN_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "environment.h"
#include <utils/environment.h>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QPair> #include <QtCore/QPair>
@@ -39,7 +40,6 @@
namespace ProjectExplorer { namespace ProjectExplorer {
class Environment;
class IOutputParser; class IOutputParser;
class Project; class Project;
@@ -95,7 +95,7 @@ public:
virtual QByteArray predefinedMacros() = 0; virtual QByteArray predefinedMacros() = 0;
virtual QList<HeaderPath> systemHeaderPaths() = 0; virtual QList<HeaderPath> systemHeaderPaths() = 0;
virtual void addToEnvironment(ProjectExplorer::Environment &env) = 0; virtual void addToEnvironment(Utils::Environment &env) = 0;
virtual ToolChainType type() const = 0; virtual ToolChainType type() const = 0;
virtual QString makeCommand() const = 0; virtual QString makeCommand() const = 0;
virtual IOutputParser *outputParser() const = 0; virtual IOutputParser *outputParser() const = 0;
@@ -126,7 +126,7 @@ public:
GccToolChain(const QString &gcc); GccToolChain(const QString &gcc);
virtual QByteArray predefinedMacros(); virtual QByteArray predefinedMacros();
virtual QList<HeaderPath> systemHeaderPaths(); virtual QList<HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env); virtual void addToEnvironment(Utils::Environment &env);
virtual ToolChainType type() const; virtual ToolChainType type() const;
virtual QString makeCommand() const; virtual QString makeCommand() const;
virtual IOutputParser *outputParser() const; virtual IOutputParser *outputParser() const;
@@ -146,7 +146,7 @@ class PROJECTEXPLORER_EXPORT MinGWToolChain : public GccToolChain
{ {
public: public:
MinGWToolChain(const QString &gcc, const QString &mingwPath); MinGWToolChain(const QString &gcc, const QString &mingwPath);
virtual void addToEnvironment(ProjectExplorer::Environment &env); virtual void addToEnvironment(Utils::Environment &env);
virtual ToolChainType type() const; virtual ToolChainType type() const;
virtual QString makeCommand() const; virtual QString makeCommand() const;
virtual IOutputParser *outputParser() const; virtual IOutputParser *outputParser() const;
@@ -205,7 +205,7 @@ public:
bool amd64 = false); bool amd64 = false);
virtual QByteArray predefinedMacros(); virtual QByteArray predefinedMacros();
virtual QList<HeaderPath> systemHeaderPaths(); virtual QList<HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env); virtual void addToEnvironment(Utils::Environment &env);
virtual ToolChainType type() const; virtual ToolChainType type() const;
virtual QString makeCommand() const; virtual QString makeCommand() const;
virtual IOutputParser *outputParser() const; virtual IOutputParser *outputParser() const;
@@ -219,7 +219,7 @@ protected:
virtual bool equals(const ToolChain *other) const; virtual bool equals(const ToolChain *other) const;
static StringStringPairList readEnvironmentSetting(const QString &varsBat, static StringStringPairList readEnvironmentSetting(const QString &varsBat,
const QStringList &args, const QStringList &args,
const ProjectExplorer::Environment &env); const Utils::Environment &env);
QByteArray m_predefinedMacros; QByteArray m_predefinedMacros;
const Installation m_installation; const Installation m_installation;
@@ -227,11 +227,11 @@ protected:
private: private:
static StringStringPairList readEnvironmentSettingI(const QString &varsBat, static StringStringPairList readEnvironmentSettingI(const QString &varsBat,
const QStringList &args, const QStringList &args,
const ProjectExplorer::Environment &env); const Utils::Environment &env);
mutable StringStringPairList m_values; mutable StringStringPairList m_values;
mutable bool m_valuesSet; mutable bool m_valuesSet;
mutable ProjectExplorer::Environment m_lastEnvironment; mutable Utils::Environment m_lastEnvironment;
}; };
PROJECTEXPLORER_EXPORT QDebug operator<<(QDebug in, const MSVCToolChain::Installation &i); PROJECTEXPLORER_EXPORT QDebug operator<<(QDebug in, const MSVCToolChain::Installation &i);
@@ -244,7 +244,7 @@ public:
virtual QByteArray predefinedMacros(); virtual QByteArray predefinedMacros();
virtual QList<HeaderPath> systemHeaderPaths(); virtual QList<HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env); virtual void addToEnvironment(Utils::Environment &env);
virtual ToolChainType type() const; virtual ToolChainType type() const;
protected: protected:

View File

@@ -29,7 +29,7 @@
#include "qmljspreviewrunner.h" #include "qmljspreviewrunner.h"
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
@@ -49,7 +49,7 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
+ QString(qgetenv("PATH")); + QString(qgetenv("PATH"));
m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer")); m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
m_applicationLauncher.setEnvironment(environment.toStringList()); m_applicationLauncher.setEnvironment(environment.toStringList());
} }

View File

@@ -32,9 +32,9 @@
#include "qmlprojectconstants.h" #include "qmlprojectconstants.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/applicationlauncher.h> #include <projectexplorer/applicationlauncher.h>
#include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <debugger/debuggerrunner.h> #include <debugger/debuggerrunner.h>
@@ -56,7 +56,7 @@ namespace Internal {
QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode) QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode)
: RunControl(runConfiguration, mode) : RunControl(runConfiguration, mode)
{ {
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
m_applicationLauncher.setEnvironment(environment.toStringList()); m_applicationLauncher.setEnvironment(environment.toStringList());
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory()); m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
@@ -173,7 +173,7 @@ QWidget *QmlRunControlFactory::createConfigurationWidget(RunConfiguration *runCo
ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProjectRunConfiguration *runConfig) ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProjectRunConfiguration *runConfig)
{ {
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment environment = Utils::Environment::systemEnvironment();
Debugger::DebuggerStartParameters params; Debugger::DebuggerStartParameters params;
params.startMode = Debugger::StartInternal; params.startMode = Debugger::StartInternal;
params.executable = runConfig->viewerPath(); params.executable = runConfig->viewerPath();

View File

@@ -46,7 +46,6 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
using ProjectExplorer::Environment;
using ExtensionSystem::PluginManager; using ExtensionSystem::PluginManager;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
@@ -122,7 +121,7 @@ bool MakeStep::fromMap(const QVariantMap &map)
bool MakeStep::init() bool MakeStep::init()
{ {
Qt4BuildConfiguration *bc = qt4BuildConfiguration(); Qt4BuildConfiguration *bc = qt4BuildConfiguration();
Environment environment = bc->environment(); Utils::Environment environment = bc->environment();
setEnvironment(environment); setEnvironment(environment);
QString workingDirectory; QString workingDirectory;
@@ -284,7 +283,7 @@ void MakeStepConfigWidget::updateDetails()
if (!m_makeStep->m_makeCmd.isEmpty()) if (!m_makeStep->m_makeCmd.isEmpty())
makeCmd = m_makeStep->m_makeCmd; makeCmd = m_makeStep->m_makeCmd;
if (!QFileInfo(makeCmd).isAbsolute()) { if (!QFileInfo(makeCmd).isAbsolute()) {
Environment environment = bc->environment(); Utils::Environment environment = bc->environment();
// Try to detect command in environment // Try to detect command in environment
const QString tmp = environment.searchInPath(makeCmd); const QString tmp = environment.searchInPath(makeCmd);
if (tmp.isEmpty()) { if (tmp.isEmpty()) {
@@ -328,7 +327,7 @@ void MakeStepConfigWidget::userArgumentsChanged()
if (m_ignoreChange) if (m_ignoreChange)
return; return;
const QStringList &makeArguments = m_makeStep->userArguments(); const QStringList &makeArguments = m_makeStep->userArguments();
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments)); m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
updateDetails(); updateDetails();
} }
@@ -340,7 +339,7 @@ void MakeStepConfigWidget::init()
m_ui->makeLineEdit->setText(makeCmd); m_ui->makeLineEdit->setText(makeCmd);
const QStringList &makeArguments = m_makeStep->userArguments(); const QStringList &makeArguments = m_makeStep->userArguments();
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments)); m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
updateDetails(); updateDetails();
} }
@@ -354,7 +353,7 @@ void MakeStepConfigWidget::makeArgumentsLineEdited()
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_makeStep->setUserArguments( m_makeStep->setUserArguments(
ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text())); Utils::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text()));
m_ignoreChange = false; m_ignoreChange = false;
updateDetails(); updateDetails();
} }

View File

@@ -329,7 +329,7 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
void QMakeStepConfigWidget::init() void QMakeStepConfigWidget::init()
{ {
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments()); QString qmakeArgs = Utils::Environment::joinArgumentList(m_step->userArguments());
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs); m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
qmakeBuildConfigChanged(); qmakeBuildConfigChanged();
@@ -373,7 +373,7 @@ void QMakeStepConfigWidget::userArgumentsChanged()
{ {
if (m_ignoreChange) if (m_ignoreChange)
return; return;
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments()); QString qmakeArgs = Utils::Environment::joinArgumentList(m_step->userArguments());
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs); m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
updateSummaryLabel(); updateSummaryLabel();
updateEffectiveQMakeCall(); updateEffectiveQMakeCall();
@@ -383,7 +383,7 @@ void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_step->setUserArguments( m_step->setUserArguments(
ProjectExplorer::Environment::parseCombinedArgString(m_ui.qmakeAdditonalArgumentsLineEdit->text())); Utils::Environment::parseCombinedArgString(m_ui.qmakeAdditonalArgumentsLineEdit->text()));
m_ignoreChange = false; m_ignoreChange = false;
updateSummaryLabel(); updateSummaryLabel();
@@ -445,7 +445,7 @@ void QMakeStepConfigWidget::updateEffectiveQMakeCall()
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration(); Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
const QtVersion *qtVersion = qt4bc->qtVersion(); const QtVersion *qtVersion = qt4bc->qtVersion();
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName(); QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->allArguments())); m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + Utils::Environment::joinArgumentList(m_step->allArguments()));
} }
//// ////

View File

@@ -312,10 +312,10 @@ int MaemoDebugSupport::qmlServerPort(const MaemoRunConfiguration *rc)
QString MaemoDebugSupport::environment(const MaemoRunConfiguration *rc) QString MaemoDebugSupport::environment(const MaemoRunConfiguration *rc)
{ {
QList<EnvironmentItem> env = rc->userEnvironmentChanges(); QList<Utils::EnvironmentItem> env = rc->userEnvironmentChanges();
// FIXME: this must use command line argument instead: -qmljsdebugger=port:1234. // FIXME: this must use command line argument instead: -qmljsdebugger=port:1234.
if (rc->useQmlDebugger()) { if (rc->useQmlDebugger()) {
// env << EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT), // env << Utils::EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT),
// QString::number(qmlServerPort(rc))); // QString::number(qmlServerPort(rc)));
} }
return MaemoGlobal::remoteEnvironment(env); return MaemoGlobal::remoteEnvironment(env);

View File

@@ -93,7 +93,7 @@ void MaemoDeviceEnvReader::setEnvironment()
{ {
if (m_remoteOutput.isEmpty()) if (m_remoteOutput.isEmpty())
return; return;
m_env = ProjectExplorer::Environment(m_remoteOutput.split(QLatin1Char('\n'), m_env = Utils::Environment(m_remoteOutput.split(QLatin1Char('\n'),
QString::SkipEmptyParts)); QString::SkipEmptyParts));
} }

View File

@@ -37,7 +37,7 @@
#include "maemodeviceconfigurations.h" #include "maemodeviceconfigurations.h"
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -61,7 +61,7 @@ public:
void start(); void start();
void stop(); void stop();
ProjectExplorer::Environment deviceEnvironment() const { return m_env; } Utils::Environment deviceEnvironment() const { return m_env; }
signals: signals:
void finished(); void finished();
@@ -81,7 +81,7 @@ private slots:
private: private:
bool m_stop; bool m_stop;
QString m_remoteOutput; QString m_remoteOutput;
ProjectExplorer::Environment m_env; Utils::Environment m_env;
MaemoDeviceConfig m_devConfig; MaemoDeviceConfig m_devConfig;
QSharedPointer<Core::SshConnection> m_connection; QSharedPointer<Core::SshConnection> m_connection;
QSharedPointer<Core::SshRemoteProcess> m_remoteProcess; QSharedPointer<Core::SshRemoteProcess> m_remoteProcess;

View File

@@ -62,11 +62,11 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
return QString::fromAscii(remoteCall); return QString::fromAscii(remoteCall);
} }
QString MaemoGlobal::remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list) QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list)
{ {
QString env; QString env;
QString placeHolder = QLatin1String("%1=%2 "); QString placeHolder = QLatin1String("%1=%2 ");
foreach (const ProjectExplorer::EnvironmentItem &item, list) foreach (const Utils::EnvironmentItem &item, list)
env.append(placeHolder.arg(item.name).arg(item.value)); env.append(placeHolder.arg(item.name).arg(item.value));
return env.mid(0, env.size() - 1); return env.mid(0, env.size() - 1);
} }

View File

@@ -30,8 +30,9 @@
#ifndef MAEMOGLOBAL_H #ifndef MAEMOGLOBAL_H
#define MAEMOGLOBAL_H #define MAEMOGLOBAL_H
#include <utils/environment.h>
#include <projectexplorer/deployconfiguration.h> #include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/environment.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -50,7 +51,7 @@ public:
static QString homeDirOnDevice(const QString &uname); static QString homeDirOnDevice(const QString &uname);
static QString remoteSudo(); static QString remoteSudo();
static QString remoteCommandPrefix(const QString &commandFilePath); static QString remoteCommandPrefix(const QString &commandFilePath);
static QString remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list); static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
static QString remoteProjectSourcesMountPoint(); static QString remoteProjectSourcesMountPoint();
static QString remoteSourceProfilesCommand(); static QString remoteSourceProfilesCommand();

View File

@@ -149,7 +149,7 @@ QVariantMap MaemoRunConfiguration::toMap() const
map.insert(UseRemoteGdbKey, useRemoteGdb()); map.insert(UseRemoteGdbKey, useRemoteGdb());
map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase); map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase);
map.insert(UserEnvironmentChangesKey, map.insert(UserEnvironmentChangesKey,
ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges)); Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.unite(m_remoteMounts->toMap()); map.unite(m_remoteMounts->toMap());
return map; return map;
} }
@@ -164,7 +164,7 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool(); m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
m_userEnvironmentChanges = m_userEnvironmentChanges =
ProjectExplorer::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey) Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey)
.toStringList()); .toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase> (map.value(BaseEnvironmentBaseKey, m_baseEnvironmentBase = static_cast<BaseEnvironmentBase> (map.value(BaseEnvironmentBaseKey,
SystemEnvironmentBase).toInt()); SystemEnvironmentBase).toInt());
@@ -355,26 +355,26 @@ void MaemoRunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env)
} }
} }
ProjectExplorer::Environment MaemoRunConfiguration::environment() const Utils::Environment MaemoRunConfiguration::environment() const
{ {
ProjectExplorer::Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
ProjectExplorer::Environment MaemoRunConfiguration::baseEnvironment() const Utils::Environment MaemoRunConfiguration::baseEnvironment() const
{ {
return (m_baseEnvironmentBase == SystemEnvironmentBase ? systemEnvironment() return (m_baseEnvironmentBase == SystemEnvironmentBase ? systemEnvironment()
: ProjectExplorer::Environment()); : Utils::Environment());
} }
QList<ProjectExplorer::EnvironmentItem> MaemoRunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> MaemoRunConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_userEnvironmentChanges;
} }
void MaemoRunConfiguration::setUserEnvironmentChanges( void MaemoRunConfiguration::setUserEnvironmentChanges(
const QList<ProjectExplorer::EnvironmentItem> &diff) const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges != diff) { if (m_userEnvironmentChanges != diff) {
m_userEnvironmentChanges = diff; m_userEnvironmentChanges = diff;
@@ -382,12 +382,12 @@ void MaemoRunConfiguration::setUserEnvironmentChanges(
} }
} }
ProjectExplorer::Environment MaemoRunConfiguration::systemEnvironment() const Utils::Environment MaemoRunConfiguration::systemEnvironment() const
{ {
return m_systemEnvironment; return m_systemEnvironment;
} }
void MaemoRunConfiguration::setSystemEnvironment(const ProjectExplorer::Environment &environment) void MaemoRunConfiguration::setSystemEnvironment(const Utils::Environment &environment)
{ {
if (m_systemEnvironment.size() == 0 || m_systemEnvironment != environment) { if (m_systemEnvironment.size() == 0 || m_systemEnvironment != environment) {
m_systemEnvironment = environment; m_systemEnvironment = environment;

View File

@@ -34,7 +34,8 @@
#include "maemodeviceconfigurations.h" #include "maemodeviceconfigurations.h"
#include "maemodeployable.h" #include "maemodeployable.h"
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
@@ -106,14 +107,14 @@ public:
BaseEnvironmentBase baseEnvironmentBase() const; BaseEnvironmentBase baseEnvironmentBase() const;
void setBaseEnvironmentBase(BaseEnvironmentBase env); void setBaseEnvironmentBase(BaseEnvironmentBase env);
ProjectExplorer::Environment environment() const; Utils::Environment environment() const;
ProjectExplorer::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
ProjectExplorer::Environment systemEnvironment() const; Utils::Environment systemEnvironment() const;
void setSystemEnvironment(const ProjectExplorer::Environment &environment); void setSystemEnvironment(const Utils::Environment &environment);
int portsUsedByDebuggers() const { return useCppDebugger() + useQmlDebugger(); } int portsUsedByDebuggers() const { return useCppDebugger() + useQmlDebugger(); }
@@ -123,7 +124,7 @@ signals:
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void systemEnvironmentChanged(); void systemEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
protected: protected:
MaemoRunConfiguration(Qt4Target *parent, MaemoRunConfiguration *source); MaemoRunConfiguration(Qt4Target *parent, MaemoRunConfiguration *source);
@@ -146,8 +147,8 @@ private:
bool m_useRemoteGdb; bool m_useRemoteGdb;
BaseEnvironmentBase m_baseEnvironmentBase; BaseEnvironmentBase m_baseEnvironmentBase;
ProjectExplorer::Environment m_systemEnvironment; Utils::Environment m_systemEnvironment;
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges; QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -263,8 +263,8 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout)
connect(m_runConfiguration, SIGNAL(systemEnvironmentChanged()), connect(m_runConfiguration, SIGNAL(systemEnvironmentChanged()),
this, SLOT(systemEnvironmentChanged())); this, SLOT(systemEnvironmentChanged()));
connect(m_runConfiguration, connect(m_runConfiguration,
SIGNAL(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)), SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>))); this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
connect(m_fetchEnv, SIGNAL(pressed()), this, SLOT(fetchEnvironment())); connect(m_fetchEnv, SIGNAL(pressed()), this, SLOT(fetchEnvironment()));
connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished()));
} }
@@ -421,7 +421,7 @@ void MaemoRunConfigurationWidget::systemEnvironmentChanged()
m_environmentWidget->setBaseEnvironment(m_runConfiguration->systemEnvironment()); m_environmentWidget->setBaseEnvironment(m_runConfiguration->systemEnvironment());
} }
void MaemoRunConfigurationWidget::userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges) void MaemoRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges)
{ {
if (m_ignoreChange) if (m_ignoreChange)
return; return;

View File

@@ -49,9 +49,12 @@ class QToolButton;
class QVBoxLayout; class QVBoxLayout;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils {
class EnvironmentItem;
}
namespace ProjectExplorer { namespace ProjectExplorer {
struct EnvironmentItem; class EnvironmentWidget;
class EnvironmentWidget;
} }
namespace Utils { class DetailsWidget; } namespace Utils { class DetailsWidget; }
@@ -86,7 +89,7 @@ private slots:
void baseEnvironmentSelected(int index); void baseEnvironmentSelected(int index);
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void systemEnvironmentChanged(); void systemEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges);
void handleRemoteMountsChanged(); void handleRemoteMountsChanged();
void handleDebuggingTypeChanged(); void handleDebuggingTypeChanged();
void handleDeploySpecsChanged(); void handleDeploySpecsChanged();

View File

@@ -54,7 +54,7 @@ ToolChain::ToolChainType MaemoToolChain::type() const
return ToolChain::GCC_MAEMO; return ToolChain::GCC_MAEMO;
} }
void MaemoToolChain::addToEnvironment(ProjectExplorer::Environment &env) void MaemoToolChain::addToEnvironment(Utils::Environment &env)
{ {
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin") env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(maddeRoot()))); .arg(maddeRoot())));

View File

@@ -42,7 +42,7 @@ public:
MaemoToolChain(const QString &targetRoot); MaemoToolChain(const QString &targetRoot);
virtual ~MaemoToolChain(); virtual ~MaemoToolChain();
void addToEnvironment(ProjectExplorer::Environment &env); void addToEnvironment(Utils::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const; ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const; QString makeCommand() const;

View File

@@ -45,7 +45,7 @@ using namespace Qt4ProjectManager::Internal;
// Locate the compiler via path. // Locate the compiler via path.
static QString gcceCommand(const QString &dir) static QString gcceCommand(const QString &dir)
{ {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
if (!dir.isEmpty()) { if (!dir.isEmpty()) {
env.prependOrSetPath(dir + QLatin1String("/bin")); env.prependOrSetPath(dir + QLatin1String("/bin"));
env.prependOrSetPath(dir); env.prependOrSetPath(dir);
@@ -123,7 +123,7 @@ QList<HeaderPath> GCCEToolChain::systemHeaderPaths()
return m_systemHeaderPaths; return m_systemHeaderPaths;
} }
void GCCEToolChain::addToEnvironment(ProjectExplorer::Environment &env) void GCCEToolChain::addToEnvironment(Utils::Environment &env)
{ {
if (debug) if (debug)
qDebug() << "GCCEToolChain::addToEnvironment" << m_type << gcc() << m_gcceBinPath<< m_mixin.device(); qDebug() << "GCCEToolChain::addToEnvironment" << m_type << gcc() << m_gcceBinPath<< m_mixin.device();
@@ -170,7 +170,7 @@ QString GCCEToolChain::gcceVersion() const
QProcess gxx; QProcess gxx;
QStringList arguments; QStringList arguments;
arguments << QLatin1String("-dumpversion"); arguments << QLatin1String("-dumpversion");
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
env.set(QLatin1String("LC_ALL"), QLatin1String("C")); //override current locale settings env.set(QLatin1String("LC_ALL"), QLatin1String("C")); //override current locale settings
gxx.setEnvironment(env.toStringList()); gxx.setEnvironment(env.toStringList());
gxx.setReadChannelMode(QProcess::MergedChannels); gxx.setReadChannelMode(QProcess::MergedChannels);

View File

@@ -50,7 +50,7 @@ public:
QByteArray predefinedMacros(); QByteArray predefinedMacros();
virtual QList<ProjectExplorer::HeaderPath> systemHeaderPaths(); virtual QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env); virtual void addToEnvironment(Utils::Environment &env);
virtual ProjectExplorer::ToolChain::ToolChainType type() const; virtual ProjectExplorer::ToolChain::ToolChainType type() const;
virtual QString makeCommand() const; virtual QString makeCommand() const;

View File

@@ -117,7 +117,7 @@ void RVCTToolChain::updateVersion()
m_minor = 0; m_minor = 0;
m_build = 0; m_build = 0;
QProcess armcc; QProcess armcc;
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
armcc.setEnvironment(env.toStringList()); armcc.setEnvironment(env.toStringList());
const QString binary = rvctBinary(); const QString binary = rvctBinary();
@@ -180,7 +180,7 @@ QList<HeaderPath> RVCTToolChain::systemHeaderPaths()
{ {
if (m_systemHeaderPaths.isEmpty()) { if (m_systemHeaderPaths.isEmpty()) {
updateVersion(); updateVersion();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
QString rvctInclude = env.value(QString::fromLatin1("RVCT%1%2INC").arg(m_major).arg(m_minor)); QString rvctInclude = env.value(QString::fromLatin1("RVCT%1%2INC").arg(m_major).arg(m_minor));
if (!rvctInclude.isEmpty()) if (!rvctInclude.isEmpty())
m_systemHeaderPaths.append(HeaderPath(rvctInclude, HeaderPath::GlobalHeaderPath)); m_systemHeaderPaths.append(HeaderPath(rvctInclude, HeaderPath::GlobalHeaderPath));
@@ -206,7 +206,7 @@ static inline QStringList headerPathToStringList(const QList<ProjectExplorer::He
// Expand an RVCT variable, such as RVCT22BIN, by some new values // Expand an RVCT variable, such as RVCT22BIN, by some new values
void RVCTToolChain::addToRVCTPathVariable(const QString &postfix, const QStringList &values, void RVCTToolChain::addToRVCTPathVariable(const QString &postfix, const QStringList &values,
ProjectExplorer::Environment &env) const Utils::Environment &env) const
{ {
// get old values // get old values
const QChar separator = QLatin1Char(','); const QChar separator = QLatin1Char(',');
@@ -237,7 +237,7 @@ QStringList RVCTToolChain::libPaths()
return rc; return rc;
} }
void RVCTToolChain::addToEnvironment(ProjectExplorer::Environment &env) void RVCTToolChain::addToEnvironment(Utils::Environment &env)
{ {
updateVersion(); updateVersion();
switch (m_type) { switch (m_type) {

View File

@@ -44,7 +44,7 @@ public:
ProjectExplorer::ToolChain::ToolChainType type); ProjectExplorer::ToolChain::ToolChainType type);
virtual QByteArray predefinedMacros(); virtual QByteArray predefinedMacros();
QList<ProjectExplorer::HeaderPath> systemHeaderPaths(); QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
void addToEnvironment(ProjectExplorer::Environment &env); void addToEnvironment(Utils::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const; ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const; QString makeCommand() const;
ProjectExplorer::IOutputParser *outputParser() const; ProjectExplorer::IOutputParser *outputParser() const;
@@ -60,7 +60,7 @@ protected:
private: private:
void addToRVCTPathVariable(const QString &postfix, const QStringList &values, void addToRVCTPathVariable(const QString &postfix, const QStringList &values,
ProjectExplorer::Environment &env) const; Utils::Environment &env) const;
static QStringList libPaths(); static QStringList libPaths();
void updateVersion(); void updateVersion();

View File

@@ -141,7 +141,7 @@ private:
QStringList m_workingDirectories; QStringList m_workingDirectories;
QString m_makeCmd; QString m_makeCmd;
ProjectExplorer::Environment m_environment; Utils::Environment m_environment;
QStringList m_args; QStringList m_args;
void ctor_package(); void ctor_package();

View File

@@ -30,7 +30,8 @@
#include "s60devices.h" #include "s60devices.h"
#include "gccetoolchain.h" #include "gccetoolchain.h"
#include <projectexplorer/environment.h> #include <utils/environment.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
@@ -563,7 +564,7 @@ QList<ProjectExplorer::HeaderPath> S60ToolChainMixin::epocHeaderPaths() const
return rc; return rc;
} }
void S60ToolChainMixin::addEpocToEnvironment(ProjectExplorer::Environment *env) const void S60ToolChainMixin::addEpocToEnvironment(Utils::Environment *env) const
{ {
QString epocRootPath(m_device.epocRoot); QString epocRootPath(m_device.epocRoot);
if (!epocRootPath.endsWith(QChar('/'))) if (!epocRootPath.endsWith(QChar('/')))
@@ -615,7 +616,7 @@ QList<ProjectExplorer::HeaderPath> S60ToolChainMixin::gnuPocRvctHeaderPaths(int
return rc; return rc;
} }
void S60ToolChainMixin::addGnuPocToEnvironment(ProjectExplorer::Environment *env) const void S60ToolChainMixin::addGnuPocToEnvironment(Utils::Environment *env) const
{ {
env->prependOrSetPath(QDir::toNativeSeparators(m_device.toolsRoot + QLatin1String("/epoc32/tools"))); env->prependOrSetPath(QDir::toNativeSeparators(m_device.toolsRoot + QLatin1String("/epoc32/tools")));
const QString epocRootVar = QLatin1String("EPOCROOT"); const QString epocRootVar = QLatin1String("EPOCROOT");

View File

@@ -176,13 +176,13 @@ public:
// Epoc // Epoc
QList<ProjectExplorer::HeaderPath> epocHeaderPaths() const; QList<ProjectExplorer::HeaderPath> epocHeaderPaths() const;
void addEpocToEnvironment(ProjectExplorer::Environment *env) const; void addEpocToEnvironment(Utils::Environment *env) const;
// GnuPoc // GnuPoc
QList<ProjectExplorer::HeaderPath> gnuPocHeaderPaths() const; QList<ProjectExplorer::HeaderPath> gnuPocHeaderPaths() const;
QList<ProjectExplorer::HeaderPath> gnuPocRvctHeaderPaths(int major, int minor) const; QList<ProjectExplorer::HeaderPath> gnuPocRvctHeaderPaths(int major, int minor) const;
QStringList gnuPocRvctLibPaths(int armver, bool debug) const; QStringList gnuPocRvctLibPaths(int armver, bool debug) const;
void addGnuPocToEnvironment(ProjectExplorer::Environment *env) const; void addGnuPocToEnvironment(Utils::Environment *env) const;
bool equals(const S60ToolChainMixin &rhs) const; bool equals(const S60ToolChainMixin &rhs) const;

View File

@@ -296,7 +296,7 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
: RunControl(runConfiguration, mode) : RunControl(runConfiguration, mode)
{ {
// stuff like the EPOCROOT and EPOCDEVICE env variable // stuff like the EPOCROOT and EPOCDEVICE env variable
Environment env = Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
runConfiguration->qt4Target()->activeBuildConfiguration()->toolChain()->addToEnvironment(env); runConfiguration->qt4Target()->activeBuildConfiguration()->toolChain()->addToEnvironment(env);
m_applicationLauncher.setEnvironment(env.toStringList()); m_applicationLauncher.setEnvironment(env.toStringList());

View File

@@ -71,7 +71,7 @@ QList<HeaderPath> WINSCWToolChain::systemHeaderPaths()
QStringList WINSCWToolChain::systemIncludes() const QStringList WINSCWToolChain::systemIncludes() const
{ {
if (m_carbidePath.isEmpty()) { if (m_carbidePath.isEmpty()) {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
QString symIncludesValue = env.value("MWCSYM2INCLUDES"); QString symIncludesValue = env.value("MWCSYM2INCLUDES");
if (!symIncludesValue.isEmpty()) if (!symIncludesValue.isEmpty())
return symIncludesValue.split(QLatin1Char(';')); return symIncludesValue.split(QLatin1Char(';'));
@@ -91,7 +91,7 @@ QStringList WINSCWToolChain::systemIncludes() const
return QStringList(); return QStringList();
} }
void WINSCWToolChain::addToEnvironment(ProjectExplorer::Environment &env) void WINSCWToolChain::addToEnvironment(Utils::Environment &env)
{ {
if (!m_carbidePath.isEmpty()) { if (!m_carbidePath.isEmpty()) {
env.set("MWCSYM2INCLUDES", systemIncludes().join(QString(QLatin1Char(';')))); env.set("MWCSYM2INCLUDES", systemIncludes().join(QString(QLatin1Char(';'))));

View File

@@ -43,7 +43,7 @@ public:
explicit WINSCWToolChain(const S60Devices::Device &device, const QString &mwcDirectory); explicit WINSCWToolChain(const S60Devices::Device &device, const QString &mwcDirectory);
QByteArray predefinedMacros(); QByteArray predefinedMacros();
QList<ProjectExplorer::HeaderPath> systemHeaderPaths(); QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
void addToEnvironment(ProjectExplorer::Environment &env); void addToEnvironment(Utils::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const; ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const; QString makeCommand() const;
ProjectExplorer::IOutputParser *outputParser() const; ProjectExplorer::IOutputParser *outputParser() const;

View File

@@ -194,9 +194,9 @@ Qt4Target *Qt4BuildConfiguration::qt4Target() const
return static_cast<Qt4Target *>(target()); return static_cast<Qt4Target *>(target());
} }
ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const Utils::Environment Qt4BuildConfiguration::baseEnvironment() const
{ {
Environment env = BuildConfiguration::baseEnvironment(); Utils::Environment env = BuildConfiguration::baseEnvironment();
qtVersion()->addToEnvironment(env); qtVersion()->addToEnvironment(env);
env.set(QLatin1String("BUILDDIR"), QDir::toNativeSeparators(buildDirectory())); env.set(QLatin1String("BUILDDIR"), QDir::toNativeSeparators(buildDirectory()));

View File

@@ -56,7 +56,7 @@ public:
Qt4Target *qt4Target() const; Qt4Target *qt4Target() const;
virtual ProjectExplorer::Environment baseEnvironment() const; virtual Utils::Environment baseEnvironment() const;
virtual QString buildDirectory() const; virtual QString buildDirectory() const;
bool shadowBuild() const; bool shadowBuild() const;

View File

@@ -201,7 +201,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
toplayout->addRow(tr("Executable:"), m_executableLineEdit); toplayout->addRow(tr("Executable:"), m_executableLineEdit);
QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()), this); m_argumentsLineEdit = new QLineEdit(Utils::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()), this);
argumentsLabel->setBuddy(m_argumentsLineEdit); argumentsLabel->setBuddy(m_argumentsLineEdit);
toplayout->addRow(argumentsLabel, m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
@@ -313,8 +313,8 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()), connect(qt4RunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection); this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection);
connect(qt4RunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>)), connect(qt4RunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged(QList<ProjectExplorer::EnvironmentItem>))); this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
connect(qt4RunConfiguration, SIGNAL(baseEnvironmentChanged()), connect(qt4RunConfiguration, SIGNAL(baseEnvironmentChanged()),
this, SLOT(baseEnvironmentChanged())); this, SLOT(baseEnvironmentChanged()));
@@ -359,7 +359,7 @@ void Qt4RunConfigurationWidget::baseEnvironmentChanged()
m_environmentWidget->setBaseEnvironmentText(m_qt4RunConfiguration->baseEnvironmentText()); m_environmentWidget->setBaseEnvironmentText(m_qt4RunConfiguration->baseEnvironmentText());
} }
void Qt4RunConfigurationWidget::userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges) void Qt4RunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges)
{ {
if (m_ignoreChange) if (m_ignoreChange)
return; return;
@@ -473,7 +473,7 @@ QVariantMap Qt4RunConfiguration::toMap() const
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath)); map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console); map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == Console);
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix); map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges)); map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), m_baseEnvironmentBase); map.insert(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), m_baseEnvironmentBase);
map.insert(QLatin1String(USER_SET_WORKING_DIRECTORY_KEY), m_userSetWokingDirectory); map.insert(QLatin1String(USER_SET_WORKING_DIRECTORY_KEY), m_userSetWokingDirectory);
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory); map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
@@ -491,7 +491,7 @@ bool Qt4RunConfiguration::fromMap(const QVariantMap &map)
m_userSetWokingDirectory = map.value(QLatin1String(USER_SET_WORKING_DIRECTORY_KEY), false).toBool(); m_userSetWokingDirectory = map.value(QLatin1String(USER_SET_WORKING_DIRECTORY_KEY), false).toBool();
m_userWorkingDirectory = map.value(QLatin1String(USER_WORKING_DIRECTORY_KEY)).toString(); m_userWorkingDirectory = map.value(QLatin1String(USER_WORKING_DIRECTORY_KEY)).toString();
m_userEnvironmentChanges = ProjectExplorer::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList()); m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(Qt4RunConfiguration::BuildEnvironmentBase)).toInt()); m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(Qt4RunConfiguration::BuildEnvironmentBase)).toInt());
return RunConfiguration::fromMap(map); return RunConfiguration::fromMap(map);
@@ -552,13 +552,13 @@ QString Qt4RunConfiguration::baseEnvironmentText() const
return QString(); return QString();
} }
ProjectExplorer::Environment Qt4RunConfiguration::baseEnvironment() const Utils::Environment Qt4RunConfiguration::baseEnvironment() const
{ {
ProjectExplorer::Environment env; Utils::Environment env;
if (m_baseEnvironmentBase == Qt4RunConfiguration::CleanEnvironmentBase) { if (m_baseEnvironmentBase == Qt4RunConfiguration::CleanEnvironmentBase) {
// Nothing // Nothing
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = Utils::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
env = target()->activeBuildConfiguration()->environment(); env = target()->activeBuildConfiguration()->environment();
} }
@@ -578,19 +578,19 @@ ProjectExplorer::Environment Qt4RunConfiguration::baseEnvironment() const
return env; return env;
} }
ProjectExplorer::Environment Qt4RunConfiguration::environment() const Utils::Environment Qt4RunConfiguration::environment() const
{ {
ProjectExplorer::Environment env = baseEnvironment(); Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges()); env.modify(userEnvironmentChanges());
return env; return env;
} }
QList<ProjectExplorer::EnvironmentItem> Qt4RunConfiguration::userEnvironmentChanges() const QList<Utils::EnvironmentItem> Qt4RunConfiguration::userEnvironmentChanges() const
{ {
return m_userEnvironmentChanges; return m_userEnvironmentChanges;
} }
void Qt4RunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff) void Qt4RunConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
{ {
if (m_userEnvironmentChanges != diff) { if (m_userEnvironmentChanges != diff) {
m_userEnvironmentChanges = diff; m_userEnvironmentChanges = diff;
@@ -613,7 +613,7 @@ void Qt4RunConfiguration::setWorkingDirectory(const QString &wd)
void Qt4RunConfiguration::setArguments(const QString &argumentsString) void Qt4RunConfiguration::setArguments(const QString &argumentsString)
{ {
m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString); m_commandLineArguments = Utils::Environment::parseCombinedArgString(argumentsString);
emit commandLineArgumentsChanged(argumentsString); emit commandLineArgumentsChanged(argumentsString);
} }

View File

@@ -81,7 +81,7 @@ public:
virtual RunMode runMode() const; virtual RunMode runMode() const;
virtual QString workingDirectory() const; virtual QString workingDirectory() const;
virtual QStringList commandLineArguments() const; virtual QStringList commandLineArguments() const;
virtual ProjectExplorer::Environment environment() const; virtual Utils::Environment environment() const;
virtual QString dumperLibrary() const; virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const; virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
@@ -102,7 +102,7 @@ signals:
void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
void usingDyldImageSuffixChanged(bool); void usingDyldImageSuffixChanged(bool);
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &diff); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
// Note: These signals might not get emitted for every change! // Note: These signals might not get emitted for every change!
void effectiveTargetInformationChanged(); void effectiveTargetInformationChanged();
@@ -127,10 +127,10 @@ private:
void ctor(); void ctor();
ProjectExplorer::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
QString baseEnvironmentText() const; QString baseEnvironmentText() const;
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff); void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const; QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
void updateTarget(); void updateTarget();
QStringList m_commandLineArguments; QStringList m_commandLineArguments;
@@ -142,7 +142,7 @@ private:
bool m_isUsingDyldImageSuffix; bool m_isUsingDyldImageSuffix;
bool m_userSetWokingDirectory; bool m_userSetWokingDirectory;
QString m_userWorkingDirectory; QString m_userWorkingDirectory;
QList<ProjectExplorer::EnvironmentItem> m_userEnvironmentChanges; QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
BaseEnvironmentBase m_baseEnvironmentBase; BaseEnvironmentBase m_baseEnvironmentBase;
}; };
@@ -166,7 +166,7 @@ private slots:
void workingDirectoryChanged(const QString &workingDirectory); void workingDirectoryChanged(const QString &workingDirectory);
void commandLineArgumentsChanged(const QString &args); void commandLineArgumentsChanged(const QString &args);
void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode); void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
void userEnvironmentChangesChanged(const QList<ProjectExplorer::EnvironmentItem> &userChanges); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges);
void baseEnvironmentChanged(); void baseEnvironmentChanged();
void effectiveTargetInformationChanged(); void effectiveTargetInformationChanged();

View File

@@ -391,7 +391,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
void QtVersionManager::updateSystemVersion() void QtVersionManager::updateSystemVersion()
{ {
bool haveSystemVersion = false; bool haveSystemVersion = false;
QString systemQMakePath = DebuggingHelperLibrary::findSystemQt(ProjectExplorer::Environment::systemEnvironment()); QString systemQMakePath = DebuggingHelperLibrary::findSystemQt(Utils::Environment::systemEnvironment());
if (systemQMakePath.isNull()) if (systemQMakePath.isNull())
systemQMakePath = tr("<not found>"); systemQMakePath = tr("<not found>");
@@ -1452,7 +1452,7 @@ void QtVersion::updateToolChainAndMkspec() const
ProjectExplorer::ToolChain::createMSVCToolChain(m_msvcVersion, isQt64Bit())); ProjectExplorer::ToolChain::createMSVCToolChain(m_msvcVersion, isQt64Bit()));
m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID)); m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
} else if (qmakeCXX == "g++" && makefileGenerator == "MINGW") { } else if (qmakeCXX == "g++" && makefileGenerator == "MINGW") {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
//addToEnvironment(env); //addToEnvironment(env);
env.prependOrSetPath(mingwDirectory() + "/bin"); env.prependOrSetPath(mingwDirectory() + "/bin");
qmakeCXX = env.searchInPath(qmakeCXX); qmakeCXX = env.searchInPath(qmakeCXX);
@@ -1461,7 +1461,7 @@ void QtVersion::updateToolChainAndMkspec() const
m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID)); m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
} else if (qmakeCXX.contains("g++")) { // All g++ variants are treated as desktop g++ } else if (qmakeCXX.contains("g++")) { // All g++ variants are treated as desktop g++
// we should try to do a better job, but for now that's good enough // we should try to do a better job, but for now that's good enough
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
//addToEnvironment(env); //addToEnvironment(env);
qmakeCXX = env.searchInPath(qmakeCXX); qmakeCXX = env.searchInPath(qmakeCXX);
m_toolChains << ToolChainPtr(ProjectExplorer::ToolChain::createGccToolChain(qmakeCXX)); m_toolChains << ToolChainPtr(ProjectExplorer::ToolChain::createGccToolChain(qmakeCXX));
@@ -1549,7 +1549,7 @@ void QtVersion::setMsvcVersion(const QString &version)
m_toolChainUpToDate = false; m_toolChainUpToDate = false;
} }
void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) const void QtVersion::addToEnvironment(Utils::Environment &env) const
{ {
env.set("QTDIR", QDir::toNativeSeparators(versionInfo().value("QT_INSTALL_DATA"))); env.set("QTDIR", QDir::toNativeSeparators(versionInfo().value("QT_INSTALL_DATA")));
env.prependOrSetPath(versionInfo().value("QT_INSTALL_BINS")); env.prependOrSetPath(versionInfo().value("QT_INSTALL_BINS"));
@@ -1707,7 +1707,7 @@ QString QtVersion::buildDebuggingHelperLibrary()
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
if (qtInstallData.isEmpty()) if (qtInstallData.isEmpty())
return QString(); return QString();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
// TODO: the debugging helper doesn't comply to actual tool chain yet // TODO: the debugging helper doesn't comply to actual tool chain yet

View File

@@ -107,7 +107,7 @@ public:
void setMingwDirectory(const QString &directory); void setMingwDirectory(const QString &directory);
QString msvcVersion() const; QString msvcVersion() const;
void setMsvcVersion(const QString &version); void setMsvcVersion(const QString &version);
void addToEnvironment(ProjectExplorer::Environment &env) const; void addToEnvironment(Utils::Environment &env) const;
bool hasDebuggingHelper() const; bool hasDebuggingHelper() const;
QString debuggingHelperLibrary() const; QString debuggingHelperLibrary() const;