forked from qt-creator/qt-creator
Fixed problem with changing tool chain type for generic projects
Some fixes were needed after the tool chain type was changed from
QString to an enum.
Task-number: 259939
(cherry picked from commit a5b22b18bd
)
This commit is contained in:
@@ -325,31 +325,30 @@ void GenericProject::setIncludePaths(const QStringList &includePaths)
|
|||||||
QByteArray GenericProject::defines() const
|
QByteArray GenericProject::defines() const
|
||||||
{ return m_defines; }
|
{ return m_defines; }
|
||||||
|
|
||||||
void GenericProject::setToolChainId(int t)
|
void GenericProject::setToolChainType(ProjectExplorer::ToolChain::ToolChainType type)
|
||||||
{
|
{
|
||||||
ProjectExplorer::ToolChain::ToolChainType toolChainId = ProjectExplorer::ToolChain::ToolChainType(t);
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
m_toolChainId = toolChainId;
|
m_toolChainType = type;
|
||||||
|
|
||||||
delete m_toolChain;
|
delete m_toolChain;
|
||||||
m_toolChain = 0;
|
m_toolChain = 0;
|
||||||
|
|
||||||
if (toolChainId == ToolChain::MinGW) {
|
if (type == ToolChain::MinGW) {
|
||||||
const QLatin1String qmake_cxx("g++"); // ### FIXME
|
const QLatin1String qmake_cxx("g++"); // ### FIXME
|
||||||
const QString mingwDirectory; // ### FIXME
|
const QString mingwDirectory; // ### FIXME
|
||||||
|
|
||||||
m_toolChain = ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory);
|
m_toolChain = ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory);
|
||||||
|
|
||||||
} else if (toolChainId == ToolChain::MSVC) {
|
} else if (type == ToolChain::MSVC) {
|
||||||
const QString msvcVersion; // ### FIXME
|
const QString msvcVersion; // ### FIXME
|
||||||
m_toolChain = ToolChain::createMSVCToolChain(msvcVersion, false);
|
m_toolChain = ToolChain::createMSVCToolChain(msvcVersion, false);
|
||||||
|
|
||||||
} else if (toolChainId == ToolChain::WINCE) {
|
} else if (type == ToolChain::WINCE) {
|
||||||
const QString msvcVersion, wincePlatform; // ### FIXME
|
const QString msvcVersion, wincePlatform; // ### FIXME
|
||||||
m_toolChain = ToolChain::createWinCEToolChain(msvcVersion, wincePlatform);
|
m_toolChain = ToolChain::createWinCEToolChain(msvcVersion, wincePlatform);
|
||||||
|
|
||||||
} else if (toolChainId == ToolChain::GCC || toolChainId == ToolChain::GCC) {
|
} else if (type == ToolChain::GCC || type == ToolChain::GCC) {
|
||||||
const QLatin1String qmake_cxx("g++"); // ### FIXME
|
const QLatin1String qmake_cxx("g++"); // ### FIXME
|
||||||
m_toolChain = ToolChain::createGccToolChain(qmake_cxx);
|
m_toolChain = ToolChain::createGccToolChain(qmake_cxx);
|
||||||
}
|
}
|
||||||
@@ -382,8 +381,8 @@ ProjectExplorer::ToolChain *GenericProject::toolChain() const
|
|||||||
return m_toolChain;
|
return m_toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::ToolChain::ToolChainType GenericProject::toolChainId() const
|
ProjectExplorer::ToolChain::ToolChainType GenericProject::toolChainType() const
|
||||||
{ return m_toolChainId; }
|
{ return m_toolChainType; }
|
||||||
|
|
||||||
QString GenericProject::name() const
|
QString GenericProject::name() const
|
||||||
{
|
{
|
||||||
@@ -494,21 +493,20 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
QString toolChainName = reader.restoreValue(QLatin1String("toolChain")).toString();
|
QString toolChainName = reader.restoreValue(QLatin1String("toolChain")).toString();
|
||||||
bool convertible = false;
|
bool convertible = false;
|
||||||
ToolChain::ToolChainType toolChainId = ToolChain::GCC;
|
ToolChain::ToolChainType type = ToolChain::ToolChainType(toolChainName.toInt(&convertible));
|
||||||
toolChainId = ToolChain::ToolChainType(toolChainName.toInt(&convertible));
|
|
||||||
if (!convertible) {
|
if (!convertible) {
|
||||||
// legacy string values
|
// legacy string values
|
||||||
if (toolChainName == QLatin1String("gcc"))
|
if (toolChainName == QLatin1String("gcc"))
|
||||||
toolChainId = ToolChain::GCC;
|
type = ToolChain::GCC;
|
||||||
else if (toolChainName == QLatin1String("mingw"))
|
else if (toolChainName == QLatin1String("mingw"))
|
||||||
toolChainId = ToolChain::MinGW;
|
type = ToolChain::MinGW;
|
||||||
else if (toolChainName == QLatin1String("msvc"))
|
else if (toolChainName == QLatin1String("msvc"))
|
||||||
toolChainId = ToolChain::MSVC;
|
type = ToolChain::MSVC;
|
||||||
else if (toolChainName == QLatin1String("wince"))
|
else if (toolChainName == QLatin1String("wince"))
|
||||||
toolChainId = ToolChain::WINCE;
|
type = ToolChain::WINCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
setToolChainId(toolChainId); // ### move
|
setToolChainType(type); // ### move
|
||||||
|
|
||||||
const QStringList userIncludePaths =
|
const QStringList userIncludePaths =
|
||||||
reader.restoreValue(QLatin1String("includePaths")).toStringList();
|
reader.restoreValue(QLatin1String("includePaths")).toStringList();
|
||||||
@@ -523,7 +521,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
|
|||||||
{
|
{
|
||||||
Project::saveSettingsImpl(writer);
|
Project::saveSettingsImpl(writer);
|
||||||
|
|
||||||
writer.saveValue(QLatin1String("toolChain"), m_toolChainId);
|
writer.saveValue(QLatin1String("toolChain"), m_toolChainType);
|
||||||
writer.saveValue(QLatin1String("includePaths"), m_includePaths);
|
writer.saveValue(QLatin1String("includePaths"), m_includePaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,13 +546,18 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
|
|||||||
QComboBox *toolChainChooser = new QComboBox;
|
QComboBox *toolChainChooser = new QComboBox;
|
||||||
toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
int index = 0;
|
||||||
|
int selectedIndex = -1;
|
||||||
foreach (ToolChain::ToolChainType tc, ToolChain::supportedToolChains()) {
|
foreach (ToolChain::ToolChainType tc, ToolChain::supportedToolChains()) {
|
||||||
toolChainChooser->addItem(ToolChain::toolChainName(tc), tc);
|
toolChainChooser->addItem(ToolChain::toolChainName(tc), QVariant::fromValue<ToolChain::ToolChainType>(tc));
|
||||||
|
if (m_project->toolChainType() == tc)
|
||||||
|
selectedIndex = index;
|
||||||
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
toolChainChooser->setCurrentIndex(toolChainChooser->findData(m_project->toolChainId()));
|
toolChainChooser->setCurrentIndex(selectedIndex);
|
||||||
fl->addRow(tr("Tool Chain:"), toolChainChooser);
|
fl->addRow(tr("Tool Chain:"), toolChainChooser);
|
||||||
connect(toolChainChooser, SIGNAL(activated(QString)), m_project, SLOT(setToolChainId(int)));
|
connect(toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
||||||
@@ -574,6 +577,15 @@ void GenericBuildSettingsWidget::buildDirectoryChanged()
|
|||||||
m_project->setValue(m_buildConfiguration, "buildDirectory", m_pathChooser->path());
|
m_project->setValue(m_buildConfiguration, "buildDirectory", m_pathChooser->path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||||
|
{
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
|
QComboBox *toolChainChooser = qobject_cast<QComboBox*>(sender());
|
||||||
|
ToolChain::ToolChainType type = toolChainChooser->itemData(index).value<ToolChain::ToolChainType>();
|
||||||
|
m_project->setToolChainType(type);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
// GenericProjectFile
|
// GenericProjectFile
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -111,10 +111,8 @@ public:
|
|||||||
QStringList projectIncludePaths() const;
|
QStringList projectIncludePaths() const;
|
||||||
QStringList files() const;
|
QStringList files() const;
|
||||||
QStringList generated() const;
|
QStringList generated() const;
|
||||||
ProjectExplorer::ToolChain::ToolChainType toolChainId() const;
|
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||||
|
void setToolChainType(ProjectExplorer::ToolChain::ToolChainType type);
|
||||||
public Q_SLOTS:
|
|
||||||
void setToolChainId(int);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||||
@@ -140,7 +138,7 @@ private:
|
|||||||
|
|
||||||
GenericProjectNode *m_rootNode;
|
GenericProjectNode *m_rootNode;
|
||||||
ProjectExplorer::ToolChain *m_toolChain;
|
ProjectExplorer::ToolChain *m_toolChain;
|
||||||
ProjectExplorer::ToolChain::ToolChainType m_toolChainId;
|
ProjectExplorer::ToolChain::ToolChainType m_toolChainType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericProjectFile : public Core::IFile
|
class GenericProjectFile : public Core::IFile
|
||||||
@@ -183,6 +181,7 @@ public:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void buildDirectoryChanged();
|
void buildDirectoryChanged();
|
||||||
|
void toolChainSelected(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GenericProject *m_project;
|
GenericProject *m_project;
|
||||||
|
Reference in New Issue
Block a user