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

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

View File

@@ -30,7 +30,7 @@
#ifndef CMAKEOPENPROJECTWIZARD_H
#define CMAKEOPENPROJECTWIZARD_H
#include <projectexplorer/environment.h>
#include <utils/environment.h>
#include <utils/wizard.h>
#include <QtCore/QProcess>
@@ -67,14 +67,14 @@ public:
};
// 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
/// 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
/// shows a page for selecting a directory
/// 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;
QString buildDirectory() const;
@@ -83,7 +83,7 @@ public:
CMakeManager *cmakeManager() const;
QStringList arguments() const;
void setArguments(const QStringList &args);
ProjectExplorer::Environment environment() const;
Utils::Environment environment() const;
QString msvcVersion() const;
void setMsvcVersion(const QString &version);
bool existsUpToDateXmlFile() const;
@@ -96,7 +96,7 @@ private:
QStringList m_arguments;
QString m_msvcVersion;
bool m_creatingCbpFiles;
ProjectExplorer::Environment m_environment;
Utils::Environment m_environment;
};
class InSourceBuildPage : public QWizardPage

View File

@@ -56,8 +56,6 @@
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
using namespace ProjectExplorer;
using ProjectExplorer::Environment;
using ProjectExplorer::EnvironmentItem;
// QtCreator CMake Generator wishlist:
// 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
// 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)
return false;

View File

@@ -36,7 +36,6 @@
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/environment.h>
#include <qtconcurrent/QtConcurrentTools>
#include <QtCore/QtConcurrentRun>
#include <QtCore/QCoreApplication>
@@ -103,7 +102,9 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
// we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
// 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
// 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->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);
}
@@ -243,7 +245,7 @@ CMakeSettingsPage::~CMakeSettingsPage()
QString CMakeSettingsPage::findCmakeExecutable() const
{
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
Utils::Environment env = Utils::Environment::systemEnvironment();
return env.searchInPath(QLatin1String("cmake"));
}

View File

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

View File

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

View File

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

View File

@@ -238,7 +238,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
void MakeStepConfigWidget::additionalArgumentsEdited()
{
m_makeStep->setAdditionalArguments(Environment::parseCombinedArgString(m_additionalArguments->text()));
m_makeStep->setAdditionalArguments(Utils::Environment::parseCombinedArgString(m_additionalArguments->text()));
updateDetails();
}
@@ -265,7 +265,7 @@ void MakeStepConfigWidget::init()
// and connect again
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();
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();