forked from qt-creator/qt-creator
TargetSetupPage: Generalize the page
Generalize the target setup page and move it into projectexplorer Move the qmake specific code into a projectimporter class with a specialization for qmake projects in the qt4projectmanager. This change depends heavily on the BuildConfigurationFactory cleanups done earlier and completes that change in such a way that generic build configuration factories are now in theory possible. The remaining problem is how to select the best factory of several that claim to be able to handle a kit and that is left for the next patch. Change-Id: I47134cb1938c52adebcdc1ddfe8dbf26abbbbeee Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -104,6 +104,24 @@ QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Tar
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AutotoolsBuildConfigurationFactory::canSetup(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||||
|
.matchesType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<BuildInfo *> result;
|
||||||
|
QTC_ASSERT(canSetup(k, projectPath), return result);
|
||||||
|
BuildInfo *info = createBuildInfo(k,
|
||||||
|
Utils::FileName::fromString(AutotoolsProject::defaultBuildDirectory(projectPath)));
|
||||||
|
//: The name of the build configuration created by default for a autotools project.
|
||||||
|
info->displayName = tr("Default");
|
||||||
|
result << info;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
BuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
BuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(parent, return 0);
|
QTC_ASSERT(parent, return 0);
|
||||||
@@ -165,6 +183,7 @@ BuildInfo *AutotoolsBuildConfigurationFactory::createBuildInfo(const ProjectExpl
|
|||||||
info->typeName = tr("Build");
|
info->typeName = tr("Build");
|
||||||
info->buildDirectory = buildDir;
|
info->buildDirectory = buildDir;
|
||||||
info->kitId = k->id();
|
info->kitId = k->id();
|
||||||
|
info->supportsShadowBuild = true; // Works sometimes...
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public:
|
|||||||
|
|
||||||
bool canCreate(const ProjectExplorer::Target *parent) const;
|
bool canCreate(const ProjectExplorer::Target *parent) const;
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||||
|
bool canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const;
|
const ProjectExplorer::BuildInfo *info) const;
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,30 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
|
|||||||
QList<ProjectExplorer::BuildInfo *> result;
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
QTC_ASSERT(canCreate(parent), return result);
|
QTC_ASSERT(canCreate(parent), return result);
|
||||||
|
|
||||||
CMakeBuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectDirectory());
|
CMakeBuildInfo *info = createBuildInfo(parent->kit(),
|
||||||
|
parent->project()->projectDirectory());
|
||||||
|
result << info;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMakeBuildConfigurationFactory::canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||||
|
.matchesType(QLatin1String(Constants::CMAKEMIMETYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
|
QTC_ASSERT(canSetup(k, projectPath), return result);
|
||||||
|
|
||||||
|
CMakeBuildInfo *info = createBuildInfo(k, ProjectExplorer::Project::projectDirectory(projectPath));
|
||||||
|
//: The name of the build configuration created by default for a cmake project.
|
||||||
|
info->displayName = tr("Default");
|
||||||
|
info->buildDirectory
|
||||||
|
= Utils::FileName::fromString(CMakeProject::shadowBuildDirectory(projectPath, k,
|
||||||
|
info->displayName));
|
||||||
result << info;
|
result << info;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -234,6 +257,7 @@ CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExp
|
|||||||
k->addToEnvironment(info->environment);
|
k->addToEnvironment(info->environment);
|
||||||
info->useNinja = false;
|
info->useNinja = false;
|
||||||
info->sourceDirectory = sourceDir;
|
info->sourceDirectory = sourceDir;
|
||||||
|
info->supportsShadowBuild = true;
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ public:
|
|||||||
|
|
||||||
bool canCreate(const ProjectExplorer::Target *parent) const;
|
bool canCreate(const ProjectExplorer::Target *parent) const;
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||||
|
bool canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const;
|
const ProjectExplorer::BuildInfo *info) const;
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public:
|
|||||||
|
|
||||||
CMakeBuildTarget buildTargetForTitle(const QString &title);
|
CMakeBuildTarget buildTargetForTitle(const QString &title);
|
||||||
|
|
||||||
QString shadowBuildDirectory(const QString &projectFilePath, const ProjectExplorer::Kit *k,
|
static QString shadowBuildDirectory(const QString &projectFilePath, const ProjectExplorer::Kit *k,
|
||||||
const QString &bcName);
|
const QString &bcName);
|
||||||
|
|
||||||
bool isProjectFile(const QString &fileName);
|
bool isProjectFile(const QString &fileName);
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,23 @@ QList<BuildInfo *> GenericBuildConfigurationFactory::availableBuilds(const Targe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GenericBuildConfigurationFactory::canSetup(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||||
|
.matchesType(QLatin1String(Constants::GENERICMIMETYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<BuildInfo *> result;
|
||||||
|
QTC_ASSERT(canSetup(k, projectPath), return result);
|
||||||
|
BuildInfo *info = createBuildInfo(k, Utils::FileName::fromString(ProjectExplorer::Project::projectDirectory(projectPath)));
|
||||||
|
//: The name of the build configuration created by default for a generic project.
|
||||||
|
info->displayName = tr("Default");
|
||||||
|
result << info;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
BuildConfiguration *GenericBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
BuildConfiguration *GenericBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(canCreate(parent), return 0);
|
QTC_ASSERT(canCreate(parent), return 0);
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ public:
|
|||||||
|
|
||||||
bool canCreate(const ProjectExplorer::Target *parent) const;
|
bool canCreate(const ProjectExplorer::Target *parent) const;
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||||
|
bool canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const;
|
const ProjectExplorer::BuildInfo *info) const;
|
||||||
|
|
||||||
|
|||||||
@@ -341,6 +341,18 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, con
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup
|
||||||
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Kit *k, const QString &projectPath)
|
||||||
|
{
|
||||||
|
QList<IBuildConfigurationFactory *> factories
|
||||||
|
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
|
||||||
|
foreach (IBuildConfigurationFactory *factory, factories) {
|
||||||
|
if (factory->canSetup(k, projectPath))
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// create
|
// create
|
||||||
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,6 +133,13 @@ public:
|
|||||||
// List of build information that can be used to create a new build configuration via
|
// List of build information that can be used to create a new build configuration via
|
||||||
// "Add Build Configuration" button.
|
// "Add Build Configuration" button.
|
||||||
virtual QList<BuildInfo *> availableBuilds(const Target *parent) const = 0;
|
virtual QList<BuildInfo *> availableBuilds(const Target *parent) const = 0;
|
||||||
|
|
||||||
|
// Used to see whether this factory can produce any BuildConfigurations for a kit when
|
||||||
|
// setting up the given project.
|
||||||
|
virtual bool canSetup(const Kit *k, const QString &projectPath) const = 0;
|
||||||
|
// List of build information that can be used to initially set up a new build configuration.
|
||||||
|
virtual QList<BuildInfo *> availableSetups(const Kit *k, const QString &projectPath) const = 0;
|
||||||
|
|
||||||
virtual BuildConfiguration *create(Target *parent, const BuildInfo *info) const = 0;
|
virtual BuildConfiguration *create(Target *parent, const BuildInfo *info) const = 0;
|
||||||
|
|
||||||
// used to recreate the runConfigurations when restoring settings
|
// used to recreate the runConfigurations when restoring settings
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
|
|||||||
|
|
||||||
BuildSettingsWidget::~BuildSettingsWidget()
|
BuildSettingsWidget::~BuildSettingsWidget()
|
||||||
{
|
{
|
||||||
clear();
|
clearWidgets();
|
||||||
qDeleteAll(m_buildInfoList);
|
qDeleteAll(m_buildInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ void BuildSettingsWidget::addSubWidget(NamedWidget *widget)
|
|||||||
m_subWidgets.append(widget);
|
m_subWidgets.append(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::clear()
|
void BuildSettingsWidget::clearWidgets()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_subWidgets);
|
qDeleteAll(m_subWidgets);
|
||||||
m_subWidgets.clear();
|
m_subWidgets.clear();
|
||||||
@@ -232,7 +232,7 @@ void BuildSettingsWidget::updateAddButtonMenu()
|
|||||||
|
|
||||||
void BuildSettingsWidget::updateBuildSettings()
|
void BuildSettingsWidget::updateBuildSettings()
|
||||||
{
|
{
|
||||||
clear();
|
clearWidgets();
|
||||||
|
|
||||||
// update buttons
|
// update buttons
|
||||||
m_removeButton->setEnabled(m_target->buildConfigurations().size() > 1);
|
m_removeButton->setEnabled(m_target->buildConfigurations().size() > 1);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
BuildSettingsWidget(Target *target);
|
BuildSettingsWidget(Target *target);
|
||||||
~BuildSettingsWidget();
|
~BuildSettingsWidget();
|
||||||
|
|
||||||
void clear();
|
void clearWidgets();
|
||||||
void addSubWidget(ProjectExplorer::NamedWidget *widget);
|
void addSubWidget(ProjectExplorer::NamedWidget *widget);
|
||||||
QList<ProjectExplorer::NamedWidget *> subWidgets() const;
|
QList<ProjectExplorer::NamedWidget *> subWidgets() const;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ImportWidget::ImportWidget(QWidget *parent) :
|
ImportWidget::ImportWidget(QWidget *parent) :
|
||||||
@@ -85,4 +85,4 @@ void ImportWidget::handleImportRequest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace ProjectExplorer
|
||||||
@@ -37,7 +37,7 @@ class PathChooser;
|
|||||||
class FileName;
|
class FileName;
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ImportWidget : public QWidget
|
class ImportWidget : public QWidget
|
||||||
@@ -61,6 +61,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // IMPORTWIDGET_H
|
#endif // IMPORTWIDGET_H
|
||||||
@@ -282,6 +282,7 @@ Target *Project::restoreTarget(const QVariantMap &data)
|
|||||||
delete t;
|
delete t;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,8 +506,16 @@ void Project::setup(QList<const BuildInfo *> infoList)
|
|||||||
continue;
|
continue;
|
||||||
t->addBuildConfiguration(bc);
|
t->addBuildConfiguration(bc);
|
||||||
}
|
}
|
||||||
foreach (Target *t, toRegister)
|
foreach (Target *t, toRegister) {
|
||||||
|
t->updateDefaultDeployConfigurations();
|
||||||
|
t->updateDefaultRunConfigurations();
|
||||||
addTarget(t);
|
addTarget(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectImporter *Project::createProjectImporter() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::onBuildDirectoryChanged()
|
void Project::onBuildDirectoryChanged()
|
||||||
|
|||||||
@@ -47,8 +47,10 @@ namespace ProjectExplorer {
|
|||||||
class BuildInfo;
|
class BuildInfo;
|
||||||
class IProjectManager;
|
class IProjectManager;
|
||||||
class EditorConfiguration;
|
class EditorConfiguration;
|
||||||
|
class ProjectImporter;
|
||||||
class ProjectNode;
|
class ProjectNode;
|
||||||
class Kit;
|
class Kit;
|
||||||
|
class KitMatcher;
|
||||||
class NamedWidget;
|
class NamedWidget;
|
||||||
class Target;
|
class Target;
|
||||||
class ProjectPrivate;
|
class ProjectPrivate;
|
||||||
@@ -125,6 +127,9 @@ public:
|
|||||||
virtual void configureAsExampleProject(const QStringList &platforms);
|
virtual void configureAsExampleProject(const QStringList &platforms);
|
||||||
|
|
||||||
virtual bool supportsNoTargetPanel() const;
|
virtual bool supportsNoTargetPanel() const;
|
||||||
|
virtual ProjectImporter *createProjectImporter() const;
|
||||||
|
virtual KitMatcher *createRequiredKitMatcher() const { return 0; }
|
||||||
|
virtual KitMatcher *createPreferredKitMatcher() const { return 0; }
|
||||||
|
|
||||||
virtual bool needsSpecialDeployment() const;
|
virtual bool needsSpecialDeployment() const;
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "projectexplorersettings.h"
|
#include "projectexplorersettings.h"
|
||||||
#include "projectmacroexpander.h"
|
#include "projectmacroexpander.h"
|
||||||
#include "removetaskhandler.h"
|
#include "removetaskhandler.h"
|
||||||
|
#include "unconfiguredprojectpanel.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
#include "kitoptionspage.h"
|
#include "kitoptionspage.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
@@ -429,6 +430,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
addAutoReleasedObject(new DependenciesPanelFactory);
|
addAutoReleasedObject(new DependenciesPanelFactory);
|
||||||
|
|
||||||
addAutoReleasedObject(new ProcessStepFactory);
|
addAutoReleasedObject(new ProcessStepFactory);
|
||||||
|
addAutoReleasedObject(new UnconfiguredProjectPanel);
|
||||||
|
|
||||||
addAutoReleasedObject(new AllProjectsFind);
|
addAutoReleasedObject(new AllProjectsFind);
|
||||||
addAutoReleasedObject(new CurrentProjectFind);
|
addAutoReleasedObject(new CurrentProjectFind);
|
||||||
@@ -1653,7 +1655,7 @@ void ProjectExplorerPlugin::buildStateChanged(Project * pro)
|
|||||||
{
|
{
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qDebug() << "buildStateChanged";
|
qDebug() << "buildStateChanged";
|
||||||
qDebug() << pro->document()->filePath() << "isBuilding()" << BuildManager::isBuilding(pro);
|
qDebug() << pro->projectFilePath() << "isBuilding()" << BuildManager::isBuilding(pro);
|
||||||
}
|
}
|
||||||
Q_UNUSED(pro)
|
Q_UNUSED(pro)
|
||||||
updateActions();
|
updateActions();
|
||||||
|
|||||||
@@ -11,12 +11,17 @@ HEADERS += projectexplorer.h \
|
|||||||
environmentaspect.h \
|
environmentaspect.h \
|
||||||
environmentaspectwidget.h \
|
environmentaspectwidget.h \
|
||||||
gcctoolchain.h \
|
gcctoolchain.h \
|
||||||
|
importwidget.h \
|
||||||
localapplicationrunconfiguration.h \
|
localapplicationrunconfiguration.h \
|
||||||
localenvironmentaspect.h \
|
localenvironmentaspect.h \
|
||||||
osparser.h \
|
osparser.h \
|
||||||
projectexplorer_export.h \
|
projectexplorer_export.h \
|
||||||
|
projectimporter.h \
|
||||||
projectwindow.h \
|
projectwindow.h \
|
||||||
removetaskhandler.h \
|
removetaskhandler.h \
|
||||||
|
targetsetuppage.h \
|
||||||
|
targetsetupwidget.h \
|
||||||
|
unconfiguredprojectpanel.h \
|
||||||
kit.h \
|
kit.h \
|
||||||
kitchooser.h \
|
kitchooser.h \
|
||||||
kitconfigwidget.h \
|
kitconfigwidget.h \
|
||||||
@@ -147,11 +152,16 @@ SOURCES += projectexplorer.cpp \
|
|||||||
environmentaspect.cpp \
|
environmentaspect.cpp \
|
||||||
environmentaspectwidget.cpp \
|
environmentaspectwidget.cpp \
|
||||||
gcctoolchain.cpp \
|
gcctoolchain.cpp \
|
||||||
|
importwidget.cpp \
|
||||||
localapplicationrunconfiguration.cpp \
|
localapplicationrunconfiguration.cpp \
|
||||||
localenvironmentaspect.cpp \
|
localenvironmentaspect.cpp \
|
||||||
osparser.cpp \
|
osparser.cpp \
|
||||||
|
projectimporter.cpp \
|
||||||
projectwindow.cpp \
|
projectwindow.cpp \
|
||||||
removetaskhandler.cpp \
|
removetaskhandler.cpp \
|
||||||
|
targetsetuppage.cpp \
|
||||||
|
targetsetupwidget.cpp \
|
||||||
|
unconfiguredprojectpanel.cpp \
|
||||||
kit.cpp \
|
kit.cpp \
|
||||||
kitchooser.cpp \
|
kitchooser.cpp \
|
||||||
kitconfigwidget.cpp \
|
kitconfigwidget.cpp \
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ QtcPlugin {
|
|||||||
"gcctoolchainfactories.h",
|
"gcctoolchainfactories.h",
|
||||||
"gnumakeparser.cpp", "gnumakeparser.h",
|
"gnumakeparser.cpp", "gnumakeparser.h",
|
||||||
"headerpath.h",
|
"headerpath.h",
|
||||||
|
"importwidget.cpp", "importwidget.h",
|
||||||
"ioutputparser.cpp", "ioutputparser.h",
|
"ioutputparser.cpp", "ioutputparser.h",
|
||||||
"iprojectmanager.h",
|
"iprojectmanager.h",
|
||||||
"iprojectproperties.h",
|
"iprojectproperties.h",
|
||||||
@@ -108,6 +109,7 @@ QtcPlugin {
|
|||||||
"projectexplorersettings.h",
|
"projectexplorersettings.h",
|
||||||
"projectexplorersettingspage.cpp", "projectexplorersettingspage.h", "projectexplorersettingspage.ui",
|
"projectexplorersettingspage.cpp", "projectexplorersettingspage.h", "projectexplorersettingspage.ui",
|
||||||
"projectfilewizardextension.cpp", "projectfilewizardextension.h",
|
"projectfilewizardextension.cpp", "projectfilewizardextension.h",
|
||||||
|
"projectimporter.cpp", "projectimporter.h",
|
||||||
"projectmacroexpander.cpp", "projectmacroexpander.h",
|
"projectmacroexpander.cpp", "projectmacroexpander.h",
|
||||||
"projectmodels.cpp", "projectmodels.h",
|
"projectmodels.cpp", "projectmodels.h",
|
||||||
"projectnodes.cpp", "projectnodes.h",
|
"projectnodes.cpp", "projectnodes.h",
|
||||||
@@ -126,8 +128,9 @@ QtcPlugin {
|
|||||||
"target.cpp", "target.h",
|
"target.cpp", "target.h",
|
||||||
"targetselector.cpp", "targetselector.h",
|
"targetselector.cpp", "targetselector.h",
|
||||||
"targetsettingspanel.cpp", "targetsettingspanel.h",
|
"targetsettingspanel.cpp", "targetsettingspanel.h",
|
||||||
"targetsettingswidget.cpp", "targetsettingswidget.h",
|
"targetsettingswidget.cpp", "targetsettingswidget.h", "targetsettingswidget.ui",
|
||||||
"targetsettingswidget.ui",
|
"targetsetuppage.cpp", "targetsetuppage.h",
|
||||||
|
"targetsetupwidget.cpp", "targetsetupwidget.h",
|
||||||
"task.cpp", "task.h",
|
"task.cpp", "task.h",
|
||||||
"taskhub.cpp", "taskhub.h",
|
"taskhub.cpp", "taskhub.h",
|
||||||
"taskmodel.cpp", "taskmodel.h",
|
"taskmodel.cpp", "taskmodel.h",
|
||||||
@@ -136,6 +139,7 @@ QtcPlugin {
|
|||||||
"toolchainconfigwidget.cpp", "toolchainconfigwidget.h",
|
"toolchainconfigwidget.cpp", "toolchainconfigwidget.h",
|
||||||
"toolchainmanager.cpp", "toolchainmanager.h",
|
"toolchainmanager.cpp", "toolchainmanager.h",
|
||||||
"toolchainoptionspage.cpp", "toolchainoptionspage.h",
|
"toolchainoptionspage.cpp", "toolchainoptionspage.h",
|
||||||
|
"unconfiguredprojectpanel.cpp", "unconfiguredprojectpanel.h",
|
||||||
"vcsannotatetaskhandler.cpp", "vcsannotatetaskhandler.h",
|
"vcsannotatetaskhandler.cpp", "vcsannotatetaskhandler.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,6 +246,9 @@ const char VAR_CURRENTKIT_ID[] = "CurrentKit:Id";
|
|||||||
const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
|
const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
|
||||||
const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
|
const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
|
||||||
|
|
||||||
|
// Unconfigured Panel
|
||||||
|
const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|
||||||
// Run modes
|
// Run modes
|
||||||
|
|||||||
130
src/plugins/projectexplorer/projectimporter.cpp
Normal file
130
src/plugins/projectexplorer/projectimporter.cpp
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "projectimporter.h"
|
||||||
|
|
||||||
|
#include "kit.h"
|
||||||
|
#include "kitmanager.h"
|
||||||
|
#include "project.h"
|
||||||
|
|
||||||
|
#include <coreplugin/idocument.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static const Core::Id KIT_IS_TEMPORARY("PE.TempKit");
|
||||||
|
static const Core::Id KIT_TEMPORARY_NAME("PE.TempName");
|
||||||
|
static const Core::Id KIT_FINAL_NAME("PE.FinalName");
|
||||||
|
static const Core::Id TEMPORARY_OF_PROJECTS("PE.TempProject");
|
||||||
|
|
||||||
|
ProjectImporter::ProjectImporter(const QString &path) : m_projectPath(path), m_isUpdating(false)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
ProjectImporter::~ProjectImporter()
|
||||||
|
{
|
||||||
|
foreach (Kit *k, KitManager::kits())
|
||||||
|
removeProject(k, m_projectPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectImporter::markTemporary(Kit *k)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(!k->hasValue(KIT_IS_TEMPORARY), return);
|
||||||
|
|
||||||
|
setIsUpdating(true);
|
||||||
|
|
||||||
|
const QString name = k->displayName();
|
||||||
|
k->setDisplayName(QCoreApplication::translate("ProjectExplorer::ProjectImporter",
|
||||||
|
"%1 - temporary").arg(name));
|
||||||
|
|
||||||
|
k->setValue(KIT_TEMPORARY_NAME, k->displayName());
|
||||||
|
k->setValue(KIT_FINAL_NAME, name);
|
||||||
|
k->setValue(KIT_IS_TEMPORARY, true);
|
||||||
|
|
||||||
|
setIsUpdating(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectImporter::makePermanent(Kit *k)
|
||||||
|
{
|
||||||
|
if (!k->hasValue(KIT_IS_TEMPORARY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
setIsUpdating(true);
|
||||||
|
|
||||||
|
k->removeKey(KIT_IS_TEMPORARY);
|
||||||
|
k->removeKey(TEMPORARY_OF_PROJECTS);
|
||||||
|
const QString tempName = k->value(KIT_TEMPORARY_NAME).toString();
|
||||||
|
if (!tempName.isNull() && k->displayName() == tempName)
|
||||||
|
k->setDisplayName(k->value(KIT_FINAL_NAME).toString());
|
||||||
|
k->removeKey(KIT_TEMPORARY_NAME);
|
||||||
|
k->removeKey(KIT_FINAL_NAME);
|
||||||
|
|
||||||
|
setIsUpdating(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectImporter::cleanupKit(Kit *k)
|
||||||
|
{
|
||||||
|
Q_UNUSED(k);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectImporter::addProject(Kit *k)
|
||||||
|
{
|
||||||
|
if (!k->hasValue(KIT_IS_TEMPORARY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
|
||||||
|
|
||||||
|
projects.append(m_projectPath); // note: There can be more than one instance of the project added!
|
||||||
|
|
||||||
|
setIsUpdating(true);
|
||||||
|
|
||||||
|
k->setValue(TEMPORARY_OF_PROJECTS, projects);
|
||||||
|
|
||||||
|
setIsUpdating(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectImporter::removeProject(Kit *k, const QString &path)
|
||||||
|
{
|
||||||
|
if (!k->hasValue(KIT_IS_TEMPORARY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
|
||||||
|
projects.removeOne(path);
|
||||||
|
|
||||||
|
setIsUpdating(true);
|
||||||
|
|
||||||
|
if (projects.isEmpty())
|
||||||
|
ProjectExplorer::KitManager::deregisterKit(k);
|
||||||
|
else
|
||||||
|
k->setValue(TEMPORARY_OF_PROJECTS, projects);
|
||||||
|
|
||||||
|
setIsUpdating(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ProjectExplorer
|
||||||
78
src/plugins/projectexplorer/projectimporter.h
Normal file
78
src/plugins/projectexplorer/projectimporter.h
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PROJECTIMPORTER_H
|
||||||
|
#define PROJECTIMPORTER_H
|
||||||
|
|
||||||
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
class BuildInfo;
|
||||||
|
class Kit;
|
||||||
|
class Project;
|
||||||
|
class Target;
|
||||||
|
|
||||||
|
// Documentation inside.
|
||||||
|
class PROJECTEXPLORER_EXPORT ProjectImporter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProjectImporter(const QString &path);
|
||||||
|
virtual ~ProjectImporter();
|
||||||
|
|
||||||
|
const QString projectFilePath() const { return m_projectPath; }
|
||||||
|
|
||||||
|
virtual QList<BuildInfo *> import(const Utils::FileName &importPath, bool silent = false) = 0;
|
||||||
|
virtual QStringList importCandidates(const Utils::FileName &projectFilePath) = 0;
|
||||||
|
virtual Target *preferredTarget(const QList<Target *> &possibleTargets) = 0;
|
||||||
|
|
||||||
|
bool isUpdating() const { return m_isUpdating; }
|
||||||
|
|
||||||
|
virtual void markTemporary(Kit *k);
|
||||||
|
virtual void makePermanent(Kit *k);
|
||||||
|
|
||||||
|
// Additional cleanup that has to happen when kits are removed
|
||||||
|
virtual void cleanupKit(Kit *k);
|
||||||
|
|
||||||
|
void addProject(Kit *k);
|
||||||
|
void removeProject(Kit *k, const QString &path);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setIsUpdating(bool b) { m_isUpdating = b; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const QString m_projectPath;
|
||||||
|
bool m_isUpdating;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
|
#endif // PROJECTIMPORTER_H
|
||||||
@@ -528,7 +528,7 @@ void Target::updateDefaultBuildConfigurations()
|
|||||||
qWarning("No build configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
qWarning("No build configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<BuildInfo *> infoList = bcFactory->availableBuilds(this);
|
QList<BuildInfo *> infoList = bcFactory->availableSetups(this->kit(), project()->projectFilePath());
|
||||||
foreach (BuildInfo *info, infoList) {
|
foreach (BuildInfo *info, infoList) {
|
||||||
BuildConfiguration *bc = bcFactory->create(this, info);
|
BuildConfiguration *bc = bcFactory->create(this, info);
|
||||||
if (!bc)
|
if (!bc)
|
||||||
|
|||||||
531
src/plugins/projectexplorer/targetsetuppage.cpp
Normal file
531
src/plugins/projectexplorer/targetsetuppage.cpp
Normal file
@@ -0,0 +1,531 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "targetsetuppage.h"
|
||||||
|
#include "buildconfiguration.h"
|
||||||
|
#include "buildinfo.h"
|
||||||
|
#include "kit.h"
|
||||||
|
#include "kitmanager.h"
|
||||||
|
#include "importwidget.h"
|
||||||
|
#include "project.h"
|
||||||
|
#include "projectexplorerconstants.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "targetsetupwidget.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class TargetSetupPageUi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QWidget *centralWidget;
|
||||||
|
QWidget *scrollAreaWidget;
|
||||||
|
QScrollArea *scrollArea;
|
||||||
|
QLabel *headerLabel;
|
||||||
|
QLabel *descriptionLabel;
|
||||||
|
QLabel *noValidKitLabel;
|
||||||
|
QLabel *optionHintLabel;
|
||||||
|
|
||||||
|
void setupUi(QWidget *q)
|
||||||
|
{
|
||||||
|
QWidget *setupTargetPage = new QWidget(q);
|
||||||
|
descriptionLabel = new QLabel(setupTargetPage);
|
||||||
|
descriptionLabel->setWordWrap(true);
|
||||||
|
descriptionLabel->setVisible(false);
|
||||||
|
|
||||||
|
headerLabel = new QLabel(setupTargetPage);
|
||||||
|
headerLabel->setWordWrap(true);
|
||||||
|
headerLabel->setVisible(false);
|
||||||
|
|
||||||
|
noValidKitLabel = new QLabel(setupTargetPage);
|
||||||
|
noValidKitLabel->setWordWrap(true);
|
||||||
|
noValidKitLabel->setText(TargetSetupPage::tr("<span style=\" font-weight:600;\">No valid kits found.</span>"));
|
||||||
|
|
||||||
|
|
||||||
|
optionHintLabel = new QLabel(setupTargetPage);
|
||||||
|
optionHintLabel->setWordWrap(true);
|
||||||
|
optionHintLabel->setText(TargetSetupPage::tr(
|
||||||
|
"Please add a kit in the <a href=\"buildandrun\">options</a> "
|
||||||
|
"or via the maintenance tool of the SDK."));
|
||||||
|
optionHintLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
optionHintLabel->setVisible(false);
|
||||||
|
|
||||||
|
centralWidget = new QWidget(setupTargetPage);
|
||||||
|
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
policy.setHorizontalStretch(0);
|
||||||
|
policy.setVerticalStretch(0);
|
||||||
|
policy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
|
||||||
|
centralWidget->setSizePolicy(policy);
|
||||||
|
|
||||||
|
scrollAreaWidget = new QWidget(setupTargetPage);
|
||||||
|
scrollArea = new QScrollArea(scrollAreaWidget);
|
||||||
|
scrollArea->setWidgetResizable(true);
|
||||||
|
|
||||||
|
QWidget *scrollAreaWidgetContents;
|
||||||
|
scrollAreaWidgetContents = new QWidget();
|
||||||
|
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 230, 81));
|
||||||
|
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||||
|
|
||||||
|
QVBoxLayout *verticalLayout = new QVBoxLayout(scrollAreaWidget);
|
||||||
|
verticalLayout->setSpacing(0);
|
||||||
|
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
verticalLayout->addWidget(scrollArea);
|
||||||
|
|
||||||
|
QVBoxLayout *verticalLayout_2 = new QVBoxLayout(setupTargetPage);
|
||||||
|
verticalLayout_2->addWidget(headerLabel);
|
||||||
|
verticalLayout_2->addWidget(noValidKitLabel);
|
||||||
|
verticalLayout_2->addWidget(descriptionLabel);
|
||||||
|
verticalLayout_2->addWidget(optionHintLabel);
|
||||||
|
verticalLayout_2->addWidget(centralWidget);
|
||||||
|
verticalLayout_2->addWidget(scrollAreaWidget);
|
||||||
|
|
||||||
|
QVBoxLayout *verticalLayout_3 = new QVBoxLayout(q);
|
||||||
|
verticalLayout_3->setContentsMargins(0, 0, 0, -1);
|
||||||
|
verticalLayout_3->addWidget(setupTargetPage);
|
||||||
|
|
||||||
|
QObject::connect(optionHintLabel, SIGNAL(linkActivated(QString)),
|
||||||
|
q, SLOT(openOptions()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
|
using namespace Internal;
|
||||||
|
|
||||||
|
TargetSetupPage::TargetSetupPage(QWidget *parent) :
|
||||||
|
QWizardPage(parent),
|
||||||
|
m_requiredMatcher(0),
|
||||||
|
m_preferredMatcher(0),
|
||||||
|
m_importer(0),
|
||||||
|
m_baseLayout(0),
|
||||||
|
m_importSearch(false),
|
||||||
|
m_firstWidget(0),
|
||||||
|
m_ui(new TargetSetupPageUi),
|
||||||
|
m_importWidget(new Internal::ImportWidget(this)),
|
||||||
|
m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)),
|
||||||
|
m_forceOptionHint(false)
|
||||||
|
{
|
||||||
|
setObjectName(QLatin1String("TargetSetupPage"));
|
||||||
|
setWindowTitle(tr("Select Kits for Your Project"));
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
policy.setHorizontalStretch(0);
|
||||||
|
policy.setVerticalStretch(0);
|
||||||
|
policy.setHeightForWidth(sizePolicy().hasHeightForWidth());
|
||||||
|
setSizePolicy(policy);
|
||||||
|
|
||||||
|
QWidget *centralWidget = new QWidget(this);
|
||||||
|
m_ui->scrollArea->setWidget(centralWidget);
|
||||||
|
centralWidget->setLayout(new QVBoxLayout);
|
||||||
|
m_ui->centralWidget->setLayout(new QVBoxLayout);
|
||||||
|
m_ui->centralWidget->layout()->setMargin(0);
|
||||||
|
|
||||||
|
setUseScrollArea(true);
|
||||||
|
setImportSearch(false);
|
||||||
|
|
||||||
|
setTitle(tr("Kit Selection"));
|
||||||
|
|
||||||
|
QObject *km = KitManager::instance();
|
||||||
|
connect(km, SIGNAL(kitAdded(ProjectExplorer::Kit*)),
|
||||||
|
this, SLOT(handleKitAddition(ProjectExplorer::Kit*)));
|
||||||
|
connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
|
||||||
|
this, SLOT(handleKitRemoval(ProjectExplorer::Kit*)));
|
||||||
|
connect(km, SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||||
|
this, SLOT(handleKitUpdate(ProjectExplorer::Kit*)));
|
||||||
|
connect(m_importWidget, SIGNAL(importFrom(Utils::FileName)),
|
||||||
|
this, SLOT(import(Utils::FileName)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::initializePage()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
|
||||||
|
setupWidgets();
|
||||||
|
setupImports();
|
||||||
|
selectAtLeastOneKit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setRequiredKitMatcher(KitMatcher *matcher)
|
||||||
|
{
|
||||||
|
m_requiredMatcher = matcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Core::Id> TargetSetupPage::selectedKits() const
|
||||||
|
{
|
||||||
|
QList<Core::Id> result;
|
||||||
|
QMap<Core::Id, Internal::TargetSetupWidget *>::const_iterator it, end;
|
||||||
|
it = m_widgets.constBegin();
|
||||||
|
end = m_widgets.constEnd();
|
||||||
|
|
||||||
|
for ( ; it != end; ++it) {
|
||||||
|
if (isKitSelected(it.key()))
|
||||||
|
result << it.key();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setPreferredKitMatcher(KitMatcher *matcher)
|
||||||
|
{
|
||||||
|
m_preferredMatcher = matcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetSetupPage::~TargetSetupPage()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
delete m_ui;
|
||||||
|
delete m_preferredMatcher;
|
||||||
|
delete m_requiredMatcher;
|
||||||
|
delete m_importer;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TargetSetupPage::isKitSelected(Core::Id id) const
|
||||||
|
{
|
||||||
|
TargetSetupWidget *widget = m_widgets.value(id);
|
||||||
|
return widget && widget->isKitSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
|
||||||
|
{
|
||||||
|
TargetSetupWidget *widget = m_widgets.value(id);
|
||||||
|
if (widget)
|
||||||
|
widget->setKitSelected(selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TargetSetupPage::isComplete() const
|
||||||
|
{
|
||||||
|
foreach (TargetSetupWidget *widget, m_widgets.values())
|
||||||
|
if (widget->isKitSelected())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setImportSearch(bool b)
|
||||||
|
{
|
||||||
|
m_importSearch = b;
|
||||||
|
m_importWidget->setVisible(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setupWidgets()
|
||||||
|
{
|
||||||
|
QList<Kit *> kitList;
|
||||||
|
// Known profiles:
|
||||||
|
if (m_requiredMatcher)
|
||||||
|
kitList = KitManager::matchingKits(*m_requiredMatcher);
|
||||||
|
else
|
||||||
|
kitList = KitManager::kits();
|
||||||
|
|
||||||
|
foreach (Kit *k, kitList)
|
||||||
|
addWidget(k);
|
||||||
|
|
||||||
|
// Setup import widget:
|
||||||
|
m_baseLayout->addWidget(m_importWidget);
|
||||||
|
Utils::FileName path = Utils::FileName::fromString(m_projectPath);
|
||||||
|
path = path.parentDir(); // base dir
|
||||||
|
path = path.parentDir(); // parent dir
|
||||||
|
m_importWidget->setCurrentDirectory(path);
|
||||||
|
|
||||||
|
updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::reset()
|
||||||
|
{
|
||||||
|
foreach (TargetSetupWidget *widget, m_widgets.values()) {
|
||||||
|
Kit *k = widget->kit();
|
||||||
|
if (!k)
|
||||||
|
continue;
|
||||||
|
if (m_importer)
|
||||||
|
m_importer->removeProject(k, m_projectPath);
|
||||||
|
delete widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_widgets.clear();
|
||||||
|
m_firstWidget = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setProjectPath(const QString &path)
|
||||||
|
{
|
||||||
|
m_projectPath = path;
|
||||||
|
if (!m_projectPath.isEmpty())
|
||||||
|
m_ui->headerLabel->setText(tr("Qt Creator can use the following kits for project <b>%1</b>:",
|
||||||
|
"%1: Project name").arg(QFileInfo(m_projectPath).baseName()));
|
||||||
|
m_ui->headerLabel->setVisible(!m_projectPath.isEmpty());
|
||||||
|
|
||||||
|
if (m_widgets.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
reset();
|
||||||
|
setupWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setProjectImporter(ProjectImporter *importer)
|
||||||
|
{
|
||||||
|
if (m_importer)
|
||||||
|
delete m_importer;
|
||||||
|
m_importer = importer;
|
||||||
|
|
||||||
|
reset();
|
||||||
|
setupWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setNoteText(const QString &text)
|
||||||
|
{
|
||||||
|
m_ui->descriptionLabel->setText(text);
|
||||||
|
m_ui->descriptionLabel->setVisible(!text.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::showOptionsHint(bool show)
|
||||||
|
{
|
||||||
|
m_forceOptionHint = show;
|
||||||
|
updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setupImports()
|
||||||
|
{
|
||||||
|
if (!m_importer || !m_importSearch || m_projectPath.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QStringList toImport = m_importer->importCandidates(Utils::FileName::fromString(m_projectPath));
|
||||||
|
foreach (const QString &path, toImport)
|
||||||
|
import(Utils::FileName::fromString(path), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::handleKitAddition(Kit *k)
|
||||||
|
{
|
||||||
|
if (isUpdating())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_ASSERT(!m_widgets.contains(k->id()));
|
||||||
|
addWidget(k);
|
||||||
|
updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::handleKitRemoval(Kit *k)
|
||||||
|
{
|
||||||
|
if (m_importer)
|
||||||
|
m_importer->cleanupKit(k);
|
||||||
|
|
||||||
|
if (isUpdating())
|
||||||
|
return;
|
||||||
|
|
||||||
|
removeWidget(k);
|
||||||
|
updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::handleKitUpdate(Kit *k)
|
||||||
|
{
|
||||||
|
if (isUpdating())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_importer)
|
||||||
|
m_importer->makePermanent(k);
|
||||||
|
|
||||||
|
TargetSetupWidget *widget = m_widgets.value(k->id());
|
||||||
|
|
||||||
|
bool acceptable = true;
|
||||||
|
if (m_requiredMatcher && !m_requiredMatcher->matches(k))
|
||||||
|
acceptable = false;
|
||||||
|
|
||||||
|
if (widget && !acceptable)
|
||||||
|
removeWidget(k);
|
||||||
|
else if (!widget && acceptable)
|
||||||
|
addWidget(k);
|
||||||
|
|
||||||
|
updateVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::selectAtLeastOneKit()
|
||||||
|
{
|
||||||
|
bool atLeastOneKitSelected = false;
|
||||||
|
foreach (TargetSetupWidget *w, m_widgets.values()) {
|
||||||
|
if (w->isKitSelected()) {
|
||||||
|
atLeastOneKitSelected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!atLeastOneKitSelected) {
|
||||||
|
TargetSetupWidget *widget = m_firstWidget;
|
||||||
|
Kit *defaultKit = KitManager::defaultKit();
|
||||||
|
if (defaultKit)
|
||||||
|
widget = m_widgets.value(defaultKit->id(), m_firstWidget);
|
||||||
|
if (widget)
|
||||||
|
widget->setKitSelected(true);
|
||||||
|
m_firstWidget = 0;
|
||||||
|
}
|
||||||
|
emit completeChanged(); // Is this necessary?
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::updateVisibility()
|
||||||
|
{
|
||||||
|
// Always show the widgets, the import widget always makes sense to show.
|
||||||
|
m_ui->scrollAreaWidget->setVisible(m_baseLayout == m_ui->scrollArea->widget()->layout());
|
||||||
|
m_ui->centralWidget->setVisible(m_baseLayout == m_ui->centralWidget->layout());
|
||||||
|
|
||||||
|
bool hasKits = !m_widgets.isEmpty();
|
||||||
|
m_ui->noValidKitLabel->setVisible(!hasKits);
|
||||||
|
m_ui->optionHintLabel->setVisible(m_forceOptionHint || !hasKits);
|
||||||
|
|
||||||
|
emit completeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::openOptions()
|
||||||
|
{
|
||||||
|
Core::ICore::instance()->showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||||
|
Constants::KITS_SETTINGS_PAGE_ID,
|
||||||
|
this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::import(const Utils::FileName &path)
|
||||||
|
{
|
||||||
|
import(path, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TargetSetupPage::isUpdating() const
|
||||||
|
{
|
||||||
|
if (m_importer)
|
||||||
|
return m_importer->isUpdating();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::import(const Utils::FileName &path, bool silent)
|
||||||
|
{
|
||||||
|
if (!m_importer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList<BuildInfo *> toImport = m_importer->import(path, silent);
|
||||||
|
foreach (BuildInfo *info, toImport) {
|
||||||
|
TargetSetupWidget *widget = m_widgets.value(info->kitId, 0);
|
||||||
|
if (!widget) {
|
||||||
|
Kit *k = KitManager::find(info->kitId);
|
||||||
|
Q_ASSERT(k);
|
||||||
|
addWidget(k);
|
||||||
|
}
|
||||||
|
widget = m_widgets.value(info->kitId, 0);
|
||||||
|
if (!widget) {
|
||||||
|
delete info;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
widget->addBuildInfo(info, true);
|
||||||
|
widget->setKitSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::removeWidget(Kit *k)
|
||||||
|
{
|
||||||
|
TargetSetupWidget *widget = m_widgets.value(k->id());
|
||||||
|
if (!widget)
|
||||||
|
return;
|
||||||
|
if (widget == m_firstWidget)
|
||||||
|
m_firstWidget = 0;
|
||||||
|
widget->deleteLater();
|
||||||
|
m_widgets.remove(k->id());
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
|
||||||
|
{
|
||||||
|
if (!k || (m_requiredMatcher && !m_requiredMatcher->matches(k)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
IBuildConfigurationFactory *factory
|
||||||
|
= IBuildConfigurationFactory::find(k, m_projectPath);
|
||||||
|
if (!factory)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
QList<BuildInfo *> infoList = factory->availableSetups(k, m_projectPath);
|
||||||
|
TargetSetupWidget *widget = infoList.isEmpty() ? 0 : new TargetSetupWidget(k, m_projectPath, infoList);
|
||||||
|
if (!widget)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m_baseLayout->removeWidget(m_importWidget);
|
||||||
|
m_baseLayout->removeItem(m_spacer);
|
||||||
|
|
||||||
|
widget->setKitSelected(m_preferredMatcher && m_preferredMatcher->matches(k));
|
||||||
|
m_widgets.insert(k->id(), widget);
|
||||||
|
m_baseLayout->addWidget(widget);
|
||||||
|
|
||||||
|
m_baseLayout->addWidget(m_importWidget);
|
||||||
|
m_baseLayout->addItem(m_spacer);
|
||||||
|
|
||||||
|
connect(widget, SIGNAL(selectedToggled()),
|
||||||
|
this, SIGNAL(completeChanged()));
|
||||||
|
|
||||||
|
if (!m_firstWidget)
|
||||||
|
m_firstWidget = widget;
|
||||||
|
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TargetSetupPage::setupProject(Project *project)
|
||||||
|
{
|
||||||
|
QList<const BuildInfo *> toSetUp; // Pointers are managed by the widgets!
|
||||||
|
foreach (TargetSetupWidget *widget, m_widgets.values()) {
|
||||||
|
if (!widget->isKitSelected())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Kit *k = widget->kit();
|
||||||
|
if (m_importer)
|
||||||
|
m_importer->makePermanent(k);
|
||||||
|
toSetUp << widget->selectedBuildInfoList();
|
||||||
|
widget->clearKit();
|
||||||
|
}
|
||||||
|
|
||||||
|
project->setup(toSetUp);
|
||||||
|
|
||||||
|
reset(); // This will delete the pointers held in toSetUp!
|
||||||
|
toSetUp.clear();
|
||||||
|
|
||||||
|
Target *activeTarget = 0;
|
||||||
|
if (m_importer)
|
||||||
|
activeTarget = m_importer->preferredTarget(project->targets());
|
||||||
|
if (activeTarget)
|
||||||
|
project->setActiveTarget(activeTarget);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetSetupPage::setUseScrollArea(bool b)
|
||||||
|
{
|
||||||
|
m_baseLayout = b ? m_ui->scrollArea->widget()->layout() : m_ui->centralWidget->layout();
|
||||||
|
m_ui->scrollAreaWidget->setVisible(b);
|
||||||
|
m_ui->centralWidget->setVisible(!b);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ProjectExplorer
|
||||||
@@ -30,7 +30,9 @@
|
|||||||
#ifndef TARGETSETUPPAGE_H
|
#ifndef TARGETSETUPPAGE_H
|
||||||
#define TARGETSETUPPAGE_H
|
#define TARGETSETUPPAGE_H
|
||||||
|
|
||||||
#include "../qt4projectmanager_global.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
|
#include "projectimporter.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
@@ -38,44 +40,36 @@
|
|||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QSpacerItem)
|
QT_FORWARD_DECLARE_CLASS(QSpacerItem)
|
||||||
|
|
||||||
|
namespace Core { class Id; }
|
||||||
namespace Utils { class FileName; }
|
namespace Utils { class FileName; }
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class Id;
|
|
||||||
} // namespace Core
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Kit;
|
||||||
class KitMatcher;
|
class KitMatcher;
|
||||||
} // namespace ProjectExplorer
|
class Project;
|
||||||
|
|
||||||
namespace QtSupport { class BaseQtVersion; }
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
class Qt4Project;
|
|
||||||
class Qt4TargetSetupWidget;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class ImportWidget;
|
class ImportWidget;
|
||||||
class TargetSetupPageUi;
|
class TargetSetupPageUi;
|
||||||
|
class TargetSetupWidget;
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
/// \internal
|
/// \internal
|
||||||
class QT4PROJECTMANAGER_EXPORT TargetSetupPage : public QWizardPage
|
class PROJECTEXPLORER_EXPORT TargetSetupPage : public QWizardPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TargetSetupPage(QWidget* parent = 0);
|
explicit TargetSetupPage(QWidget *parent = 0);
|
||||||
~TargetSetupPage();
|
~TargetSetupPage();
|
||||||
|
|
||||||
/// Initializes the TargetSetupPage
|
/// Initializes the TargetSetupPage
|
||||||
/// \note The import information is gathered in initializePage(), make sure that the right proFilePath is set before
|
/// \note The import information is gathered in initializePage(), make sure that the right projectPath is set before
|
||||||
void initializePage();
|
void initializePage();
|
||||||
|
|
||||||
// Call these before initializePage!
|
// Call these before initializePage!
|
||||||
void setRequiredKitMatcher(ProjectExplorer::KitMatcher *matcher);
|
void setRequiredKitMatcher(KitMatcher *matcher);
|
||||||
void setPreferredKitMatcher(ProjectExplorer::KitMatcher *matcher);
|
void setPreferredKitMatcher(KitMatcher *matcher);
|
||||||
void setImportSearch(bool b);
|
void setImportSearch(bool b);
|
||||||
|
|
||||||
/// Sets whether the targetsetupage uses a scrollarea
|
/// Sets whether the targetsetupage uses a scrollarea
|
||||||
@@ -84,50 +78,46 @@ public:
|
|||||||
void setUseScrollArea(bool b);
|
void setUseScrollArea(bool b);
|
||||||
|
|
||||||
bool isComplete() const;
|
bool isComplete() const;
|
||||||
bool setupProject(Qt4ProjectManager::Qt4Project *project);
|
bool setupProject(Project *project);
|
||||||
bool isKitSelected(Core::Id id) const;
|
bool isKitSelected(Core::Id id) const;
|
||||||
void setKitSelected(Core::Id id, bool selected);
|
void setKitSelected(Core::Id id, bool selected);
|
||||||
QList<Core::Id> selectedKits() const;
|
QList<Core::Id> selectedKits() const;
|
||||||
void setProFilePath(const QString &dir);
|
void setProjectPath(const QString &dir);
|
||||||
|
void setProjectImporter(ProjectImporter *importer);
|
||||||
|
|
||||||
/// Overrides the summary text of the targetsetuppage
|
/// Overrides the summary text of the targetsetuppage
|
||||||
void setNoteText(const QString &text);
|
void setNoteText(const QString &text);
|
||||||
void showOptionsHint(bool show);
|
void showOptionsHint(bool show);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void import(const Utils::FileName &path);
|
|
||||||
void handleQtUpdate(const QList<int> &add, const QList<int> &rm, const QList<int> &mod);
|
|
||||||
void handleKitAddition(ProjectExplorer::Kit *k);
|
void handleKitAddition(ProjectExplorer::Kit *k);
|
||||||
void handleKitRemoval(ProjectExplorer::Kit *k);
|
void handleKitRemoval(ProjectExplorer::Kit *k);
|
||||||
void handleKitUpdate(ProjectExplorer::Kit *k);
|
void handleKitUpdate(ProjectExplorer::Kit *k);
|
||||||
void updateVisibility();
|
void updateVisibility();
|
||||||
void openOptions();
|
void openOptions();
|
||||||
|
void import(const Utils::FileName &path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isUpdating() const;
|
||||||
void selectAtLeastOneKit();
|
void selectAtLeastOneKit();
|
||||||
void import(const Utils::FileName &path, const bool silent);
|
void removeWidget(Kit *k);
|
||||||
void removeWidget(ProjectExplorer::Kit *k);
|
Internal::TargetSetupWidget *addWidget(Kit *k);
|
||||||
Qt4TargetSetupWidget *addWidget(ProjectExplorer::Kit *k);
|
|
||||||
|
|
||||||
void setupImports();
|
void setupImports();
|
||||||
|
void import(const Utils::FileName &path, bool silent);
|
||||||
|
|
||||||
void setupWidgets();
|
void setupWidgets();
|
||||||
void reset();
|
void reset();
|
||||||
ProjectExplorer::Kit *createTemporaryKit(QtSupport::BaseQtVersion *version, bool temporaryVersion, const Utils::FileName &parsedSpec);
|
|
||||||
void cleanKit(ProjectExplorer::Kit *k);
|
|
||||||
void makeQtPersistent(ProjectExplorer::Kit *k);
|
|
||||||
void addProject(ProjectExplorer::Kit *k, const QString &path);
|
|
||||||
void removeProject(ProjectExplorer::Kit *k, const QString &path);
|
|
||||||
|
|
||||||
ProjectExplorer::KitMatcher *m_requiredMatcher;
|
KitMatcher *m_requiredMatcher;
|
||||||
ProjectExplorer::KitMatcher *m_preferredMatcher;
|
KitMatcher *m_preferredMatcher;
|
||||||
|
ProjectImporter *m_importer;
|
||||||
QLayout *m_baseLayout;
|
QLayout *m_baseLayout;
|
||||||
bool m_importSearch;
|
bool m_importSearch;
|
||||||
bool m_ignoreUpdates;
|
QString m_projectPath;
|
||||||
QString m_proFilePath;
|
|
||||||
QString m_defaultShadowBuildLocation;
|
QString m_defaultShadowBuildLocation;
|
||||||
QMap<Core::Id, Qt4TargetSetupWidget *> m_widgets;
|
QMap<Core::Id, Internal::TargetSetupWidget *> m_widgets;
|
||||||
Qt4TargetSetupWidget *m_firstWidget;
|
Internal::TargetSetupWidget *m_firstWidget;
|
||||||
|
|
||||||
Internal::TargetSetupPageUi *m_ui;
|
Internal::TargetSetupPageUi *m_ui;
|
||||||
|
|
||||||
@@ -137,6 +127,6 @@ private:
|
|||||||
bool m_forceOptionHint;
|
bool m_forceOptionHint;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // TARGETSETUPPAGE_H
|
#endif // TARGETSETUPPAGE_H
|
||||||
@@ -27,17 +27,17 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qt4targetsetupwidget.h"
|
#include "targetsetupwidget.h"
|
||||||
|
|
||||||
#include "buildconfigurationinfo.h"
|
#include "buildconfiguration.h"
|
||||||
#include "qt4buildconfiguration.h"
|
#include "buildinfo.h"
|
||||||
|
#include "projectexplorerconstants.h"
|
||||||
|
#include "kit.h"
|
||||||
|
#include "kitmanager.h"
|
||||||
|
#include "kitoptionspage.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/kitoptionspage.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
|
|
||||||
#include <utils/detailsbutton.h>
|
#include <utils/detailsbutton.h>
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
@@ -49,15 +49,16 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace ProjectExplorer {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Qt4TargetSetupWidget
|
// TargetSetupWidget
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Kit *k,
|
TargetSetupWidget::TargetSetupWidget(Kit *k,
|
||||||
const QString &proFilePath,
|
const QString &projectPath,
|
||||||
const QList<BuildConfigurationInfo> &infoList) :
|
const QList<BuildInfo *> &infoList) :
|
||||||
m_kit(k),
|
m_kit(k),
|
||||||
m_haveImported(false),
|
m_haveImported(false),
|
||||||
m_ignoreChange(false),
|
m_ignoreChange(false),
|
||||||
@@ -100,45 +101,48 @@ Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Kit *k,
|
|||||||
widget->setEnabled(false);
|
widget->setEnabled(false);
|
||||||
m_detailsWidget->setWidget(widget);
|
m_detailsWidget->setWidget(widget);
|
||||||
|
|
||||||
foreach (const BuildConfigurationInfo &info, infoList)
|
foreach (BuildInfo *info, infoList)
|
||||||
addBuildConfigurationInfo(info);
|
addBuildInfo(info, false);
|
||||||
|
|
||||||
setProFilePath(proFilePath);
|
setProjectPath(projectPath);
|
||||||
|
|
||||||
connect(m_detailsWidget, SIGNAL(checked(bool)),
|
connect(m_detailsWidget, SIGNAL(checked(bool)),
|
||||||
this, SLOT(targetCheckBoxToggled(bool)));
|
this, SLOT(targetCheckBoxToggled(bool)));
|
||||||
|
|
||||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
connect(KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||||
this, SLOT(handleKitUpdate(ProjectExplorer::Kit*)));
|
this, SLOT(handleKitUpdate(ProjectExplorer::Kit*)));
|
||||||
|
|
||||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageKit()));
|
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageKit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4TargetSetupWidget::~Qt4TargetSetupWidget()
|
TargetSetupWidget::~TargetSetupWidget()
|
||||||
{ }
|
{
|
||||||
|
qDeleteAll(m_infoList);
|
||||||
|
m_infoList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
ProjectExplorer::Kit *Qt4TargetSetupWidget::kit()
|
Kit *TargetSetupWidget::kit()
|
||||||
{
|
{
|
||||||
return m_kit;
|
return m_kit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::clearKit()
|
void TargetSetupWidget::clearKit()
|
||||||
{
|
{
|
||||||
m_kit = 0;
|
m_kit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Qt4TargetSetupWidget::isKitSelected() const
|
bool TargetSetupWidget::isKitSelected() const
|
||||||
{
|
{
|
||||||
if (!m_detailsWidget->isChecked())
|
if (!m_detailsWidget->isChecked())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !selectedBuildConfigurationInfoList().isEmpty();
|
return !selectedBuildInfoList().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::setKitSelected(bool b)
|
void TargetSetupWidget::setKitSelected(bool b)
|
||||||
{
|
{
|
||||||
// Only check target if there are build configurations possible
|
// Only check target if there are build configurations possible
|
||||||
b &= !selectedBuildConfigurationInfoList().isEmpty();
|
b &= !selectedBuildInfoList().isEmpty();
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
m_detailsWidget->setChecked(b);
|
m_detailsWidget->setChecked(b);
|
||||||
m_detailsWidget->widget()->setEnabled(b);
|
m_detailsWidget->widget()->setEnabled(b);
|
||||||
@@ -147,39 +151,36 @@ void Qt4TargetSetupWidget::setKitSelected(bool b)
|
|||||||
m_detailsWidget->setState(b ? Utils::DetailsWidget::Expanded : Utils::DetailsWidget::Collapsed);
|
m_detailsWidget->setState(b ? Utils::DetailsWidget::Expanded : Utils::DetailsWidget::Collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing)
|
void TargetSetupWidget::addBuildInfo(BuildInfo *info, bool isImport)
|
||||||
{
|
{
|
||||||
if (importing) {
|
if (isImport && !m_haveImported) {
|
||||||
if (!m_haveImported) {
|
// disable everything on first import
|
||||||
// disable everything on first import
|
for (int i = 0; i < m_enabled.count(); ++i) {
|
||||||
for (int i = 0; i < m_enabled.count(); ++i) {
|
m_enabled[i] = false;
|
||||||
m_enabled[i] = false;
|
m_checkboxes[i]->setChecked(false);
|
||||||
m_checkboxes[i]->setChecked(false);
|
|
||||||
}
|
|
||||||
m_selected = 0;
|
|
||||||
}
|
}
|
||||||
|
m_selected = 0;
|
||||||
|
|
||||||
m_haveImported = true;
|
m_haveImported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = m_pathChoosers.count();
|
int pos = m_pathChoosers.count();
|
||||||
m_enabled.append(true);
|
m_enabled.append(true);
|
||||||
++m_selected;
|
++m_selected;
|
||||||
|
|
||||||
m_infoList.append(info);
|
m_infoList << info;
|
||||||
|
|
||||||
QCheckBox *checkbox = new QCheckBox;
|
QCheckBox *checkbox = new QCheckBox;
|
||||||
checkbox->setText(Qt4BuildConfigurationFactory::buildConfigurationDisplayName(info));
|
checkbox->setText(info->displayName);
|
||||||
checkbox->setChecked(m_enabled.at(pos));
|
checkbox->setChecked(m_enabled.at(pos));
|
||||||
checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||||
m_newBuildsLayout->addWidget(checkbox, pos * 2, 0);
|
m_newBuildsLayout->addWidget(checkbox, pos * 2, 0);
|
||||||
|
|
||||||
Utils::PathChooser *pathChooser = new Utils::PathChooser();
|
Utils::PathChooser *pathChooser = new Utils::PathChooser();
|
||||||
pathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
pathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||||
pathChooser->setPath(info.directory);
|
pathChooser->setFileName(info->buildDirectory);
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_kit);
|
pathChooser->setEnabled(info->supportsShadowBuild);
|
||||||
if (!version)
|
pathChooser->setReadOnly(!info->supportsShadowBuild || isImport);
|
||||||
return;
|
|
||||||
pathChooser->setReadOnly(!version->supportsShadowBuilds() || importing);
|
|
||||||
m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);
|
m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);
|
||||||
|
|
||||||
QLabel *reportIssuesLabel = new QLabel;
|
QLabel *reportIssuesLabel = new QLabel;
|
||||||
@@ -203,7 +204,7 @@ void Qt4TargetSetupWidget::addBuildConfigurationInfo(const BuildConfigurationInf
|
|||||||
emit selectedToggled();
|
emit selectedToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::targetCheckBoxToggled(bool b)
|
void TargetSetupWidget::targetCheckBoxToggled(bool b)
|
||||||
{
|
{
|
||||||
if (m_ignoreChange)
|
if (m_ignoreChange)
|
||||||
return;
|
return;
|
||||||
@@ -219,7 +220,7 @@ void Qt4TargetSetupWidget::targetCheckBoxToggled(bool b)
|
|||||||
emit selectedToggled();
|
emit selectedToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::manageKit()
|
void TargetSetupWidget::manageKit()
|
||||||
{
|
{
|
||||||
ProjectExplorer::KitOptionsPage *page =
|
ProjectExplorer::KitOptionsPage *page =
|
||||||
ExtensionSystem::PluginManager::getObject<ProjectExplorer::KitOptionsPage>();
|
ExtensionSystem::PluginManager::getObject<ProjectExplorer::KitOptionsPage>();
|
||||||
@@ -227,25 +228,31 @@ void Qt4TargetSetupWidget::manageKit()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
page->showKit(m_kit);
|
page->showKit(m_kit);
|
||||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
Core::ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||||
ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID);
|
Constants::KITS_SETTINGS_PAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::setProFilePath(const QString &proFilePath)
|
void TargetSetupWidget::setProjectPath(const QString &projectPath)
|
||||||
{
|
{
|
||||||
if (!m_kit)
|
if (!m_kit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_proFilePath = proFilePath;
|
m_projectPath = projectPath;
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> infoList
|
IBuildConfigurationFactory *factory
|
||||||
= Qt4BuildConfigurationFactory::availableBuildConfigurations(m_kit, proFilePath);
|
= IBuildConfigurationFactory::find(m_kit, projectPath);
|
||||||
foreach (const BuildConfigurationInfo &info, infoList)
|
|
||||||
addBuildConfigurationInfo(info);
|
if (!factory)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList<BuildInfo *> infoList
|
||||||
|
= factory->availableSetups(m_kit, projectPath);
|
||||||
|
foreach (BuildInfo *info, infoList)
|
||||||
|
addBuildInfo(info, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::handleKitUpdate(ProjectExplorer::Kit *k)
|
void TargetSetupWidget::handleKitUpdate(Kit *k)
|
||||||
{
|
{
|
||||||
if (k != m_kit)
|
if (k != m_kit)
|
||||||
return;
|
return;
|
||||||
@@ -254,9 +261,9 @@ void Qt4TargetSetupWidget::handleKitUpdate(ProjectExplorer::Kit *k)
|
|||||||
m_detailsWidget->setSummaryText(k->displayName());
|
m_detailsWidget->setSummaryText(k->displayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> Qt4TargetSetupWidget::selectedBuildConfigurationInfoList() const
|
QList<const BuildInfo *> TargetSetupWidget::selectedBuildInfoList() const
|
||||||
{
|
{
|
||||||
QList<BuildConfigurationInfo> result;
|
QList<const BuildInfo *> result;
|
||||||
for (int i = 0; i < m_infoList.count(); ++i) {
|
for (int i = 0; i < m_infoList.count(); ++i) {
|
||||||
if (m_enabled.at(i))
|
if (m_enabled.at(i))
|
||||||
result.append(m_infoList.at(i));
|
result.append(m_infoList.at(i));
|
||||||
@@ -264,12 +271,7 @@ QList<BuildConfigurationInfo> Qt4TargetSetupWidget::selectedBuildConfigurationIn
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> Qt4TargetSetupWidget::allBuildConfigurationInfoList() const
|
void TargetSetupWidget::clear()
|
||||||
{
|
|
||||||
return m_infoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::clear()
|
|
||||||
{
|
{
|
||||||
qDeleteAll(m_checkboxes);
|
qDeleteAll(m_checkboxes);
|
||||||
m_checkboxes.clear();
|
m_checkboxes.clear();
|
||||||
@@ -277,8 +279,9 @@ void Qt4TargetSetupWidget::clear()
|
|||||||
m_pathChoosers.clear();
|
m_pathChoosers.clear();
|
||||||
qDeleteAll(m_reportIssuesLabels);
|
qDeleteAll(m_reportIssuesLabels);
|
||||||
m_reportIssuesLabels.clear();
|
m_reportIssuesLabels.clear();
|
||||||
|
qDeleteAll(m_infoList);
|
||||||
m_infoList.clear();
|
m_infoList.clear();
|
||||||
|
|
||||||
m_issues.clear();
|
m_issues.clear();
|
||||||
m_enabled.clear();
|
m_enabled.clear();
|
||||||
m_selected = 0;
|
m_selected = 0;
|
||||||
@@ -287,7 +290,7 @@ void Qt4TargetSetupWidget::clear()
|
|||||||
emit selectedToggled();
|
emit selectedToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::checkBoxToggled(bool b)
|
void TargetSetupWidget::checkBoxToggled(bool b)
|
||||||
{
|
{
|
||||||
QCheckBox *box = qobject_cast<QCheckBox *>(sender());
|
QCheckBox *box = qobject_cast<QCheckBox *>(sender());
|
||||||
if (!box)
|
if (!box)
|
||||||
@@ -305,7 +308,7 @@ void Qt4TargetSetupWidget::checkBoxToggled(bool b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::pathChanged()
|
void TargetSetupWidget::pathChanged()
|
||||||
{
|
{
|
||||||
if (m_ignoreChange)
|
if (m_ignoreChange)
|
||||||
return;
|
return;
|
||||||
@@ -315,45 +318,41 @@ void Qt4TargetSetupWidget::pathChanged()
|
|||||||
int index = m_pathChoosers.indexOf(pathChooser);
|
int index = m_pathChoosers.indexOf(pathChooser);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
m_infoList[index].directory = pathChooser->path();
|
m_infoList[index]->buildDirectory = pathChooser->fileName();
|
||||||
reportIssues(index);
|
reportIssues(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4TargetSetupWidget::reportIssues(int index)
|
void TargetSetupWidget::reportIssues(int index)
|
||||||
{
|
{
|
||||||
QPair<ProjectExplorer::Task::TaskType, QString> issues = findIssues(m_infoList.at(index));
|
QPair<Task::TaskType, QString> issues = findIssues(m_infoList.at(index));
|
||||||
QLabel *reportIssuesLabel = m_reportIssuesLabels.at(index);
|
QLabel *reportIssuesLabel = m_reportIssuesLabels.at(index);
|
||||||
reportIssuesLabel->setText(issues.second);
|
reportIssuesLabel->setText(issues.second);
|
||||||
bool error = issues.first != ProjectExplorer::Task::Unknown;
|
bool error = issues.first != Task::Unknown;
|
||||||
reportIssuesLabel->setVisible(error);
|
reportIssuesLabel->setVisible(error);
|
||||||
m_issues[index] = error;
|
m_issues[index] = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<ProjectExplorer::Task::TaskType, QString> Qt4TargetSetupWidget::findIssues(const BuildConfigurationInfo &info)
|
QPair<Task::TaskType, QString> TargetSetupWidget::findIssues(const BuildInfo *info)
|
||||||
{
|
{
|
||||||
if (m_proFilePath.isEmpty())
|
if (m_projectPath.isEmpty())
|
||||||
return qMakePair(ProjectExplorer::Task::Unknown, QString());
|
return qMakePair(Task::Unknown, QString());
|
||||||
|
|
||||||
QString buildDir = info.directory;
|
QString buildDir = info->buildDirectory.toString();
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_kit);
|
QList<Task> issues = info->reportIssues(m_projectPath, buildDir);
|
||||||
if (!version)
|
|
||||||
return qMakePair(ProjectExplorer::Task::Unknown, QString());
|
|
||||||
|
|
||||||
QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath, buildDir);
|
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
ProjectExplorer::Task::TaskType highestType = ProjectExplorer::Task::Unknown;
|
Task::TaskType highestType = Task::Unknown;
|
||||||
foreach (const ProjectExplorer::Task &t, issues) {
|
foreach (const Task &t, issues) {
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
text.append(QLatin1String("<br>"));
|
text.append(QLatin1String("<br>"));
|
||||||
// set severity:
|
// set severity:
|
||||||
QString severity;
|
QString severity;
|
||||||
if (t.type == ProjectExplorer::Task::Error) {
|
if (t.type == Task::Error) {
|
||||||
highestType = ProjectExplorer::Task::Error;
|
highestType = Task::Error;
|
||||||
severity = tr("<b>Error:</b> ", "Severity is Task::Error");
|
severity = tr("<b>Error:</b> ", "Severity is Task::Error");
|
||||||
} else if (t.type == ProjectExplorer::Task::Warning) {
|
} else if (t.type == Task::Warning) {
|
||||||
if (highestType == ProjectExplorer::Task::Unknown)
|
if (highestType == Task::Unknown)
|
||||||
highestType = ProjectExplorer::Task::Warning;
|
highestType = Task::Warning;
|
||||||
severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
|
severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
|
||||||
}
|
}
|
||||||
text.append(severity + t.description);
|
text.append(severity + t.description);
|
||||||
@@ -363,4 +362,5 @@ QPair<ProjectExplorer::Task::TaskType, QString> Qt4TargetSetupWidget::findIssues
|
|||||||
return qMakePair(highestType, text);
|
return qMakePair(highestType, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Internal
|
||||||
|
} // namespace ProjectExplorer
|
||||||
@@ -27,12 +27,13 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QT4TARGETSETUPWIDGET_H
|
#ifndef TARGETSETUPWIDGET_H
|
||||||
#define QT4TARGETSETUPWIDGET_H
|
#define TARGETSETUPWIDGET_H
|
||||||
|
|
||||||
#include "qt4projectmanager_global.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
#include <projectexplorer/task.h>
|
#include "buildinfo.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@@ -45,38 +46,36 @@ class QPushButton;
|
|||||||
class QSpacerItem;
|
class QSpacerItem;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer { class Kit; }
|
|
||||||
namespace QtSupport {
|
|
||||||
class BaseQtVersion;
|
|
||||||
} // namespace QtSupport
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class DetailsWidget;
|
class DetailsWidget;
|
||||||
class PathChooser;
|
class PathChooser;
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace ProjectExplorer {
|
||||||
class BuildConfigurationInfo;
|
class BuildInfo;
|
||||||
|
class Kit;
|
||||||
|
|
||||||
class QT4PROJECTMANAGER_EXPORT Qt4TargetSetupWidget : public QWidget
|
namespace Internal {
|
||||||
|
|
||||||
|
class TargetSetupWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Qt4TargetSetupWidget(ProjectExplorer::Kit *k,
|
TargetSetupWidget(Kit *k,
|
||||||
const QString &proFilePath,
|
const QString &projectPath,
|
||||||
const QList<BuildConfigurationInfo> &infoList);
|
const QList<BuildInfo *> &infoList);
|
||||||
~Qt4TargetSetupWidget();
|
~TargetSetupWidget();
|
||||||
|
|
||||||
ProjectExplorer::Kit *kit();
|
Kit *kit();
|
||||||
void clearKit();
|
void clearKit();
|
||||||
|
|
||||||
bool isKitSelected() const;
|
bool isKitSelected() const;
|
||||||
void setKitSelected(bool b);
|
void setKitSelected(bool b);
|
||||||
|
|
||||||
void addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing = false);
|
void addBuildInfo(BuildInfo *info, bool isImport);
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> selectedBuildConfigurationInfoList() const;
|
QList<const BuildInfo *> selectedBuildInfoList() const;
|
||||||
QList<BuildConfigurationInfo> allBuildConfigurationInfoList() const;
|
void setProjectPath(const QString &projectPath);
|
||||||
void setProFilePath(const QString &proFilePath);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectedToggled() const;
|
void selectedToggled() const;
|
||||||
@@ -91,18 +90,18 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void reportIssues(int index);
|
void reportIssues(int index);
|
||||||
QPair<ProjectExplorer::Task::TaskType, QString> findIssues(const BuildConfigurationInfo &info);
|
QPair<Task::TaskType, QString> findIssues(const BuildInfo *info);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
ProjectExplorer::Kit *m_kit;
|
Kit *m_kit;
|
||||||
QString m_proFilePath;
|
QString m_projectPath;
|
||||||
bool m_haveImported;
|
bool m_haveImported;
|
||||||
Utils::DetailsWidget *m_detailsWidget;
|
Utils::DetailsWidget *m_detailsWidget;
|
||||||
QPushButton *m_manageButton;
|
QPushButton *m_manageButton;
|
||||||
QGridLayout *m_newBuildsLayout;
|
QGridLayout *m_newBuildsLayout;
|
||||||
QList<QCheckBox *> m_checkboxes;
|
QList<QCheckBox *> m_checkboxes;
|
||||||
QList<Utils::PathChooser *> m_pathChoosers;
|
QList<Utils::PathChooser *> m_pathChoosers;
|
||||||
QList<BuildConfigurationInfo> m_infoList;
|
QList<BuildInfo *> m_infoList;
|
||||||
QList<bool> m_enabled;
|
QList<bool> m_enabled;
|
||||||
QList<QLabel *> m_reportIssuesLabels;
|
QList<QLabel *> m_reportIssuesLabels;
|
||||||
QList<bool> m_issues;
|
QList<bool> m_issues;
|
||||||
@@ -110,6 +109,7 @@ private:
|
|||||||
int m_selected; // Number of selected buildconfiguartions
|
int m_selected; // Number of selected buildconfiguartions
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Internal
|
||||||
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // QT4TARGETSETUPWIDGET_H
|
#endif // TARGETSETUPWIDGET_H
|
||||||
@@ -28,38 +28,36 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "unconfiguredprojectpanel.h"
|
#include "unconfiguredprojectpanel.h"
|
||||||
#include "wizards/targetsetuppage.h"
|
|
||||||
#include "qt4projectmanagerconstants.h"
|
|
||||||
|
|
||||||
#include "qt4project.h"
|
#include "kit.h"
|
||||||
|
#include "kitmanager.h"
|
||||||
|
#include "project.h"
|
||||||
|
#include "projectexplorer.h"
|
||||||
|
#include "projectexplorerconstants.h"
|
||||||
|
#include "session.h"
|
||||||
|
#include "targetsetuppage.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <projectexplorer/session.h>
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
namespace ProjectExplorer {
|
||||||
using namespace Qt4ProjectManager;
|
namespace Internal {
|
||||||
using namespace Qt4ProjectManager::Internal;
|
|
||||||
|
|
||||||
|
|
||||||
UnconfiguredProjectPanel::UnconfiguredProjectPanel()
|
UnconfiguredProjectPanel::UnconfiguredProjectPanel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Qt4ProjectManager::Internal::UnconfiguredProjectPanel::id() const
|
QString UnconfiguredProjectPanel::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(Constants::UNCONFIGURED_PANEL_PAGE_ID);
|
return QLatin1String(Constants::UNCONFIGURED_PANEL_PAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Qt4ProjectManager::Internal::UnconfiguredProjectPanel::displayName() const
|
QString UnconfiguredProjectPanel::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Configure Project");
|
return tr("Configure Project");
|
||||||
}
|
}
|
||||||
@@ -69,16 +67,14 @@ int UnconfiguredProjectPanel::priority() const
|
|||||||
return -10;
|
return -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Qt4ProjectManager::Internal::UnconfiguredProjectPanel::supports(ProjectExplorer::Project *project)
|
bool UnconfiguredProjectPanel::supports(Project *project)
|
||||||
{
|
{
|
||||||
if (qobject_cast<Qt4Project *>(project) && project->targets().isEmpty())
|
return project->targets().isEmpty() && project->supportsNoTargetPanel();
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::PropertiesPanel *Qt4ProjectManager::Internal::UnconfiguredProjectPanel::createPanel(ProjectExplorer::Project *project)
|
PropertiesPanel *UnconfiguredProjectPanel::createPanel(Project *project)
|
||||||
{
|
{
|
||||||
ProjectExplorer::PropertiesPanel *panel = new ProjectExplorer::PropertiesPanel;
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
panel->setDisplayName(displayName());
|
panel->setDisplayName(displayName());
|
||||||
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png")));
|
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png")));
|
||||||
|
|
||||||
@@ -91,20 +87,22 @@ ProjectExplorer::PropertiesPanel *Qt4ProjectManager::Internal::UnconfiguredProje
|
|||||||
/// TargetSetupPageWrapper
|
/// TargetSetupPageWrapper
|
||||||
////////
|
////////
|
||||||
|
|
||||||
TargetSetupPageWrapper::TargetSetupPageWrapper(ProjectExplorer::Project *project)
|
TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) :
|
||||||
: QWidget(), m_project(qobject_cast<Qt4Project *>(project))
|
QWidget(), m_project(project)
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
m_targetSetupPage = new TargetSetupPage(this);
|
m_targetSetupPage = new TargetSetupPage(this);
|
||||||
m_targetSetupPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher);
|
m_targetSetupPage->setProjectImporter(project->createProjectImporter());
|
||||||
m_targetSetupPage->setUseScrollArea(false);
|
m_targetSetupPage->setUseScrollArea(false);
|
||||||
m_targetSetupPage->setImportSearch(true);
|
m_targetSetupPage->setImportSearch(true);
|
||||||
m_targetSetupPage->setProFilePath(project->projectFilePath());
|
m_targetSetupPage->setProjectPath(project->projectFilePath());
|
||||||
m_targetSetupPage->initializePage();
|
m_targetSetupPage->initializePage();
|
||||||
m_targetSetupPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
m_targetSetupPage->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
m_targetSetupPage->setRequiredKitMatcher(project->createRequiredKitMatcher());
|
||||||
|
m_targetSetupPage->setPreferredKitMatcher(project->createPreferredKitMatcher());
|
||||||
updateNoteText();
|
updateNoteText();
|
||||||
|
|
||||||
layout->addWidget(m_targetSetupPage);
|
layout->addWidget(m_targetSetupPage);
|
||||||
@@ -137,21 +135,21 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(ProjectExplorer::Project *project
|
|||||||
this, SLOT(cancel()));
|
this, SLOT(cancel()));
|
||||||
connect(m_targetSetupPage, SIGNAL(completeChanged()),
|
connect(m_targetSetupPage, SIGNAL(completeChanged()),
|
||||||
this, SLOT(completeChanged()));
|
this, SLOT(completeChanged()));
|
||||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(defaultkitChanged()),
|
connect(KitManager::instance(), SIGNAL(defaultkitChanged()),
|
||||||
this, SLOT(updateNoteText()));
|
this, SLOT(updateNoteText()));
|
||||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
connect(KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||||
this, SLOT(kitUpdated(ProjectExplorer::Kit*)));
|
this, SLOT(kitUpdated(ProjectExplorer::Kit*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetSetupPageWrapper::kitUpdated(ProjectExplorer::Kit *k)
|
void TargetSetupPageWrapper::kitUpdated(Kit *k)
|
||||||
{
|
{
|
||||||
if (k == ProjectExplorer::KitManager::defaultKit())
|
if (k == KitManager::defaultKit())
|
||||||
updateNoteText();
|
updateNoteText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetSetupPageWrapper::updateNoteText()
|
void TargetSetupPageWrapper::updateNoteText()
|
||||||
{
|
{
|
||||||
ProjectExplorer::Kit *k = ProjectExplorer::KitManager::defaultKit();
|
Kit *k = KitManager::defaultKit();
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
bool showHint = false;
|
bool showHint = false;
|
||||||
@@ -211,3 +209,6 @@ void TargetSetupPageWrapper::completeChanged()
|
|||||||
{
|
{
|
||||||
m_configureButton->setEnabled(m_targetSetupPage->isComplete());
|
m_configureButton->setEnabled(m_targetSetupPage->isComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace ProjectExplorer
|
||||||
@@ -30,21 +30,19 @@
|
|||||||
#ifndef UNCONFIGUREDPROJECTPANEL_H
|
#ifndef UNCONFIGUREDPROJECTPANEL_H
|
||||||
#define UNCONFIGUREDPROJECTPANEL_H
|
#define UNCONFIGUREDPROJECTPANEL_H
|
||||||
|
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
#include "iprojectproperties.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||||
|
|
||||||
namespace ProjectExplorer { class Kit; }
|
namespace ProjectExplorer {
|
||||||
|
class Kit;
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
class TargetSetupPage;
|
class TargetSetupPage;
|
||||||
class Qt4Project;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class UnconfiguredProjectPanel : public ProjectExplorer::IProjectPanelFactory
|
class UnconfiguredProjectPanel : public IProjectPanelFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -52,15 +50,15 @@ public:
|
|||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
virtual bool supports(ProjectExplorer::Project *project);
|
virtual bool supports(Project *project);
|
||||||
virtual ProjectExplorer::PropertiesPanel *createPanel(ProjectExplorer::Project *project);
|
virtual PropertiesPanel *createPanel(Project *project);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TargetSetupPageWrapper : public QWidget
|
class TargetSetupPageWrapper : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TargetSetupPageWrapper(ProjectExplorer::Project *project);
|
TargetSetupPageWrapper(Project *project);
|
||||||
protected:
|
protected:
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
@@ -72,13 +70,13 @@ private slots:
|
|||||||
void completeChanged();
|
void completeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt4Project *m_project;
|
Project *m_project;
|
||||||
TargetSetupPage *m_targetSetupPage;
|
TargetSetupPage *m_targetSetupPage;
|
||||||
QPushButton *m_configureButton;
|
QPushButton *m_configureButton;
|
||||||
QPushButton *m_cancelButton;
|
QPushButton *m_cancelButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace Internal
|
||||||
}
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // UNCONFIGUREDPROJECTPANEL_H
|
#endif // UNCONFIGUREDPROJECTPANEL_H
|
||||||
@@ -250,6 +250,7 @@ ProjectExplorer::BuildInfo *QbsBuildConfigurationFactory::createBuildInfo(const
|
|||||||
info->buildDirectory = buildDirectory;
|
info->buildDirectory = buildDirectory;
|
||||||
info->kitId = k->id();
|
info->kitId = k->id();
|
||||||
info->type = type;
|
info->type = type;
|
||||||
|
info->supportsShadowBuild = true;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +273,32 @@ QList<ProjectExplorer::BuildInfo *> QbsBuildConfigurationFactory::availableBuild
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QbsBuildConfigurationFactory::canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||||
|
.matchesType(QLatin1String(Constants::MIME_TYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ProjectExplorer::BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
|
QTC_ASSERT(canSetup(k, projectPath), return result);
|
||||||
|
|
||||||
|
const Utils::FileName buildDirectory = QbsProject::defaultBuildDirectory(projectPath);
|
||||||
|
|
||||||
|
ProjectExplorer::BuildInfo *info = createBuildInfo(k, buildDirectory, ProjectExplorer::BuildConfiguration::Debug);
|
||||||
|
//: The name of the debug build configuration created by default for a qbs project.
|
||||||
|
info->displayName = tr("Debug");
|
||||||
|
result << info;
|
||||||
|
|
||||||
|
info = createBuildInfo(k, buildDirectory, ProjectExplorer::BuildConfiguration::Release);
|
||||||
|
//: The name of the release build configuration created by default for a qbs project.
|
||||||
|
info->displayName = tr("Release");
|
||||||
|
result << info;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *QbsBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *QbsBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const
|
const ProjectExplorer::BuildInfo *info) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ public:
|
|||||||
|
|
||||||
bool canCreate(const ProjectExplorer::Target *parent) const;
|
bool canCreate(const ProjectExplorer::Target *parent) const;
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||||
|
bool canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const;
|
const ProjectExplorer::BuildInfo *info) const;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,9 @@
|
|||||||
#include "qt4buildconfiguration.h"
|
#include "qt4buildconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildinfo.h>
|
#include <projectexplorer/buildinfo.h>
|
||||||
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
@@ -45,6 +47,15 @@ public:
|
|||||||
ProjectExplorer::BuildConfiguration::BuildType type;
|
ProjectExplorer::BuildConfiguration::BuildType type;
|
||||||
QString additionalArguments;
|
QString additionalArguments;
|
||||||
QString makefile;
|
QString makefile;
|
||||||
|
|
||||||
|
QList<ProjectExplorer::Task> reportIssues(const QString &projectPath,
|
||||||
|
const QString &buildDir) const
|
||||||
|
{
|
||||||
|
ProjectExplorer::Kit *k = ProjectExplorer::KitManager::find(kitId);
|
||||||
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
|
return version ? version->reportIssues(projectPath, buildDir)
|
||||||
|
: QList<ProjectExplorer::Task>();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
254
src/plugins/qt4projectmanager/qmakeprojectimporter.cpp
Normal file
254
src/plugins/qt4projectmanager/qmakeprojectimporter.cpp
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qmakeprojectimporter.h"
|
||||||
|
|
||||||
|
#include "qmakebuildinfo.h"
|
||||||
|
#include "qmakekitinformation.h"
|
||||||
|
#include "qt4buildconfiguration.h"
|
||||||
|
#include "qt4project.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/idocument.h>
|
||||||
|
#include <projectexplorer/kitmanager.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
#include <qtsupport/qtversionfactory.h>
|
||||||
|
#include <qtsupport/qtversionmanager.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
static const Core::Id QT_IS_TEMPORARY("Qmake.TempQt");
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
QmakeProjectImporter::QmakeProjectImporter(const QString &path) :
|
||||||
|
ProjectExplorer::ProjectImporter(path)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
QList<ProjectExplorer::BuildInfo *> QmakeProjectImporter::import(const Utils::FileName &importPath,
|
||||||
|
bool silent)
|
||||||
|
{
|
||||||
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
|
QFileInfo fi = importPath.toFileInfo();
|
||||||
|
if (!fi.exists() && !fi.isDir())
|
||||||
|
return result;
|
||||||
|
|
||||||
|
QStringList makefiles = QDir(importPath.toString()).entryList(QStringList(QLatin1String("Makefile*")));
|
||||||
|
|
||||||
|
QtSupport::BaseQtVersion *version = 0;
|
||||||
|
bool temporaryVersion = false;
|
||||||
|
|
||||||
|
foreach (const QString &file, makefiles) {
|
||||||
|
// find interesting makefiles
|
||||||
|
QString makefile = importPath.toString() + QLatin1Char('/') + file;
|
||||||
|
Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
||||||
|
QFileInfo qmakeFi = qmakeBinary.toFileInfo();
|
||||||
|
Utils::FileName canonicalQmakeBinary = Utils::FileName::fromString(qmakeFi.canonicalFilePath());
|
||||||
|
if (canonicalQmakeBinary.isEmpty())
|
||||||
|
continue;
|
||||||
|
if (QtSupport::QtVersionManager::makefileIsFor(makefile, projectFilePath()) != QtSupport::QtVersionManager::SameProject)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Find version:
|
||||||
|
foreach (QtSupport::BaseQtVersion *v, QtSupport::QtVersionManager::versions()) {
|
||||||
|
QFileInfo vfi = v->qmakeCommand().toFileInfo();
|
||||||
|
Utils::FileName current = Utils::FileName::fromString(vfi.canonicalFilePath());
|
||||||
|
if (current == canonicalQmakeBinary) {
|
||||||
|
version = v;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new version if not found:
|
||||||
|
if (!version) {
|
||||||
|
// Do not use the canonical path here...
|
||||||
|
version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary);
|
||||||
|
if (!version)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
setIsUpdating(true);
|
||||||
|
QtSupport::QtVersionManager::addVersion(version);
|
||||||
|
setIsUpdating(false);
|
||||||
|
temporaryVersion = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find qmake arguments and mkspec
|
||||||
|
QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> makefileBuildConfig =
|
||||||
|
QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
|
||||||
|
|
||||||
|
QString additionalArguments = makefileBuildConfig.second;
|
||||||
|
Utils::FileName parsedSpec =
|
||||||
|
Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, importPath.toString(), version);
|
||||||
|
Utils::FileName versionSpec = version->mkspec();
|
||||||
|
if (parsedSpec.isEmpty() || parsedSpec == Utils::FileName::fromString(QLatin1String("default")))
|
||||||
|
parsedSpec = versionSpec;
|
||||||
|
|
||||||
|
QString specArgument;
|
||||||
|
// Compare mkspecs and add to additional arguments
|
||||||
|
if (parsedSpec != versionSpec)
|
||||||
|
specArgument = QLatin1String("-spec ") + Utils::QtcProcess::quoteArg(parsedSpec.toUserOutput());
|
||||||
|
Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
|
||||||
|
|
||||||
|
// Find kits (can be more than one, e.g. (Linux-)Desktop and embedded linux):
|
||||||
|
QList<ProjectExplorer::Kit *> kitList;
|
||||||
|
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::kits()) {
|
||||||
|
QtSupport::BaseQtVersion *kitVersion = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
|
Utils::FileName kitSpec = QmakeKitInformation::mkspec(k);
|
||||||
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||||
|
if (kitSpec.isEmpty() && kitVersion)
|
||||||
|
kitSpec = kitVersion->mkspecFor(tc);
|
||||||
|
|
||||||
|
if (kitVersion == version
|
||||||
|
&& kitSpec == parsedSpec)
|
||||||
|
kitList.append(k);
|
||||||
|
}
|
||||||
|
if (kitList.isEmpty())
|
||||||
|
kitList.append(createTemporaryKit(version, temporaryVersion, parsedSpec));
|
||||||
|
|
||||||
|
foreach (ProjectExplorer::Kit *k, kitList) {
|
||||||
|
addProject(k);
|
||||||
|
|
||||||
|
Qt4BuildConfigurationFactory *factory
|
||||||
|
= qobject_cast<Qt4BuildConfigurationFactory *>(
|
||||||
|
ProjectExplorer::IBuildConfigurationFactory::find(k, projectFilePath()));
|
||||||
|
|
||||||
|
if (!factory)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// create info:
|
||||||
|
QmakeBuildInfo *info = new QmakeBuildInfo(factory);
|
||||||
|
if (makefileBuildConfig.first | QtSupport::BaseQtVersion::DebugBuild) {
|
||||||
|
info->type = ProjectExplorer::BuildConfiguration::Debug;
|
||||||
|
info->displayName = QCoreApplication::translate("Qt4ProjectManager::Internal::QmakeProjectImporter", "Debug");
|
||||||
|
} else {
|
||||||
|
info->type = ProjectExplorer::BuildConfiguration::Release;
|
||||||
|
info->displayName = QCoreApplication::translate("Qt4ProjectManager::Internal::QmakeProjectImporter", "Release");
|
||||||
|
}
|
||||||
|
info->kitId = k->id();
|
||||||
|
info->buildDirectory = Utils::FileName::fromString(fi.absoluteFilePath());
|
||||||
|
info->additionalArguments = additionalArguments;
|
||||||
|
info->makefile = makefile;
|
||||||
|
|
||||||
|
result << info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.isEmpty() && !silent)
|
||||||
|
QMessageBox::critical(Core::ICore::mainWindow(),
|
||||||
|
QCoreApplication::translate("Qt4ProjectManager::Internal::QmakeProjectImporter", "No Build Found"),
|
||||||
|
QCoreApplication::translate("Qt4ProjectManager::Internal::QmakeProjectImporter", "No build found in %1 matching project %2.")
|
||||||
|
.arg(importPath.toUserOutput()).arg(projectFilePath()));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QmakeProjectImporter::importCandidates(const Utils::FileName &projectPath)
|
||||||
|
{
|
||||||
|
QStringList candidates;
|
||||||
|
|
||||||
|
QFileInfo pfi = projectPath.toFileInfo();
|
||||||
|
const QString prefix = pfi.baseName();
|
||||||
|
candidates << pfi.absolutePath();
|
||||||
|
|
||||||
|
QList<ProjectExplorer::Kit *> kitList = ProjectExplorer::KitManager::kits();
|
||||||
|
foreach (ProjectExplorer::Kit *k, kitList) {
|
||||||
|
QFileInfo fi(Qt4Project::shadowBuildDirectory(projectPath.toString(), k, QString()));
|
||||||
|
const QString baseDir = fi.absolutePath();
|
||||||
|
|
||||||
|
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
||||||
|
const QString path = baseDir + QLatin1Char('/') + dir;
|
||||||
|
if (dir.startsWith(prefix) && !candidates.contains(path))
|
||||||
|
candidates << path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return candidates;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::Target *QmakeProjectImporter::preferredTarget(const QList<ProjectExplorer::Target *> &possibleTargets)
|
||||||
|
{
|
||||||
|
// Select active target
|
||||||
|
// a) The default target
|
||||||
|
// b) Simulator target
|
||||||
|
// c) Desktop target
|
||||||
|
// d) the first target
|
||||||
|
ProjectExplorer::Target *activeTarget = possibleTargets.isEmpty() ? 0 : possibleTargets.at(0);
|
||||||
|
int activeTargetPriority = 0;
|
||||||
|
foreach (ProjectExplorer::Target *t, possibleTargets) {
|
||||||
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(t->kit());
|
||||||
|
if (t->kit() == ProjectExplorer::KitManager::defaultKit()) {
|
||||||
|
activeTarget = t;
|
||||||
|
activeTargetPriority = 3;
|
||||||
|
} else if (activeTargetPriority < 2 && version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)) {
|
||||||
|
activeTarget = t;
|
||||||
|
activeTargetPriority = 2;
|
||||||
|
} else if (activeTargetPriority < 1 && version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)) {
|
||||||
|
activeTarget = t;
|
||||||
|
activeTargetPriority = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return activeTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmakeProjectImporter::cleanupKit(ProjectExplorer::Kit *k)
|
||||||
|
{
|
||||||
|
QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::version(k->value(QT_IS_TEMPORARY, -1).toInt());
|
||||||
|
if (version)
|
||||||
|
QtSupport::QtVersionManager::removeVersion(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::Kit *QmakeProjectImporter::createTemporaryKit(QtSupport::BaseQtVersion *version,
|
||||||
|
bool temporaryVersion,
|
||||||
|
const Utils::FileName &parsedSpec)
|
||||||
|
{
|
||||||
|
ProjectExplorer::Kit *k = new ProjectExplorer::Kit;
|
||||||
|
QtSupport::QtKitInformation::setQtVersion(k, version);
|
||||||
|
ProjectExplorer::ToolChainKitInformation::setToolChain(k, version->preferredToolChain(parsedSpec));
|
||||||
|
QmakeKitInformation::setMkspec(k, parsedSpec);
|
||||||
|
|
||||||
|
markTemporary(k);
|
||||||
|
if (temporaryVersion)
|
||||||
|
k->setValue(QT_IS_TEMPORARY, version->uniqueId());
|
||||||
|
|
||||||
|
k->setDisplayName(version->displayName());
|
||||||
|
setIsUpdating(true);
|
||||||
|
ProjectExplorer::KitManager::registerKit(k);
|
||||||
|
setIsUpdating(false);
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
@@ -27,48 +27,38 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef BUILDCONFIGURATIONINFO_H
|
#ifndef QMAKEPROJECTIMPORTER_H
|
||||||
#define BUILDCONFIGURATIONINFO_H
|
#define QMAKEPROJECTIMPORTER_H
|
||||||
|
|
||||||
#include "qt4projectmanager_global.h"
|
#include <projectexplorer/projectimporter.h>
|
||||||
|
|
||||||
#include <qtsupport/baseqtversion.h>
|
namespace QtSupport { class BaseQtVersion; }
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
class QT4PROJECTMANAGER_EXPORT BuildConfigurationInfo
|
class Qt4Project;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
// Documentation inside.
|
||||||
|
class QmakeProjectImporter : public ProjectExplorer::ProjectImporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BuildConfigurationInfo()
|
QmakeProjectImporter(const QString &path);
|
||||||
: buildConfig(QtSupport::BaseQtVersion::QmakeBuildConfig(0)), importing(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
explicit BuildConfigurationInfo(QtSupport::BaseQtVersion::QmakeBuildConfigs bc,
|
QList<ProjectExplorer::BuildInfo *> import(const Utils::FileName &importPath, bool silent = false);
|
||||||
const QString &aa, const QString &d,
|
QStringList importCandidates(const Utils::FileName &projectFilePath);
|
||||||
bool importing_ = false,
|
ProjectExplorer::Target *preferredTarget(const QList<ProjectExplorer::Target *> &possibleTargets);
|
||||||
const QString &makefile_ = QString())
|
|
||||||
: buildConfig(bc),
|
|
||||||
additionalArguments(aa), directory(d),
|
|
||||||
importing(importing_),
|
|
||||||
makefile(makefile_)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool operator ==(const BuildConfigurationInfo &other) const
|
void cleanupKit(ProjectExplorer::Kit *k);
|
||||||
{
|
|
||||||
return buildConfig == other.buildConfig
|
|
||||||
&& additionalArguments == other.additionalArguments
|
|
||||||
&& directory == other.directory
|
|
||||||
&& importing == other.importing
|
|
||||||
&& makefile == other.makefile;
|
|
||||||
}
|
|
||||||
|
|
||||||
QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig;
|
private:
|
||||||
QString additionalArguments;
|
ProjectExplorer::Kit *createTemporaryKit(QtSupport::BaseQtVersion *version,
|
||||||
QString directory;
|
bool temporaryVersion,
|
||||||
bool importing;
|
const Utils::FileName &parsedSpec);
|
||||||
QString makefile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
#endif // BUILDCONFIGURATIONINFO_H
|
#endif // QMAKEPROJECTIMPORTER_H
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "qt4buildconfiguration.h"
|
#include "qt4buildconfiguration.h"
|
||||||
|
|
||||||
#include "buildconfigurationinfo.h"
|
|
||||||
#include "qmakebuildinfo.h"
|
#include "qmakebuildinfo.h"
|
||||||
#include "qt4project.h"
|
#include "qt4project.h"
|
||||||
#include "qt4projectconfigwidget.h"
|
#include "qt4projectconfigwidget.h"
|
||||||
@@ -58,6 +57,20 @@
|
|||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Helpers:
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
static Utils::FileName defaultBuildDirectory(bool supportsShadowBuild,
|
||||||
|
const QString &projectPath,
|
||||||
|
const ProjectExplorer::Kit *k,
|
||||||
|
const QString &suffix)
|
||||||
|
{
|
||||||
|
if (supportsShadowBuild)
|
||||||
|
return Utils::FileName::fromString(Qt4Project::shadowBuildDirectory(projectPath, k, suffix));
|
||||||
|
return Utils::FileName::fromString(ProjectExplorer::Project::projectDirectory(projectPath));
|
||||||
|
}
|
||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
@@ -550,10 +563,8 @@ QmakeBuildInfo *Qt4BuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|||||||
// Leave info->buildDirectory unset;
|
// Leave info->buildDirectory unset;
|
||||||
info->kitId = k->id();
|
info->kitId = k->id();
|
||||||
info->supportsShadowBuild = (version && version->supportsShadowBuilds());
|
info->supportsShadowBuild = (version && version->supportsShadowBuilds());
|
||||||
if (info->supportsShadowBuild)
|
info->buildDirectory
|
||||||
info->buildDirectory = Utils::FileName::fromString(Qt4Project::shadowBuildDirectory(projectPath, k, info->displayName));
|
= defaultBuildDirectory(info->supportsShadowBuild, projectPath, k, info->displayName);
|
||||||
else
|
|
||||||
info->buildDirectory = Utils::FileName::fromString(ProjectExplorer::Project::projectDirectory(projectPath));
|
|
||||||
info->type = type;
|
info->type = type;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@@ -571,11 +582,30 @@ QList<BuildInfo *> Qt4BuildConfigurationFactory::availableBuilds(const Target *p
|
|||||||
QmakeBuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath(),
|
QmakeBuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath(),
|
||||||
BuildConfiguration::Debug);
|
BuildConfiguration::Debug);
|
||||||
info->displayName.clear(); // ask for a name
|
info->displayName.clear(); // ask for a name
|
||||||
|
info->buildDirectory.clear(); // This depends on the displayName
|
||||||
result << info;
|
result << info;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Qt4BuildConfigurationFactory::canSetup(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
return k && QtSupport::QtKitInformation::qtVersion(k)
|
||||||
|
&& Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||||
|
.matchesType(QLatin1String(Constants::PROFILE_MIMETYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> Qt4BuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
|
QTC_ASSERT(canSetup(k, projectPath), return result);
|
||||||
|
|
||||||
|
result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Debug);
|
||||||
|
result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Release);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
BuildConfiguration *Qt4BuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
BuildConfiguration *Qt4BuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(canCreate(parent), return 0);
|
QTC_ASSERT(canCreate(parent), return 0);
|
||||||
@@ -594,11 +624,44 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(Target *parent, const B
|
|||||||
else
|
else
|
||||||
config |= QtSupport::BaseQtVersion::DebugBuild;
|
config |= QtSupport::BaseQtVersion::DebugBuild;
|
||||||
|
|
||||||
BuildConfiguration *bc
|
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(parent);
|
||||||
= Qt4BuildConfiguration::setup(parent, info->displayName, info->displayName,
|
bc->setDefaultDisplayName(info->displayName);
|
||||||
config, qmakeInfo->additionalArguments,
|
bc->setDisplayName(info->displayName);
|
||||||
info->buildDirectory.toString(), false);
|
|
||||||
|
|
||||||
|
BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
|
||||||
|
BuildStepList *cleanSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
|
||||||
|
Q_ASSERT(buildSteps);
|
||||||
|
Q_ASSERT(cleanSteps);
|
||||||
|
|
||||||
|
QMakeStep *qmakeStep = new QMakeStep(buildSteps);
|
||||||
|
buildSteps->insertStep(0, qmakeStep);
|
||||||
|
|
||||||
|
MakeStep *makeStep = new MakeStep(buildSteps);
|
||||||
|
buildSteps->insertStep(1, makeStep);
|
||||||
|
|
||||||
|
MakeStep *cleanStep = new MakeStep(cleanSteps);
|
||||||
|
cleanStep->setClean(true);
|
||||||
|
cleanStep->setUserArguments(QLatin1String("clean"));
|
||||||
|
cleanSteps->insertStep(0, cleanStep);
|
||||||
|
|
||||||
|
QString additionalArguments = qmakeInfo->additionalArguments;
|
||||||
|
|
||||||
|
bool enableQmlDebugger
|
||||||
|
= Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
|
||||||
|
if (!additionalArguments.isEmpty())
|
||||||
|
qmakeStep->setUserArguments(additionalArguments);
|
||||||
|
qmakeStep->setLinkQmlDebuggingLibrary(enableQmlDebugger);
|
||||||
|
|
||||||
|
bc->setQMakeBuildConfiguration(config);
|
||||||
|
|
||||||
|
Utils::FileName directory = qmakeInfo->buildDirectory;
|
||||||
|
if (directory.isEmpty()) {
|
||||||
|
directory = defaultBuildDirectory(qmakeInfo->supportsShadowBuild,
|
||||||
|
parent->project()->projectFilePath(),
|
||||||
|
parent->kit(), info->displayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bc->setBuildDirectory(directory);
|
||||||
return bc;
|
return bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,35 +696,6 @@ BuildConfiguration *Qt4BuildConfigurationFactory::restore(Target *parent, const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> Qt4BuildConfigurationFactory::availableBuildConfigurations(const Kit *k,
|
|
||||||
const QString &proFilePath)
|
|
||||||
{
|
|
||||||
QList<BuildConfigurationInfo> infoList;
|
|
||||||
|
|
||||||
BaseQtVersion *version = QtKitInformation::qtVersion(k);
|
|
||||||
if (!version || !version->isValid())
|
|
||||||
return infoList;
|
|
||||||
BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig() | QtSupport::BaseQtVersion::DebugBuild;
|
|
||||||
BuildConfigurationInfo info = BuildConfigurationInfo(config, QString(), QString(), false);
|
|
||||||
info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info));
|
|
||||||
infoList.append(info);
|
|
||||||
|
|
||||||
info.buildConfig = config ^ BaseQtVersion::DebugBuild;
|
|
||||||
info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info));
|
|
||||||
infoList.append(info);
|
|
||||||
return infoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return name of a build configuration.
|
|
||||||
QString Qt4BuildConfigurationFactory::buildConfigurationDisplayName(const BuildConfigurationInfo &info)
|
|
||||||
{
|
|
||||||
return (info.buildConfig & BaseQtVersion::DebugBuild) ?
|
|
||||||
//: Name of a debug build configuration to created by a project wizard. We recommend not translating it.
|
|
||||||
tr("Debug") :
|
|
||||||
//: Name of a release build configuration to be created by a project wizard. We recommend not translating it.
|
|
||||||
tr("Release");
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
|
BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
|
||||||
{
|
{
|
||||||
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
|
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
|
||||||
@@ -670,52 +704,6 @@ BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
|
|||||||
return Release;
|
return Release;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDisplayName,
|
|
||||||
QString displayName,
|
|
||||||
BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
|
||||||
QString additionalArguments, QString directory,
|
|
||||||
bool importing)
|
|
||||||
{
|
|
||||||
Q_UNUSED(importing);
|
|
||||||
|
|
||||||
// Add the build configuration.
|
|
||||||
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(t);
|
|
||||||
bc->setDefaultDisplayName(defaultDisplayName);
|
|
||||||
bc->setDisplayName(displayName);
|
|
||||||
|
|
||||||
BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
|
|
||||||
BuildStepList *cleanSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
|
|
||||||
Q_ASSERT(buildSteps);
|
|
||||||
Q_ASSERT(cleanSteps);
|
|
||||||
|
|
||||||
QMakeStep *qmakeStep = new QMakeStep(buildSteps);
|
|
||||||
buildSteps->insertStep(0, qmakeStep);
|
|
||||||
|
|
||||||
MakeStep *makeStep = new MakeStep(buildSteps);
|
|
||||||
buildSteps->insertStep(1, makeStep);
|
|
||||||
|
|
||||||
MakeStep *cleanStep = new MakeStep(cleanSteps);
|
|
||||||
cleanStep->setClean(true);
|
|
||||||
cleanStep->setUserArguments(QLatin1String("clean"));
|
|
||||||
cleanSteps->insertStep(0, cleanStep);
|
|
||||||
|
|
||||||
bool enableQmlDebugger
|
|
||||||
= Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
|
|
||||||
|
|
||||||
if (!additionalArguments.isEmpty())
|
|
||||||
qmakeStep->setUserArguments(additionalArguments);
|
|
||||||
qmakeStep->setLinkQmlDebuggingLibrary(enableQmlDebugger);
|
|
||||||
|
|
||||||
bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
|
|
||||||
|
|
||||||
if (directory.isEmpty())
|
|
||||||
bc->setBuildDirectory(Utils::FileName::fromString(t->project()->projectDirectory()));
|
|
||||||
else
|
|
||||||
bc->setBuildDirectory(Utils::FileName::fromString(directory));
|
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt4BuildConfiguration::LastKitState::LastKitState()
|
Qt4BuildConfiguration::LastKitState::LastKitState()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -743,6 +731,4 @@ bool Qt4BuildConfiguration::LastKitState::operator !=(const LastKitState &other)
|
|||||||
return !operator ==(other);
|
return !operator ==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class QMakeStep;
|
|||||||
class MakeStep;
|
class MakeStep;
|
||||||
class Qt4BuildConfigurationFactory;
|
class Qt4BuildConfigurationFactory;
|
||||||
class Qt4ProFileNode;
|
class Qt4ProFileNode;
|
||||||
class BuildConfigurationInfo;
|
|
||||||
|
|
||||||
namespace Internal { class Qt4ProjectConfigWidget; }
|
namespace Internal { class Qt4ProjectConfigWidget; }
|
||||||
|
|
||||||
@@ -103,13 +102,6 @@ public:
|
|||||||
|
|
||||||
BuildType buildType() const;
|
BuildType buildType() const;
|
||||||
|
|
||||||
static Qt4BuildConfiguration *setup(ProjectExplorer::Target *t,
|
|
||||||
QString defaultDisplayName,
|
|
||||||
QString displayName,
|
|
||||||
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
|
||||||
QString additionalArguments,
|
|
||||||
QString directory,
|
|
||||||
bool importing);
|
|
||||||
/// returns whether the Qt version in the profile supports shadow building (also true for no Qt version)
|
/// returns whether the Qt version in the profile supports shadow building (also true for no Qt version)
|
||||||
bool supportsShadowBuilds();
|
bool supportsShadowBuilds();
|
||||||
|
|
||||||
@@ -161,6 +153,7 @@ private:
|
|||||||
ProjectExplorer::FileNode *m_fileNodeBuild;
|
ProjectExplorer::FileNode *m_fileNodeBuild;
|
||||||
|
|
||||||
friend class Internal::Qt4ProjectConfigWidget;
|
friend class Internal::Qt4ProjectConfigWidget;
|
||||||
|
friend class Qt4BuildConfigurationFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QT4PROJECTMANAGER_EXPORT Qt4BuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
class QT4PROJECTMANAGER_EXPORT Qt4BuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
@@ -173,6 +166,9 @@ public:
|
|||||||
|
|
||||||
bool canCreate(const ProjectExplorer::Target *parent) const;
|
bool canCreate(const ProjectExplorer::Target *parent) const;
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||||
|
bool canSetup(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
||||||
const ProjectExplorer::BuildInfo *info) const;
|
const ProjectExplorer::BuildInfo *info) const;
|
||||||
|
|
||||||
@@ -181,9 +177,6 @@ public:
|
|||||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||||
|
|
||||||
static QList<BuildConfigurationInfo> availableBuildConfigurations(const ProjectExplorer::Kit *k, const QString &proFilePath);
|
|
||||||
static QString buildConfigurationDisplayName(const BuildConfigurationInfo &info);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,13 @@
|
|||||||
#include "qt4project.h"
|
#include "qt4project.h"
|
||||||
|
|
||||||
#include "qt4projectmanager.h"
|
#include "qt4projectmanager.h"
|
||||||
|
#include "qmakeprojectimporter.h"
|
||||||
|
#include "qmakebuildinfo.h"
|
||||||
#include "qmakestep.h"
|
#include "qmakestep.h"
|
||||||
#include "qt4nodes.h"
|
#include "qt4nodes.h"
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include "qt4buildconfiguration.h"
|
#include "qt4buildconfiguration.h"
|
||||||
#include "findqt4profiles.h"
|
#include "findqt4profiles.h"
|
||||||
#include "buildconfigurationinfo.h"
|
|
||||||
#include "qt4projectmanager/wizards/abstractmobileapp.h"
|
#include "qt4projectmanager/wizards/abstractmobileapp.h"
|
||||||
#include "qt4projectmanager/wizards/qtquickapp.h"
|
#include "qt4projectmanager/wizards/qtquickapp.h"
|
||||||
#include "qt4projectmanager/wizards/html5app.h"
|
#include "qt4projectmanager/wizards/html5app.h"
|
||||||
@@ -380,32 +381,6 @@ void Qt4Project::updateFileList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Qt4Project::setupTarget(ProjectExplorer::Target *t)
|
|
||||||
{
|
|
||||||
QList<BuildConfigurationInfo> infoList
|
|
||||||
= Qt4BuildConfigurationFactory::availableBuildConfigurations(t->kit(), m_fileInfo->filePath());
|
|
||||||
setupTarget(t, infoList);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4Project::setupTarget(ProjectExplorer::Target *t, const QList<BuildConfigurationInfo> &infoList)
|
|
||||||
{
|
|
||||||
// Build Configurations:
|
|
||||||
foreach (const BuildConfigurationInfo &info, infoList) {
|
|
||||||
QString name = info.buildConfig & QtSupport::BaseQtVersion::DebugBuild
|
|
||||||
? tr("Debug") : tr("Release");
|
|
||||||
Qt4BuildConfiguration *bc
|
|
||||||
= Qt4BuildConfiguration::setup(t, name, name,
|
|
||||||
info.buildConfig, info.additionalArguments,
|
|
||||||
info.directory, info.importing);
|
|
||||||
t->addBuildConfiguration(bc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deploy Configurations:
|
|
||||||
t->updateDefaultDeployConfigurations();
|
|
||||||
// Do not create Run Configurations: Those will be generated later anyway.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Qt4Project::fromMap(const QVariantMap &map)
|
bool Qt4Project::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!Project::fromMap(map))
|
if (!Project::fromMap(map))
|
||||||
@@ -1389,6 +1364,7 @@ bool Qt4Project::needsConfiguration() const
|
|||||||
|
|
||||||
void Qt4Project::configureAsExampleProject(const QStringList &platforms)
|
void Qt4Project::configureAsExampleProject(const QStringList &platforms)
|
||||||
{
|
{
|
||||||
|
QList<const BuildInfo *> infoList;
|
||||||
QList<Kit *> kits = ProjectExplorer::KitManager::kits();
|
QList<Kit *> kits = ProjectExplorer::KitManager::kits();
|
||||||
foreach (Kit *k, kits) {
|
foreach (Kit *k, kits) {
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||||
@@ -1397,12 +1373,14 @@ void Qt4Project::configureAsExampleProject(const QStringList &platforms)
|
|||||||
if (!platforms.isEmpty() && !platforms.contains(version->platformName()))
|
if (!platforms.isEmpty() && !platforms.contains(version->platformName()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> infoList
|
IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(k, projectFilePath());
|
||||||
= Qt4BuildConfigurationFactory::availableBuildConfigurations(k, projectFilePath());
|
if (!factory)
|
||||||
if (infoList.isEmpty())
|
|
||||||
continue;
|
continue;
|
||||||
addTarget(createTarget(k, infoList));
|
foreach (BuildInfo *info, factory->availableSetups(k, projectFilePath()))
|
||||||
|
infoList << info;
|
||||||
}
|
}
|
||||||
|
setup(infoList);
|
||||||
|
qDeleteAll(infoList);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
|
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1456,16 +1434,6 @@ QString Qt4Project::buildNameFor(const Kit *k)
|
|||||||
return k->fileSystemFriendlyName();
|
return k->fileSystemFriendlyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Target *Qt4Project::createTarget(Kit *k, const QList<BuildConfigurationInfo> &infoList)
|
|
||||||
{
|
|
||||||
if (target(k))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Target *t = new Target(this, k);
|
|
||||||
setupTarget(t, infoList);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt4Project::updateBuildSystemData()
|
void Qt4Project::updateBuildSystemData()
|
||||||
{
|
{
|
||||||
Target * const target = activeTarget();
|
Target * const target = activeTarget();
|
||||||
@@ -1653,6 +1621,12 @@ void Qt4Project::emitBuildDirectoryInitialized()
|
|||||||
{
|
{
|
||||||
emit buildDirectoryInitialized();
|
emit buildDirectoryInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectImporter *Qt4Project::createProjectImporter() const
|
||||||
|
{
|
||||||
|
return new QmakeProjectImporter(projectFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
#include "qt4project.moc"
|
#include "qt4project.moc"
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace ProjectExplorer { class DeploymentData; }
|
|||||||
namespace QtSupport { class ProFileReader; }
|
namespace QtSupport { class ProFileReader; }
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
class BuildConfigurationInfo;
|
|
||||||
class MakeStep;
|
class MakeStep;
|
||||||
class QMakeStep;
|
class QMakeStep;
|
||||||
class Qt4BuildConfiguration;
|
class Qt4BuildConfiguration;
|
||||||
@@ -139,10 +138,10 @@ public:
|
|||||||
/// used by the default implementation of shadowBuildDirectory
|
/// used by the default implementation of shadowBuildDirectory
|
||||||
static QString buildNameFor(const ProjectExplorer::Kit *k);
|
static QString buildNameFor(const ProjectExplorer::Kit *k);
|
||||||
|
|
||||||
ProjectExplorer::Target *createTarget(ProjectExplorer::Kit *k, const QList<BuildConfigurationInfo> &infoList);
|
|
||||||
|
|
||||||
void emitBuildDirectoryInitialized();
|
void emitBuildDirectoryInitialized();
|
||||||
|
|
||||||
|
ProjectExplorer::ProjectImporter *createProjectImporter() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
|
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
|
||||||
void buildDirectoryInitialized();
|
void buildDirectoryInitialized();
|
||||||
@@ -155,8 +154,6 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool fromMap(const QVariantMap &map);
|
bool fromMap(const QVariantMap &map);
|
||||||
bool setupTarget(ProjectExplorer::Target *t);
|
|
||||||
void setupTarget(ProjectExplorer::Target *t, const QList<BuildConfigurationInfo> &infoList);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void asyncUpdate();
|
void asyncUpdate();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ HEADERS += \
|
|||||||
qmakebuildinfo.h \
|
qmakebuildinfo.h \
|
||||||
qmakekitinformation.h \
|
qmakekitinformation.h \
|
||||||
qmakekitconfigwidget.h \
|
qmakekitconfigwidget.h \
|
||||||
|
qmakeprojectimporter.h \
|
||||||
qmakerunconfigurationfactory.h \
|
qmakerunconfigurationfactory.h \
|
||||||
qt4projectmanagerplugin.h \
|
qt4projectmanagerplugin.h \
|
||||||
qt4projectmanager.h \
|
qt4projectmanager.h \
|
||||||
@@ -38,8 +39,6 @@ HEADERS += \
|
|||||||
wizards/modulespage.h \
|
wizards/modulespage.h \
|
||||||
wizards/filespage.h \
|
wizards/filespage.h \
|
||||||
wizards/qtwizard.h \
|
wizards/qtwizard.h \
|
||||||
wizards/targetsetuppage.h \
|
|
||||||
wizards/importwidget.h \
|
|
||||||
wizards/qtquickapp.h \
|
wizards/qtquickapp.h \
|
||||||
wizards/qtquickappwizard.h \
|
wizards/qtquickappwizard.h \
|
||||||
wizards/qtquickappwizardpages.h \
|
wizards/qtquickappwizardpages.h \
|
||||||
@@ -62,16 +61,14 @@ HEADERS += \
|
|||||||
librarydetailscontroller.h \
|
librarydetailscontroller.h \
|
||||||
findqt4profiles.h \
|
findqt4profiles.h \
|
||||||
qt4projectmanager_global.h \
|
qt4projectmanager_global.h \
|
||||||
qt4targetsetupwidget.h \
|
|
||||||
buildconfigurationinfo.h \
|
|
||||||
winceqtversionfactory.h \
|
winceqtversionfactory.h \
|
||||||
winceqtversion.h \
|
winceqtversion.h \
|
||||||
profilecompletionassist.h \
|
profilecompletionassist.h
|
||||||
unconfiguredprojectpanel.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qmakekitconfigwidget.cpp \
|
qmakekitconfigwidget.cpp \
|
||||||
qmakekitinformation.cpp \
|
qmakekitinformation.cpp \
|
||||||
|
qmakeprojectimporter.cpp \
|
||||||
qmakerunconfigurationfactory.cpp \
|
qmakerunconfigurationfactory.cpp \
|
||||||
qt4projectmanagerplugin.cpp \
|
qt4projectmanagerplugin.cpp \
|
||||||
qt4projectmanager.cpp \
|
qt4projectmanager.cpp \
|
||||||
@@ -102,8 +99,6 @@ SOURCES += \
|
|||||||
wizards/modulespage.cpp \
|
wizards/modulespage.cpp \
|
||||||
wizards/filespage.cpp \
|
wizards/filespage.cpp \
|
||||||
wizards/qtwizard.cpp \
|
wizards/qtwizard.cpp \
|
||||||
wizards/targetsetuppage.cpp \
|
|
||||||
wizards/importwidget.cpp \
|
|
||||||
wizards/qtquickapp.cpp \
|
wizards/qtquickapp.cpp \
|
||||||
wizards/qtquickappwizard.cpp \
|
wizards/qtquickappwizard.cpp \
|
||||||
wizards/qtquickappwizardpages.cpp \
|
wizards/qtquickappwizardpages.cpp \
|
||||||
@@ -124,11 +119,9 @@ SOURCES += \
|
|||||||
addlibrarywizard.cpp \
|
addlibrarywizard.cpp \
|
||||||
librarydetailscontroller.cpp \
|
librarydetailscontroller.cpp \
|
||||||
findqt4profiles.cpp \
|
findqt4profiles.cpp \
|
||||||
qt4targetsetupwidget.cpp \
|
|
||||||
winceqtversionfactory.cpp \
|
winceqtversionfactory.cpp \
|
||||||
winceqtversion.cpp \
|
winceqtversion.cpp \
|
||||||
profilecompletionassist.cpp \
|
profilecompletionassist.cpp
|
||||||
unconfiguredprojectpanel.cpp
|
|
||||||
|
|
||||||
FORMS += makestep.ui \
|
FORMS += makestep.ui \
|
||||||
qmakestep.ui \
|
qmakestep.ui \
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ QtcPlugin {
|
|||||||
"qt4projectmanagerplugin.cpp", "qt4projectmanagerplugin.h",
|
"qt4projectmanagerplugin.cpp", "qt4projectmanagerplugin.h",
|
||||||
"qt4targetsetupwidget.cpp", "qt4targetsetupwidget.h",
|
"qt4targetsetupwidget.cpp", "qt4targetsetupwidget.h",
|
||||||
"qtmodulesinfo.cpp", "qtmodulesinfo.h",
|
"qtmodulesinfo.cpp", "qtmodulesinfo.h",
|
||||||
"unconfiguredprojectpanel.cpp", "unconfiguredprojectpanel.h",
|
|
||||||
"winceqtversion.cpp", "winceqtversion.h",
|
"winceqtversion.cpp", "winceqtversion.h",
|
||||||
"winceqtversionfactory.cpp", "winceqtversionfactory.h"
|
"winceqtversionfactory.cpp", "winceqtversionfactory.h"
|
||||||
]
|
]
|
||||||
@@ -117,7 +116,6 @@ QtcPlugin {
|
|||||||
"html5appwizard.cpp", "html5appwizard.h",
|
"html5appwizard.cpp", "html5appwizard.h",
|
||||||
"html5appwizardpages.cpp", "html5appwizardpages.h",
|
"html5appwizardpages.cpp", "html5appwizardpages.h",
|
||||||
"html5appwizardsourcespage.ui",
|
"html5appwizardsourcespage.ui",
|
||||||
"importwidget.cpp", "importwidget.h",
|
|
||||||
"libraryparameters.cpp", "libraryparameters.h",
|
"libraryparameters.cpp", "libraryparameters.h",
|
||||||
"librarywizard.cpp", "librarywizard.h",
|
"librarywizard.cpp", "librarywizard.h",
|
||||||
"librarywizarddialog.cpp", "librarywizarddialog.h",
|
"librarywizarddialog.cpp", "librarywizarddialog.h",
|
||||||
@@ -137,7 +135,6 @@ QtcPlugin {
|
|||||||
"qtwizard.cpp", "qtwizard.h",
|
"qtwizard.cpp", "qtwizard.h",
|
||||||
"subdirsprojectwizard.cpp", "subdirsprojectwizard.h",
|
"subdirsprojectwizard.cpp", "subdirsprojectwizard.h",
|
||||||
"subdirsprojectwizarddialog.cpp", "subdirsprojectwizarddialog.h",
|
"subdirsprojectwizarddialog.cpp", "subdirsprojectwizarddialog.h",
|
||||||
"targetsetuppage.cpp", "targetsetuppage.h",
|
|
||||||
"testwizard.cpp", "testwizard.h",
|
"testwizard.cpp", "testwizard.h",
|
||||||
"testwizarddialog.cpp", "testwizarddialog.h",
|
"testwizarddialog.cpp", "testwizarddialog.h",
|
||||||
"testwizardpage.cpp", "testwizardpage.h",
|
"testwizardpage.cpp", "testwizardpage.h",
|
||||||
|
|||||||
@@ -90,9 +90,6 @@ const char QMAKEVAR_QMLJSDEBUGGER_PATH[] = "QMLJSDEBUGGER_PATH";
|
|||||||
const char QMAKEVAR_QUICK1_DEBUG[] = "CONFIG+=declarative_debug";
|
const char QMAKEVAR_QUICK1_DEBUG[] = "CONFIG+=declarative_debug";
|
||||||
const char QMAKEVAR_QUICK2_DEBUG[] = "CONFIG+=qml_debug";
|
const char QMAKEVAR_QUICK2_DEBUG[] = "CONFIG+=qml_debug";
|
||||||
|
|
||||||
// Unconfigured Panel
|
|
||||||
const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
|
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
#include "qt-desktop/desktopqtversionfactory.h"
|
#include "qt-desktop/desktopqtversionfactory.h"
|
||||||
#include "qt-desktop/simulatorqtversionfactory.h"
|
#include "qt-desktop/simulatorqtversionfactory.h"
|
||||||
#include "winceqtversionfactory.h"
|
#include "winceqtversionfactory.h"
|
||||||
#include "unconfiguredprojectpanel.h"
|
|
||||||
#include "qmakekitinformation.h"
|
#include "qmakekitinformation.h"
|
||||||
#include "profilehighlighterfactory.h"
|
#include "profilehighlighterfactory.h"
|
||||||
|
|
||||||
@@ -156,7 +155,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
|||||||
|
|
||||||
addAutoReleasedObject(new ProFileCompletionAssistProvider);
|
addAutoReleasedObject(new ProFileCompletionAssistProvider);
|
||||||
addAutoReleasedObject(new ProFileHoverHandler(this));
|
addAutoReleasedObject(new ProFileHoverHandler(this));
|
||||||
addAutoReleasedObject(new UnconfiguredProjectPanel);
|
|
||||||
addAutoReleasedObject(new ProFileHighlighterFactory);
|
addAutoReleasedObject(new ProFileHighlighterFactory);
|
||||||
|
|
||||||
//menus
|
//menus
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "abstractmobileappwizard.h"
|
#include "abstractmobileappwizard.h"
|
||||||
|
|
||||||
#include "mobileappwizardpages.h"
|
#include "mobileappwizardpages.h"
|
||||||
#include "targetsetuppage.h"
|
#include "../qmakeprojectimporter.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <qt4projectmanager/qt4project.h>
|
#include <qt4projectmanager/qt4project.h>
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/targetsetuppage.h>
|
||||||
#include <projectexplorer/customwizard/customwizard.h>
|
#include <projectexplorer/customwizard/customwizard.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
@@ -64,7 +65,8 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
|
|||||||
.value<QList<Core::Id> >())
|
.value<QList<Core::Id> >())
|
||||||
{
|
{
|
||||||
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) {
|
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) {
|
||||||
m_targetsPage = new TargetSetupPage;
|
m_targetsPage = new ProjectExplorer::TargetSetupPage;
|
||||||
|
m_targetsPage->setProjectImporter(new Internal::QmakeProjectImporter(path()));
|
||||||
QString platform = selectedPlatform();
|
QString platform = selectedPlatform();
|
||||||
if (platform.isEmpty()) {
|
if (platform.isEmpty()) {
|
||||||
m_targetsPage->setPreferredKitMatcher(
|
m_targetsPage->setPreferredKitMatcher(
|
||||||
@@ -120,7 +122,7 @@ void AbstractMobileAppWizardDialog::addMobilePages()
|
|||||||
m_targetItem->setNextShownItem(0);
|
m_targetItem->setNextShownItem(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetSetupPage *AbstractMobileAppWizardDialog::targetsPage() const
|
ProjectExplorer::TargetSetupPage *AbstractMobileAppWizardDialog::targetsPage() const
|
||||||
{
|
{
|
||||||
return m_targetsPage;
|
return m_targetsPage;
|
||||||
}
|
}
|
||||||
@@ -295,7 +297,7 @@ void AbstractMobileAppWizard::useProjectPath(const QString &projectName,
|
|||||||
app()->setProjectName(projectName);
|
app()->setProjectName(projectName);
|
||||||
app()->setProjectPath(projectPath);
|
app()->setProjectPath(projectPath);
|
||||||
if (wizardDialog()->m_targetsPage)
|
if (wizardDialog()->m_targetsPage)
|
||||||
wizardDialog()->m_targetsPage->setProFilePath(app()->path(AbstractMobileApp::AppPro));
|
wizardDialog()->m_targetsPage->setProjectPath(app()->path(AbstractMobileApp::AppPro));
|
||||||
projectPathChanged(app()->path(AbstractMobileApp::AppPro));
|
projectPathChanged(app()->path(AbstractMobileApp::AppPro));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <qt4projectmanager/qt4projectmanager_global.h>
|
#include <qt4projectmanager/qt4projectmanager_global.h>
|
||||||
#include <projectexplorer/baseprojectwizarddialog.h>
|
#include <projectexplorer/baseprojectwizarddialog.h>
|
||||||
|
|
||||||
|
namespace ProjectExplorer { class TargetSetupPage; }
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
class QtVersionNumber;
|
class QtVersionNumber;
|
||||||
class QtVersionManager;
|
class QtVersionManager;
|
||||||
@@ -41,7 +43,6 @@ class QtVersionManager;
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
class AbstractMobileApp;
|
class AbstractMobileApp;
|
||||||
class TargetSetupPage;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class MobileAppWizardGenericOptionsPage;
|
class MobileAppWizardGenericOptionsPage;
|
||||||
@@ -61,7 +62,7 @@ protected:
|
|||||||
void addMobilePages();
|
void addMobilePages();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TargetSetupPage *targetsPage() const;
|
ProjectExplorer::TargetSetupPage *targetsPage() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int addPageWithTitle(QWizardPage *page, const QString &title);
|
int addPageWithTitle(QWizardPage *page, const QString &title);
|
||||||
@@ -80,7 +81,7 @@ private:
|
|||||||
Internal::MobileAppWizardGenericOptionsPage *m_genericOptionsPage;
|
Internal::MobileAppWizardGenericOptionsPage *m_genericOptionsPage;
|
||||||
Internal::MobileAppWizardMaemoOptionsPage *m_maemoOptionsPage;
|
Internal::MobileAppWizardMaemoOptionsPage *m_maemoOptionsPage;
|
||||||
Internal::MobileAppWizardHarmattanOptionsPage *m_harmattanOptionsPage;
|
Internal::MobileAppWizardHarmattanOptionsPage *m_harmattanOptionsPage;
|
||||||
TargetSetupPage *m_targetsPage;
|
ProjectExplorer::TargetSetupPage *m_targetsPage;
|
||||||
|
|
||||||
int m_genericOptionsPageId;
|
int m_genericOptionsPageId;
|
||||||
int m_maemoOptionsPageId;
|
int m_maemoOptionsPageId;
|
||||||
|
|||||||
@@ -31,11 +31,11 @@
|
|||||||
|
|
||||||
#include "html5app.h"
|
#include "html5app.h"
|
||||||
#include "html5appwizardpages.h"
|
#include "html5appwizardpages.h"
|
||||||
#include "targetsetuppage.h"
|
|
||||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||||
|
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/targetsetuppage.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ AbstractMobileAppWizardDialog *Html5AppWizard::createWizardDialogInternal(QWidge
|
|||||||
void Html5AppWizard::projectPathChanged(const QString &path) const
|
void Html5AppWizard::projectPathChanged(const QString &path) const
|
||||||
{
|
{
|
||||||
if (d->wizardDialog->targetsPage())
|
if (d->wizardDialog->targetsPage())
|
||||||
d->wizardDialog->targetsPage()->setProFilePath(path);
|
d->wizardDialog->targetsPage()->setProjectPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Html5AppWizard::prepareGenerateFiles(const QWizard *w,
|
void Html5AppWizard::prepareGenerateFiles(const QWizard *w,
|
||||||
|
|||||||
@@ -31,12 +31,12 @@
|
|||||||
|
|
||||||
#include "qtquickapp.h"
|
#include "qtquickapp.h"
|
||||||
#include "qtquickappwizardpages.h"
|
#include "qtquickappwizardpages.h"
|
||||||
#include "targetsetuppage.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
|
||||||
|
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/targetsetuppage.h>
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -226,7 +226,7 @@ AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWid
|
|||||||
void QtQuickAppWizard::projectPathChanged(const QString &path) const
|
void QtQuickAppWizard::projectPathChanged(const QString &path) const
|
||||||
{
|
{
|
||||||
if (d->wizardDialog->targetsPage())
|
if (d->wizardDialog->targetsPage())
|
||||||
d->wizardDialog->targetsPage()->setProFilePath(path);
|
d->wizardDialog->targetsPage()->setProjectPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
|
void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "qtwizard.h"
|
#include "qtwizard.h"
|
||||||
|
|
||||||
#include "modulespage.h"
|
#include "modulespage.h"
|
||||||
#include "targetsetuppage.h"
|
|
||||||
|
|
||||||
#include <qt4projectmanager/qt4project.h>
|
#include <qt4projectmanager/qt4project.h>
|
||||||
#include <qt4projectmanager/qt4projectmanager.h>
|
#include <qt4projectmanager/qt4projectmanager.h>
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/targetsetuppage.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
|
|||||||
|
|
||||||
int BaseQt4ProjectWizardDialog::addTargetSetupPage(bool mobile, int id)
|
int BaseQt4ProjectWizardDialog::addTargetSetupPage(bool mobile, int id)
|
||||||
{
|
{
|
||||||
m_targetSetupPage = new TargetSetupPage;
|
m_targetSetupPage = new ProjectExplorer::TargetSetupPage;
|
||||||
const QString platform = selectedPlatform();
|
const QString platform = selectedPlatform();
|
||||||
Core::FeatureSet features = mobile ? Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE)
|
Core::FeatureSet features = mobile ? Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE)
|
||||||
: Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP);
|
: Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP);
|
||||||
@@ -323,5 +323,5 @@ void BaseQt4ProjectWizardDialog::generateProfileName(const QString &name, const
|
|||||||
QDir::cleanPath(path + QLatin1Char('/') + name + QLatin1Char('/')
|
QDir::cleanPath(path + QLatin1Char('/') + name + QLatin1Char('/')
|
||||||
+ name + QLatin1String(".pro"));
|
+ name + QLatin1String(".pro"));
|
||||||
|
|
||||||
m_targetSetupPage->setProFilePath(proFile);
|
m_targetSetupPage->setProjectPath(proFile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,12 +34,14 @@
|
|||||||
#include <projectexplorer/baseprojectwizarddialog.h>
|
#include <projectexplorer/baseprojectwizarddialog.h>
|
||||||
#include <projectexplorer/customwizard/customwizard.h>
|
#include <projectexplorer/customwizard/customwizard.h>
|
||||||
|
|
||||||
namespace ProjectExplorer { class Kit; }
|
namespace ProjectExplorer {
|
||||||
|
class Kit;
|
||||||
|
class TargetSetupPage;
|
||||||
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
class Qt4Project;
|
class Qt4Project;
|
||||||
class TargetSetupPage;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -142,7 +144,7 @@ private:
|
|||||||
inline void init(bool showModulesPage);
|
inline void init(bool showModulesPage);
|
||||||
|
|
||||||
ModulesPage *m_modulesPage;
|
ModulesPage *m_modulesPage;
|
||||||
TargetSetupPage *m_targetSetupPage;
|
ProjectExplorer::TargetSetupPage *m_targetSetupPage;
|
||||||
QStringList m_selectedModules;
|
QStringList m_selectedModules;
|
||||||
QStringList m_deselectedModules;
|
QStringList m_deselectedModules;
|
||||||
QList<Core::Id> m_profileIds;
|
QList<Core::Id> m_profileIds;
|
||||||
|
|||||||
@@ -1,731 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "targetsetuppage.h"
|
|
||||||
#include "importwidget.h"
|
|
||||||
#include "../qt4targetsetupwidget.h"
|
|
||||||
|
|
||||||
#include <qt4projectmanager/buildconfigurationinfo.h>
|
|
||||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
|
||||||
#include <qt4projectmanager/qt4project.h>
|
|
||||||
#include <qt4projectmanager/qmakekitinformation.h>
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
|
||||||
#include <qtsupport/qtversionfactory.h>
|
|
||||||
#include <qtsupport/qtversionmanager.h>
|
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace QtSupport;
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static const Core::Id QT_IS_TEMPORARY("Qt4PM.TempQt");
|
|
||||||
static const Core::Id KIT_IS_TEMPORARY("Qt4PM.TempKit");
|
|
||||||
static const Core::Id KIT_TEMPORARY_NAME("Qt4PM.TempName");
|
|
||||||
static const Core::Id KIT_FINAL_NAME("Qt4PM.FinalName");
|
|
||||||
static const Core::Id TEMPORARY_OF_PROJECTS("Qt4PM.TempProject");
|
|
||||||
|
|
||||||
class TargetSetupPageUi
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QWidget *centralWidget;
|
|
||||||
QWidget *scrollAreaWidget;
|
|
||||||
QScrollArea *scrollArea;
|
|
||||||
QLabel *headerLabel;
|
|
||||||
QLabel *descriptionLabel;
|
|
||||||
QLabel *noValidKitLabel;
|
|
||||||
QLabel *optionHintLabel;
|
|
||||||
|
|
||||||
void setupUi(QWidget *q)
|
|
||||||
{
|
|
||||||
QWidget *setupTargetPage = new QWidget(q);
|
|
||||||
descriptionLabel = new QLabel(setupTargetPage);
|
|
||||||
descriptionLabel->setWordWrap(true);
|
|
||||||
descriptionLabel->setVisible(false);
|
|
||||||
|
|
||||||
headerLabel = new QLabel(setupTargetPage);
|
|
||||||
headerLabel->setWordWrap(true);
|
|
||||||
headerLabel->setVisible(false);
|
|
||||||
|
|
||||||
noValidKitLabel = new QLabel(setupTargetPage);
|
|
||||||
noValidKitLabel->setWordWrap(true);
|
|
||||||
noValidKitLabel->setText(TargetSetupPage::tr("<span style=\" font-weight:600;\">No valid kits found.</span>"));
|
|
||||||
|
|
||||||
|
|
||||||
optionHintLabel = new QLabel(setupTargetPage);
|
|
||||||
optionHintLabel->setWordWrap(true);
|
|
||||||
optionHintLabel->setText(TargetSetupPage::tr(
|
|
||||||
"Please add a kit in the <a href=\"buildandrun\">options</a> "
|
|
||||||
"or via the maintenance tool of the SDK."));
|
|
||||||
optionHintLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
||||||
optionHintLabel->setVisible(false);
|
|
||||||
|
|
||||||
centralWidget = new QWidget(setupTargetPage);
|
|
||||||
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
||||||
policy.setHorizontalStretch(0);
|
|
||||||
policy.setVerticalStretch(0);
|
|
||||||
policy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
|
|
||||||
centralWidget->setSizePolicy(policy);
|
|
||||||
|
|
||||||
scrollAreaWidget = new QWidget(setupTargetPage);
|
|
||||||
scrollArea = new QScrollArea(scrollAreaWidget);
|
|
||||||
scrollArea->setWidgetResizable(true);
|
|
||||||
|
|
||||||
QWidget *scrollAreaWidgetContents;
|
|
||||||
scrollAreaWidgetContents = new QWidget();
|
|
||||||
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 230, 81));
|
|
||||||
scrollArea->setWidget(scrollAreaWidgetContents);
|
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout(scrollAreaWidget);
|
|
||||||
verticalLayout->setSpacing(0);
|
|
||||||
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
verticalLayout->addWidget(scrollArea);
|
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout_2 = new QVBoxLayout(setupTargetPage);
|
|
||||||
verticalLayout_2->addWidget(headerLabel);
|
|
||||||
verticalLayout_2->addWidget(noValidKitLabel);
|
|
||||||
verticalLayout_2->addWidget(descriptionLabel);
|
|
||||||
verticalLayout_2->addWidget(optionHintLabel);
|
|
||||||
verticalLayout_2->addWidget(centralWidget);
|
|
||||||
verticalLayout_2->addWidget(scrollAreaWidget);
|
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout_3 = new QVBoxLayout(q);
|
|
||||||
verticalLayout_3->setContentsMargins(0, 0, 0, -1);
|
|
||||||
verticalLayout_3->addWidget(setupTargetPage);
|
|
||||||
|
|
||||||
QObject::connect(optionHintLabel, SIGNAL(linkActivated(QString)),
|
|
||||||
q, SLOT(openOptions()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
using namespace Internal;
|
|
||||||
|
|
||||||
TargetSetupPage::TargetSetupPage(QWidget *parent) :
|
|
||||||
QWizardPage(parent),
|
|
||||||
m_requiredMatcher(0),
|
|
||||||
m_preferredMatcher(0),
|
|
||||||
m_baseLayout(0),
|
|
||||||
m_importSearch(false),
|
|
||||||
m_ignoreUpdates(false),
|
|
||||||
m_firstWidget(0),
|
|
||||||
m_ui(new TargetSetupPageUi),
|
|
||||||
m_importWidget(new Internal::ImportWidget(this)),
|
|
||||||
m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)),
|
|
||||||
m_forceOptionHint(false)
|
|
||||||
{
|
|
||||||
setObjectName(QLatin1String("TargetSetupPage"));
|
|
||||||
setWindowTitle(tr("Select Kits for Your Project"));
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
|
|
||||||
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
||||||
policy.setHorizontalStretch(0);
|
|
||||||
policy.setVerticalStretch(0);
|
|
||||||
policy.setHeightForWidth(sizePolicy().hasHeightForWidth());
|
|
||||||
setSizePolicy(policy);
|
|
||||||
|
|
||||||
QWidget *centralWidget = new QWidget(this);
|
|
||||||
m_ui->scrollArea->setWidget(centralWidget);
|
|
||||||
centralWidget->setLayout(new QVBoxLayout);
|
|
||||||
m_ui->centralWidget->setLayout(new QVBoxLayout);
|
|
||||||
m_ui->centralWidget->layout()->setMargin(0);
|
|
||||||
|
|
||||||
setUseScrollArea(true);
|
|
||||||
setImportSearch(false);
|
|
||||||
|
|
||||||
setTitle(tr("Kit Selection"));
|
|
||||||
|
|
||||||
QObject *km = KitManager::instance();
|
|
||||||
connect(km, SIGNAL(kitAdded(ProjectExplorer::Kit*)),
|
|
||||||
this, SLOT(handleKitAddition(ProjectExplorer::Kit*)));
|
|
||||||
connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
|
|
||||||
this, SLOT(handleKitRemoval(ProjectExplorer::Kit*)));
|
|
||||||
connect(km, SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
|
||||||
this, SLOT(handleKitUpdate(ProjectExplorer::Kit*)));
|
|
||||||
connect(m_importWidget, SIGNAL(importFrom(Utils::FileName)),
|
|
||||||
this, SLOT(import(Utils::FileName)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::initializePage()
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
|
|
||||||
setupWidgets();
|
|
||||||
setupImports();
|
|
||||||
selectAtLeastOneKit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setRequiredKitMatcher(ProjectExplorer::KitMatcher *matcher)
|
|
||||||
{
|
|
||||||
m_requiredMatcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Core::Id> TargetSetupPage::selectedKits() const
|
|
||||||
{
|
|
||||||
QList<Core::Id> result;
|
|
||||||
QMap<Core::Id, Qt4TargetSetupWidget *>::const_iterator it, end;
|
|
||||||
it = m_widgets.constBegin();
|
|
||||||
end = m_widgets.constEnd();
|
|
||||||
|
|
||||||
for ( ; it != end; ++it) {
|
|
||||||
if (isKitSelected(it.key()))
|
|
||||||
result << it.key();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setPreferredKitMatcher(ProjectExplorer::KitMatcher *matcher)
|
|
||||||
{
|
|
||||||
m_preferredMatcher = matcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
TargetSetupPage::~TargetSetupPage()
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
delete m_ui;
|
|
||||||
delete m_preferredMatcher;
|
|
||||||
delete m_requiredMatcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetSetupPage::isKitSelected(Core::Id id) const
|
|
||||||
{
|
|
||||||
Qt4TargetSetupWidget *widget = m_widgets.value(id);
|
|
||||||
return widget && widget->isKitSelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
|
|
||||||
{
|
|
||||||
Qt4TargetSetupWidget *widget = m_widgets.value(id);
|
|
||||||
if (widget)
|
|
||||||
widget->setKitSelected(selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetSetupPage::isComplete() const
|
|
||||||
{
|
|
||||||
foreach (Qt4TargetSetupWidget *widget, m_widgets.values())
|
|
||||||
if (widget->isKitSelected())
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setImportSearch(bool b)
|
|
||||||
{
|
|
||||||
m_importSearch = b;
|
|
||||||
m_importWidget->setVisible(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setupWidgets()
|
|
||||||
{
|
|
||||||
// Known profiles:
|
|
||||||
QList<Kit *> kits = m_requiredMatcher
|
|
||||||
? KitManager::matchingKits(*m_requiredMatcher) : KitManager::kits();
|
|
||||||
foreach (Kit *k, kits)
|
|
||||||
addWidget(k);
|
|
||||||
|
|
||||||
// Setup import widget:
|
|
||||||
m_baseLayout->addWidget(m_importWidget);
|
|
||||||
Utils::FileName path = Utils::FileName::fromString(m_proFilePath);
|
|
||||||
path = path.parentDir(); // base dir
|
|
||||||
path = path.parentDir(); // parent dir
|
|
||||||
m_importWidget->setCurrentDirectory(path);
|
|
||||||
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::reset()
|
|
||||||
{
|
|
||||||
foreach (Qt4TargetSetupWidget *widget, m_widgets.values()) {
|
|
||||||
ProjectExplorer::Kit *k = widget->kit();
|
|
||||||
if (!k)
|
|
||||||
continue;
|
|
||||||
removeProject(k, m_proFilePath);
|
|
||||||
delete widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_widgets.clear();
|
|
||||||
m_firstWidget = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Kit *TargetSetupPage::createTemporaryKit(BaseQtVersion *version,
|
|
||||||
bool temporaryVersion,
|
|
||||||
const Utils::FileName &parsedSpec)
|
|
||||||
{
|
|
||||||
ProjectExplorer::Kit *k = new ProjectExplorer::Kit;
|
|
||||||
QtKitInformation::setQtVersion(k, version);
|
|
||||||
ProjectExplorer::ToolChainKitInformation::setToolChain(k, version->preferredToolChain(parsedSpec));
|
|
||||||
QmakeKitInformation::setMkspec(k, parsedSpec);
|
|
||||||
|
|
||||||
k->setDisplayName(tr("%1 - temporary").arg(version->displayName()));
|
|
||||||
k->setValue(KIT_TEMPORARY_NAME, k->displayName());
|
|
||||||
k->setValue(KIT_FINAL_NAME, version->displayName());
|
|
||||||
k->setValue(KIT_IS_TEMPORARY, true);
|
|
||||||
if (temporaryVersion)
|
|
||||||
k->setValue(QT_IS_TEMPORARY, version->uniqueId());
|
|
||||||
|
|
||||||
m_ignoreUpdates = true;
|
|
||||||
ProjectExplorer::KitManager::registerKit(k);
|
|
||||||
m_ignoreUpdates = false;
|
|
||||||
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::cleanKit(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
m_ignoreUpdates = true;
|
|
||||||
k->removeKey(KIT_IS_TEMPORARY);
|
|
||||||
k->removeKey(QT_IS_TEMPORARY);
|
|
||||||
k->removeKey(TEMPORARY_OF_PROJECTS);
|
|
||||||
const QString tempName = k->value(KIT_TEMPORARY_NAME).toString();
|
|
||||||
if (!tempName.isNull() && k->displayName() == tempName)
|
|
||||||
k->setDisplayName(k->value(KIT_FINAL_NAME).toString());
|
|
||||||
k->removeKey(KIT_TEMPORARY_NAME);
|
|
||||||
k->removeKey(KIT_FINAL_NAME);
|
|
||||||
m_ignoreUpdates = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::makeQtPersistent(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
m_ignoreUpdates = true;
|
|
||||||
k->removeKey(QT_IS_TEMPORARY);
|
|
||||||
m_ignoreUpdates = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::addProject(ProjectExplorer::Kit *k, const QString &path)
|
|
||||||
{
|
|
||||||
if (!k->hasValue(KIT_IS_TEMPORARY))
|
|
||||||
return;
|
|
||||||
|
|
||||||
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
|
|
||||||
if (!projects.contains(path)) {
|
|
||||||
projects.append(path);
|
|
||||||
m_ignoreUpdates = true;
|
|
||||||
k->setValue(TEMPORARY_OF_PROJECTS, projects);
|
|
||||||
m_ignoreUpdates = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::removeProject(ProjectExplorer::Kit *k, const QString &path)
|
|
||||||
{
|
|
||||||
if (!k->hasValue(KIT_IS_TEMPORARY) || path.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
|
|
||||||
if (projects.contains(path)) {
|
|
||||||
projects.removeOne(path);
|
|
||||||
m_ignoreUpdates = true;
|
|
||||||
if (projects.isEmpty())
|
|
||||||
ProjectExplorer::KitManager::deregisterKit(k);
|
|
||||||
else
|
|
||||||
k->setValue(TEMPORARY_OF_PROJECTS, projects);
|
|
||||||
m_ignoreUpdates = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setProFilePath(const QString &path)
|
|
||||||
{
|
|
||||||
m_proFilePath = path;
|
|
||||||
if (!m_proFilePath.isEmpty())
|
|
||||||
m_ui->headerLabel->setText(tr("Qt Creator can use the following kits for project <b>%1</b>:",
|
|
||||||
"%1: Project name").arg(QFileInfo(m_proFilePath).baseName()));
|
|
||||||
m_ui->headerLabel->setVisible(!m_proFilePath.isEmpty());
|
|
||||||
|
|
||||||
if (m_widgets.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
reset();
|
|
||||||
setupWidgets();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setNoteText(const QString &text)
|
|
||||||
{
|
|
||||||
m_ui->descriptionLabel->setText(text);
|
|
||||||
m_ui->descriptionLabel->setVisible(!text.isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::showOptionsHint(bool show)
|
|
||||||
{
|
|
||||||
m_forceOptionHint = show;
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::import(const Utils::FileName &path)
|
|
||||||
{
|
|
||||||
import(path, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::import(const Utils::FileName &path, const bool silent)
|
|
||||||
{
|
|
||||||
QFileInfo fi = path.toFileInfo();
|
|
||||||
if (!fi.exists() && !fi.isDir())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QStringList makefiles = QDir(path.toString()).entryList(QStringList(QLatin1String("Makefile*")));
|
|
||||||
|
|
||||||
BaseQtVersion *version = 0;
|
|
||||||
bool temporaryVersion = false;
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
foreach (const QString &file, makefiles) {
|
|
||||||
// find interesting makefiles
|
|
||||||
QString makefile = path.toString() + QLatin1Char('/') + file;
|
|
||||||
Utils::FileName qmakeBinary = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
|
||||||
QFileInfo fi = qmakeBinary.toFileInfo();
|
|
||||||
Utils::FileName canonicalQmakeBinary = Utils::FileName::fromString(fi.canonicalFilePath());
|
|
||||||
if (canonicalQmakeBinary.isEmpty())
|
|
||||||
continue;
|
|
||||||
if (QtVersionManager::makefileIsFor(makefile, m_proFilePath) != QtVersionManager::SameProject)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Find version:
|
|
||||||
foreach (BaseQtVersion *v, QtVersionManager::versions()) {
|
|
||||||
QFileInfo vfi = v->qmakeCommand().toFileInfo();
|
|
||||||
Utils::FileName current = Utils::FileName::fromString(vfi.canonicalFilePath());
|
|
||||||
if (current == canonicalQmakeBinary) {
|
|
||||||
version = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new version if not found:
|
|
||||||
if (!version) {
|
|
||||||
// Do not use the canonical path here...
|
|
||||||
version = QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary);
|
|
||||||
if (!version)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QtVersionManager::addVersion(version);
|
|
||||||
temporaryVersion = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find qmake arguments and mkspec
|
|
||||||
QPair<BaseQtVersion::QmakeBuildConfigs, QString> makefileBuildConfig =
|
|
||||||
QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
|
|
||||||
|
|
||||||
QString additionalArguments = makefileBuildConfig.second;
|
|
||||||
Utils::FileName parsedSpec =
|
|
||||||
Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, path.toString(), version);
|
|
||||||
Utils::FileName versionSpec = version->mkspec();
|
|
||||||
if (parsedSpec.isEmpty() || parsedSpec == Utils::FileName::fromString(QLatin1String("default")))
|
|
||||||
parsedSpec = versionSpec;
|
|
||||||
|
|
||||||
QString specArgument;
|
|
||||||
// Compare mkspecs and add to additional arguments
|
|
||||||
if (parsedSpec != versionSpec)
|
|
||||||
specArgument = QLatin1String("-spec ") + Utils::QtcProcess::quoteArg(parsedSpec.toUserOutput());
|
|
||||||
Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
|
|
||||||
|
|
||||||
// Find profiles (can be more than one, e.g. (Linux-)Desktop and embedded linux):
|
|
||||||
QList<ProjectExplorer::Kit *> kitList;
|
|
||||||
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::kits()) {
|
|
||||||
BaseQtVersion *profileVersion = QtKitInformation::qtVersion(k);
|
|
||||||
Utils::FileName profileSpec = QmakeKitInformation::mkspec(k);
|
|
||||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
|
||||||
if (profileSpec.isEmpty() && profileVersion)
|
|
||||||
profileSpec = profileVersion->mkspecFor(tc);
|
|
||||||
|
|
||||||
if (profileVersion == version
|
|
||||||
&& profileSpec == parsedSpec)
|
|
||||||
kitList.append(k);
|
|
||||||
}
|
|
||||||
if (kitList.isEmpty())
|
|
||||||
kitList.append(createTemporaryKit(version, temporaryVersion, parsedSpec));
|
|
||||||
|
|
||||||
foreach (ProjectExplorer::Kit *k, kitList) {
|
|
||||||
addProject(k, m_proFilePath);
|
|
||||||
|
|
||||||
// Create widget:
|
|
||||||
Qt4TargetSetupWidget *widget = m_widgets.value(k->id(), 0);
|
|
||||||
if (!widget)
|
|
||||||
addWidget(k);
|
|
||||||
widget = m_widgets.value(k->id(), 0);
|
|
||||||
if (!widget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// create info:
|
|
||||||
BuildConfigurationInfo info = BuildConfigurationInfo(makefileBuildConfig.first,
|
|
||||||
specArgument,
|
|
||||||
path.toString(),
|
|
||||||
true,
|
|
||||||
file);
|
|
||||||
|
|
||||||
widget->addBuildConfigurationInfo(info, true);
|
|
||||||
widget->setKitSelected(true);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateVisibility();
|
|
||||||
|
|
||||||
if (!found && !silent)
|
|
||||||
QMessageBox::critical(this,
|
|
||||||
tr("No Build Found"),
|
|
||||||
tr("No build found in %1 matching project %2.").arg(path.toUserOutput()).arg(m_proFilePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::handleQtUpdate(const QList<int> &add, const QList<int> &rm, const QList<int> &mod)
|
|
||||||
{
|
|
||||||
Q_UNUSED(add);
|
|
||||||
// Update kit to no longer claim a Qt version is temporary once it is modified/removed.
|
|
||||||
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::kits()) {
|
|
||||||
if (!k->hasValue(QT_IS_TEMPORARY))
|
|
||||||
continue;
|
|
||||||
int qtVersion = k->value(QT_IS_TEMPORARY, -1).toInt();
|
|
||||||
if (rm.contains(qtVersion) || mod.contains(qtVersion))
|
|
||||||
makeQtPersistent(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setupImports()
|
|
||||||
{
|
|
||||||
if (!m_importSearch || m_proFilePath.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QFileInfo pfi(m_proFilePath);
|
|
||||||
const QString prefix = pfi.baseName();
|
|
||||||
QStringList toImport;
|
|
||||||
toImport << pfi.absolutePath();
|
|
||||||
|
|
||||||
QList<ProjectExplorer::Kit *> kitList = ProjectExplorer::KitManager::kits();
|
|
||||||
foreach (ProjectExplorer::Kit *k, kitList) {
|
|
||||||
QFileInfo fi(Qt4Project::shadowBuildDirectory(m_proFilePath, k, QString()));
|
|
||||||
const QString baseDir = fi.absolutePath();
|
|
||||||
|
|
||||||
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
|
||||||
const QString path = baseDir + QLatin1Char('/') + dir;
|
|
||||||
if (dir.startsWith(prefix) && !toImport.contains(path))
|
|
||||||
toImport << path;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (const QString &path, toImport)
|
|
||||||
import(Utils::FileName::fromString(path), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::handleKitAddition(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
if (m_ignoreUpdates)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Q_ASSERT(!m_widgets.contains(k->id()));
|
|
||||||
addWidget(k);
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::handleKitRemoval(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
BaseQtVersion *version = QtVersionManager::version(k->value(QT_IS_TEMPORARY, -1).toInt());
|
|
||||||
if (version)
|
|
||||||
QtVersionManager::removeVersion(version);
|
|
||||||
|
|
||||||
if (m_ignoreUpdates)
|
|
||||||
return;
|
|
||||||
|
|
||||||
removeWidget(k);
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::handleKitUpdate(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
if (m_ignoreUpdates)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cleanKit(k);
|
|
||||||
Qt4TargetSetupWidget *widget = m_widgets.value(k->id());
|
|
||||||
|
|
||||||
bool acceptable = true;
|
|
||||||
if (m_requiredMatcher && !m_requiredMatcher->matches(k))
|
|
||||||
acceptable = false;
|
|
||||||
|
|
||||||
if (widget && !acceptable)
|
|
||||||
removeWidget(k);
|
|
||||||
else if (!widget && acceptable)
|
|
||||||
addWidget(k);
|
|
||||||
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::selectAtLeastOneKit()
|
|
||||||
{
|
|
||||||
bool atLeastOneKitSelected = false;
|
|
||||||
foreach (Qt4TargetSetupWidget *w, m_widgets.values()) {
|
|
||||||
if (w->isKitSelected()) {
|
|
||||||
atLeastOneKitSelected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!atLeastOneKitSelected) {
|
|
||||||
Qt4TargetSetupWidget *widget = m_firstWidget;
|
|
||||||
ProjectExplorer::Kit *defaultKit = ProjectExplorer::KitManager::defaultKit();
|
|
||||||
if (defaultKit)
|
|
||||||
widget = m_widgets.value(defaultKit->id(), m_firstWidget);
|
|
||||||
if (widget)
|
|
||||||
widget->setKitSelected(true);
|
|
||||||
m_firstWidget = 0;
|
|
||||||
}
|
|
||||||
emit completeChanged(); // Is this necessary?
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::updateVisibility()
|
|
||||||
{
|
|
||||||
// Always show the widgets, the import widget always makes sense to show.
|
|
||||||
m_ui->scrollAreaWidget->setVisible(m_baseLayout == m_ui->scrollArea->widget()->layout());
|
|
||||||
m_ui->centralWidget->setVisible(m_baseLayout == m_ui->centralWidget->layout());
|
|
||||||
|
|
||||||
bool hasKits = !m_widgets.isEmpty();
|
|
||||||
m_ui->noValidKitLabel->setVisible(!hasKits);
|
|
||||||
m_ui->optionHintLabel->setVisible(m_forceOptionHint || !hasKits);
|
|
||||||
|
|
||||||
emit completeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::openOptions()
|
|
||||||
{
|
|
||||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
|
||||||
ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID,
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::removeWidget(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
Qt4TargetSetupWidget *widget = m_widgets.value(k->id());
|
|
||||||
if (!widget)
|
|
||||||
return;
|
|
||||||
if (widget == m_firstWidget)
|
|
||||||
m_firstWidget = 0;
|
|
||||||
widget->deleteLater();
|
|
||||||
m_widgets.remove(k->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt4TargetSetupWidget *TargetSetupPage::addWidget(ProjectExplorer::Kit *k)
|
|
||||||
{
|
|
||||||
if (m_requiredMatcher && !m_requiredMatcher->matches(k))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
QList<BuildConfigurationInfo> infoList = Qt4BuildConfigurationFactory::availableBuildConfigurations(k, m_proFilePath);
|
|
||||||
Qt4TargetSetupWidget *widget = infoList.isEmpty() ? 0 : new Qt4TargetSetupWidget(k, m_proFilePath, infoList);
|
|
||||||
if (!widget)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
m_baseLayout->removeWidget(m_importWidget);
|
|
||||||
m_baseLayout->removeItem(m_spacer);
|
|
||||||
|
|
||||||
widget->setKitSelected(m_preferredMatcher && m_preferredMatcher->matches(k));
|
|
||||||
m_widgets.insert(k->id(), widget);
|
|
||||||
m_baseLayout->addWidget(widget);
|
|
||||||
|
|
||||||
m_baseLayout->addWidget(m_importWidget);
|
|
||||||
m_baseLayout->addItem(m_spacer);
|
|
||||||
|
|
||||||
connect(widget, SIGNAL(selectedToggled()),
|
|
||||||
this, SIGNAL(completeChanged()));
|
|
||||||
|
|
||||||
if (!m_firstWidget)
|
|
||||||
m_firstWidget = widget;
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class KitBuildInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
KitBuildInfo(ProjectExplorer::Kit *k, const QList<BuildConfigurationInfo> &il) :
|
|
||||||
kit(k), infoList(il)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
ProjectExplorer::Kit *kit;
|
|
||||||
QList<BuildConfigurationInfo> infoList;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
|
|
||||||
{
|
|
||||||
QList<KitBuildInfo> toRegister;
|
|
||||||
foreach (Qt4TargetSetupWidget *widget, m_widgets.values()) {
|
|
||||||
if (!widget->isKitSelected())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ProjectExplorer::Kit *k = widget->kit();
|
|
||||||
cleanKit(k);
|
|
||||||
toRegister.append(KitBuildInfo(k, widget->selectedBuildConfigurationInfoList()));
|
|
||||||
widget->clearKit();
|
|
||||||
}
|
|
||||||
reset();
|
|
||||||
|
|
||||||
// only register kits after we are done cleaning up
|
|
||||||
foreach (const KitBuildInfo &data, toRegister)
|
|
||||||
project->addTarget(project->createTarget(data.kit, data.infoList));
|
|
||||||
|
|
||||||
// Select active target
|
|
||||||
// a) Simulator target
|
|
||||||
// b) Desktop target
|
|
||||||
// c) the first target
|
|
||||||
ProjectExplorer::Target *activeTarget = 0;
|
|
||||||
QList<ProjectExplorer::Target *> targets = project->targets();
|
|
||||||
int activeTargetPriority = 0;
|
|
||||||
foreach (ProjectExplorer::Target *t, targets) {
|
|
||||||
BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(t->kit());
|
|
||||||
if (t->kit() == ProjectExplorer::KitManager::defaultKit()) {
|
|
||||||
activeTarget = t;
|
|
||||||
activeTargetPriority = 3;
|
|
||||||
} else if (activeTargetPriority < 2 && version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)) {
|
|
||||||
activeTarget = t;
|
|
||||||
activeTargetPriority = 2;
|
|
||||||
} else if (activeTargetPriority < 1 && version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)) {
|
|
||||||
activeTarget = t;
|
|
||||||
activeTargetPriority = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!activeTarget && !targets.isEmpty())
|
|
||||||
activeTarget = targets.first();
|
|
||||||
if (activeTarget)
|
|
||||||
project->setActiveTarget(activeTarget);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetSetupPage::setUseScrollArea(bool b)
|
|
||||||
{
|
|
||||||
m_baseLayout = b ? m_ui->scrollArea->widget()->layout() : m_ui->centralWidget->layout();
|
|
||||||
m_ui->scrollAreaWidget->setVisible(b);
|
|
||||||
m_ui->centralWidget->setVisible(!b);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
Reference in New Issue
Block a user