Commit 7b6eb2c4 authored by Roberto Raggi's avatar Roberto Raggi

Added a way to change the tool chain.

parent 90e12652
......@@ -40,13 +40,14 @@
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtDebug>
#include <QDir>
#include <QSettings>
#include <QtCore/QtDebug>
#include <QtCore/QDir>
#include <QtCore/QSettings>
#include <QtCore/QProcess>
#include <QProcess>
#include <QFormLayout>
#include <QMainWindow>
#include <QtGui/QFormLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QComboBox>
using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
......@@ -81,8 +82,6 @@ void GenericProject::refresh()
_rootNode->refresh();
setToolChain(_rootNode->toolChainId());
CppTools::CppModelManagerInterface *modelManager =
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
......@@ -123,6 +122,8 @@ void GenericProject::setToolChain(const QString &toolChainId)
qDebug() << Q_FUNC_INFO;
_toolChainId = toolChainId;
delete _toolChain;
_toolChain = 0;
......@@ -143,7 +144,6 @@ void GenericProject::setToolChain(const QString &toolChainId)
} else if (toolChainId == QLatin1String("gcc") || toolChainId == QLatin1String("icc")) {
const QLatin1String qmake_cxx("g++"); // ### FIXME
_toolChain = ToolChain::createGccToolChain(qmake_cxx);
}
}
......@@ -170,6 +170,9 @@ QString GenericProject::buildParser(const QString &buildConfiguration) const
return QString();
}
QString GenericProject::toolChainId() const
{ return _toolChainId; }
QString GenericProject::name() const
{
qDebug() << Q_FUNC_INFO;
......@@ -248,7 +251,7 @@ QList<ProjectExplorer::BuildStepConfigWidget*> GenericProject::subConfigWidgets(
makeStep()->setBuildTarget(buildConfiguration, "all", true);
}
ProjectExplorer::ProjectNode *GenericProject::rootProjectNode() const
GenericProjectNode *GenericProject::rootProjectNode() const
{
qDebug() << Q_FUNC_INFO;
......@@ -306,8 +309,7 @@ void GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
if (toolChainId.isEmpty())
toolChainId = QLatin1String("gcc");
toolChainId = toolChainId.toLower(); // ### move
_rootNode->setToolChainId(toolChainId);
setToolChain(toolChainId.toLower()); // ### move
const QStringList includePaths = reader.restoreValue(QLatin1String("includePaths")).toStringList();
_rootNode->setIncludePaths(includePaths);
......@@ -319,7 +321,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
Project::saveSettingsImpl(writer);
writer.saveValue("toolChain", _rootNode->toolChainId());
writer.saveValue("toolChain", _toolChainId);
writer.saveValue("includePaths", _rootNode->includePaths());
}
......@@ -339,6 +341,13 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
fl->addRow("Build directory:", _pathChooser);
connect(_pathChooser, SIGNAL(changed()), this, SLOT(buildDirectoryChanged()));
QComboBox *toolChainChooser = new QComboBox;
toolChainChooser->addItems(ProjectExplorer::ToolChain::supportedToolChains());
toolChainChooser->setCurrentIndex(toolChainChooser->findText(_project->toolChainId()));
fl->addRow("Tool chain:", toolChainChooser);
connect(toolChainChooser, SIGNAL(activated(QString)), _project, SLOT(setToolChain(QString)));
}
GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
......
......@@ -69,15 +69,18 @@ public:
virtual QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets();
virtual void newBuildConfiguration(const QString &buildConfiguration);
virtual ProjectExplorer::ProjectNode *rootProjectNode() const;
virtual GenericProjectNode *rootProjectNode() const;
virtual QStringList files(FilesMode fileMode) const;
void setToolChain(const QString &toolChainId);
QStringList targets() const;
MakeStep *makeStep() const;
QString buildParser(const QString &buildConfiguration) const;
QString toolChainId() const;
public Q_SLOTS:
void setToolChain(const QString &toolChainId);
private:
void refresh();
......@@ -93,6 +96,7 @@ private:
GenericProjectNode* _rootNode;
ProjectExplorer::ToolChain *_toolChain;
QString _toolChainId;
};
class GenericProjectFile : public Core::IFile
......
......@@ -234,12 +234,6 @@ void GenericProjectNode::setIncludePaths(const QStringList &includePaths)
QStringList GenericProjectNode::defines() const
{ return _defines; }
QString GenericProjectNode::toolChainId() const
{ return _toolChainId; }
void GenericProjectNode::setToolChainId(const QString &toolChainId)
{ _toolChainId = toolChainId; }
bool GenericProjectNode::hasTargets() const
{
qDebug() << Q_FUNC_INFO;
......
......@@ -69,9 +69,6 @@ public:
void refresh();
QString toolChainId() const;
void setToolChainId(const QString &toolChainId);
QStringList includePaths() const;
void setIncludePaths(const QStringList &includePaths);
......@@ -89,7 +86,6 @@ private:
QStringList _generated;
QStringList _includePaths;
QStringList _defines;
QString _toolChainId;
QHash<QString, FolderNode *> _folderByName;
};
......
......@@ -59,6 +59,14 @@ QStringList ToolChain::availableMSVCVersions()
return versions;
}
QStringList ToolChain::supportedToolChains()
{
return QStringList() << QLatin1String("gcc")
<< QLatin1String("mingw")
<< QLatin1String("msvc")
<< QLatin1String("wince");
}
GccToolChain::GccToolChain(const QString &gcc)
: m_gcc(gcc)
{
......
......@@ -62,6 +62,7 @@ public:
static ToolChain *createMSVCToolChain(const QString &name);
static ToolChain *createWinCEToolChain(const QString &name, const QString &platform);
static QStringList availableMSVCVersions();
static QStringList supportedToolChains();
protected:
virtual bool equals(ToolChain *other) const = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment