forked from qt-creator/qt-creator
Configuration types for each Qt Version.
This commit is contained in:
@@ -81,6 +81,9 @@ public:
|
|||||||
// restore
|
// restore
|
||||||
// clone
|
// clone
|
||||||
virtual QList<BuildConfiguration *> createDefaultConfigurations() const = 0;
|
virtual QList<BuildConfiguration *> createDefaultConfigurations() const = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void availableCreationTypesChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -164,7 +164,9 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
m_subWidgets = new BuildSettingsSubWidgets(this);
|
m_subWidgets = new BuildSettingsSubWidgets(this);
|
||||||
vbox->addWidget(m_subWidgets);
|
vbox->addWidget(m_subWidgets);
|
||||||
|
|
||||||
createAddButtonMenu();
|
m_addButtonMenu = new QMenu(this);
|
||||||
|
m_addButton->setMenu(m_addButtonMenu);
|
||||||
|
updateAddButtonMenu();
|
||||||
|
|
||||||
m_buildConfiguration = m_project->activeBuildConfiguration()->name();
|
m_buildConfiguration = m_project->activeBuildConfiguration()->name();
|
||||||
|
|
||||||
@@ -176,23 +178,24 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
|
|
||||||
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||||
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||||
|
if (m_project->buildConfigurationFactory())
|
||||||
|
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationTypesChanged()), SLOT(updateAddButtonMenu()));
|
||||||
|
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::createAddButtonMenu()
|
void BuildSettingsWidget::updateAddButtonMenu()
|
||||||
{
|
{
|
||||||
QMenu *addButtonMenu = new QMenu(this);
|
m_addButtonMenu->clear();
|
||||||
addButtonMenu->addAction(tr("&Clone Selected"),
|
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
||||||
this, SLOT(cloneConfiguration()));
|
this, SLOT(cloneConfiguration()));
|
||||||
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
||||||
if (factory) {
|
if (factory) {
|
||||||
foreach (const QString &type, factory->availableCreationTypes()) {
|
foreach (const QString &type, factory->availableCreationTypes()) {
|
||||||
QAction *action = addButtonMenu->addAction(factory->displayNameForType(type), this, SLOT(createConfiguration()));
|
QAction *action = m_addButtonMenu->addAction(factory->displayNameForType(type), this, SLOT(createConfiguration()));
|
||||||
action->setData(type);
|
action->setData(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_addButton->setMenu(addButtonMenu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
||||||
|
|||||||
@@ -98,11 +98,11 @@ private slots:
|
|||||||
void createConfiguration();
|
void createConfiguration();
|
||||||
void cloneConfiguration();
|
void cloneConfiguration();
|
||||||
void deleteConfiguration();
|
void deleteConfiguration();
|
||||||
|
void updateAddButtonMenu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void cloneConfiguration(const QString &toClone);
|
void cloneConfiguration(const QString &toClone);
|
||||||
void deleteConfiguration(const QString &toDelete);
|
void deleteConfiguration(const QString &toDelete);
|
||||||
void createAddButtonMenu();
|
|
||||||
|
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
QPushButton *m_addButton;
|
QPushButton *m_addButton;
|
||||||
@@ -110,6 +110,7 @@ private:
|
|||||||
QComboBox *m_buildConfigurationComboBox;
|
QComboBox *m_buildConfigurationComboBox;
|
||||||
BuildSettingsSubWidgets *m_subWidgets;
|
BuildSettingsSubWidgets *m_subWidgets;
|
||||||
QString m_buildConfiguration;
|
QString m_buildConfiguration;
|
||||||
|
QMenu *m_addButtonMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ using namespace ProjectExplorer;
|
|||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char * const KEY_QT_VERSION_ID = "QtVersionId";
|
||||||
|
}
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -234,25 +238,42 @@ Qt4BuildConfigurationFactory::Qt4BuildConfigurationFactory(Qt4Project *project)
|
|||||||
: IBuildConfigurationFactory(project),
|
: IBuildConfigurationFactory(project),
|
||||||
m_project(project)
|
m_project(project)
|
||||||
{
|
{
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4BuildConfigurationFactory::~Qt4BuildConfigurationFactory()
|
Qt4BuildConfigurationFactory::~Qt4BuildConfigurationFactory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Qt4BuildConfigurationFactory::update()
|
||||||
|
{
|
||||||
|
|
||||||
|
m_versions.clear();
|
||||||
|
m_versions.insert(QLatin1String("DefaultQt"), VersionInfo(tr("Using Default Qt Version"), 0));
|
||||||
|
QtVersionManager *vm = QtVersionManager::instance();
|
||||||
|
foreach (const QtVersion *version, vm->versions()) {
|
||||||
|
m_versions.insert(QString::fromLatin1("Qt%1").arg(version->uniqueId()),
|
||||||
|
VersionInfo(tr("Using Qt Version \"%1\"").arg(version->name()), version->uniqueId()));
|
||||||
|
}
|
||||||
|
emit availableCreationTypesChanged();
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Qt4BuildConfigurationFactory::availableCreationTypes() const
|
QStringList Qt4BuildConfigurationFactory::availableCreationTypes() const
|
||||||
{
|
{
|
||||||
return QStringList() << "DefaultQt";
|
return m_versions.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Qt4BuildConfigurationFactory::displayNameForType(const QString &type) const
|
QString Qt4BuildConfigurationFactory::displayNameForType(const QString &type) const
|
||||||
{
|
{
|
||||||
return tr("Using Default Qt Version");
|
if (m_versions.contains(type))
|
||||||
|
return m_versions.value(type).displayName;
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildConfiguration *> Qt4BuildConfigurationFactory::create(const QString &type) const
|
QList<BuildConfiguration *> Qt4BuildConfigurationFactory::create(const QString &type) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(type == "DefaultQt", return QList<BuildConfiguration*>());
|
QTC_ASSERT(m_versions.contains(type), return QList<BuildConfiguration *>());
|
||||||
|
const VersionInfo &info = m_versions.value(type);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString buildConfigurationName = QInputDialog::getText(0,
|
QString buildConfigurationName = QInputDialog::getText(0,
|
||||||
tr("New configuration"),
|
tr("New configuration"),
|
||||||
@@ -263,6 +284,7 @@ QList<BuildConfiguration *> Qt4BuildConfigurationFactory::create(const QString &
|
|||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return QList<BuildConfiguration *>();
|
return QList<BuildConfiguration *>();
|
||||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||||
|
bc->setValue(KEY_QT_VERSION_ID, info.versionId);
|
||||||
return QList<BuildConfiguration *>() << bc;
|
return QList<BuildConfiguration *>() << bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +339,7 @@ void Qt4Project::qtVersionsChanged()
|
|||||||
m_rootProjectNode->update();
|
m_rootProjectNode->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_buildConfigurationFactory->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4Project::updateFileList()
|
void Qt4Project::updateFileList()
|
||||||
@@ -891,13 +914,13 @@ int Qt4Project::qtVersionId(BuildConfiguration *configuration) const
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug()<<"Looking for qtVersion ID of "<<configuration->name();
|
qDebug()<<"Looking for qtVersion ID of "<<configuration->name();
|
||||||
int id = 0;
|
int id = 0;
|
||||||
QVariant vid = configuration->value("QtVersionId");
|
QVariant vid = configuration->value(KEY_QT_VERSION_ID);
|
||||||
if (vid.isValid()) {
|
if (vid.isValid()) {
|
||||||
id = vid.toInt();
|
id = vid.toInt();
|
||||||
if (vm->version(id)->isValid()) {
|
if (vm->version(id)->isValid()) {
|
||||||
return id;
|
return id;
|
||||||
} else {
|
} else {
|
||||||
configuration->setValue("QtVersionId", 0);
|
configuration->setValue(KEY_QT_VERSION_ID, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -911,7 +934,7 @@ int Qt4Project::qtVersionId(BuildConfiguration *configuration) const
|
|||||||
if (version->name() == vname) {
|
if (version->name() == vname) {
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug()<<"found name in versions";
|
qDebug()<<"found name in versions";
|
||||||
configuration->setValue("QtVersionId", version->uniqueId());
|
configuration->setValue(KEY_QT_VERSION_ID, version->uniqueId());
|
||||||
return version->uniqueId();
|
return version->uniqueId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -920,13 +943,13 @@ int Qt4Project::qtVersionId(BuildConfiguration *configuration) const
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug()<<" using qtversion with id ="<<id;
|
qDebug()<<" using qtversion with id ="<<id;
|
||||||
// Nothing found, reset to default
|
// Nothing found, reset to default
|
||||||
configuration->setValue("QtVersionId", id);
|
configuration->setValue(KEY_QT_VERSION_ID, id);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4Project::setQtVersion(BuildConfiguration *configuration, int id)
|
void Qt4Project::setQtVersion(BuildConfiguration *configuration, int id)
|
||||||
{
|
{
|
||||||
configuration->setValue("QtVersionId", id);
|
configuration->setValue(KEY_QT_VERSION_ID, id);
|
||||||
updateActiveRunConfiguration();
|
updateActiveRunConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
#include <QtCore/QMap>
|
||||||
#include <QtGui/QDirModel>
|
#include <QtGui/QDirModel>
|
||||||
#include "qtextended_integration.h"
|
#include "qtextended_integration.h"
|
||||||
|
|
||||||
@@ -131,8 +132,19 @@ public:
|
|||||||
QList<ProjectExplorer::BuildConfiguration *> create(const QString &type) const;
|
QList<ProjectExplorer::BuildConfiguration *> create(const QString &type) const;
|
||||||
QList<ProjectExplorer::BuildConfiguration *> createDefaultConfigurations() const;
|
QList<ProjectExplorer::BuildConfiguration *> createDefaultConfigurations() const;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct VersionInfo {
|
||||||
|
VersionInfo() {}
|
||||||
|
VersionInfo(const QString &d, int v)
|
||||||
|
: displayName(d), versionId(v) { }
|
||||||
|
QString displayName;
|
||||||
|
int versionId;
|
||||||
|
};
|
||||||
|
|
||||||
Qt4Project *m_project;
|
Qt4Project *m_project;
|
||||||
|
QMap<QString, VersionInfo> m_versions;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Qt4Project : public ProjectExplorer::Project
|
class Qt4Project : public ProjectExplorer::Project
|
||||||
|
|||||||
Reference in New Issue
Block a user