forked from qt-creator/qt-creator
VcProjectManager: Adapt to master API
Change-Id: I7a89173bec3e00e3d9853940399b36aadfe27b24 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Radovan Zivkovic <pivonroll@gmail.com>
This commit is contained in:
committed by
Radovan Zivkovic
parent
2b53b21e53
commit
88c3d00e01
@@ -52,7 +52,6 @@ public:
|
||||
virtual IAttributeContainer *attributeContainer() const = 0;
|
||||
virtual IFile *clone() const = 0;
|
||||
virtual ProjectExplorer::FileType fileType() const = 0;
|
||||
virtual IConfiguration *createDefaultBuildConfiguration(const QString &fullConfigName) const = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -98,6 +98,11 @@ VcProject::VcProject(VcManager *projectManager, const QString &projectFilePath,
|
||||
setProjectContext(Core::Context(Constants::VC_PROJECT_ID));
|
||||
m_rootNode = m_projectFile->createVcDocNode();
|
||||
|
||||
if (m_projectFile->documentModel()->vcProjectDocument()->documentVersion() != VcDocConstants::DV_MSVC_2005)
|
||||
setId(Core::Id(Constants::VC_PROJECT_ID));
|
||||
else
|
||||
setId(Core::Id(Constants::VC_PROJECT_2005_ID));
|
||||
|
||||
connect(m_rootNode, SIGNAL(settingsDialogAccepted()), this, SLOT(onSettingsDialogAccepted()));
|
||||
}
|
||||
|
||||
@@ -113,13 +118,6 @@ QString VcProject::displayName() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
Core::Id VcProject::id() const
|
||||
{
|
||||
if (m_projectFile->documentModel()->vcProjectDocument()->documentVersion() != VcDocConstants::DV_MSVC_2005)
|
||||
return Core::Id(Constants::VC_PROJECT_ID);
|
||||
return Core::Id(Constants::VC_PROJECT_2005_ID);
|
||||
}
|
||||
|
||||
Core::IDocument *VcProject::document() const
|
||||
{
|
||||
return m_projectFile;
|
||||
@@ -149,7 +147,12 @@ QStringList VcProject::files(Project::FilesMode fileMode) const
|
||||
QString VcProject::defaultBuildDirectory() const
|
||||
{
|
||||
VcProjectFile* vcFile = static_cast<VcProjectFile *>(document());
|
||||
return vcFile->path()/* + QLatin1String("-build")*/;
|
||||
return defaultBuildDirectory(vcFile->filePath());
|
||||
}
|
||||
|
||||
QString VcProject::defaultBuildDirectory(const QString &fileName)
|
||||
{
|
||||
return QFileInfo(fileName).absolutePath() /* + QLatin1String("-build")*/;
|
||||
}
|
||||
|
||||
bool VcProject::needsConfiguration() const
|
||||
@@ -206,12 +209,8 @@ void VcProject::onSettingsDialogAccepted()
|
||||
// add all new build configurations
|
||||
foreach (ProjectExplorer::Target *target, targetList) {
|
||||
if (target) {
|
||||
|
||||
for (int i = 0; i < configs->configurationContainer()->configurationCount(); ++i) {
|
||||
IConfiguration *config = configs->configurationContainer()->configuration(i);
|
||||
if (config && !findBuildConfiguration(target, config->fullName()))
|
||||
addBuildConfiguration(target, config);
|
||||
}
|
||||
target->updateDefaultBuildConfigurations();
|
||||
target->updateDefaultDeployConfigurations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,11 +232,8 @@ bool VcProject::fromMap(const QVariantMap &map)
|
||||
|
||||
bool VcProject::setupTarget(ProjectExplorer::Target *t)
|
||||
{
|
||||
for (int i = 0; i < m_projectFile->documentModel()->vcProjectDocument()->configurations()->configurationContainer()->configurationCount(); ++i){
|
||||
IConfiguration *config = m_projectFile->documentModel()->vcProjectDocument()->configurations()->configurationContainer()->configuration(i);
|
||||
if (config)
|
||||
addBuildConfiguration(t, config);
|
||||
}
|
||||
t->updateDefaultBuildConfigurations();
|
||||
t->updateDefaultDeployConfigurations();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -267,7 +263,7 @@ void VcProject::addCxxModelFiles(const FolderNode *node, QStringList &projectFil
|
||||
*/
|
||||
void VcProject::updateCodeModels()
|
||||
{
|
||||
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::instance()->defaultKit();
|
||||
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::defaultKit();
|
||||
QTC_ASSERT(k, return);
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(k);
|
||||
QTC_ASSERT(tc, return);
|
||||
@@ -296,11 +292,10 @@ void VcProject::updateCodeModels()
|
||||
IToolAttribute *toolAttr = toolSection->attributeContainer()->toolAttribute(QLatin1String("PreprocessorDefinitions"));
|
||||
|
||||
if (toolAttr) {
|
||||
StringListToolAttribute *stringToolAttr = static_cast<StringListToolAttribute *>(toolAttr);
|
||||
stringToolAttr->descriptionDataItem();
|
||||
QStringList preprocDefs = stringToolAttr->value().split(stringToolAttr->descriptionDataItem()->optionalValue(QLatin1String("separator")));
|
||||
toolAttr->descriptionDataItem();
|
||||
QStringList preprocDefs = toolAttr->value().split(toolAttr->descriptionDataItem()->optionalValue(QLatin1String("separator")));
|
||||
|
||||
pPart->defines += preprocDefs.join(QLatin1String("\n")).toLatin1();
|
||||
pPart->projectDefines += preprocDefs.join(QLatin1String("\n")).toLatin1();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +306,7 @@ void VcProject::updateCodeModels()
|
||||
// VS 2005-2008 has poor c++11 support, see http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport
|
||||
pPart->cxxVersion = CppTools::ProjectPart::CXX98;
|
||||
pPart->qtVersion = CppTools::ProjectPart::NoQt;
|
||||
pPart->defines += tc->predefinedMacros(QStringList());
|
||||
pPart->projectDefines += tc->predefinedMacros(QStringList());
|
||||
|
||||
QStringList cxxFlags;
|
||||
foreach (const HeaderPath &path, tc->systemHeaderPaths(cxxFlags, Utils::FileName())) {
|
||||
@@ -335,9 +330,9 @@ void VcProject::updateCodeModels()
|
||||
void VcProject::importBuildConfigurations()
|
||||
{
|
||||
VCProjKitMatcher matcher;
|
||||
Kit *kit = KitManager::instance()->find(&matcher);
|
||||
Kit *kit = KitManager::find(matcher);
|
||||
if (!kit)
|
||||
kit = KitManager::instance()->defaultKit();
|
||||
kit = KitManager::defaultKit();
|
||||
|
||||
removeTarget(target(kit));
|
||||
addTarget(createTarget(kit));
|
||||
@@ -345,35 +340,6 @@ void VcProject::importBuildConfigurations()
|
||||
addTarget(createTarget(kit));
|
||||
}
|
||||
|
||||
void VcProject::addBuildConfiguration(Target *target, IConfiguration *config)
|
||||
{
|
||||
if (target && config) {
|
||||
VcProjectBuildConfigurationFactory *factory
|
||||
= ExtensionSystem::PluginManager::instance()->getObject<VcProjectBuildConfigurationFactory>();
|
||||
VcProjectBuildConfiguration *bc = factory->create(target, Constants::VC_PROJECT_BC_ID, config->fullName());
|
||||
if (!bc)
|
||||
return;
|
||||
|
||||
bc->setConfiguration(config);
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
VcMakeStep *makeStep = new VcMakeStep(buildSteps);
|
||||
QString argument(QLatin1String("/p:configuration=\"") + config->fullName() + QLatin1String("\""));
|
||||
makeStep->addBuildArgument(m_projectFile->filePath());
|
||||
makeStep->addBuildArgument(argument);
|
||||
buildSteps->insertStep(0, makeStep);
|
||||
|
||||
//clean step
|
||||
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||
makeStep = new VcMakeStep(cleanSteps);
|
||||
argument = QLatin1String("/p:configuration=\"") + config->fullName() + QLatin1String("\" /t:Clean");
|
||||
makeStep->addBuildArgument(m_projectFile->filePath());
|
||||
makeStep->addBuildArgument(argument);
|
||||
cleanSteps->insertStep(0, makeStep);
|
||||
|
||||
target->addBuildConfiguration(bc);
|
||||
}
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration *VcProject::findBuildConfiguration(Target *target, const QString &buildConfigurationName) const
|
||||
{
|
||||
if (target) {
|
||||
|
@@ -64,12 +64,12 @@ public:
|
||||
~VcProject();
|
||||
|
||||
QString displayName() const;
|
||||
Core::Id id() const;
|
||||
Core::IDocument *document() const;
|
||||
ProjectExplorer::IProjectManager *projectManager() const;
|
||||
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
||||
QStringList files(FilesMode fileMode) const;
|
||||
QString defaultBuildDirectory() const;
|
||||
static QString defaultBuildDirectory(const QString &fileName);
|
||||
bool needsConfiguration() const;
|
||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const;
|
||||
|
||||
@@ -87,7 +87,6 @@ private:
|
||||
void addCxxModelFiles(const ProjectExplorer::FolderNode *node, QStringList &sourceFiles);
|
||||
void updateCodeModels();
|
||||
void importBuildConfigurations();
|
||||
void addBuildConfiguration(ProjectExplorer::Target *target, IConfiguration *config);
|
||||
VcProjectBuildConfiguration *findBuildConfiguration(ProjectExplorer::Target *target, const QString &buildConfigurationName) const;
|
||||
void allProjectFile(QStringList &allFiles) const;
|
||||
VcManager *m_projectManager;
|
||||
|
@@ -45,19 +45,26 @@
|
||||
#include <QLabel>
|
||||
#include <QInputDialog>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace VcProjectManager::Constants;
|
||||
|
||||
////////////////////////////////////
|
||||
// VcProjectBuildConfiguration class
|
||||
////////////////////////////////////
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
VcProjectBuildConfiguration::VcProjectBuildConfiguration(ProjectExplorer::Target *parent) :
|
||||
BuildConfiguration(parent, Core::Id(Constants::VC_PROJECT_BC_ID))
|
||||
VcProjectBuildConfiguration::VcProjectBuildConfiguration(Target *parent) :
|
||||
BuildConfiguration(parent, Core::Id(VC_PROJECT_BC_ID))
|
||||
{
|
||||
m_buildDirectory = static_cast<VcProject *>(parent->project())->defaultBuildDirectory();
|
||||
}
|
||||
|
||||
ProjectExplorer::NamedWidget *VcProjectBuildConfiguration::createConfigWidget()
|
||||
VcProjectBuildConfiguration::~VcProjectBuildConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
NamedWidget *VcProjectBuildConfiguration::createConfigWidget()
|
||||
{
|
||||
return new VcProjectBuildSettingsWidget;
|
||||
}
|
||||
@@ -67,17 +74,7 @@ QString VcProjectBuildConfiguration::buildDirectory() const
|
||||
return m_buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::IOutputParser *VcProjectBuildConfiguration::createOutputParser() const
|
||||
{
|
||||
ProjectExplorer::IOutputParser *parserchain = new ProjectExplorer::GnuMakeParser;
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (tc)
|
||||
parserchain->appendOutputParser(tc->outputParser());
|
||||
return parserchain;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfiguration::BuildType VcProjectBuildConfiguration::buildType() const
|
||||
BuildConfiguration::BuildType VcProjectBuildConfiguration::buildType() const
|
||||
{
|
||||
return Debug;
|
||||
}
|
||||
@@ -88,29 +85,9 @@ void VcProjectBuildConfiguration::setConfiguration(IConfiguration *config)
|
||||
connect(m_configuration, SIGNAL(nameChanged()), this, SLOT(reloadConfigurationName()));
|
||||
}
|
||||
|
||||
QString VcProjectBuildConfiguration::configurationNameOnly() const
|
||||
{
|
||||
QStringList splits = m_configuration->fullName().split(QLatin1Char('|'));
|
||||
|
||||
if (splits.isEmpty())
|
||||
return QString();
|
||||
|
||||
return splits[0];
|
||||
}
|
||||
|
||||
QString VcProjectBuildConfiguration::platformNameOnly() const
|
||||
{
|
||||
QStringList splits = m_configuration->fullName().split(QLatin1Char('|'));
|
||||
|
||||
if (splits.isEmpty() || splits.size() <= 1 || splits.size() > 2)
|
||||
return QString();
|
||||
|
||||
return splits[1];
|
||||
}
|
||||
|
||||
QVariantMap VcProjectBuildConfiguration::toMap() const
|
||||
{
|
||||
return ProjectExplorer::BuildConfiguration::toMap();
|
||||
return BuildConfiguration::toMap();
|
||||
}
|
||||
|
||||
void VcProjectBuildConfiguration::reloadConfigurationName()
|
||||
@@ -119,7 +96,7 @@ void VcProjectBuildConfiguration::reloadConfigurationName()
|
||||
setDefaultDisplayName(m_configuration->fullName());
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration::VcProjectBuildConfiguration(ProjectExplorer::Target *parent, VcProjectBuildConfiguration *source)
|
||||
VcProjectBuildConfiguration::VcProjectBuildConfiguration(Target *parent, VcProjectBuildConfiguration *source)
|
||||
: BuildConfiguration(parent, source)
|
||||
{
|
||||
cloneSteps(source);
|
||||
@@ -127,7 +104,7 @@ VcProjectBuildConfiguration::VcProjectBuildConfiguration(ProjectExplorer::Target
|
||||
|
||||
bool VcProjectBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
return ProjectExplorer::BuildConfiguration::fromMap(map);
|
||||
return BuildConfiguration::fromMap(map);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
@@ -138,62 +115,72 @@ VcProjectBuildConfigurationFactory::VcProjectBuildConfigurationFactory(QObject *
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> VcProjectBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
|
||||
int VcProjectBuildConfigurationFactory::priority(const Target *parent) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
|
||||
return QList<Core::Id>() << Core::Id(Constants::VC_PROJECT_BC_ID);
|
||||
return canHandle(parent) ? 0 : -1;
|
||||
}
|
||||
|
||||
QString VcProjectBuildConfigurationFactory::displayNameForId(const Core::Id id) const
|
||||
int VcProjectBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||
{
|
||||
if (id == Constants::VC_PROJECT_BC_ID)
|
||||
return tr("Vc Project");
|
||||
|
||||
return QString();
|
||||
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
||||
.matchesType(QLatin1String(Constants::VCPROJ_MIMETYPE))) ? 0 : -1;
|
||||
}
|
||||
|
||||
bool VcProjectBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
QList<BuildInfo *> VcProjectBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
||||
{
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
if (id == Constants::VC_PROJECT_BC_ID)
|
||||
return true;
|
||||
return false;
|
||||
QList<BuildInfo *> result;
|
||||
result << createBuildInfo(parent->kit(),
|
||||
parent->project()->projectDirectory());
|
||||
return result;
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
|
||||
QList<BuildInfo *> VcProjectBuildConfigurationFactory::availableSetups(
|
||||
const Kit *k, const QString &projectPath) const
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
// VcProject *project = static_cast<VcProject *>(parent->project());
|
||||
QList<BuildInfo *> result;
|
||||
// TODO: Populate from Configuration
|
||||
BuildInfo *info = createBuildInfo(k,
|
||||
Utils::FileName::fromString(VcProject::defaultBuildDirectory(projectPath)));
|
||||
info->displayName = tr("Default");
|
||||
result << info;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
QString buildConfigName = name;
|
||||
if (buildConfigName.isEmpty())
|
||||
buildConfigName = QInputDialog::getText(0,
|
||||
tr("New Vc Project Configuration"),
|
||||
tr("New Configuration name:"),
|
||||
QLineEdit::Normal,
|
||||
QString(), &ok);
|
||||
buildConfigName = buildConfigName.trimmed();
|
||||
if (!ok || buildConfigName.isEmpty())
|
||||
return 0;
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
||||
{
|
||||
QTC_ASSERT(parent, return 0);
|
||||
QTC_ASSERT(info->factory() == this, return 0);
|
||||
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
||||
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
||||
|
||||
VcProjectBuildConfiguration *bc = new VcProjectBuildConfiguration(parent);
|
||||
bc->setDisplayName(buildConfigName);
|
||||
bc->setDefaultDisplayName(buildConfigName);
|
||||
bc->setDisplayName(info->displayName);
|
||||
bc->setDefaultDisplayName(info->displayName);
|
||||
bc->setBuildDirectory(info->buildDirectory);
|
||||
|
||||
return bc;
|
||||
}
|
||||
|
||||
bool VcProjectBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
bool VcProjectBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
return canHandle(parent) && source->id() == VC_PROJECT_BC_ID;
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
|
||||
VcProjectBuildConfiguration *old = static_cast<VcProjectBuildConfiguration *>(source);
|
||||
return new VcProjectBuildConfiguration(parent, old);
|
||||
}
|
||||
|
||||
bool VcProjectBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canHandle(parent) && idFromMap(map) == VC_PROJECT_BC_ID;
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
@@ -205,26 +192,25 @@ VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::restore(Project
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool VcProjectBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
||||
{
|
||||
return canCreate(parent, source->id());
|
||||
}
|
||||
|
||||
VcProjectBuildConfiguration *VcProjectBuildConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
|
||||
VcProjectBuildConfiguration *old = static_cast<VcProjectBuildConfiguration *>(source);
|
||||
return new VcProjectBuildConfiguration(parent, old);
|
||||
}
|
||||
|
||||
bool VcProjectBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
|
||||
bool VcProjectBuildConfigurationFactory::canHandle(const Target *t) const
|
||||
{
|
||||
QTC_ASSERT(t, return false);
|
||||
if (!t->project()->supportsKit(t->kit()))
|
||||
return false;
|
||||
return qobject_cast<VcProject *>(t->project());
|
||||
}
|
||||
|
||||
BuildInfo *VcProjectBuildConfigurationFactory::createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
const Utils::FileName &buildDir) const
|
||||
{
|
||||
BuildInfo *info = new BuildInfo(this);
|
||||
info->typeName = tr("Build");
|
||||
info->buildDirectory = buildDir;
|
||||
info->kitId = k->id();
|
||||
info->supportsShadowBuild = true;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
@@ -45,15 +45,13 @@ class VcProjectBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
|
||||
public:
|
||||
explicit VcProjectBuildConfiguration(ProjectExplorer::Target *parent);
|
||||
~VcProjectBuildConfiguration();
|
||||
|
||||
ProjectExplorer::NamedWidget *createConfigWidget();
|
||||
QString buildDirectory() const;
|
||||
ProjectExplorer::IOutputParser *createOutputParser() const;
|
||||
BuildType buildType() const;
|
||||
|
||||
void setConfiguration(IConfiguration *config);
|
||||
QString configurationNameOnly() const;
|
||||
QString platformNameOnly() const;
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
@@ -77,16 +75,21 @@ public:
|
||||
explicit VcProjectBuildConfigurationFactory(QObject *parent = 0);
|
||||
|
||||
QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
|
||||
VcProjectBuildConfiguration* create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name);
|
||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
|
||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
VcProjectBuildConfiguration* restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
|
||||
int priority(const ProjectExplorer::Target *parent) const;
|
||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const;
|
||||
VcProjectBuildConfiguration* create(ProjectExplorer::Target *parent,
|
||||
const ProjectExplorer::BuildInfo *info) const;
|
||||
VcProjectBuildConfiguration* restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
VcProjectBuildConfiguration* clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
|
||||
|
||||
private:
|
||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
||||
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
const Utils::FileName &buildDir) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -404,13 +404,15 @@ VcProjectBuildOptionsPage::~VcProjectBuildOptionsPage()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *VcProjectBuildOptionsPage::createPage(QWidget *parent)
|
||||
QWidget *VcProjectBuildOptionsPage::widget()
|
||||
{
|
||||
m_optionsWidget = new VcProjectBuildOptionsWidget(parent);
|
||||
if (!m_optionsWidget) {
|
||||
m_optionsWidget = new VcProjectBuildOptionsWidget;
|
||||
|
||||
connect(m_optionsWidget, SIGNAL(addNewButtonClicked()), this, SLOT(addNewMsBuild()));
|
||||
connect(m_optionsWidget, SIGNAL(editButtonClicked()), this, SLOT(editMsBuild()));
|
||||
connect(m_optionsWidget, SIGNAL(deleteButtonClicked()), this, SLOT(deleteMsBuild()));
|
||||
connect(m_optionsWidget, SIGNAL(addNewButtonClicked()), this, SLOT(addNewMsBuild()));
|
||||
connect(m_optionsWidget, SIGNAL(editButtonClicked()), this, SLOT(editMsBuild()));
|
||||
connect(m_optionsWidget, SIGNAL(deleteButtonClicked()), this, SLOT(deleteMsBuild()));
|
||||
}
|
||||
return m_optionsWidget;
|
||||
}
|
||||
|
||||
@@ -424,6 +426,8 @@ void VcProjectBuildOptionsPage::apply()
|
||||
|
||||
void VcProjectBuildOptionsPage::finish()
|
||||
{
|
||||
delete m_optionsWidget;
|
||||
m_optionsWidget = 0;
|
||||
}
|
||||
|
||||
void VcProjectBuildOptionsPage::saveSettings()
|
||||
|
@@ -147,7 +147,7 @@ public:
|
||||
VcProjectBuildOptionsPage();
|
||||
~VcProjectBuildOptionsPage();
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
|
@@ -34,15 +34,12 @@
|
||||
#include "vcprojectmodel/vcprojectdocument.h"
|
||||
#include "vcprojectmodel/vcdocprojectnodes.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
VcProjectFile::VcProjectFile(const QString &filePath, VcDocConstants::DocumentVersion docVersion)
|
||||
: m_filePath(filePath)
|
||||
, m_path(QFileInfo(filePath).path())
|
||||
{
|
||||
setFilePath(filePath);
|
||||
m_documentModel = new VcProjectManager::Internal::VcDocumentModel(filePath, docVersion);
|
||||
}
|
||||
|
||||
@@ -60,11 +57,6 @@ bool VcProjectFile::save(QString *errorString, const QString &fileName, bool aut
|
||||
return false;
|
||||
}
|
||||
|
||||
QString VcProjectFile::fileName() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
QString VcProjectFile::defaultPath() const
|
||||
{
|
||||
// TODO: what's this for?
|
||||
@@ -110,16 +102,6 @@ void VcProjectFile::rename(const QString &newName)
|
||||
// TODO: obvious
|
||||
}
|
||||
|
||||
QString VcProjectFile::filePath()
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
QString VcProjectFile::path()
|
||||
{
|
||||
return m_path;
|
||||
}
|
||||
|
||||
VcDocProjectNode *VcProjectFile::createVcDocNode() const
|
||||
{
|
||||
if (m_documentModel)
|
||||
@@ -131,7 +113,7 @@ void VcProjectFile::reloadVcDoc()
|
||||
{
|
||||
VcDocConstants::DocumentVersion docVersion = m_documentModel->vcProjectDocument()->documentVersion();
|
||||
delete m_documentModel;
|
||||
m_documentModel = new VcDocumentModel(m_filePath, docVersion);
|
||||
m_documentModel = new VcDocumentModel(filePath(), docVersion);
|
||||
}
|
||||
|
||||
VcDocumentModel *VcProjectFile::documentModel() const
|
||||
|
@@ -34,8 +34,6 @@
|
||||
|
||||
#include "vcprojectmodel/vcprojectdocument_constants.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -51,7 +49,6 @@ public:
|
||||
~VcProjectFile();
|
||||
|
||||
bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false);
|
||||
QString fileName() const;
|
||||
|
||||
QString defaultPath() const;
|
||||
QString suggestedFileName() const;
|
||||
@@ -63,15 +60,10 @@ public:
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
|
||||
void rename(const QString &newName);
|
||||
|
||||
QString filePath();
|
||||
QString path();
|
||||
|
||||
VcDocProjectNode *createVcDocNode() const;
|
||||
void reloadVcDoc();
|
||||
VcDocumentModel *documentModel() const;
|
||||
private:
|
||||
QString m_filePath;
|
||||
QString m_path;
|
||||
VcDocumentModel *m_documentModel;
|
||||
};
|
||||
|
||||
|
@@ -122,7 +122,7 @@ ProjectExplorer::KitInformation::ItemList VcProjectKitInformation::toUserOutput(
|
||||
|
||||
ProjectExplorer::KitConfigWidget *VcProjectKitInformation::createConfigWidget(Kit *k) const
|
||||
{
|
||||
return new VcProjectKitConfigWidget(k);
|
||||
return new VcProjectKitConfigWidget(k, this);
|
||||
}
|
||||
|
||||
MsBuildInformation *VcProjectKitInformation::msBuildInfo(const Kit *k)
|
||||
@@ -142,7 +142,7 @@ void VcProjectKitInformation::setMsBuild(Kit *k, MsBuildInformation *msBuild)
|
||||
void VcProjectKitInformation::onMSBuildAdded(Core::Id msBuildId)
|
||||
{
|
||||
Q_UNUSED(msBuildId);
|
||||
foreach (Kit *k, KitManager::instance()->kits()) {
|
||||
foreach (Kit *k, KitManager::kits()) {
|
||||
fix(k);
|
||||
notifyAboutUpdate(k);
|
||||
}
|
||||
@@ -151,14 +151,14 @@ void VcProjectKitInformation::onMSBuildAdded(Core::Id msBuildId)
|
||||
void VcProjectKitInformation::onMSBuildRemoved(Core::Id msBuildId)
|
||||
{
|
||||
Q_UNUSED(msBuildId);
|
||||
foreach (Kit *k, KitManager::instance()->kits())
|
||||
foreach (Kit *k, KitManager::kits())
|
||||
fix(k);
|
||||
}
|
||||
|
||||
void VcProjectKitInformation::onMSBuildReplaced(Core::Id oldMsBuildId, Core::Id newMsBuildId)
|
||||
{
|
||||
Q_UNUSED(oldMsBuildId);
|
||||
foreach (Kit *k, KitManager::instance()->kits()) {
|
||||
foreach (Kit *k, KitManager::kits()) {
|
||||
fix(k);
|
||||
setMsBuild(k, MsBuildVersionManager::instance()->msBuildInformation(newMsBuildId));
|
||||
notifyAboutUpdate(k);
|
||||
|
@@ -73,16 +73,6 @@ ProjectExplorer::Project *VcManager::openProject(const QString &fileName, QStrin
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check whether the project is already open or not.
|
||||
ProjectExplorerPlugin *projectExplorer = ProjectExplorerPlugin::instance();
|
||||
foreach (Project *pi, projectExplorer->session()->projects()) {
|
||||
if (canonicalFilePath == pi->document()->fileName()) {
|
||||
*errorString = tr("Failed opening project '%1': Project already open").
|
||||
arg(QDir::toNativeSeparators(canonicalFilePath));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check if project is a valid vc project
|
||||
// versions supported are 2003, 2005 and 2008
|
||||
VcDocConstants::DocumentVersion docVersion = VcDocConstants::DV_UNRECOGNIZED;
|
||||
@@ -123,12 +113,12 @@ bool VcManager::checkIfVersion2003(const QString &filePath) const
|
||||
schema.load(&schemaFile, QUrl::fromLocalFile(schemaFile.fileName()));
|
||||
|
||||
if (schema.isValid()) {
|
||||
QXmlSchemaValidator validator( schema );
|
||||
if (validator.validate(QUrl(filePath)))
|
||||
return true;
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
else
|
||||
return false;
|
||||
QXmlSchemaValidator validator(schema);
|
||||
if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -148,12 +138,12 @@ bool VcManager::checkIfVersion2005(const QString &filePath) const
|
||||
schema.load(&schemaFile, QUrl::fromLocalFile(schemaFile.fileName()));
|
||||
|
||||
if (schema.isValid()) {
|
||||
QXmlSchemaValidator validator( schema );
|
||||
if (validator.validate(QUrl(filePath)))
|
||||
return true;
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
else
|
||||
return false;
|
||||
QXmlSchemaValidator validator(schema);
|
||||
if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -173,12 +163,12 @@ bool VcManager::checkIfVersion2008(const QString &filePath) const
|
||||
schema.load(&schemaFile, QUrl::fromLocalFile(schemaFile.fileName()));
|
||||
|
||||
if (schema.isValid()) {
|
||||
QXmlSchemaValidator validator( schema );
|
||||
if (validator.validate(QUrl(filePath)))
|
||||
return true;
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
else
|
||||
return false;
|
||||
QXmlSchemaValidator validator(schema);
|
||||
if (validator.validate(&file, QUrl::fromLocalFile(file.fileName())))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -34,7 +34,7 @@ OTHER_FILES += \
|
||||
RESOURCES += \
|
||||
vcproject.qrc
|
||||
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include($$PWD/interfaces/interfaces.pri)
|
||||
include($$PWD/vcprojectmodel/vcprojectmodel.pri)
|
||||
include($$PWD/widgets/widgets.pri)
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(interfaces/interfaces.pri)
|
||||
|
@@ -54,8 +54,7 @@
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
using namespace VcProjectManager::Internal;
|
||||
|
||||
VcProjectManagerPlugin::VcProjectManagerPlugin()
|
||||
{
|
||||
@@ -79,7 +78,8 @@ bool VcProjectManagerPlugin::initialize(const QStringList &arguments, QString *e
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":vcproject/VcProject.mimetypes.xml"), errorString))
|
||||
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":vcproject/VcProject.mimetypes.xml"),
|
||||
errorString))
|
||||
return false;
|
||||
|
||||
VcProjectBuildOptionsPage *confPage = new VcProjectBuildOptionsPage;
|
||||
@@ -92,7 +92,7 @@ bool VcProjectManagerPlugin::initialize(const QStringList &arguments, QString *e
|
||||
addAutoReleasedObject(new MenuHandler);
|
||||
addAutoReleasedObject(new ToolDescriptionDataManager);
|
||||
|
||||
ProjectExplorer::KitManager::instance()->registerKitInformation(new VcProjectKitInformation);
|
||||
ProjectExplorer::KitManager::registerKitInformation(new VcProjectKitInformation);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -112,7 +112,4 @@ ExtensionSystem::IPlugin::ShutdownFlag VcProjectManagerPlugin::aboutToShutdown()
|
||||
return SynchronousShutdown;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
||||
Q_EXPORT_PLUGIN(VcProjectManager)
|
||||
Q_EXPORT_PLUGIN(VcProjectManagerPlugin)
|
||||
|
@@ -139,7 +139,7 @@ IReference *ActiveXReference::clone() const
|
||||
|
||||
void ActiveXReference::processReferenceConfig(const QDomNode &referenceConfig)
|
||||
{
|
||||
IConfiguration *referenceConfiguration = createReferenceConfiguration();
|
||||
IConfiguration *referenceConfiguration = new Configuration(QLatin1String("ReferenceConfiguration"));
|
||||
referenceConfiguration->processNode(referenceConfig);
|
||||
m_configurations->addConfiguration(referenceConfiguration);
|
||||
|
||||
@@ -149,10 +149,5 @@ void ActiveXReference::processReferenceConfig(const QDomNode &referenceConfig)
|
||||
processReferenceConfig(nextSibling);
|
||||
}
|
||||
|
||||
IConfiguration *ActiveXReference::createReferenceConfiguration() const
|
||||
{
|
||||
return new Configuration(QLatin1String("ReferenceConfiguration"));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
@@ -61,7 +61,6 @@ public:
|
||||
private:
|
||||
void processNodeAttributes(const QDomElement &element);
|
||||
void processReferenceConfig(const QDomNode &referenceConfig);
|
||||
IConfiguration *createReferenceConfiguration() const;
|
||||
|
||||
GeneralAttributeContainer *m_attributeContainer;
|
||||
ConfigurationContainer *m_configurations;
|
||||
|
@@ -49,8 +49,8 @@ using namespace ToolConstants;
|
||||
|
||||
Configuration::Configuration(const QString &nodeName)
|
||||
: m_nodeName(nodeName),
|
||||
m_tools(new Tools),
|
||||
m_attributeContainer(new GeneralAttributeContainer)
|
||||
m_attributeContainer(new GeneralAttributeContainer),
|
||||
m_tools(new Tools)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,6 @@ void ConfigurationBuildTools::removeTool(IConfigurationBuildTool *tool)
|
||||
foreach (IConfigurationBuildTool *toolPtr, m_tools) {
|
||||
if (toolPtr->toolDescription()->toolKey() == tool->toolDescription()->toolKey()) {
|
||||
m_tools.removeOne(toolPtr);
|
||||
delete toolPtr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ ConfigurationContainer::ConfigurationContainer(QObject *parent)
|
||||
}
|
||||
|
||||
ConfigurationContainer::ConfigurationContainer(const ConfigurationContainer &configCont)
|
||||
: QObject(0)
|
||||
{
|
||||
foreach (const IConfiguration *config, configCont.m_configs)
|
||||
m_configs.append(config->clone());
|
||||
|
@@ -65,8 +65,8 @@ File::File(const File &file)
|
||||
*m_configurationContainer = *(file.m_configurationContainer);
|
||||
*m_attributeContainer = *(file.m_attributeContainer);
|
||||
|
||||
foreach (const File::Ptr &f, file.m_files)
|
||||
m_files.append(File::Ptr(new File(*f)));
|
||||
foreach (const File *f, file.m_files)
|
||||
m_files.append(new File(*f));
|
||||
}
|
||||
|
||||
File &File::operator =(const File &file)
|
||||
@@ -77,17 +77,17 @@ File &File::operator =(const File &file)
|
||||
*m_configurationContainer = *(file.m_configurationContainer);
|
||||
*m_attributeContainer = *(file.m_attributeContainer);
|
||||
|
||||
m_files.clear();
|
||||
qDeleteAll(m_files);
|
||||
|
||||
foreach (const File::Ptr &f, file.m_files)
|
||||
m_files.append(File::Ptr(new File(*f)));
|
||||
foreach (const File *f, file.m_files)
|
||||
m_files.append(new File(*f));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
File::~File()
|
||||
{
|
||||
m_files.clear();
|
||||
qDeleteAll(m_files);
|
||||
delete m_configurationContainer;
|
||||
delete m_attributeContainer;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void File::processNode(const QDomNode &node)
|
||||
|
||||
VcNodeWidget *File::createSettingsWidget()
|
||||
{
|
||||
return new ConfigurationsEditWidget(m_parentProjectDoc, m_configurationContainer);
|
||||
return new FileConfigurationsEditWidget(this, m_parentProjectDoc);
|
||||
}
|
||||
|
||||
QDomNode File::toXMLDomNode(QDomDocument &domXMLDocument) const
|
||||
@@ -122,7 +122,7 @@ QDomNode File::toXMLDomNode(QDomDocument &domXMLDocument) const
|
||||
|
||||
fileNode.setAttribute(QLatin1String("RelativePath"), m_relativePath);
|
||||
|
||||
foreach (const File::Ptr &file, m_files)
|
||||
foreach (const File *file, m_files)
|
||||
fileNode.appendChild(file->toXMLDomNode(domXMLDocument));
|
||||
|
||||
m_configurationContainer->appendToXMLNode(fileNode, domXMLDocument);
|
||||
@@ -157,14 +157,13 @@ IFile *File::clone() const
|
||||
|
||||
ProjectExplorer::FileType File::fileType() const
|
||||
{
|
||||
const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase();
|
||||
QString mimeType = mdb->findByFile(canonicalPath()).type();
|
||||
QString mimeType = Core::MimeDatabase::findByFile(canonicalPath()).type();
|
||||
|
||||
if (mimeType == QLatin1String(ProjectExplorer::Constants::CPP_SOURCE_MIMETYPE)
|
||||
|| mimeType == QLatin1String(ProjectExplorer::Constants::C_SOURCE_MIMETYPE))
|
||||
|| mimeType == QLatin1String(ProjectExplorer::Constants::C_SOURCE_MIMETYPE))
|
||||
return ProjectExplorer::SourceType;
|
||||
if (mimeType == QLatin1String(ProjectExplorer::Constants::CPP_HEADER_MIMETYPE)
|
||||
|| mimeType == QLatin1String(ProjectExplorer::Constants::C_HEADER_MIMETYPE))
|
||||
|| mimeType == QLatin1String(ProjectExplorer::Constants::C_HEADER_MIMETYPE))
|
||||
return ProjectExplorer::HeaderType;
|
||||
if (mimeType == QLatin1String(ProjectExplorer::Constants::RESOURCE_MIMETYPE))
|
||||
return ProjectExplorer::ResourceType;
|
||||
@@ -187,26 +186,16 @@ QString File::canonicalPath() const
|
||||
return QString() + m_relativePath;
|
||||
}
|
||||
|
||||
IConfiguration *File::createDefaultBuildConfiguration(const QString &fullConfigName) const
|
||||
{
|
||||
IConfiguration *config = new FileBuildConfiguration;
|
||||
config->setFullName(fullConfigName);
|
||||
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
IToolDescription *toolDesc = tDDM->toolDescription(QLatin1String(ToolConstants::strVCCLCompilerTool));
|
||||
|
||||
if (toolDesc) {
|
||||
IConfigurationBuildTool *tool = toolDesc->createTool();
|
||||
config->tools()->configurationBuildTools()->addTool(tool);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
void File::processFileConfiguration(const QDomNode &fileConfigNode)
|
||||
{
|
||||
IConfiguration *fileConfig = new FileBuildConfiguration();
|
||||
IConfiguration *fileConfig = new FileBuildConfiguration(m_parentProjectDoc);
|
||||
fileConfig->processNode(fileConfigNode);
|
||||
|
||||
if (m_parentProjectDoc->configurations() && m_parentProjectDoc->configurations()->configurationContainer()) {
|
||||
IConfiguration *projConf = m_parentProjectDoc->configurations()->configurationContainer()->configuration(fileConfig->fullName());
|
||||
copyAllNonDefaultToolAtributes(fileConfig, projConf);
|
||||
}
|
||||
|
||||
m_configurationContainer->addConfiguration(fileConfig);
|
||||
|
||||
// process next sibling
|
||||
@@ -221,7 +210,7 @@ void File::processFileConfiguration(const QDomNode &fileConfigNode)
|
||||
|
||||
void File::processFile(const QDomNode &fileNode)
|
||||
{
|
||||
File::Ptr file(new File(m_parentProjectDoc));
|
||||
File *file = new File(m_parentProjectDoc);
|
||||
file->processNode(fileNode);
|
||||
m_files.append(file);
|
||||
|
||||
@@ -254,5 +243,58 @@ void File::processNodeAttributes(const QDomElement &element)
|
||||
}
|
||||
}
|
||||
|
||||
void File::copyAllNonDefaultToolAtributes(IConfiguration *fileConfig, IConfiguration *projConfig)
|
||||
{
|
||||
if (fileConfig && projConfig &&
|
||||
fileConfig->tools() && fileConfig->tools()->configurationBuildTools() &&
|
||||
projConfig->tools() && projConfig->tools()->configurationBuildTools()
|
||||
) {
|
||||
IConfigurationBuildTool *tool = fileConfig->tools()->configurationBuildTools()->tool(0);
|
||||
|
||||
if (tool && tool->toolDescription()) {
|
||||
IConfigurationBuildTool *projToolCopy = projConfig->tools()->configurationBuildTools()->
|
||||
tool(tool->toolDescription()->toolKey());
|
||||
|
||||
if (projToolCopy) {
|
||||
ISectionContainer *secCont = tool->sectionContainer();
|
||||
ISectionContainer *projSecCont = projToolCopy->sectionContainer();
|
||||
|
||||
if (secCont && projSecCont) {
|
||||
|
||||
for (int i = 0; i < secCont->sectionCount(); ++i) {
|
||||
IToolSection *toolSec = secCont->section(i);
|
||||
|
||||
if (toolSec && toolSec->sectionDescription()) {
|
||||
IToolSection *projSec = projSecCont->section(toolSec->sectionDescription()->displayName());
|
||||
copyAllNonDefaultToolAtributes(toolSec, projSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void File::copyAllNonDefaultToolAtributes(IToolSection *fileSec, IToolSection *projSec)
|
||||
{
|
||||
if (fileSec && projSec &&
|
||||
fileSec->sectionDescription() && projSec->sectionDescription()) {
|
||||
IToolAttributeContainer *attrCont = fileSec->attributeContainer();
|
||||
IToolAttributeContainer *projAttrCont = projSec->attributeContainer();
|
||||
|
||||
if (attrCont && projAttrCont) {
|
||||
for (int i = 0; i < projAttrCont->toolAttributeCount(); ++i) {
|
||||
IToolAttribute *projToolAttr = projAttrCont->toolAttribute(i);
|
||||
|
||||
if (projToolAttr && projToolAttr->descriptionDataItem()) {
|
||||
IToolAttribute *toolAttr = attrCont->toolAttribute(projToolAttr->descriptionDataItem()->key());
|
||||
if (toolAttr && !toolAttr->isUsed() && projToolAttr && projToolAttr->isUsed())
|
||||
toolAttr->setValue(projToolAttr->value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
@@ -45,8 +45,6 @@ class File : public IFile
|
||||
friend class FileFactory;
|
||||
|
||||
public:
|
||||
typedef QSharedPointer<File> Ptr;
|
||||
|
||||
explicit File(IVisualStudioProject *parentProjectDoc);
|
||||
File(const File &file);
|
||||
File &operator=(const File &file);
|
||||
@@ -65,15 +63,15 @@ public:
|
||||
ProjectExplorer::FileType fileType() const;
|
||||
QString canonicalPath() const;
|
||||
|
||||
IConfiguration *createDefaultBuildConfiguration(const QString &fullConfigName) const;
|
||||
|
||||
private:
|
||||
void processFileConfiguration(const QDomNode &fileConfigNode);
|
||||
void processFile(const QDomNode &fileNode);
|
||||
void processNodeAttributes(const QDomElement &element);
|
||||
void copyAllNonDefaultToolAtributes(IConfiguration *fileConfig, IConfiguration *projConfig);
|
||||
void copyAllNonDefaultToolAtributes(IToolSection *fileSec, IToolSection *projSec);
|
||||
|
||||
QString m_relativePath; // required
|
||||
QList<QSharedPointer<File> > m_files;
|
||||
QList<File *> m_files;
|
||||
IVisualStudioProject *m_parentProjectDoc;
|
||||
ConfigurationContainer *m_configurationContainer;
|
||||
GeneralAttributeContainer *m_attributeContainer;
|
||||
|
@@ -40,25 +40,57 @@
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
FileBuildConfiguration::FileBuildConfiguration()
|
||||
: Configuration(QLatin1String("FileConfiguration"))
|
||||
FileBuildConfiguration::FileBuildConfiguration(IVisualStudioProject *parentProject)
|
||||
: Configuration(QLatin1String("FileConfiguration")),
|
||||
m_parentProjectDoc(parentProject)
|
||||
{
|
||||
}
|
||||
|
||||
FileBuildConfiguration::FileBuildConfiguration(const FileBuildConfiguration &fileBuildConfig)
|
||||
: Configuration(fileBuildConfig)
|
||||
{
|
||||
m_parentProjectDoc = fileBuildConfig.m_parentProjectDoc;
|
||||
}
|
||||
|
||||
FileBuildConfiguration &FileBuildConfiguration::operator =(const FileBuildConfiguration &fileBuildConfig)
|
||||
{
|
||||
Configuration::operator =(fileBuildConfig);
|
||||
|
||||
if (this != &fileBuildConfig)
|
||||
m_parentProjectDoc = fileBuildConfig.m_parentProjectDoc;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
VcNodeWidget *FileBuildConfiguration::createSettingsWidget()
|
||||
{
|
||||
return new FileConfigurationSettingsWidget(this);
|
||||
return new FileConfigurationSettingsWidget(this, m_parentProjectDoc);
|
||||
}
|
||||
|
||||
QDomNode FileBuildConfiguration::toXMLDomNode(QDomDocument &domXMLDocument) const
|
||||
{
|
||||
if (tools()->configurationBuildTools()->toolCount()) {
|
||||
IConfigurations *configs = m_parentProjectDoc->configurations();
|
||||
|
||||
QDomElement configurationNode = domXMLDocument.createElement(m_nodeName);
|
||||
m_attributeContainer->appendToXMLNode(configurationNode);
|
||||
|
||||
if (configs) {
|
||||
ConfigurationContainer *configContainer = m_parentProjectDoc->configurations()->configurationContainer();
|
||||
|
||||
if (configContainer) {
|
||||
IConfiguration *projectConfig = configContainer->configuration(fullName());
|
||||
toXMLNode(projectConfig, configurationNode, domXMLDocument);
|
||||
}
|
||||
}
|
||||
|
||||
if (configurationNode.childNodes().size() || configurationNode.attributes().size()) {
|
||||
configurationNode.setAttribute(QLatin1String("Name"), m_fullName);
|
||||
return configurationNode;
|
||||
}
|
||||
}
|
||||
|
||||
return QDomNode();
|
||||
}
|
||||
|
||||
void FileBuildConfiguration::processToolNode(const QDomNode &toolNode)
|
||||
@@ -67,18 +99,18 @@ void FileBuildConfiguration::processToolNode(const QDomNode &toolNode)
|
||||
IConfigurationBuildTool *toolConf = 0;
|
||||
QDomNamedNodeMap namedNodeMap = toolNode.toElement().attributes();
|
||||
|
||||
QDomNode domNode = namedNodeMap.item(0);
|
||||
for (int i = 0; i < namedNodeMap.size(); ++i) {
|
||||
QDomNode domNode = namedNodeMap.item(i);
|
||||
|
||||
if (domNode.nodeType() == QDomNode::AttributeNode) {
|
||||
QDomAttr domAttribute = domNode.toAttr();
|
||||
if (domAttribute.name() == QLatin1String("Name")) {
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
|
||||
if (tDDM) {
|
||||
if (domNode.nodeType() == QDomNode::AttributeNode) {
|
||||
QDomAttr domAttribute = domNode.toAttr();
|
||||
if (domAttribute.name() == QLatin1String("Name")) {
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
IToolDescription *toolDesc = tDDM->toolDescription(domAttribute.value());
|
||||
|
||||
if (toolDesc)
|
||||
toolConf = toolDesc->createTool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,5 +139,76 @@ void FileBuildConfiguration::processToolNode(const QDomNode &toolNode)
|
||||
processToolNode(nextSibling);
|
||||
}
|
||||
|
||||
void FileBuildConfiguration::toXMLNode(IConfiguration *projectConfig, QDomElement &configurationNode, QDomDocument &domXMLDocument) const
|
||||
{
|
||||
QTC_ASSERT(projectConfig, return);
|
||||
|
||||
ITools *projectTools = projectConfig->tools();
|
||||
|
||||
if (projectTools && projectTools->configurationBuildTools()) {
|
||||
IConfigurationBuildTool *tool = tools()->configurationBuildTools()->tool(0);
|
||||
|
||||
if (tool) {
|
||||
IConfigurationBuildTool *projectTool = projectTools->configurationBuildTools()->tool(tool->toolDescription()->toolKey());
|
||||
|
||||
if (projectTool && projectTool->toolDescription()) {
|
||||
toXMLNode(projectTool, tool, configurationNode, domXMLDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileBuildConfiguration::toXMLNode(IConfigurationBuildTool *projectConfigTool, IConfigurationBuildTool *tool,
|
||||
QDomElement &configurationNode, QDomDocument &domXMLDocument) const
|
||||
{
|
||||
QTC_ASSERT(projectConfigTool && tool, return);
|
||||
|
||||
ISectionContainer *projSecContainer = projectConfigTool->sectionContainer();
|
||||
ISectionContainer *toolSecContainer = tool->sectionContainer();
|
||||
|
||||
bool isNodeCreated = false;
|
||||
QDomElement toolNode;
|
||||
|
||||
if (projSecContainer && toolSecContainer) {
|
||||
for (int i = 0; i < projSecContainer->sectionCount(); ++i) {
|
||||
IToolSection *projToolSec = projSecContainer->section(i);
|
||||
|
||||
if (projToolSec) {
|
||||
IToolSection *toolSec = toolSecContainer->section(projToolSec->sectionDescription()->displayName());
|
||||
|
||||
if (toolSec) {
|
||||
IToolAttributeContainer *projToolAttrContainer = projToolSec->attributeContainer();
|
||||
IToolAttributeContainer *toolAttrContainer = toolSec->attributeContainer();
|
||||
|
||||
for (int j = 0; j < projToolAttrContainer->toolAttributeCount(); ++j) {
|
||||
IToolAttribute *projToolAttr = projToolAttrContainer->toolAttribute(j);
|
||||
|
||||
if (projToolAttr && projToolAttr->descriptionDataItem()) {
|
||||
IToolAttribute *toolAttr = toolAttrContainer->toolAttribute(projToolAttr->descriptionDataItem()->key());
|
||||
|
||||
if (toolAttr && toolAttr->value() != projToolAttr->value()) {
|
||||
if (!isNodeCreated) {
|
||||
toolNode = domXMLDocument.createElement(QLatin1String("Tool"));
|
||||
toolNode.setAttribute(QLatin1String("Name"), projectConfigTool->toolDescription()->toolKey());
|
||||
configurationNode.appendChild(toolNode);
|
||||
isNodeCreated = true;
|
||||
}
|
||||
|
||||
toolNode.setAttribute(toolAttr->descriptionDataItem()->key(),
|
||||
toolAttr->value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IConfiguration *FileBuildConfiguration::clone() const
|
||||
{
|
||||
return new FileBuildConfiguration(*this);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
@@ -38,14 +38,23 @@ namespace Internal {
|
||||
class FileBuildConfiguration : public Configuration
|
||||
{
|
||||
public:
|
||||
FileBuildConfiguration();
|
||||
FileBuildConfiguration(IVisualStudioProject *parentProject);
|
||||
FileBuildConfiguration(const FileBuildConfiguration &fileBuildConfig);
|
||||
FileBuildConfiguration &operator =(const FileBuildConfiguration &fileBuildConfig);
|
||||
|
||||
VcNodeWidget *createSettingsWidget();
|
||||
QDomNode toXMLDomNode(QDomDocument &domXMLDocument) const;
|
||||
IConfiguration *clone() const;
|
||||
|
||||
protected:
|
||||
void processToolNode(const QDomNode &toolNode);
|
||||
|
||||
private:
|
||||
void toXMLNode(IConfiguration *projectConfig, QDomElement &configurationNode, QDomDocument &domXMLDocument) const;
|
||||
void toXMLNode(IConfigurationBuildTool *projectConfigTool, IConfigurationBuildTool *tool,
|
||||
QDomElement &configurationNode, QDomDocument &domXMLDocument) const;
|
||||
|
||||
IVisualStudioProject *m_parentProjectDoc;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -62,8 +62,8 @@ public:
|
||||
|
||||
private:
|
||||
QString m_key;
|
||||
QString m_descriptionText;
|
||||
QString m_displayText;
|
||||
QString m_descriptionText;
|
||||
QString m_defaultValue;
|
||||
QString m_type;
|
||||
ToolAttributeOption *m_firstOption;
|
||||
|
@@ -35,8 +35,8 @@ namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
BoolToolAttribute::BoolToolAttribute(const AttributeDescriptionDataItem *descDataItem)
|
||||
: m_isUsed(false),
|
||||
m_descDataItem(descDataItem)
|
||||
: m_descDataItem(descDataItem),
|
||||
m_isUsed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -35,8 +35,8 @@ namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
IntegerToolAttribute::IntegerToolAttribute(const AttributeDescriptionDataItem *descDataItem)
|
||||
: m_isUsed(false),
|
||||
m_descDataItem(descDataItem)
|
||||
: m_descDataItem(descDataItem),
|
||||
m_isUsed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -35,8 +35,8 @@ namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
StringListToolAttribute::StringListToolAttribute(const AttributeDescriptionDataItem *descDataItem)
|
||||
: m_isUsed(false),
|
||||
m_descDataItem(descDataItem)
|
||||
: m_descDataItem(descDataItem),
|
||||
m_isUsed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -35,8 +35,8 @@ namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
StringToolAttribute::StringToolAttribute(const AttributeDescriptionDataItem *descDataItem)
|
||||
: m_isUsed(false),
|
||||
m_descDataItem(descDataItem)
|
||||
: m_descDataItem(descDataItem),
|
||||
m_isUsed(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -323,19 +323,19 @@ void ToolDescriptionDataManager::processToolAttributeDescriptions(ToolSectionDes
|
||||
QDomNode domNode = namedNodeMap.item(i);
|
||||
|
||||
if (domNode.nodeType() == QDomNode::AttributeNode) {
|
||||
QDomAttr domElement = domNode.toAttr();
|
||||
QDomAttr domAttr = domNode.toAttr();
|
||||
|
||||
if (domElement.name() == QLatin1String("Name"))
|
||||
displayName = domElement.value();
|
||||
if (domAttr.name() == QLatin1String("Name"))
|
||||
displayName = domAttr.value();
|
||||
|
||||
else if (domElement.name() == QLatin1String("Key"))
|
||||
key = domElement.value();
|
||||
else if (domAttr.name() == QLatin1String("Key"))
|
||||
key = domAttr.value();
|
||||
|
||||
else if (domElement.name() == QLatin1String("DefaultValue"))
|
||||
defaultValue = domElement.value();
|
||||
else if (domAttr.name() == QLatin1String("DefaultValue"))
|
||||
defaultValue = domAttr.value();
|
||||
|
||||
else if (domElement.name() == QLatin1String("Description"))
|
||||
description = domElement.value();
|
||||
else if (domAttr.name() == QLatin1String("Description"))
|
||||
description = domAttr.value();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -78,6 +78,7 @@ VcFileContainerNode::VcFileContainerNode(IFileContainer *fileContainerModel, VcD
|
||||
if (m_vcFileContainerModel->containerType() == QLatin1String(Constants::VC_PROJECT_FILE_CONTAINER_FOLDER))
|
||||
m_vcContainerType = VcContainerType_Folder;
|
||||
|
||||
setProjectNode(vcDocProjNode);
|
||||
readChildren();
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ bool VcFileContainerNode::appendFileNode(VcFileNode *fileNode)
|
||||
m_vcFileContainerModel->addFile(fileNode->m_vcFileModel);
|
||||
QList<ProjectExplorer::FileNode *> vcFileNodes;
|
||||
vcFileNodes << fileNode;
|
||||
m_parentVcDocProjNode->addFileNodes(vcFileNodes, this);
|
||||
m_parentVcDocProjNode->addFileNodes(vcFileNodes);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,7 +173,7 @@ bool VcFileContainerNode::appendFileContainerNode(VcFileContainerNode *fileConta
|
||||
m_vcFileContainerModel->addFileContainer(fileContainer->m_vcFileContainerModel);
|
||||
QList<ProjectExplorer::FolderNode *> vcFolderNodes;
|
||||
vcFolderNodes << fileContainer;
|
||||
m_parentVcDocProjNode->addFolderNodes(vcFolderNodes, this);
|
||||
m_parentVcDocProjNode->addFolderNodes(vcFolderNodes);
|
||||
m_parentVcDocProjNode->m_vcProjectModel->saveToFile(m_parentVcDocProjNode->m_vcProjectModel->filePath());
|
||||
return true;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ void VcFileContainerNode::removeFileContainerNode(VcFileContainerNode *fileConta
|
||||
|
||||
QList<ProjectExplorer::FolderNode *> folderNodesToRemove;
|
||||
folderNodesToRemove << fileContainer;
|
||||
m_parentVcDocProjNode->removeFolderNodes(folderNodesToRemove, this);
|
||||
m_parentVcDocProjNode->removeFolderNodes(folderNodesToRemove);
|
||||
|
||||
m_vcFileContainerModel->removeFileContainer(fileContainerModel);
|
||||
m_parentVcDocProjNode->m_vcProjectModel->saveToFile(m_parentVcDocProjNode->m_vcProjectModel->filePath());
|
||||
@@ -201,7 +202,7 @@ void VcFileContainerNode::removeFileNode(VcFileNode *fileNode)
|
||||
|
||||
QList<ProjectExplorer::FileNode *> fileNodesToRemove;
|
||||
fileNodesToRemove << fileNode;
|
||||
m_parentVcDocProjNode->removeFileNodes(fileNodesToRemove, this);
|
||||
m_parentVcDocProjNode->removeFileNodes(fileNodesToRemove);
|
||||
|
||||
m_vcFileContainerModel->removeFile(file);
|
||||
m_parentVcDocProjNode->m_vcProjectModel->saveToFile(m_parentVcDocProjNode->m_vcProjectModel->filePath());
|
||||
@@ -217,7 +218,7 @@ void VcFileContainerNode::readChildren()
|
||||
vcFolderNodes.append(new VcFileContainerNode(fileCont, m_parentVcDocProjNode));
|
||||
}
|
||||
|
||||
m_parentVcDocProjNode->addFolderNodes(vcFolderNodes, this);
|
||||
addFolderNodes(vcFolderNodes);
|
||||
|
||||
QList<ProjectExplorer::FileNode *> vcFileNodes;
|
||||
|
||||
@@ -228,12 +229,19 @@ void VcFileContainerNode::readChildren()
|
||||
vcFileNodes.append(new VcFileNode(file, m_parentVcDocProjNode));
|
||||
}
|
||||
|
||||
m_parentVcDocProjNode->addFileNodes(vcFileNodes, this);
|
||||
addFileNodes(vcFileNodes);
|
||||
}
|
||||
|
||||
VcFileNode *VcFileContainerNode::findFileNode(const QString &filePath)
|
||||
{
|
||||
VcFileNode *fileNode = static_cast<VcFileNode *>(findFile(filePath));
|
||||
VcFileNode *fileNode = 0;
|
||||
foreach (ProjectExplorer::FileNode *f, fileNodes()) {
|
||||
// There can be one match only here!
|
||||
if (f->path() != filePath)
|
||||
continue;
|
||||
fileNode = static_cast<VcFileNode *>(f);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fileNode)
|
||||
return fileNode;
|
||||
@@ -259,7 +267,7 @@ VcDocProjectNode::VcDocProjectNode(IVisualStudioProject *vcProjectModel)
|
||||
if (fileContainer)
|
||||
vcFolderNodes.append(new VcFileContainerNode(fileContainer, this));
|
||||
}
|
||||
addFolderNodes(vcFolderNodes, this);
|
||||
addFolderNodes(vcFolderNodes);
|
||||
|
||||
QList<ProjectExplorer::FileNode *> vcFileNodes;
|
||||
for (int i = 0; i < m_vcProjectModel->files()->fileCount(); ++i) {
|
||||
@@ -267,7 +275,7 @@ VcDocProjectNode::VcDocProjectNode(IVisualStudioProject *vcProjectModel)
|
||||
if (file)
|
||||
vcFileNodes.append(new VcFileNode(file, this));
|
||||
}
|
||||
addFileNodes(vcFileNodes, this);
|
||||
addFileNodes(vcFileNodes);
|
||||
}
|
||||
|
||||
VcDocProjectNode::~VcDocProjectNode()
|
||||
@@ -279,17 +287,17 @@ bool VcDocProjectNode::hasBuildTargets() const
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::ProjectNode::ProjectAction> VcDocProjectNode::supportedActions(ProjectExplorer::Node *node) const
|
||||
QList<ProjectExplorer::ProjectAction> VcDocProjectNode::supportedActions(ProjectExplorer::Node *node) const
|
||||
{
|
||||
QList<ProjectExplorer::ProjectNode::ProjectAction> actions;
|
||||
QList<ProjectExplorer::ProjectAction> actions;
|
||||
|
||||
actions << AddNewFile
|
||||
<< AddExistingFile;
|
||||
actions << ProjectExplorer::AddNewFile
|
||||
<< ProjectExplorer::AddExistingFile;
|
||||
|
||||
ProjectExplorer::FileNode *fileNode = qobject_cast<ProjectExplorer::FileNode *>(node);
|
||||
if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType) {
|
||||
actions << Rename;
|
||||
actions << RemoveFile;
|
||||
actions << ProjectExplorer::Rename;
|
||||
actions << ProjectExplorer::RemoveFile;
|
||||
}
|
||||
|
||||
return actions;
|
||||
@@ -313,14 +321,12 @@ bool VcDocProjectNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VcDocProjectNode::addFiles(const ProjectExplorer::FileType fileType, const QStringList &filePaths, QStringList *notAdded)
|
||||
bool VcDocProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||
{
|
||||
// add files like in VS
|
||||
// if ()
|
||||
|
||||
// add files to the node which called it
|
||||
Q_UNUSED(fileType)
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin *projExplPlugin = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
ProjectExplorer::Node *node = projExplPlugin->currentNode();
|
||||
|
||||
@@ -374,10 +380,8 @@ bool VcDocProjectNode::addFiles(const ProjectExplorer::FileType fileType, const
|
||||
return filesNotAdded.isEmpty();
|
||||
}
|
||||
|
||||
bool VcDocProjectNode::removeFiles(const ProjectExplorer::FileType fileType, const QStringList &filePaths, QStringList *notRemoved)
|
||||
bool VcDocProjectNode::removeFiles(const QStringList &filePaths, QStringList *notRemoved)
|
||||
{
|
||||
Q_UNUSED(fileType)
|
||||
|
||||
QStringList filesNotRemoved;
|
||||
|
||||
foreach (const QString &filePath, filePaths) {
|
||||
@@ -415,16 +419,14 @@ bool VcDocProjectNode::removeFiles(const ProjectExplorer::FileType fileType, con
|
||||
return filesNotRemoved.isEmpty();
|
||||
}
|
||||
|
||||
bool VcDocProjectNode::deleteFiles(const ProjectExplorer::FileType fileType, const QStringList &filePaths)
|
||||
bool VcDocProjectNode::deleteFiles(const QStringList &filePaths)
|
||||
{
|
||||
Q_UNUSED(fileType)
|
||||
Q_UNUSED(filePaths)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VcDocProjectNode::renameFile(const ProjectExplorer::FileType fileType, const QString &filePath, const QString &newFilePath)
|
||||
bool VcDocProjectNode::renameFile(const QString &filePath, const QString &newFilePath)
|
||||
{
|
||||
Q_UNUSED(fileType)
|
||||
Q_UNUSED(filePath)
|
||||
Q_UNUSED(newFilePath)
|
||||
return false;
|
||||
@@ -502,7 +504,7 @@ bool VcDocProjectNode::appendFileContainerNode(VcFileContainerNode *fileContaine
|
||||
|
||||
QList<ProjectExplorer::FolderNode *> vcFolderNodes;
|
||||
vcFolderNodes << fileContainerNode;
|
||||
addFolderNodes(vcFolderNodes, this);
|
||||
addFolderNodes(vcFolderNodes);
|
||||
m_vcProjectModel->saveToFile(m_vcProjectModel->filePath());
|
||||
return true;
|
||||
}
|
||||
@@ -526,7 +528,7 @@ bool VcDocProjectNode::appendFileNode(VcFileNode *fileNode)
|
||||
m_vcProjectModel->files()->addFile(fileNode->m_vcFileModel);
|
||||
QList<ProjectExplorer::FileNode *> vcFileNodes;
|
||||
vcFileNodes << fileNode;
|
||||
addFileNodes(vcFileNodes, this);
|
||||
addFileNodes(vcFileNodes);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -539,7 +541,7 @@ void VcDocProjectNode::removeFileNode(VcFileNode *fileNode)
|
||||
|
||||
QList<ProjectExplorer::FileNode *> fileNodesToRemove;
|
||||
fileNodesToRemove << fileNode;
|
||||
removeFileNodes(fileNodesToRemove, this);
|
||||
removeFileNodes(fileNodesToRemove);
|
||||
|
||||
IFile *filePtr = m_vcProjectModel->files()->file(relativePath);
|
||||
|
||||
@@ -559,7 +561,7 @@ void VcDocProjectNode::removeFileContainerNode(VcFileContainerNode *fileContaine
|
||||
|
||||
QList<ProjectExplorer::FolderNode *> folderNodesToRemove;
|
||||
folderNodesToRemove << fileContainerNode;
|
||||
removeFolderNodes(folderNodesToRemove, this);
|
||||
removeFolderNodes(folderNodesToRemove);
|
||||
|
||||
m_vcProjectModel->files()->removeFileContainer(fileContainer);
|
||||
m_vcProjectModel->saveToFile(m_vcProjectModel->filePath());
|
||||
@@ -579,7 +581,14 @@ void VcDocProjectNode::showSettingsDialog()
|
||||
|
||||
VcFileNode *VcDocProjectNode::findFileNode(const QString &filePath)
|
||||
{
|
||||
VcFileNode *fileNode = static_cast<VcFileNode *>(findFile(filePath));
|
||||
VcFileNode *fileNode = 0;
|
||||
foreach (ProjectExplorer::FileNode *f, fileNodes()) {
|
||||
// There can be one match only here!
|
||||
if (f->path() != filePath)
|
||||
continue;
|
||||
fileNode = static_cast<VcFileNode *>(f);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fileNode)
|
||||
return fileNode;
|
||||
|
@@ -112,21 +112,14 @@ public:
|
||||
~VcDocProjectNode();
|
||||
|
||||
bool hasBuildTargets() const;
|
||||
QList<ProjectAction> supportedActions(Node *node) const;
|
||||
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
||||
bool canAddSubProject(const QString &proFilePath) const;
|
||||
bool addSubProjects(const QStringList &proFilePaths);
|
||||
bool removeSubProjects(const QStringList &proFilePaths);
|
||||
bool addFiles(const ProjectExplorer::FileType fileType,
|
||||
const QStringList &filePaths,
|
||||
QStringList *notAdded);
|
||||
bool removeFiles(const ProjectExplorer::FileType fileType,
|
||||
const QStringList &filePaths,
|
||||
QStringList *notRemoved);
|
||||
bool deleteFiles(const ProjectExplorer::FileType fileType,
|
||||
const QStringList &filePaths);
|
||||
bool renameFile(const ProjectExplorer::FileType fileType,
|
||||
const QString &filePath,
|
||||
const QString &newFilePath);
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded);
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved);
|
||||
bool deleteFiles(const QStringList &filePaths);
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath);
|
||||
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
|
||||
|
||||
QString projectDirectory() const;
|
||||
|
@@ -126,14 +126,14 @@ IGlobals* VcProjectDocument::globals() const
|
||||
|
||||
VcProjectDocument::VcProjectDocument(const QString &filePath, VcDocConstants::DocumentVersion docVersion)
|
||||
: m_filePath(filePath),
|
||||
m_documentVersion(docVersion),
|
||||
m_platforms(new Platforms),
|
||||
m_globals(new Globals),
|
||||
m_files(new Files(this)),
|
||||
m_configurations(new Configurations(this)),
|
||||
m_files(new Files(this)),
|
||||
m_references(new References),
|
||||
m_globals(new Globals),
|
||||
m_toolFiles(new ToolFiles),
|
||||
m_publishingData(new PublishingData),
|
||||
m_documentVersion(docVersion),
|
||||
m_attributeContainer(new GeneralAttributeContainer)
|
||||
{
|
||||
}
|
||||
@@ -141,7 +141,7 @@ VcProjectDocument::VcProjectDocument(const QString &filePath, VcDocConstants::Do
|
||||
VcProjectDocument::VcProjectDocument(const VcProjectDocument &vcDoc)
|
||||
{
|
||||
// <?xml part
|
||||
m_processingInstructionData = vcDoc.m_processingInstructionData;
|
||||
m_processingInstr = vcDoc.m_processingInstr;
|
||||
m_processingInstructionTarget = vcDoc.m_processingInstructionTarget;
|
||||
|
||||
m_attributeContainer = new GeneralAttributeContainer(*vcDoc.m_attributeContainer);
|
||||
@@ -161,7 +161,7 @@ VcProjectDocument &VcProjectDocument::operator =(const VcProjectDocument &vcDoc)
|
||||
*m_attributeContainer = *vcDoc.m_attributeContainer;
|
||||
|
||||
// <?xml part
|
||||
m_processingInstructionData = vcDoc.m_processingInstructionData;
|
||||
m_processingInstr = vcDoc.m_processingInstr;
|
||||
m_processingInstructionTarget = vcDoc.m_processingInstructionTarget;
|
||||
|
||||
*m_platforms = *vcDoc.m_platforms;
|
||||
@@ -197,7 +197,7 @@ void VcProjectDocument::parseProcessingInstruction(const QDomProcessingInstructi
|
||||
if (sl.size() == 2) {
|
||||
QString value = sl[1];
|
||||
value = value.replace(QLatin1String("\'"), QString());
|
||||
m_processingInstructionData.insert(sl[0].trimmed(), value.trimmed());
|
||||
m_processingInstr.append(QPair<QString, QString>(sl[0].trimmed(), value.trimmed()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,13 +237,13 @@ void VcProjectDocument::processDocumentAttributes(const QDomElement &vsNode)
|
||||
QDomNode VcProjectDocument::toXMLDomNode(QDomDocument &domXMLDocument) const
|
||||
{
|
||||
QString processingData;
|
||||
QHashIterator<QString, QString> it(m_processingInstructionData);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
processingData.append(it.key());
|
||||
QPair<QString, QString> pr;
|
||||
|
||||
foreach (pr, m_processingInstr) {
|
||||
processingData.append(pr.first);
|
||||
processingData.append(QLatin1Char('='));
|
||||
processingData.append(QLatin1String("\"") + it.value() + QLatin1String("\""));
|
||||
processingData.append(QLatin1String("\"") + pr.second + QLatin1String("\""));
|
||||
processingData.append(QLatin1Char(' '));
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ protected:
|
||||
QString m_filePath; // used to store path to a file
|
||||
|
||||
// <?xml part
|
||||
QHash<QString, QString> m_processingInstructionData;
|
||||
QList<QPair <QString, QString> > m_processingInstr;
|
||||
QString m_processingInstructionTarget;
|
||||
|
||||
VcDocConstants::DocumentVersion m_documentVersion;
|
||||
|
@@ -21,7 +21,6 @@ HEADERS += \
|
||||
vcprojectmodel/assemblyreference.h \
|
||||
vcprojectmodel/activexreference.h \
|
||||
vcprojectmodel/tools/tool_constants.h \
|
||||
vcprojectmodel/tools/candcpptool_constants.h \
|
||||
vcprojectmodel/vcdocumentmodel.h \
|
||||
vcprojectmodel/vcdocprojectnodes.h \
|
||||
vcprojectmodel/tools/toolattributes/booltoolattribute.h \
|
||||
@@ -31,7 +30,6 @@ HEADERS += \
|
||||
vcprojectmodel/tools/configurationtool.h \
|
||||
vcprojectmodel/tools/toolattributes/tooldescriptiondatamanager.h \
|
||||
vcprojectmodel/tools/toolattributes/tooldescription.h \
|
||||
vcprojectmodel/tools/toolattributes/iattributedescriptiondataitem.h \
|
||||
vcprojectmodel/tools/toolsectiondescription.h \
|
||||
vcprojectmodel/tools/toolsection.h \
|
||||
vcprojectmodel/tools/toolattributes/toolattributeoption.h \
|
||||
|
@@ -70,7 +70,7 @@ ConfigurationsEditWidget::ConfigurationsEditWidget(VcProjectManager::Internal::I
|
||||
}
|
||||
}
|
||||
|
||||
readFileBuildConfigurations(configContainer);
|
||||
readFileBuildConfigurations();
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
@@ -102,7 +102,7 @@ void ConfigurationsEditWidget::saveData()
|
||||
IFile *file = it.key();
|
||||
ConfigurationContainer *newConfigCont = it.value();
|
||||
|
||||
if (containsNonDefaultConfiguration(newConfigCont)) {
|
||||
if (file && newConfigCont) {
|
||||
ConfigurationContainer *oldConfigContainer = file->configurationContainer();
|
||||
*oldConfigContainer = *newConfigCont;
|
||||
}
|
||||
@@ -111,6 +111,8 @@ void ConfigurationsEditWidget::saveData()
|
||||
|
||||
void ConfigurationsEditWidget::onAddNewConfig(QString newConfigName, QString copyFrom)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = copyFrom.split(QLatin1Char('|')).at(0);
|
||||
|
||||
@@ -119,7 +121,11 @@ void ConfigurationsEditWidget::onAddNewConfig(QString newConfigName, QString cop
|
||||
|
||||
if (platform) {
|
||||
QString newFullConfigName = newConfigName + QLatin1Char('|') + platform->displayName();
|
||||
QString copyFromFullConfigName = copyFromConfigName + QLatin1Char('|') + platform->displayName();
|
||||
QString copyFromFullConfigName;
|
||||
|
||||
if (!copyFromConfigName.isEmpty())
|
||||
copyFromFullConfigName = copyFromConfigName + QLatin1Char('|') + platform->displayName();
|
||||
|
||||
addConfigToProjectBuild(newFullConfigName, copyFromFullConfigName);
|
||||
addConfigToFiles(newFullConfigName, copyFromFullConfigName);
|
||||
}
|
||||
@@ -128,12 +134,14 @@ void ConfigurationsEditWidget::onAddNewConfig(QString newConfigName, QString cop
|
||||
|
||||
void ConfigurationsEditWidget::onNewConfigAdded(IConfiguration *config)
|
||||
{
|
||||
if (config)
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
QTC_ASSERT(config, return);
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = oldConfigNameWithPlatform.split(QLatin1Char('|')).at(0);
|
||||
|
||||
@@ -162,6 +170,8 @@ void ConfigurationsEditWidget::onRenameConfig(QString newConfigName, QString old
|
||||
|
||||
void ConfigurationsEditWidget::onRemoveConfig(QString configNameWithPlatform)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = configNameWithPlatform.split(QLatin1Char('|')).at(0);
|
||||
|
||||
@@ -184,57 +194,50 @@ void ConfigurationsEditWidget::onRemoveConfig(QString configNameWithPlatform)
|
||||
|
||||
void ConfigurationsEditWidget::addConfigWidget(IConfiguration *config)
|
||||
{
|
||||
if (config)
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
QTC_ASSERT(config, return);
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations(ConfigurationContainer *configContainer)
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations()
|
||||
{
|
||||
if (!configContainer)
|
||||
return;
|
||||
QTC_ASSERT(m_vsProject, return);
|
||||
QTC_ASSERT(m_vsProject->files(), return);
|
||||
|
||||
IFiles *files = m_vsProject->files();
|
||||
|
||||
for (int i = 0; i < files->fileContainerCount(); ++i) {
|
||||
IFileContainer *fileContainer = files->fileContainer(i);
|
||||
readFileBuildConfigurations(fileContainer, configContainer);
|
||||
readFileBuildConfigurations(fileContainer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < files->fileCount(); ++i) {
|
||||
IFile *file = files->file(i);
|
||||
readFileBuildConfigurations(file, configContainer);
|
||||
readFileBuildConfigurations(file);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations(IFileContainer *container, ConfigurationContainer *configContainer)
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations(IFileContainer *container)
|
||||
{
|
||||
if (!container || !configContainer)
|
||||
return;
|
||||
QTC_ASSERT(container, return);
|
||||
|
||||
for (int i = 0; i < container->childCount(); ++i) {
|
||||
IFileContainer *fileContainer = container->fileContainer(i);
|
||||
readFileBuildConfigurations(fileContainer, configContainer);
|
||||
readFileBuildConfigurations(fileContainer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < container->fileCount(); ++i) {
|
||||
IFile *file = container->file(i);
|
||||
readFileBuildConfigurations(file, configContainer);
|
||||
readFileBuildConfigurations(file);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations(IFile *file, ConfigurationContainer *configContainer)
|
||||
void ConfigurationsEditWidget::readFileBuildConfigurations(IFile *file)
|
||||
{
|
||||
if (!file)
|
||||
return;
|
||||
QTC_ASSERT(file, return);
|
||||
QTC_ASSERT(file->configurationContainer(), return);
|
||||
|
||||
ConfigurationContainer *configCont = cloneFileConfigContainer(file);
|
||||
|
||||
if (configCont && file->configurationContainer() == configContainer) {
|
||||
connect(configCont, SIGNAL(configurationAdded(IConfiguration*)), this, SLOT(addConfigWidget(IConfiguration*)));
|
||||
|
||||
for (int i = 0; i < configCont->configurationCount(); ++i)
|
||||
addConfigWidget(configCont->configuration(i));
|
||||
}
|
||||
ConfigurationContainer *configCont = new ConfigurationContainer(*file->configurationContainer());
|
||||
m_fileConfigurations[file] = configCont;
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::addConfigToProjectBuild(const QString &newConfigName, const QString ©From)
|
||||
@@ -262,11 +265,7 @@ void ConfigurationsEditWidget::addConfigToFiles(const QString &newConfigName, co
|
||||
it.next();
|
||||
ConfigurationContainer *container = it.value();
|
||||
|
||||
if (copyFrom.isEmpty()) {
|
||||
IFile *file = it.key();
|
||||
IConfiguration *newConfig = file->createDefaultBuildConfiguration(newConfigName);
|
||||
container->addConfiguration(newConfig);
|
||||
} else {
|
||||
if (container) {
|
||||
IConfiguration *config = container->configuration(copyFrom);
|
||||
|
||||
if (config) {
|
||||
@@ -280,93 +279,6 @@ void ConfigurationsEditWidget::addConfigToFiles(const QString &newConfigName, co
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::addConfigsAsInProjectBuildConfig(IFile *file, ConfigurationContainer *container)
|
||||
{
|
||||
for (int i = 0; i < m_buildConfigurations->configurationCount(); ++i) {
|
||||
IConfiguration *config = m_buildConfigurations->configuration(i);
|
||||
|
||||
if (config) {
|
||||
IConfiguration *newConfig = file->createDefaultBuildConfiguration(config->fullName());
|
||||
container->addConfiguration(newConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationsEditWidget::addDefaultToolToConfig(IConfiguration *config, const QString &toolKey)
|
||||
{
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
IToolDescription *toolDesc = tDDM->toolDescription(toolKey);
|
||||
|
||||
if (toolDesc) {
|
||||
IConfigurationBuildTool *tool = toolDesc->createTool();
|
||||
if (tool)
|
||||
config->tools()->configurationBuildTools()->addTool(tool);
|
||||
}
|
||||
}
|
||||
|
||||
bool ConfigurationsEditWidget::hasNonDefaultConfigurationTool(IConfiguration *config)
|
||||
{
|
||||
if (!config)
|
||||
return false;
|
||||
|
||||
if (config && config->tools() && config->tools()->configurationBuildTools()) {
|
||||
for (int i = 0; i < config->tools()->configurationBuildTools()->toolCount(); ++i) {
|
||||
IConfigurationBuildTool *tool = config->tools()->configurationBuildTools()->tool(i);
|
||||
if (tool && !tool->allAttributesAreDefault())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConfigurationsEditWidget::containsNonDefaultConfiguration(ConfigurationContainer *configCont)
|
||||
{
|
||||
if (!configCont)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < configCont->configurationCount(); ++i) {
|
||||
IConfiguration *config = configCont->configuration(i);
|
||||
if (hasNonDefaultConfigurationTool(config))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ConfigurationContainer *ConfigurationsEditWidget::cloneFileConfigContainer(IFile *file)
|
||||
{
|
||||
ConfigurationContainer *configCont = new ConfigurationContainer(*(file->configurationContainer()));
|
||||
m_fileConfigurations[file] = configCont;
|
||||
|
||||
if (configCont->configurationCount() > 0) {
|
||||
for (int j = 0; j < configCont->configurationCount(); ++j) {
|
||||
IConfiguration *config = configCont->configuration(j);
|
||||
|
||||
// add C/C++ compiler tool as a default tool to any configuration that doesn't contain any tool
|
||||
if (config && config->tools() && config->tools()->configurationBuildTools() &&
|
||||
config->tools()->configurationBuildTools()->toolCount() == 0)
|
||||
addDefaultToolToConfig(config, QLatin1String(ToolConstants::strVCCLCompilerTool));
|
||||
}
|
||||
} else {
|
||||
// if file does not contain any build configurations,
|
||||
// add build configurations that reflect those in the project build configurations
|
||||
addConfigsAsInProjectBuildConfig(file, configCont);
|
||||
|
||||
// add C/C++ compiler tool as a default tool to all configurations
|
||||
for (int j = 0; j < configCont->configurationCount(); ++j) {
|
||||
IConfiguration *config = configCont->configuration(j);
|
||||
if (config)
|
||||
addDefaultToolToConfig(config, QLatin1String(ToolConstants::strVCCLCompilerTool));
|
||||
}
|
||||
}
|
||||
|
||||
return configCont;
|
||||
}
|
||||
|
||||
|
||||
} // Internal
|
||||
} // VcProjectManager
|
||||
|
@@ -62,16 +62,11 @@ private slots:
|
||||
void addConfigWidget(IConfiguration *config);
|
||||
|
||||
private:
|
||||
void readFileBuildConfigurations(ConfigurationContainer *configContainer);
|
||||
void readFileBuildConfigurations(IFileContainer *container, ConfigurationContainer *configContainer);
|
||||
void readFileBuildConfigurations(IFile *file, ConfigurationContainer *configContainer);
|
||||
void readFileBuildConfigurations();
|
||||
void readFileBuildConfigurations(IFileContainer *container);
|
||||
void readFileBuildConfigurations(IFile *file);
|
||||
void addConfigToProjectBuild(const QString &newConfigName, const QString ©From);
|
||||
void addConfigToFiles(const QString &newConfigName, const QString ©From);
|
||||
void addConfigsAsInProjectBuildConfig(IFile *file, ConfigurationContainer *container);
|
||||
void addDefaultToolToConfig(IConfiguration *config, const QString &toolKey);
|
||||
bool hasNonDefaultConfigurationTool(IConfiguration *config);
|
||||
bool containsNonDefaultConfiguration(ConfigurationContainer *configCont);
|
||||
ConfigurationContainer *cloneFileConfigContainer(IFile *file);
|
||||
|
||||
IVisualStudioProject *m_vsProject;
|
||||
ConfigurationsWidget *m_configsWidget;
|
||||
|
@@ -64,11 +64,12 @@ void ConfigurationsWidget::addConfiguration(const QString &configName, QWidget *
|
||||
ui->m_configurationsStackWidget->addWidget(configWidget);
|
||||
}
|
||||
|
||||
QWidget *ConfigurationsWidget::configWidget(const QString &configName)
|
||||
VcNodeWidget *ConfigurationsWidget::configWidget(const QString &configName)
|
||||
{
|
||||
for (int i = 0; i < ui->m_configurationComboBox->count(); ++i) {
|
||||
QString name = ui->m_configurationComboBox->itemText(i);
|
||||
if (ui->m_configurationComboBox->itemText(i) == configName)
|
||||
return ui->m_configurationsStackWidget->widget(i);
|
||||
return qobject_cast<VcNodeWidget *>(ui->m_configurationsStackWidget->widget(i));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -92,12 +93,12 @@ void ConfigurationsWidget::renameConfiguration(const QString &newConfigNameWithP
|
||||
ui->m_configurationComboBox->setItemText(index, newConfigNameWithPlatform);
|
||||
}
|
||||
|
||||
QList<ConfigurationBaseWidget *> ConfigurationsWidget::configWidgets()
|
||||
QList<VcNodeWidget *> ConfigurationsWidget::configWidgets()
|
||||
{
|
||||
QList<ConfigurationBaseWidget *> configWidgets;
|
||||
QList<VcNodeWidget *> configWidgets;
|
||||
|
||||
for (int i = 0; i < ui->m_configurationsStackWidget->count(); ++i) {
|
||||
ConfigurationBaseWidget *w = qobject_cast<ConfigurationBaseWidget *>(ui->m_configurationsStackWidget->widget(i));
|
||||
VcNodeWidget *w = qobject_cast<VcNodeWidget *>(ui->m_configurationsStackWidget->widget(i));
|
||||
|
||||
if (w)
|
||||
configWidgets.append(w);
|
||||
|
@@ -50,10 +50,10 @@ public:
|
||||
~ConfigurationsWidget();
|
||||
|
||||
void addConfiguration(const QString &configName, QWidget *configWidget);
|
||||
QWidget *configWidget(const QString &configName);
|
||||
VcNodeWidget *configWidget(const QString &configName);
|
||||
void removeConfiguration(const QString &configNameWithPlatform);
|
||||
void renameConfiguration(const QString &newconfigNameWithPlatform, const QString &oldConfigNameWithPlatform);
|
||||
QList<ConfigurationBaseWidget *> configWidgets();
|
||||
QList<VcNodeWidget *> configWidgets();
|
||||
|
||||
private slots:
|
||||
void onAddNewConfig();
|
||||
|
@@ -0,0 +1,451 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (c) 2014 Bojan Petrovic
|
||||
** Copyright (c) 2014 Radovan Zivkovic
|
||||
** 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 "fileconfigurationseditwidget.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include "../interfaces/iattributecontainer.h"
|
||||
#include "../interfaces/iattributedescriptiondataitem.h"
|
||||
#include "../interfaces/iconfiguration.h"
|
||||
#include "../interfaces/iconfigurationbuildtool.h"
|
||||
#include "../interfaces/iconfigurationbuildtools.h"
|
||||
#include "../interfaces/iconfigurations.h"
|
||||
#include "../interfaces/ifile.h"
|
||||
#include "../interfaces/ifiles.h"
|
||||
#include "../interfaces/ifilecontainer.h"
|
||||
#include "../interfaces/iplatform.h"
|
||||
#include "../interfaces/iplatforms.h"
|
||||
#include "../interfaces/itoolattribute.h"
|
||||
#include "../interfaces/itoolattributecontainer.h"
|
||||
#include "../interfaces/itooldescription.h"
|
||||
#include "../interfaces/itools.h"
|
||||
#include "../interfaces/itoolsection.h"
|
||||
#include "../interfaces/itoolsectiondescription.h"
|
||||
#include "../interfaces/isectioncontainer.h"
|
||||
#include "../interfaces/ivisualstudioproject.h"
|
||||
|
||||
#include "../vcprojectmodel/configurationcontainer.h"
|
||||
#include "../vcprojectmodel/tools/tool_constants.h"
|
||||
|
||||
#include "configurationswidget.h"
|
||||
#include "configurationbasewidget.h"
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
FileConfigurationsEditWidget::FileConfigurationsEditWidget(IFile *file, IVisualStudioProject *project)
|
||||
: m_file(file),
|
||||
m_vsProject(project)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject, return);
|
||||
QTC_ASSERT(m_vsProject->configurations(), return);
|
||||
QTC_ASSERT(m_vsProject->configurations()->configurationContainer(), return);
|
||||
|
||||
m_buildConfigurations = new ConfigurationContainer(*m_vsProject->configurations()->configurationContainer());
|
||||
m_configsWidget = new ConfigurationsWidget;
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_configsWidget);
|
||||
setLayout(layout);
|
||||
|
||||
readFileBuildConfigurations();
|
||||
|
||||
ConfigurationContainer *fileConfigContainer = m_fileConfigurations[m_file];
|
||||
|
||||
for (int i = 0; i < fileConfigContainer->configurationCount(); ++i) {
|
||||
IConfiguration *config = fileConfigContainer->configuration(i);
|
||||
if (config)
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
}
|
||||
|
||||
connect(m_configsWidget, SIGNAL(addNewConfigSignal(QString, QString)), this, SLOT(onAddNewConfig(QString, QString)));
|
||||
connect(m_configsWidget, SIGNAL(renameConfigSignal(QString,QString)), this, SLOT(onRenameConfig(QString, QString)));
|
||||
connect(m_configsWidget, SIGNAL(removeConfigSignal(QString)), this, SLOT(onRemoveConfig(QString)));
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::saveData()
|
||||
{
|
||||
ConfigurationContainer *newFileConfigContainer = m_fileConfigurations[m_file];
|
||||
|
||||
QTC_ASSERT(newFileConfigContainer, return);
|
||||
|
||||
for (int i = 0; i < newFileConfigContainer->configurationCount(); ++i) {
|
||||
VcNodeWidget *configWidget = m_configsWidget->configWidget(newFileConfigContainer->configuration(i)->fullName());
|
||||
if (configWidget)
|
||||
configWidget->saveData();
|
||||
}
|
||||
|
||||
QMapIterator<IFile *, ConfigurationContainer *> it(m_fileConfigurations);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
IFile *file = it.key();
|
||||
ConfigurationContainer *newConfigContainer = it.value();
|
||||
|
||||
if (file && file->configurationContainer() && newConfigContainer)
|
||||
*file->configurationContainer() = *newConfigContainer;
|
||||
}
|
||||
|
||||
QTC_ASSERT(m_vsProject, return);
|
||||
QTC_ASSERT(m_vsProject->configurations(), return);
|
||||
*m_vsProject->configurations()->configurationContainer() = *m_buildConfigurations;
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::onAddNewConfig(QString newConfigName, QString copyFrom)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = copyFrom.split(QLatin1Char('|')).at(0);
|
||||
|
||||
for (int i = 0; i < platforms->platformCount(); ++i) {
|
||||
IPlatform *platform = platforms->platform(i);
|
||||
|
||||
if (platform) {
|
||||
QString newFullConfigName = newConfigName + QLatin1Char('|') + platform->displayName();
|
||||
QString copyFromFullConfigName;
|
||||
|
||||
if (!copyFromConfigName.isEmpty())
|
||||
copyFromFullConfigName = copyFromConfigName + QLatin1Char('|') + platform->displayName();
|
||||
|
||||
addConfigToProjectBuild(newFullConfigName, copyFromFullConfigName);
|
||||
addConfigToFiles(newFullConfigName, copyFromFullConfigName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::onNewConfigAdded(IConfiguration *config)
|
||||
{
|
||||
QTC_ASSERT(config, return);
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = oldConfigNameWithPlatform.split(QLatin1Char('|')).at(0);
|
||||
|
||||
for (int i = 0; i < platforms->platformCount(); ++i) {
|
||||
IPlatform *platform = platforms->platform(i);
|
||||
|
||||
if (platform) {
|
||||
QString oldConfigName = copyFromConfigName + QLatin1Char('|') + platform->displayName();
|
||||
QString newConfigNamePl = newConfigName + QLatin1Char('|') + platform->displayName();
|
||||
IConfiguration *config = m_buildConfigurations->configuration(oldConfigName);
|
||||
|
||||
if (config)
|
||||
config->setFullName(newConfigNamePl);
|
||||
|
||||
QMapIterator<IFile *, ConfigurationContainer *> it(m_fileConfigurations);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
config = it.value()->configuration(oldConfigName);
|
||||
if (config)
|
||||
config->setFullName(newConfigNamePl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::onRemoveConfig(QString configNameWithPlatform)
|
||||
{
|
||||
QTC_ASSERT(m_vsProject->platforms(), return);
|
||||
|
||||
IPlatforms *platforms = m_vsProject->platforms();
|
||||
QString copyFromConfigName = configNameWithPlatform.split(QLatin1Char('|')).at(0);
|
||||
|
||||
for (int i = 0; i < platforms->platformCount(); ++i) {
|
||||
IPlatform *platform = platforms->platform(i);
|
||||
if (platform) {
|
||||
QString configName = copyFromConfigName + QLatin1Char('|') + platform->displayName();
|
||||
m_buildConfigurations->removeConfiguration(configName);
|
||||
m_configsWidget->removeConfiguration(configName);
|
||||
|
||||
QMapIterator<IFile*, ConfigurationContainer*> it(m_fileConfigurations);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
it.value()->removeConfiguration(configName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::addConfigWidget(IConfiguration *config)
|
||||
{
|
||||
QTC_ASSERT(config, return);
|
||||
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::addConfigToProjectBuild(const QString &newConfigName, const QString ©From)
|
||||
{
|
||||
if (copyFrom.isEmpty()) {
|
||||
IConfiguration *newConfig = m_vsProject->createDefaultBuildConfiguration(newConfigName);
|
||||
if (newConfig)
|
||||
m_buildConfigurations->addConfiguration(newConfig);
|
||||
} else {
|
||||
IConfiguration *config = m_buildConfigurations->configuration(copyFrom);
|
||||
|
||||
if (config) {
|
||||
IConfiguration *newConfig = config->clone();
|
||||
newConfig->setFullName(newConfigName);
|
||||
m_buildConfigurations->addConfiguration(newConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::addConfigToFiles(const QString &newConfigName, const QString ©From)
|
||||
{
|
||||
QMapIterator<IFile *, ConfigurationContainer *> it(m_fileConfigurations);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
ConfigurationContainer *container = it.value();
|
||||
|
||||
if (container) {
|
||||
if (copyFrom.isEmpty()) {
|
||||
IConfiguration *config = m_vsProject->configurations()->configurationContainer()->configuration(newConfigName);
|
||||
leaveOnlyCppTool(config);
|
||||
container->addConfiguration(config);
|
||||
} else {
|
||||
IConfiguration *config = container->configuration(copyFrom);
|
||||
|
||||
if (config) {
|
||||
IConfiguration *newConfig = config->clone();
|
||||
if (newConfig) {
|
||||
newConfig->setFullName(newConfigName);
|
||||
container->addConfiguration(newConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::readFileBuildConfigurations()
|
||||
{
|
||||
IFiles *files = m_vsProject->files();
|
||||
|
||||
for (int i = 0; i < files->fileContainerCount(); ++i) {
|
||||
IFileContainer *fileContainer = files->fileContainer(i);
|
||||
readFileBuildConfigurations(fileContainer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < files->fileCount(); ++i) {
|
||||
IFile *file = files->file(i);
|
||||
readFileBuildConfigurations(file);
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::readFileBuildConfigurations(IFileContainer *container)
|
||||
{
|
||||
QTC_ASSERT(container, return);
|
||||
|
||||
for (int i = 0; i < container->childCount(); ++i) {
|
||||
IFileContainer *fileContainer = container->fileContainer(i);
|
||||
readFileBuildConfigurations(fileContainer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < container->fileCount(); ++i) {
|
||||
IFile *file = container->file(i);
|
||||
readFileBuildConfigurations(file);
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::readFileBuildConfigurations(IFile *file)
|
||||
{
|
||||
QTC_ASSERT(file, return);
|
||||
QTC_ASSERT(file->configurationContainer(), return);
|
||||
|
||||
ConfigurationContainer *configCont = 0;
|
||||
|
||||
if (file != m_file)
|
||||
configCont = new ConfigurationContainer(*(file->configurationContainer()));
|
||||
else {
|
||||
configCont = cloneFileConfigContainer(file);
|
||||
connect(configCont, SIGNAL(configurationAdded(IConfiguration*)), this, SLOT(addConfigWidget(IConfiguration*)));
|
||||
}
|
||||
|
||||
m_fileConfigurations[file] = configCont;
|
||||
}
|
||||
|
||||
ConfigurationContainer *FileConfigurationsEditWidget::cloneFileConfigContainer(IFile *file)
|
||||
{
|
||||
QTC_ASSERT(file, return 0);
|
||||
|
||||
ConfigurationContainer *configCont = new ConfigurationContainer(*(file->configurationContainer()));
|
||||
m_fileConfigurations[file] = configCont;
|
||||
|
||||
// add any build configuration that does exist in project but not among file's build configurations
|
||||
for (int i = 0; i < m_buildConfigurations->configurationCount(); ++i) {
|
||||
IConfiguration *config = m_buildConfigurations->configuration(i);
|
||||
|
||||
if (config) {
|
||||
IConfiguration *fileConfig = configCont->configuration(config->fullName());
|
||||
|
||||
if (!fileConfig) {
|
||||
IConfiguration *newConfig = config->clone();
|
||||
leaveOnlyCppTool(newConfig);
|
||||
configCont->addConfiguration(newConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return configCont;
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::leaveOnlyCppTool(IConfiguration *config)
|
||||
{
|
||||
QTC_ASSERT(config && config->tools() && config->tools()->configurationBuildTools(), return);
|
||||
|
||||
int i = 0;
|
||||
while (config->tools()->configurationBuildTools()->toolCount() > 1)
|
||||
{
|
||||
IConfigurationBuildTool *tool = config->tools()->configurationBuildTools()->tool(i);
|
||||
|
||||
if (tool->toolDescription()->toolKey() != QLatin1String(ToolConstants::strVCCLCompilerTool)) {
|
||||
config->tools()->configurationBuildTools()->removeTool(tool);
|
||||
delete tool;
|
||||
}
|
||||
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::cleanUpConfig(IConfiguration *config)
|
||||
{
|
||||
QTC_ASSERT(config, return);
|
||||
|
||||
VcNodeWidget *configWidget = m_configsWidget->configWidget(config->fullName());
|
||||
|
||||
if (configWidget)
|
||||
configWidget->saveData();
|
||||
|
||||
IConfiguration *projectConfig = m_vsProject->configurations()->configurationContainer()->configuration(config->fullName());
|
||||
|
||||
if (projectConfig) {
|
||||
cleanUpConfigAttributes(config, projectConfig);
|
||||
cleanUpConfigTools(config, projectConfig);
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::cleanUpConfigAttributes(IConfiguration *config, IConfiguration *projectConfig)
|
||||
{
|
||||
QTC_ASSERT(config && projectConfig, return);
|
||||
|
||||
IAttributeContainer *configAttrCont = config->attributeContainer();
|
||||
IAttributeContainer *projConfigAttrCont = projectConfig->attributeContainer();
|
||||
|
||||
if (configAttrCont) {
|
||||
for (int i = 0; i < configAttrCont->getAttributeCount();) {
|
||||
QString attrName = configAttrCont->getAttributeName(i);
|
||||
|
||||
if (configAttrCont->attributeValue(attrName) == projConfigAttrCont->attributeValue(attrName))
|
||||
configAttrCont->removeAttribute(attrName);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::cleanUpConfigTools(IConfiguration *config, IConfiguration *projectConfig)
|
||||
{
|
||||
QTC_ASSERT(config && projectConfig, return);
|
||||
|
||||
ITools *tools = config->tools();
|
||||
ITools *projectTools = projectConfig->tools();
|
||||
|
||||
if (tools && projectTools && tools->configurationBuildTools() && projectTools->configurationBuildTools()) {
|
||||
IConfigurationBuildTool *tool = tools->configurationBuildTools()->tool(0);
|
||||
|
||||
if (tool->toolDescription()) {
|
||||
IConfigurationBuildTool *projTool = projectTools->configurationBuildTools()->tool(tool->toolDescription()->toolKey());
|
||||
|
||||
if (projTool)
|
||||
cleanUpConfigTool(tool, projTool);
|
||||
|
||||
if (tool->allAttributesAreDefault())
|
||||
tools->configurationBuildTools()->removeTool(tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::cleanUpConfigTool(IConfigurationBuildTool *tool, IConfigurationBuildTool *projTool)
|
||||
{
|
||||
QTC_ASSERT(tool && projTool, return);
|
||||
QTC_ASSERT(tool->sectionContainer() && projTool->sectionContainer(), return);
|
||||
|
||||
ISectionContainer *secCont = tool->sectionContainer();
|
||||
ISectionContainer *projSecCont = projTool->sectionContainer();
|
||||
|
||||
for (int i = 0; i < secCont->sectionCount(); ++i) {
|
||||
IToolSection *section = secCont->section(i);
|
||||
|
||||
if (section && section->sectionDescription()) {
|
||||
IToolSection *projSection = projSecCont->section(section->sectionDescription()->displayName());
|
||||
|
||||
if (projSection)
|
||||
cleanUpConfigToolSection(section, projSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationsEditWidget::cleanUpConfigToolSection(IToolSection *toolSection, IToolSection *projToolSection)
|
||||
{
|
||||
QTC_ASSERT(toolSection && projToolSection, return);
|
||||
IToolAttributeContainer *attrCont = toolSection->attributeContainer();
|
||||
IToolAttributeContainer *projAttrCont = projToolSection->attributeContainer();
|
||||
|
||||
if (attrCont && projAttrCont) {
|
||||
for (int i = 0; i < attrCont->toolAttributeCount();) {
|
||||
IToolAttribute *attr = attrCont->toolAttribute(i);
|
||||
|
||||
if (attr && attr->descriptionDataItem()) {
|
||||
IToolAttribute *projAttr = projAttrCont->toolAttribute(attr->descriptionDataItem()->key());
|
||||
|
||||
if (projAttr && attr->value() == projAttr->value())
|
||||
attrCont->removeToolAttribute(attr);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
@@ -0,0 +1,91 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (c) 2014 Bojan Petrovic
|
||||
** Copyright (c) 2014 Radovan Zivkovic
|
||||
** 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 VCPROJECTMANAGER_INTERNAL_FILECONFIGURATIONSEDITWIDGET_H
|
||||
#define VCPROJECTMANAGER_INTERNAL_FILECONFIGURATIONSEDITWIDGET_H
|
||||
|
||||
#include <QMap>
|
||||
|
||||
#include "vcnodewidget.h"
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class IVisualStudioProject;
|
||||
class ConfigurationsWidget;
|
||||
class IFile;
|
||||
class ConfigurationContainer;
|
||||
class IFileContainer;
|
||||
class IConfiguration;
|
||||
class IConfigurationBuildTool;
|
||||
class IToolSection;
|
||||
|
||||
class FileConfigurationsEditWidget : public VcNodeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileConfigurationsEditWidget(IFile *file, IVisualStudioProject *project);
|
||||
|
||||
// VcNodeWidget interface
|
||||
void saveData();
|
||||
|
||||
private slots:
|
||||
void onAddNewConfig(QString newConfigName, QString copyFrom);
|
||||
void onNewConfigAdded(IConfiguration *config);
|
||||
void onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform);
|
||||
void onRemoveConfig(QString configNameWithPlatform);
|
||||
|
||||
void addConfigWidget(IConfiguration *config);
|
||||
|
||||
private:
|
||||
void addConfigToProjectBuild(const QString &newConfigName, const QString ©From);
|
||||
void addConfigToFiles(const QString &newConfigName, const QString ©From);
|
||||
void readFileBuildConfigurations();
|
||||
void readFileBuildConfigurations(IFileContainer *container);
|
||||
void readFileBuildConfigurations(IFile *file);
|
||||
ConfigurationContainer *cloneFileConfigContainer(IFile *file);
|
||||
void leaveOnlyCppTool(IConfiguration *config);
|
||||
void cleanUpConfig(IConfiguration *config);
|
||||
void cleanUpConfigAttributes(IConfiguration *config, IConfiguration *projectConfig);
|
||||
void cleanUpConfigTools(IConfiguration *config, IConfiguration *projectConfig);
|
||||
void cleanUpConfigTool(IConfigurationBuildTool *tool, IConfigurationBuildTool *projTool);
|
||||
void cleanUpConfigToolSection(IToolSection *tool, IToolSection *projTool);
|
||||
|
||||
IFile *m_file;
|
||||
IVisualStudioProject *m_vsProject;
|
||||
ConfigurationsWidget *m_configsWidget;
|
||||
QMap<IFile *, ConfigurationContainer *> m_fileConfigurations;
|
||||
ConfigurationContainer *m_buildConfigurations;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
||||
#endif // VCPROJECTMANAGER_INTERNAL_FILECONFIGURATIONSEDITWIDGET_H
|
@@ -41,25 +41,24 @@
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
FileConfigurationSettingsWidget::FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, QWidget *parent) :
|
||||
FileConfigurationSettingsWidget::FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, IVisualStudioProject *parentProjectDoc, QWidget *parent) :
|
||||
VcNodeWidget(parent),
|
||||
ui(new Ui::FileConfigurationSettingsWidget),
|
||||
m_fileBuildConfig(fileBuildConfig),
|
||||
m_configBuildTool(0)
|
||||
m_toolSettingsWidget(0),
|
||||
m_parentProjectDoc(parentProjectDoc)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readTools();
|
||||
|
||||
if (m_fileBuildConfig &&
|
||||
m_fileBuildConfig->tools() &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()) {
|
||||
IConfigurationBuildTool *configBuildTool = m_fileBuildConfig->tools()->configurationBuildTools()->tool(0);
|
||||
|
||||
if (configBuildTool)
|
||||
m_configBuildTool = configBuildTool->clone();
|
||||
|
||||
if (m_configBuildTool) {
|
||||
if (m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)) {
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
m_toolSettingsWidget = m_configBuildTool->createSettingsWidget();
|
||||
m_toolSettingsWidget = m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)->createSettingsWidget();
|
||||
layout->addWidget(m_toolSettingsWidget);
|
||||
ui->m_toolWidget->setLayout(layout);
|
||||
}
|
||||
@@ -73,38 +72,20 @@ FileConfigurationSettingsWidget::FileConfigurationSettingsWidget(IConfiguration
|
||||
ui->m_excludedFromBuild->setCurrentIndex(1);
|
||||
|
||||
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
IToolDescription *toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_CPP_C_COMPILER));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_CPP_C_COMPILER));
|
||||
QMapIterator<QString, IConfigurationBuildTool *> it(m_toolMap);
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_CUSTOM));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_CUSTOM));
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
ui->m_tool->addItem(it.value()->toolDescription()->toolDisplayName(), it.key());
|
||||
}
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_MANAGED_RESOURCE_COMPILER));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_MANAGED_RESOURCE_COMPILER));
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_MIDL));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_MIDL));
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_RESOURCE_COMPILER));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_RESOURCE_COMPILER));
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_WEB_SERVICE_PROXY_GENERATOR));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_WEB_SERVICE_PROXY_GENERATOR));
|
||||
|
||||
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_XML_DATA_PROXY_GENERATOR));
|
||||
if (toolDesc)
|
||||
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_XML_DATA_PROXY_GENERATOR));
|
||||
|
||||
int index = toolIndex(m_configBuildTool->toolDescription()->toolKey());
|
||||
if (index != -1)
|
||||
ui->m_tool->setCurrentIndex(index);
|
||||
if (m_fileBuildConfig && m_fileBuildConfig->tools() && m_fileBuildConfig->tools()->configurationBuildTools() &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->tool(0) &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)->toolDescription()) {
|
||||
int index = toolIndex(m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)->toolDescription()->toolKey());
|
||||
if (index != -1)
|
||||
ui->m_tool->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
connect(ui->m_tool, SIGNAL(currentIndexChanged(int)), this, SLOT(changeTool(int)));
|
||||
}
|
||||
@@ -116,43 +97,47 @@ FileConfigurationSettingsWidget::~FileConfigurationSettingsWidget()
|
||||
|
||||
void FileConfigurationSettingsWidget::saveData()
|
||||
{
|
||||
if (m_fileBuildConfig &&
|
||||
m_fileBuildConfig->tools() &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools() &&
|
||||
m_configBuildTool &&
|
||||
m_toolSettingsWidget) {
|
||||
// remove old tool
|
||||
IConfigurationBuildTool *confBuildTool = m_fileBuildConfig->tools()->configurationBuildTools()->tool(0);
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->removeTool(confBuildTool);
|
||||
|
||||
// add new tool and save it's settings data
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->addTool(m_configBuildTool);
|
||||
if (m_toolSettingsWidget)
|
||||
m_toolSettingsWidget->saveData();
|
||||
|
||||
if (m_fileBuildConfig) {
|
||||
if (ITools *tools = m_fileBuildConfig->tools()) {
|
||||
if (IConfigurationBuildTools *buildTools = tools->configurationBuildTools()) {
|
||||
IConfigurationBuildTool *tool = buildTools->tool(0);
|
||||
if (const IToolDescription *toolDescription = tool->toolDescription()) {
|
||||
const QString currentTool = ui->m_tool->itemData(ui->m_tool->currentIndex()).toString();
|
||||
if (toolDescription->toolKey() != currentTool) {
|
||||
buildTools->removeTool(tool);
|
||||
delete tool;
|
||||
tool = m_toolMap[currentTool];
|
||||
if (tool)
|
||||
buildTools->addTool(tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileConfigurationSettingsWidget::changeTool(int index)
|
||||
{
|
||||
QString toolKey = ui->m_tool->itemData(index).toString();
|
||||
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
|
||||
IToolDescription *toolDesc = tDDM->toolDescription(toolKey);
|
||||
ui->m_toolWidget->setLayout(0);
|
||||
m_toolSettingsWidget = 0;
|
||||
IConfigurationBuildTool *oldConfigBuildTool = m_configBuildTool;
|
||||
m_configBuildTool = 0;
|
||||
|
||||
if (toolDesc) {
|
||||
IConfigurationBuildTool *configBuildTool = toolDesc->createTool();
|
||||
|
||||
if (configBuildTool) {
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
m_toolSettingsWidget = configBuildTool->createSettingsWidget();
|
||||
layout->addWidget(m_toolSettingsWidget);
|
||||
m_configBuildTool = configBuildTool;
|
||||
}
|
||||
// remove previous tool
|
||||
if (m_toolSettingsWidget) {
|
||||
ui->m_toolWidget->layout()->removeWidget(m_toolSettingsWidget);
|
||||
// flush data in order to save them
|
||||
m_toolSettingsWidget->saveData();
|
||||
m_toolSettingsWidget->deleteLater();
|
||||
m_toolSettingsWidget = 0;
|
||||
}
|
||||
|
||||
delete oldConfigBuildTool;
|
||||
// add settings widget for the selected tool
|
||||
QString toolKey = ui->m_tool->itemData(index).toString();
|
||||
IConfigurationBuildTool *tool = m_toolMap[toolKey];
|
||||
|
||||
if (tool) {
|
||||
m_toolSettingsWidget = tool->createSettingsWidget();
|
||||
ui->m_toolWidget->layout()->addWidget(m_toolSettingsWidget);
|
||||
}
|
||||
}
|
||||
|
||||
int FileConfigurationSettingsWidget::toolIndex(const QString &toolKey)
|
||||
@@ -165,5 +150,31 @@ int FileConfigurationSettingsWidget::toolIndex(const QString &toolKey)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FileConfigurationSettingsWidget::readTools()
|
||||
{
|
||||
if (m_fileBuildConfig && m_fileBuildConfig->tools() &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools() &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->tool(0) &&
|
||||
m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)->toolDescription()) {
|
||||
QString key = m_fileBuildConfig->tools()->configurationBuildTools()->tool(0)->toolDescription()->toolKey();
|
||||
m_toolMap[key] = m_fileBuildConfig->tools()->configurationBuildTools()->tool(0);
|
||||
}
|
||||
|
||||
if (m_parentProjectDoc && m_parentProjectDoc->configurations() &&
|
||||
m_parentProjectDoc->configurations()->configurationContainer()) {
|
||||
IConfiguration *parentConfig = m_parentProjectDoc->configurations()->configurationContainer()->configuration(m_fileBuildConfig->fullName());
|
||||
|
||||
if (parentConfig && parentConfig->tools() && parentConfig->tools()->configurationBuildTools()) {
|
||||
for (int i = 0; i < parentConfig->tools()->configurationBuildTools()->toolCount(); ++i) {
|
||||
IConfigurationBuildTool *tool = parentConfig->tools()->configurationBuildTools()->tool(i);
|
||||
|
||||
if (tool && tool->toolDescription() &&
|
||||
!m_toolMap.contains(tool->toolDescription()->toolKey()))
|
||||
m_toolMap[tool->toolDescription()->toolKey()] = tool->clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace VcProjectManager
|
||||
|
@@ -49,7 +49,7 @@ class FileConfigurationSettingsWidget : public VcNodeWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, QWidget *parent = 0);
|
||||
explicit FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, IVisualStudioProject *parentProjectDoc, QWidget *parent = 0);
|
||||
~FileConfigurationSettingsWidget();
|
||||
|
||||
void saveData();
|
||||
@@ -59,10 +59,14 @@ private slots:
|
||||
int toolIndex(const QString &toolKey);
|
||||
|
||||
private:
|
||||
void readTools();
|
||||
|
||||
Ui::FileConfigurationSettingsWidget *ui;
|
||||
IConfiguration *m_fileBuildConfig;
|
||||
IConfigurationBuildTool *m_configBuildTool;
|
||||
VcNodeWidget *m_toolSettingsWidget;
|
||||
IVisualStudioProject *m_parentProjectDoc;
|
||||
|
||||
QMap<QString, IConfigurationBuildTool *> m_toolMap; // <tool key, tool>
|
||||
};
|
||||
|
||||
|
||||
|
@@ -39,33 +39,49 @@ namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
IntegerToolAttributeSettingsItem::IntegerToolAttributeSettingsItem(IntegerToolAttribute *toolAttribute)
|
||||
: m_toolAttribute(toolAttribute)
|
||||
: m_comboBox(0),
|
||||
m_spinBox(0),
|
||||
m_toolAttribute(toolAttribute)
|
||||
{
|
||||
m_comboBox = new QComboBox;
|
||||
|
||||
ToolAttributeOption *option = toolAttribute->descriptionDataItem()->firstOption();
|
||||
|
||||
while (option) {
|
||||
m_comboBox->addItem(option->description(), option->value());
|
||||
if (option->value() == toolAttribute->value())
|
||||
m_comboBox->setCurrentIndex(m_comboBox->count() - 1);
|
||||
option = option->nextOption();
|
||||
}
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_comboBox);
|
||||
|
||||
if (option) {
|
||||
m_comboBox = new QComboBox;
|
||||
while (option) {
|
||||
m_comboBox->addItem(option->description(), option->value());
|
||||
if (option->value() == toolAttribute->value())
|
||||
m_comboBox->setCurrentIndex(m_comboBox->count() - 1);
|
||||
option = option->nextOption();
|
||||
}
|
||||
layout->addWidget(m_comboBox);
|
||||
}
|
||||
else {
|
||||
m_spinBox = new QSpinBox;
|
||||
m_spinBox->setValue(toolAttribute->value().toInt());
|
||||
layout->addWidget(m_spinBox);
|
||||
}
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
IntegerToolAttributeSettingsItem::~IntegerToolAttributeSettingsItem()
|
||||
{
|
||||
m_comboBox->deleteLater();
|
||||
if (m_comboBox)
|
||||
m_comboBox->deleteLater();
|
||||
else
|
||||
m_spinBox->deleteLater();
|
||||
}
|
||||
|
||||
void IntegerToolAttributeSettingsItem::saveData()
|
||||
{
|
||||
m_toolAttribute->setValue(m_comboBox->itemData(m_comboBox->currentIndex()).toString().trimmed());
|
||||
if (m_comboBox)
|
||||
m_toolAttribute->setValue(m_comboBox->itemData(m_comboBox->currentIndex()).toString().trimmed());
|
||||
else if (m_spinBox)
|
||||
m_toolAttribute->setValue(QVariant(m_spinBox->value()).toString());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -32,7 +32,10 @@
|
||||
|
||||
#include "itoolattributesettingswidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
@@ -51,6 +54,7 @@ public:
|
||||
|
||||
private:
|
||||
QComboBox *m_comboBox;
|
||||
QSpinBox *m_spinBox;
|
||||
IntegerToolAttribute *m_toolAttribute;
|
||||
};
|
||||
|
||||
|
@@ -39,8 +39,9 @@
|
||||
namespace VcProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
VcProjectKitConfigWidget::VcProjectKitConfigWidget(ProjectExplorer::Kit *k)
|
||||
: ProjectExplorer::KitConfigWidget(k)
|
||||
VcProjectKitConfigWidget::VcProjectKitConfigWidget(ProjectExplorer::Kit *k,
|
||||
const ProjectExplorer::KitInformation *ki)
|
||||
: ProjectExplorer::KitConfigWidget(k, ki)
|
||||
{
|
||||
m_comboBox = new QComboBox;
|
||||
MsBuildVersionManager *msBVM = MsBuildVersionManager::instance();
|
||||
|
@@ -47,7 +47,7 @@ class VcProjectKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VcProjectKitConfigWidget(ProjectExplorer::Kit *k);
|
||||
VcProjectKitConfigWidget(ProjectExplorer::Kit *k, const ProjectExplorer::KitInformation *ki);
|
||||
~VcProjectKitConfigWidget();
|
||||
|
||||
QString displayName() const;
|
||||
|
@@ -19,7 +19,8 @@ HEADERS += \
|
||||
widgets/configurationbasewidget.h \
|
||||
widgets/fileconfigurationsettingswidget.h \
|
||||
widgets/configurationseditwidget.h \
|
||||
widgets/filesettingswidget.h
|
||||
widgets/filesettingswidget.h \
|
||||
widgets/fileconfigurationseditwidget.h
|
||||
|
||||
SOURCES += \
|
||||
widgets/vcnodewidget.cpp \
|
||||
@@ -42,7 +43,8 @@ SOURCES += \
|
||||
widgets/configurationbasewidget.cpp \
|
||||
widgets/fileconfigurationsettingswidget.cpp \
|
||||
widgets/configurationseditwidget.cpp \
|
||||
widgets/filesettingswidget.cpp
|
||||
widgets/filesettingswidget.cpp \
|
||||
widgets/fileconfigurationseditwidget.cpp
|
||||
|
||||
FORMS += \
|
||||
widgets/projectsettingswidget.ui \
|
||||
|
Reference in New Issue
Block a user