Added file build configuration editing.

Change-Id: Ib010f588cb364d56d5b3198c0088cf5307abc134
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Radovan Zivkovic
2013-10-20 17:46:25 +02:00
committed by Oswald Buddenhagen
parent 689e126bbb
commit 648c180b80
41 changed files with 1312 additions and 451 deletions

View File

@@ -47,6 +47,7 @@ public:
virtual ISectionContainer* sectionContainer() const = 0;
virtual const IToolDescription* toolDescription() const = 0;
virtual IConfigurationBuildTool* clone() const = 0;
virtual bool allAttributesAreDefault() const = 0;
};
} // namespace Internal

View File

@@ -54,6 +54,7 @@ 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

View File

@@ -46,6 +46,7 @@ class ISettingsWidget;
class IToolFiles;
class IPublishingData;
class IAttributeContainer;
class IConfiguration;
class IVisualStudioProject : public IVcProjectXMLNode
{
@@ -63,6 +64,8 @@ public:
virtual QString filePath() const = 0;
virtual bool saveToFile(const QString &filePath) const = 0;
virtual VcDocConstants::DocumentVersion documentVersion() const = 0;
virtual IConfiguration* createDefaultBuildConfiguration(const QString &fullConfigName) const = 0;
};
} // namespace Internal

View File

@@ -76,6 +76,8 @@ void MenuHandler::initialize()
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
Core::ActionContainer *folderContextMenu =
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_FOLDERCONTEXT);
Core::ActionContainer *fileContextMenu =
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_FILECONTEXT);
// versions 2003 and 2005
m_addFilter = new QAction(tr("Add Filter..."), this);
@@ -99,9 +101,16 @@ void MenuHandler::initialize()
projectContextMenu->addAction(cmd, ProjectExplorer::Constants::G_PROJECT_FILES);
subProjectContextMenu->addAction(cmd, ProjectExplorer::Constants::G_PROJECT_FILES);
m_fileProperties = new QAction(tr("Show Properties..."), this);
cmd = Core::ActionManager::registerAction(m_fileProperties, Constants::VC_FILE_SHOW_PROPERTIES_ACTION,
projectContext);
cmd->setAttribute(Core::Command::CA_Hide);
fileContextMenu->addAction(cmd, ProjectExplorer::Constants::G_FILE_OTHER);
connect(m_projectProperties, SIGNAL(triggered()), this, SLOT(onShowProjectSettings()));
connect(m_addFilter, SIGNAL(triggered()), this, SLOT(onAddFilter()));
connect(m_removeFilter, SIGNAL(triggered()), this, SLOT(onRemoveFilter()));
connect(m_fileProperties, SIGNAL(triggered()), this, SLOT(onShowFileSettings()));
}
void MenuHandler::initialize2005()
@@ -114,6 +123,8 @@ void MenuHandler::initialize2005()
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
Core::ActionContainer *folderContextMenu =
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_FOLDERCONTEXT);
Core::ActionContainer *fileContextMenu =
Core::ActionManager::createMenu(ProjectExplorer::Constants::M_FILECONTEXT);
// version 2005
m_addFolder2005 = new QAction(tr("Add Folder..."), this);
@@ -151,19 +162,29 @@ void MenuHandler::initialize2005()
projectContextMenu->addAction(cmd, ProjectExplorer::Constants::G_PROJECT_FILES);
subProjectContextMenu->addAction(cmd, ProjectExplorer::Constants::G_PROJECT_FILES);
m_fileProperties2005 = new QAction(tr("Show Properties..."), this);
cmd = Core::ActionManager::registerAction(m_fileProperties2005, Constants::VC_FILE_SHOW_PROPERTIES_ACTION,
project2005Context);
cmd->setAttribute(Core::Command::CA_Hide);
fileContextMenu->addAction(cmd, ProjectExplorer::Constants::G_FILE_OTHER);
connect(m_projectProperties2005, SIGNAL(triggered()), this, SLOT(onShowProjectSettings()));
connect(m_addFilter2005, SIGNAL(triggered()), this, SLOT(onAddFilter()));
connect(m_removeFilter2005, SIGNAL(triggered()), this, SLOT(onRemoveFilter()));
connect(m_addFolder2005, SIGNAL(triggered()), this, SLOT(onAddFolder()));
connect(m_removeFolder2005, SIGNAL(triggered()), this, SLOT(onRemoveFolder()));
connect(m_fileProperties2005, SIGNAL(triggered()), this, SLOT(onShowFileSettings()));
}
void MenuHandler::onShowProjectSettings()
{
VcProject *project = dynamic_cast<VcProject *>(ProjectExplorer::ProjectExplorerPlugin::currentProject());
ProjectExplorer::ProjectExplorerPlugin *projExplPlugin = ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Node *node = projExplPlugin->currentNode();
if (project)
project->showSettingsDialog();
if (node && node->nodeType() == ProjectExplorer::ProjectNodeType) {
VcDocProjectNode *projectNode = static_cast<VcDocProjectNode *>(node);
projectNode->showSettingsDialog();
}
}
void MenuHandler::onAddFolder()
@@ -254,5 +275,16 @@ void MenuHandler::onRemoveFolder()
}
}
void MenuHandler::onShowFileSettings()
{
ProjectExplorer::ProjectExplorerPlugin *projExplPlugin = ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Node *node = projExplPlugin->currentNode();
if (node && node->nodeType() == ProjectExplorer::FileNodeType) {
VcFileNode *fileNode = static_cast<VcFileNode *>(node);
fileNode->showSettingsWidget();
}
}
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -58,18 +58,21 @@ private slots:
void onAddFilter();
void onRemoveFilter();
void onRemoveFolder();
void onShowFileSettings();
private:
static MenuHandler *m_instance;
QAction *m_projectProperties;
QAction *m_addFilter;
QAction *m_removeFilter;
QAction *m_fileProperties;
QAction *m_projectProperties2005;
QAction *m_addFolder2005;
QAction *m_addFilter2005;
QAction *m_removeFolder2005;
QAction *m_removeFilter2005;
QAction *m_fileProperties2005;
};
} // namespace Internal

View File

@@ -97,6 +97,8 @@ VcProject::VcProject(VcManager *projectManager, const QString &projectFilePath,
else
setProjectContext(Core::Context(Constants::VC_PROJECT_ID));
m_rootNode = m_projectFile->createVcDocNode();
connect(m_rootNode, SIGNAL(settingsDialogAccepted()), this, SLOT(onSettingsDialogAccepted()));
}
VcProject::~VcProject()
@@ -166,18 +168,6 @@ bool VcProject::supportsKit(Kit *k, QString *errorMessage) const
return true;
}
void VcProject::showSettingsDialog()
{
if (m_projectFile->documentModel() && m_projectFile->documentModel()->vcProjectDocument()) {
VcProjectDocumentWidget *settingsWidget = static_cast<VcProjectDocumentWidget *>(m_projectFile->documentModel()->vcProjectDocument()->createSettingsWidget());
if (settingsWidget) {
settingsWidget->show();
connect(settingsWidget, SIGNAL(accepted()), this, SLOT(onSettingsDialogAccepted()));
}
}
}
void VcProject::reloadProjectNodes()
{
m_rootNode->deleteLater();
@@ -191,9 +181,7 @@ void VcProject::reloadProjectNodes()
void VcProject::onSettingsDialogAccepted()
{
VcProjectDocumentWidget *settingsWidget = qobject_cast<VcProjectDocumentWidget *>(QObject::sender());
m_projectFile->documentModel()->saveToFile(m_projectFile->filePath());
settingsWidget->deleteLater();
IConfigurations *configs = m_projectFile->documentModel()->vcProjectDocument()->configurations();
if (configs) {
@@ -309,12 +297,8 @@ void VcProject::updateCodeModels()
if (toolAttr) {
StringListToolAttribute *stringToolAttr = static_cast<StringListToolAttribute *>(toolAttr);
QString separator = stringToolAttr->descriptionDataItem()->optionalValue(QLatin1String("separator"));
QStringList preprocDefs;
if (!separator.isEmpty())
preprocDefs = stringToolAttr->value().split(separator);
stringToolAttr->descriptionDataItem();
QStringList preprocDefs = stringToolAttr->value().split(stringToolAttr->descriptionDataItem()->optionalValue(QLatin1String("separator")));
pPart->defines += preprocDefs.join(QLatin1String("\n")).toLatin1();
}

View File

@@ -53,6 +53,7 @@ class VcManager;
class Configuration;
class VcProjectBuildConfiguration;
class IConfiguration;
class IFile;
class VcProject : public ProjectExplorer::Project
{
@@ -72,8 +73,6 @@ public:
bool needsConfiguration() const;
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const;
void showSettingsDialog();
public slots:
void reloadProjectNodes();

View File

@@ -66,6 +66,7 @@ const char VC_PROJECT_ADD_FOLDER_ACTION[] = "VcProject.AddFolderAction";
const char VC_PROJECT_ADD_FILTER_ACTION[] = "VcProject.AddFilterAction";
const char VC_PROJECT_REMOVE_FOLDER_ACTION[] = "VcProject.RemoveFolderAction";
const char VC_PROJECT_REMOVE_FILTER_ACTION[] = "VcProject.RemoveFilterAction";
const char VC_FILE_SHOW_PROPERTIES_ACTION[] = "VcProject.ShowFilePropertiesAction";
// File container constants
const char VC_PROJECT_FILE_CONTAINER_FOLDER[] = "Folder";

View File

@@ -32,7 +32,7 @@
#include "debuggertool.h"
#include "deploymenttool.h"
#include "tools/tool_constants.h"
#include "../widgets/configurationwidgets.h"
#include "../widgets/configurationbasewidget.h"
#include "tools/toolattributes/tooldescriptiondatamanager.h"
#include "tools/toolattributes/tooldescription.h"
#include "tools/configurationtool.h"
@@ -193,7 +193,9 @@ void Configuration::processToolNode(const QDomNode &toolNode)
if (domAttribute.name() == QLatin1String("Name")) {
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
IToolDescription *toolDesc = tDDM->toolDescription(domAttribute.value());
toolConf = toolDesc->createTool();
if (toolDesc)
toolConf = toolDesc->createTool();
break;
}
}

View File

@@ -33,7 +33,8 @@
namespace VcProjectManager {
namespace Internal {
ConfigurationContainer::ConfigurationContainer()
ConfigurationContainer::ConfigurationContainer(QObject *parent)
: QObject(parent)
{
}
@@ -70,7 +71,9 @@ void ConfigurationContainer::addConfiguration(IConfiguration *config)
if (config->fullName() == conf->fullName())
return;
}
m_configs.append(config);
emit configurationAdded(config);
}
IConfiguration *ConfigurationContainer::configuration(const QString &fullName) const
@@ -100,6 +103,7 @@ void ConfigurationContainer::removeConfiguration(const QString &fullName)
foreach (IConfiguration *conf, m_configs) {
if (conf->fullName() == fullName) {
m_configs.removeOne(conf);
emit configurationRemoved(fullName);
delete conf;
return;
}

View File

@@ -30,6 +30,7 @@
#ifndef VCPROJECTMANAGER_INTERNAL_CONFIGURATIONCONTAINER_H
#define VCPROJECTMANAGER_INTERNAL_CONFIGURATIONCONTAINER_H
#include <QObject>
#include <QList>
#include <QDomElement>
@@ -38,10 +39,12 @@ namespace Internal {
class IConfiguration;
class ConfigurationContainer
class ConfigurationContainer : public QObject
{
Q_OBJECT
public:
ConfigurationContainer();
ConfigurationContainer(QObject *parent = 0);
ConfigurationContainer(const ConfigurationContainer &configCont);
ConfigurationContainer& operator=(const ConfigurationContainer &configCont);
~ConfigurationContainer();
@@ -53,6 +56,10 @@ public:
void removeConfiguration(const QString &fullName);
void appendToXMLNode(QDomElement &domElement, QDomDocument &domXMLDocument);
signals:
void configurationAdded(IConfiguration *config);
void configurationRemoved(QString fullConfigName);
private:
QList<IConfiguration *> m_configs;
};

View File

@@ -30,7 +30,7 @@
#include "configurations.h"
#include "vcprojectdocument.h"
#include "../widgets/configurationswidgets.h"
#include "../widgets/configurationseditwidget.h"
#include "../interfaces/iconfiguration.h"
#include "configurationcontainer.h"
@@ -81,8 +81,7 @@ void Configurations::processNode(const QDomNode &node)
VcNodeWidget *Configurations::createSettingsWidget()
{
ConfigurationsBaseWidget* widget = new ConfigurationsBaseWidget(this, m_vcProjDoc);
return widget;
return new ConfigurationsEditWidget(m_vcProjDoc, m_configurationContainer);
}
QDomNode Configurations::toXMLDomNode(QDomDocument &domXMLDocument) const

View File

@@ -32,6 +32,14 @@
#include "vcprojectdocument.h"
#include "configurationcontainer.h"
#include "generalattributecontainer.h"
#include "../widgets/configurationseditwidget.h"
#include "filebuildconfiguration.h"
#include "tools/toolattributes/tooldescriptiondatamanager.h"
#include "tools/tool_constants.h"
#include "../interfaces/itooldescription.h"
#include "../interfaces/itools.h"
#include "../interfaces/iconfigurationbuildtool.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <coreplugin/mimedatabase.h>
@@ -105,7 +113,7 @@ void File::processNode(const QDomNode &node)
VcNodeWidget *File::createSettingsWidget()
{
return 0;
return new ConfigurationsEditWidget(m_parentProjectDoc, m_configurationContainer);
}
QDomNode File::toXMLDomNode(QDomDocument &domXMLDocument) const
@@ -132,19 +140,6 @@ IAttributeContainer *File::attributeContainer() const
return m_attributeContainer;
}
void File::addFile(File::Ptr file)
{
if (m_files.contains(file))
return;
m_files.append(file);
}
void File::removeFile(File::Ptr file)
{
if (m_files.contains(file))
m_files.removeAll(file);
}
QString File::relativePath() const
{
return m_relativePath;
@@ -192,9 +187,25 @@ 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 Configuration(QLatin1String("FileConfiguration"));
IConfiguration *fileConfig = new FileBuildConfiguration();
fileConfig->processNode(fileConfigNode);
m_configurationContainer->addConfiguration(fileConfig);

View File

@@ -58,14 +58,14 @@ public:
ConfigurationContainer *configurationContainer() const;
IAttributeContainer *attributeContainer() const;
void addFile(File::Ptr file);
void removeFile(File::Ptr file);
QString relativePath() const;
void setRelativePath(const QString &relativePath);
IFile* clone() const;
ProjectExplorer::FileType fileType() const;
QString canonicalPath() const;
IConfiguration* createDefaultBuildConfiguration(const QString &fullConfigName) const;
private:
void processFileConfiguration(const QDomNode &fileConfigNode);
void processFile(const QDomNode &fileNode);

View File

@@ -0,0 +1,111 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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 "filebuildconfiguration.h"
#include "tools/toolattributes/tooldescriptiondatamanager.h"
#include "../interfaces/iconfigurationbuildtool.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include "../interfaces/idebuggertools.h"
#include "../interfaces/ideploymenttools.h"
#include "tools.h"
#include "tools/toolattributes/tooldescription.h"
#include "../widgets/fileconfigurationsettingswidget.h"
namespace VcProjectManager {
namespace Internal {
FileBuildConfiguration::FileBuildConfiguration()
: Configuration(QLatin1String("FileConfiguration"))
{
}
FileBuildConfiguration::FileBuildConfiguration(const FileBuildConfiguration &fileBuildConfig)
: Configuration(fileBuildConfig)
{
}
FileBuildConfiguration &FileBuildConfiguration::operator =(const FileBuildConfiguration &fileBuildConfig)
{
Configuration::operator =(fileBuildConfig);
return *this;
}
VcNodeWidget *FileBuildConfiguration::createSettingsWidget()
{
return new FileConfigurationSettingsWidget(this);
}
void FileBuildConfiguration::processToolNode(const QDomNode &toolNode)
{
if (toolNode.nodeName() == QLatin1String("Tool")) {
IConfigurationBuildTool *toolConf = 0;
QDomNamedNodeMap namedNodeMap = toolNode.toElement().attributes();
QDomNode domNode = namedNodeMap.item(0);
if (domNode.nodeType() == QDomNode::AttributeNode) {
QDomAttr domAttribute = domNode.toAttr();
if (domAttribute.name() == QLatin1String("Name")) {
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
if (tDDM) {
IToolDescription *toolDesc = tDDM->toolDescription(domAttribute.value());
if (toolDesc)
toolConf = toolDesc->createTool();
}
}
}
if (toolConf) {
toolConf->processNode(toolNode);
m_tools->configurationBuildTools()->addTool(toolConf);
}
}
else if (toolNode.nodeName() == QLatin1String("DeploymentTool")) {
DeploymentTool* deplTool = new DeploymentTool;
deplTool->processNode(toolNode);
m_tools->deploymentTools()->addTool(deplTool);
}
else {
DebuggerTool* deplTool = new DebuggerTool;
deplTool->processNode(toolNode);
m_tools->debuggerTools()->addTool(deplTool);
}
// process next sibling
QDomNode nextSibling = toolNode.nextSibling();
if (!nextSibling.isNull())
processToolNode(nextSibling);
}
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -0,0 +1,54 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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_FILEBUILDCONFIGURATION_H
#define VCPROJECTMANAGER_INTERNAL_FILEBUILDCONFIGURATION_H
#include "configuration.h"
namespace VcProjectManager {
namespace Internal {
class FileBuildConfiguration : public Configuration
{
public:
FileBuildConfiguration();
FileBuildConfiguration(const FileBuildConfiguration &fileBuildConfig);
FileBuildConfiguration& operator =(const FileBuildConfiguration &fileBuildConfig);
VcNodeWidget *createSettingsWidget();
protected:
void processToolNode(const QDomNode &toolNode);
};
} // namespace Internal
} // namespace VcProjectManager
#endif // VCPROJECTMANAGER_INTERNAL_FILEBUILDCONFIGURATION_H

View File

@@ -99,6 +99,24 @@ IConfigurationBuildTool *ConfigurationTool::clone() const
return new ConfigurationTool(*this);
}
bool ConfigurationTool::allAttributesAreDefault() const
{
for (int i = 0; i < m_sectionContainer->sectionCount(); ++i) {
IToolSection *section = m_sectionContainer->section(i);
if (section && section->attributeContainer()) {
for (int j = 0; j < section->attributeContainer()->toolAttributeCount(); ++j) {
IToolAttribute *attr = section->attributeContainer()->toolAttribute(j);
if (attr && attr->value() != attr->descriptionDataItem()->defaultValue())
return false;
}
}
}
return true;
}
void ConfigurationTool::processNodeAttributes(const QDomElement &domElement)
{
QDomNamedNodeMap namedNodeMap = domElement.attributes();

View File

@@ -60,6 +60,7 @@ public:
ISectionContainer *sectionContainer() const;
IConfigurationBuildTool *clone() const;
bool allAttributesAreDefault() const;
private:
void processNodeAttributes(const QDomElement &domElement);

View File

@@ -54,6 +54,12 @@ STRING(VCXDCMakeTool);
STRING(VCXMLDataGeneratorTool);
STRING(VCWebServiceProxyGeneratorTool);
// sections
const char CPP_PRECOMPILED_HEADERS[] = "Precompiled Headers";
// attributes
const char CPP_USE_PRECOMPILED_HEADER[] = "UsePrecompiledHeader";
} // namespace ToolConstants
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -109,16 +109,16 @@ int ToolDescriptionDataManager::toolDescriptionCount() const
return m_toolDescriptions.size();
}
ToolDescription *ToolDescriptionDataManager::toolDescription(int index) const
IToolDescription *ToolDescriptionDataManager::toolDescription(int index) const
{
if (0 <= index && index < m_toolDescriptions.size())
return m_toolDescriptions[index];
return 0;
}
ToolDescription *ToolDescriptionDataManager::toolDescription(const QString &toolKey) const
IToolDescription *ToolDescriptionDataManager::toolDescription(const QString &toolKey) const
{
foreach (ToolDescription *toolDesc, m_toolDescriptions) {
foreach (IToolDescription *toolDesc, m_toolDescriptions) {
if (toolDesc->toolKey() == toolKey)
return toolDesc;
}
@@ -202,14 +202,14 @@ void ToolDescriptionDataManager::processXMLDoc(const QDomDocument &xmlDoc)
void ToolDescriptionDataManager::processDomNode(const QDomNode &node)
{
ToolDescription *toolDesc = readToolDescription(node);
IToolDescription *toolDesc = readToolDescription(node);
m_toolDescriptions.append(toolDesc);
if (node.hasChildNodes())
processToolSectionNode(toolDesc, node.firstChild());
}
void ToolDescriptionDataManager::processToolSectionNode(ToolDescription *toolDescription, const QDomNode &domNode)
void ToolDescriptionDataManager::processToolSectionNode(IToolDescription *toolDescription, const QDomNode &domNode)
{
if (domNode.nodeName() == QLatin1String("Section")) {
ToolSectionDescription *toolSectionDesc = new ToolSectionDescription;
@@ -391,7 +391,7 @@ void ToolDescriptionDataManager::processToolAttributeDescriptions(ToolSectionDes
processToolAttributeDescriptions(toolSectDesc, nextSibling);
}
ToolDescription *ToolDescriptionDataManager::readToolDescription(const QDomNode &domNode)
IToolDescription *ToolDescriptionDataManager::readToolDescription(const QDomNode &domNode)
{
QDomNode tempNode = domNode;

View File

@@ -40,7 +40,7 @@ namespace VcProjectManager {
namespace Internal {
class IAttributeDescriptionDataItem;
class ToolDescription;
class IToolDescription;
class ToolSectionDescription;
struct ToolInfo {
@@ -68,8 +68,8 @@ public:
~ToolDescriptionDataManager();
int toolDescriptionCount() const;
ToolDescription* toolDescription(int index) const;
ToolDescription* toolDescription(const QString &toolKey) const;
IToolDescription* toolDescription(int index) const;
IToolDescription* toolDescription(const QString &toolKey) const;
static ToolInfo readToolInfo(const QString &filePath, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);
@@ -78,11 +78,11 @@ private:
void readAttributeDataFromFile(const QString &filePath);
void processXMLDoc(const QDomDocument &xmlDoc);
void processDomNode(const QDomNode &node);
void processToolSectionNode(ToolDescription *toolDescription, const QDomNode &domNode);
void processToolSectionNode(IToolDescription *toolDescription, const QDomNode &domNode);
void processToolAttributeDescriptions(ToolSectionDescription *toolSectDesc, const QDomNode &domNode);
ToolDescription* readToolDescription(const QDomNode &domNode);
IToolDescription* readToolDescription(const QDomNode &domNode);
QList<ToolDescription *> m_toolDescriptions;
QList<IToolDescription *> m_toolDescriptions;
static ToolDescriptionDataManager *m_instance;
};

View File

@@ -34,6 +34,7 @@
#include "files.h"
#include "filecontainer.h"
#include "../vcprojectmanagerconstants.h"
#include "widgets/filesettingswidget.h"
#include <QFileInfo>
#include <projectexplorer/projectexplorer.h>
@@ -47,12 +48,22 @@ VcFileNode::VcFileNode(IFile *fileModel, VcDocProjectNode *vcDocProject)
m_vcFileModel(fileModel)
{
Q_UNUSED(vcDocProject)
connect(this, SIGNAL(settingsDialogAccepted()), vcDocProject, SIGNAL(settingsDialogAccepted()));
}
VcFileNode::~VcFileNode()
{
}
void VcFileNode::showSettingsWidget()
{
FileSettingsWidget *settingsWidget = new FileSettingsWidget(m_vcFileModel);
if (settingsWidget) {
settingsWidget->show();
connect(settingsWidget, SIGNAL(accepted()), this, SIGNAL(settingsDialogAccepted()));
}
}
void VcFileNode::readChildren(VcDocProjectNode *vcDocProj)
{
Q_UNUSED(vcDocProj)
@@ -457,7 +468,7 @@ void VcDocProjectNode::addFileContainerNode(const QString &name, VcFileContainer
m_vcProjectModel);
else
fileContainer = new FileContainer(QLatin1String(Constants::VC_PROJECT_FILE_CONTAINER_FOLDER),
m_vcProjectModel);
m_vcProjectModel);
fileContainer->setDisplayName(name);
VcFileContainerNode *folderNode = new VcFileContainerNode(fileContainer, this);
@@ -554,6 +565,18 @@ void VcDocProjectNode::removeFileContainerNode(VcFileContainerNode *fileContaine
m_vcProjectModel->saveToFile(m_vcProjectModel->filePath());
}
void VcDocProjectNode::showSettingsDialog()
{
if (m_vcProjectModel) {
VcProjectDocumentWidget *settingsWidget = static_cast<VcProjectDocumentWidget *>(m_vcProjectModel->createSettingsWidget());
if (settingsWidget) {
settingsWidget->show();
connect(settingsWidget, SIGNAL(accepted()), this, SIGNAL(settingsDialogAccepted()));
}
}
}
VcFileNode *VcDocProjectNode::findFileNode(const QString &filePath)
{
VcFileNode *fileNode = static_cast<VcFileNode *>(findFile(filePath));

View File

@@ -52,10 +52,14 @@ class VcFileNode : public ProjectExplorer::FileNode
public:
VcFileNode(IFile *fileModel, VcDocProjectNode *vcDocProject);
~VcFileNode();
void showSettingsWidget();
protected:
void readChildren(VcDocProjectNode *vcDocProj);
signals:
void settingsDialogAccepted();
private:
IFile *m_vcFileModel;
};
@@ -133,6 +137,10 @@ public:
bool appendFileNode(VcFileNode *fileNode);
void removeFileNode(VcFileNode *fileNode);
void removeFileContainerNode(VcFileContainerNode *fileContainerNode);
void showSettingsDialog();
signals:
void settingsDialogAccepted();
private:
VcFileNode* findFileNode(const QString &filePath);

View File

@@ -39,10 +39,16 @@
#include <coreplugin/mainwindow.h>
#include "../widgets/projectsettingswidget.h"
#include "../widgets/configurationswidgets.h"
#include "../widgets/configurationseditwidget.h"
#include "configurationcontainer.h"
#include "../interfaces/iattributecontainer.h"
#include "generalattributecontainer.h"
#include "tools/tool_constants.h"
#include "tools/toolattributes/tooldescriptiondatamanager.h"
#include "../interfaces/itooldescription.h"
#include "../interfaces/iconfigurationbuildtool.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include "../interfaces/itools.h"
namespace VcProjectManager {
namespace Internal {
@@ -198,6 +204,22 @@ void VcProjectDocument::parseProcessingInstruction(const QDomProcessingInstructi
m_processingInstructionTarget = processingInstruction.target();
}
void VcProjectDocument::addToolToConfiguration(IConfiguration *config, const QString &toolKey) const
{
if (!config || !config->tools() || !config->tools()->configurationBuildTools() || toolKey.isEmpty())
return;
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
IToolDescription *toolDesc = tDDM->toolDescription(toolKey);
if (toolDesc) {
IConfigurationBuildTool *tool = toolDesc->createTool();
if (tool)
config->tools()->configurationBuildTools()->addTool(tool);
}
}
void VcProjectDocument::processDocumentAttributes(const QDomElement &vsNode)
{
QDomNamedNodeMap namedNodeMap = vsNode.attributes();
@@ -267,6 +289,27 @@ VcNodeWidget *VcProjectDocument::createSettingsWidget()
return new VcProjectDocumentWidget(this);
}
IConfiguration *VcProjectDocument::createDefaultBuildConfiguration(const QString &fullConfigName) const
{
IConfiguration *newConfig = new Configuration(QLatin1String("Configuration"));
newConfig->setFullName(fullConfigName);
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCCLCompilerTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCLinkerTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCManifestTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCXDCMakeTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCBscMakeTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCPreBuildEventTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCPreLinkEventTool));
addToolToConfiguration(newConfig, QLatin1String(ToolConstants::strVCPostBuildEventTool));
newConfig->attributeContainer()->setAttribute(QLatin1String("OutputDirectory"), QLatin1String("$(SolutionDir)$(ConfigurationName)"));
newConfig->attributeContainer()->setAttribute(QLatin1String("IntermediateDirectory"), QLatin1String("$(ConfigurationName)"));
newConfig->attributeContainer()->setAttribute(QLatin1String("ConfigurationType"), QLatin1String("1"));
return newConfig;
}
void VcProjectDocument::processDocumentNode(const QDomNode &node)
{
if (node.isNull())
@@ -300,10 +343,10 @@ void VcProjectDocument::processDocumentNode(const QDomNode &node)
VcProjectDocumentWidget::VcProjectDocumentWidget(VcProjectDocument *vcDoc)
: m_vcDoc(vcDoc)
{
ProjectSettingsWidget *projectSettingsWidget = new ProjectSettingsWidget(m_vcDoc, this);
ProjectSettingsWidget *projectSettingsWidget = new ProjectSettingsWidget(this);
// add Configurations
m_configurationsWidget = static_cast<ConfigurationsBaseWidget *>(m_vcDoc->configurations()->createSettingsWidget());
m_configurationsWidget = static_cast<ConfigurationsEditWidget *>(m_vcDoc->configurations()->createSettingsWidget());
projectSettingsWidget->addWidget(tr("Configurations"), m_configurationsWidget);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);

View File

@@ -46,7 +46,7 @@
namespace VcProjectManager {
namespace Internal {
class ConfigurationsBaseWidget;
class ConfigurationsEditWidget;
class VcProjectDocument : public IVisualStudioProject
{
@@ -70,6 +70,7 @@ public:
IPublishingData *publishingData() const;
IAttributeContainer* attributeContainer() const;
VcNodeWidget *createSettingsWidget();
IConfiguration* createDefaultBuildConfiguration(const QString &fullConfigName) const;
protected:
void processDocumentNode(const QDomNode &node);
@@ -78,6 +79,7 @@ protected:
QDomElement toVcDocumentElement(QDomDocument &domXMLDocument) const;
void parseProcessingInstruction(const QDomProcessingInstruction &processingInstruction);
void addToolToConfiguration(IConfiguration *config, const QString &toolKey) const;
QString m_filePath; // used to store path to a file
@@ -114,7 +116,7 @@ signals:
protected:
VcProjectDocument *m_vcDoc;
ConfigurationsBaseWidget *m_configurationsWidget;
ConfigurationsEditWidget *m_configurationsWidget;
};
} // namespace Internal

View File

@@ -104,6 +104,18 @@ const char VS_PROJECT_TARGET_ZONE [] = "TargetZone";
const char VS_PROJECT_EXCLUDED_PERMISSIONS [] = "ExcludedPermissions";
const char VS_PROJECT_TARGET_FRAMEWORK_VERSION [] = "TargetFrameworkVersion";
// Configuration Attributes
const char VS_PROJECT_CONFIG_EXCLUDED [] = "ExcludedFromBuild";
// Tools
const char TOOL_CPP_C_COMPILER [] = "VCCLCompilerTool";
const char TOOL_CUSTOM [] = "VCCustomBuildTool";
const char TOOL_MIDL [] = "VCMIDLTool";
const char TOOL_RESOURCE_COMPILER [] = "VCResourceCompilerTool";
const char TOOL_MANAGED_RESOURCE_COMPILER [] = "VCManagedResourceCompilerTool";
const char TOOL_WEB_SERVICE_PROXY_GENERATOR [] = "VCWebServiceProxyGeneratorTool";
const char TOOL_XML_DATA_PROXY_GENERATOR [] = "VCXMLDataGeneratorTool";
} // VcDocConstants
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -44,7 +44,8 @@ HEADERS += \
vcprojectmodel/deploymenttools.h \
vcprojectmodel/tools.h \
vcprojectmodel/debuggertools.h \
vcprojectmodel/filecontainer.h
vcprojectmodel/filecontainer.h \
vcprojectmodel/filebuildconfiguration.h
SOURCES += \
vcprojectmodel/vcprojectdocument.cpp \
@@ -89,7 +90,8 @@ SOURCES += \
vcprojectmodel/deploymenttools.cpp \
vcprojectmodel/tools.cpp \
vcprojectmodel/debuggertools.cpp \
vcprojectmodel/filecontainer.cpp
vcprojectmodel/filecontainer.cpp \
vcprojectmodel/filebuildconfiguration.cpp
OTHER_FILES += \
vcprojectmodel/tools/xml_definitions/VCXMLDataGeneratorTool.xml \

View File

@@ -27,7 +27,7 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "configurationwidgets.h"
#include "configurationbasewidget.h"
#include <QSplitter>
#include <QListWidget>
@@ -43,7 +43,7 @@
namespace VcProjectManager {
namespace Internal {
ConfigurationBaseWidget::ConfigurationBaseWidget(Configuration *config)
ConfigurationBaseWidget::ConfigurationBaseWidget(IConfiguration *config)
: m_config(config)
{
QSplitter *mainWidgetSplitter = new QSplitter(Qt::Horizontal, this);

View File

@@ -45,7 +45,7 @@ class ConfigurationBaseWidget : public VcNodeWidget
{
Q_OBJECT
public:
explicit ConfigurationBaseWidget(Configuration *config);
explicit ConfigurationBaseWidget(IConfiguration *config);
~ConfigurationBaseWidget();
void saveData();
@@ -53,7 +53,7 @@ protected:
QListWidget *m_listWidget;
QStackedWidget *m_stackWidget;
Configuration* m_config;
IConfiguration* m_config;
QList<VcNodeWidget *> m_toolWidgets;
};

View File

@@ -0,0 +1,372 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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 "configurationseditwidget.h"
#include <QVBoxLayout>
#include "../vcprojectmodel/configurationcontainer.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include "../interfaces/iconfigurationbuildtool.h"
#include "../interfaces/itools.h"
#include "../interfaces/iconfiguration.h"
#include "../interfaces/iconfigurations.h"
#include "../interfaces/iattributecontainer.h"
#include "../interfaces/iplatform.h"
#include "../interfaces/iplatforms.h"
#include "../interfaces/ifile.h"
#include "../interfaces/ifiles.h"
#include "../interfaces/ifilecontainer.h"
#include "../interfaces/ivisualstudioproject.h"
#include "../interfaces/itooldescription.h"
#include "../vcprojectmodel/configuration.h"
#include "../vcprojectmodel/tools/tool_constants.h"
#include "configurationswidget.h"
#include "../vcprojectmodel/tools/toolattributes/tooldescriptiondatamanager.h"
namespace VcProjectManager {
namespace Internal {
ConfigurationsEditWidget::ConfigurationsEditWidget(VcProjectManager::Internal::IVisualStudioProject *vsProj, ConfigurationContainer *configContainer)
: m_vsProject(vsProj)
{
m_configsWidget = new ConfigurationsWidget;
m_buildConfigurations = new ConfigurationContainer(*(m_vsProject->configurations()->configurationContainer()));
if (configContainer == m_vsProject->configurations()->configurationContainer()) {
connect(m_buildConfigurations, SIGNAL(configurationAdded(IConfiguration*)), this, SLOT(addConfigWidget(IConfiguration*)));
for (int i = 0; i < m_buildConfigurations->configurationCount(); ++i) {
IConfiguration *config = m_buildConfigurations->configuration(i);
if (config)
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
}
}
readFileBuildConfigurations(configContainer);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->addWidget(m_configsWidget);
setLayout(layout);
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)));
}
ConfigurationsEditWidget::~ConfigurationsEditWidget()
{
delete m_buildConfigurations;
QList<ConfigurationContainer *> fileConfigurations = m_fileConfigurations.values();
qDeleteAll(fileConfigurations);
}
void ConfigurationsEditWidget::saveData()
{
ConfigurationContainer *configContainer = m_vsProject->configurations()->configurationContainer();
*configContainer = *m_buildConfigurations;
QMapIterator<IFile *, ConfigurationContainer *> it(m_fileConfigurations);
while (it.hasNext()) {
it.next();
IFile *file = it.key();
ConfigurationContainer *newConfigCont = it.value();
if (containsNonDefaultConfiguration(newConfigCont)) {
ConfigurationContainer *oldConfigContainer = file->configurationContainer();
*oldConfigContainer = *newConfigCont;
}
}
}
void ConfigurationsEditWidget::onAddNewConfig(QString newConfigName, QString copyFrom)
{
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 = copyFromConfigName + QLatin1Char('|') + platform->displayName();
addConfigToProjectBuild(newFullConfigName, copyFromFullConfigName);
addConfigToFiles(newFullConfigName, copyFromFullConfigName);
}
}
}
void ConfigurationsEditWidget::onNewConfigAdded(IConfiguration *config)
{
if (config)
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
}
void ConfigurationsEditWidget::onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform)
{
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 ConfigurationsEditWidget::onRemoveConfig(QString configNameWithPlatform)
{
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 ConfigurationsEditWidget::addConfigWidget(IConfiguration *config)
{
if (config)
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
}
void ConfigurationsEditWidget::readFileBuildConfigurations(ConfigurationContainer *configContainer)
{
if (!configContainer)
return;
IFiles *files = m_vsProject->files();
for (int i = 0; i < files->fileContainerCount(); ++i) {
IFileContainer *fileContainer = files->fileContainer(i);
readFileBuildConfigurations(fileContainer, configContainer);
}
for (int i = 0; i < files->fileCount(); ++i) {
IFile *file = files->file(i);
readFileBuildConfigurations(file, configContainer);
}
}
void ConfigurationsEditWidget::readFileBuildConfigurations(IFileContainer *container, ConfigurationContainer *configContainer)
{
if (!container || !configContainer)
return;
for (int i = 0; i < container->childCount(); ++i) {
IFileContainer *fileContainer = container->fileContainer(i);
readFileBuildConfigurations(fileContainer, configContainer);
}
for (int i = 0; i < container->fileCount(); ++i) {
IFile *file = container->file(i);
readFileBuildConfigurations(file, configContainer);
}
}
void ConfigurationsEditWidget::readFileBuildConfigurations(IFile *file, ConfigurationContainer *configContainer)
{
if (!file)
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));
}
}
void ConfigurationsEditWidget::addConfigToProjectBuild(const QString &newConfigName, const QString &copyFrom)
{
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 ConfigurationsEditWidget::addConfigToFiles(const QString &newConfigName, const QString &copyFrom)
{
QMapIterator<IFile *, ConfigurationContainer *> it(m_fileConfigurations);
while (it.hasNext()) {
it.next();
ConfigurationContainer *container = it.value();
if (copyFrom.isEmpty()) {
IFile *file = it.key();
IConfiguration *newConfig = file->createDefaultBuildConfiguration(newConfigName);
container->addConfiguration(newConfig);
} else {
IConfiguration *config = container->configuration(copyFrom);
if (config) {
IConfiguration *newConfig = config->clone();
if (newConfig) {
newConfig->setFullName(newConfigName);
container->addConfiguration(newConfig);
}
}
}
}
}
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

View File

@@ -27,60 +27,58 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CONFIGURATIONS2003WIDGET_H
#define CONFIGURATIONS2003WIDGET_H
#ifndef VCPROJECTMANAGER_INTERNAL_CONFIGURATIONSEDITWIDGET_H
#define VCPROJECTMANAGER_INTERNAL_CONFIGURATIONSEDITWIDGET_H
#include "vcnodewidget.h"
#include "../vcprojectmodel/configuration.h"
#include <QList>
#include <QMap>
namespace VcProjectManager {
namespace Internal {
class Configurations;
class Configuration;
class VcProjectDocument;
class IVisualStudioProject;
class ConfigurationsWidget;
class IConfiguration;
class ConfigurationContainer;
class IFile;
class IFileContainer;
class ConfigurationsBaseWidget : public VcNodeWidget
class ConfigurationsEditWidget : public VcNodeWidget
{
Q_OBJECT
public:
explicit ConfigurationsBaseWidget(Configurations *configs, VcProjectDocument *vcProjDoc);
~ConfigurationsBaseWidget();
ConfigurationsEditWidget(IVisualStudioProject *vsProj, ConfigurationContainer *configContainer);
~ConfigurationsEditWidget();
void saveData();
private slots:
void onAddNewConfig(QString newConfigName, QString copyFrom);
void onNewConfigAdded(IConfiguration *config);
void onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform);
void onRemoveConfig(QString configNameWithPlatform);
protected:
void addConfiguration(IConfiguration *config);
void removeConfiguration(IConfiguration *config);
IConfiguration* createConfiguration(const QString &configNameWithPlatform) const;
IConfiguration* configInNewConfigurations(const QString &configNameWithPlatform) const;
void addConfigurationToFiles(const QString &copyFromConfig, const QString &targetConfigName);
void addConfigurationToFilesInFilter(IFileContainer *filterPtr, const QString &copyFromConfig, const QString &targetConfigName);
void addConfigurationToFile(IFile *filePtr, const QString &copyFromConfig, const QString &targetConfigName);
void addConfigWidget(IConfiguration *config);
Configurations *m_configs;
VcProjectDocument *m_vcProjDoc;
private:
void readFileBuildConfigurations(ConfigurationContainer *configContainer);
void readFileBuildConfigurations(IFileContainer *container, ConfigurationContainer *configContainer);
void readFileBuildConfigurations(IFile *file, ConfigurationContainer *configContainer);
void addConfigToProjectBuild(const QString &newConfigName, const QString &copyFrom);
void addConfigToFiles(const QString &newConfigName, const QString &copyFrom);
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;
QList<IConfiguration *> m_newConfigurations;
QList<QString> m_removedConfigurations;
QMap<IConfiguration*, QString> m_renamedConfigurations; // <oldName, newName>
QHash<IFile*, QList<IConfiguration*> > m_newFilesConfigurations;
QMap<IFile*, ConfigurationContainer*> m_fileConfigurations;
ConfigurationContainer *m_buildConfigurations;
};
} // namespace Internal
} // namespace VcProjectManager
} // Internal
} // VcProjectManager
#endif // CONFIGURATIONS2003WIDGET_H
#endif // VCPROJECTMANAGER_INTERNAL_CONFIGURATIONSEDITWIDGET_H

View File

@@ -32,7 +32,7 @@
#include "newconfigitemdialog.h"
#include "vcenternamedialog.h"
#include "configurationwidgets.h"
#include "configurationbasewidget.h"
namespace VcProjectManager {
namespace Internal {

View File

@@ -1,333 +0,0 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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 "configurationswidgets.h"
#include <QVBoxLayout>
#include "configurationswidget.h"
#include "../vcprojectmodel/configurations.h"
#include "../vcprojectmodel/vcprojectdocument.h"
#include "../vcprojectmodel/configurationcontainer.h"
#include "../vcprojectmodel/configuration.h"
#include "../vcprojectmodel/tools/toolattributes/tooldescription.h"
#include "../vcprojectmodel/tools/toolattributes/tooldescriptiondatamanager.h"
#include "configurationwidgets.h"
#include "../vcprojectmodel/files.h"
#include "../vcprojectmodel/file.h"
#include "../interfaces/iattributecontainer.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include "../interfaces/itools.h"
namespace VcProjectManager {
namespace Internal {
ConfigurationsBaseWidget::ConfigurationsBaseWidget(Configurations *configs, VcProjectDocument *vcProjDoc)
: m_configs(configs),
m_vcProjDoc(vcProjDoc)
{
m_configsWidget = new ConfigurationsWidget;
if (m_configs) {
for (int i = 0; i < m_configs->configurationContainer()->configurationCount(); ++i) {
IConfiguration *config = m_configs->configurationContainer()->configuration(i);
if (config)
addConfiguration(config);
}
}
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->addWidget(m_configsWidget);
setLayout(layout);
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)));
}
ConfigurationsBaseWidget::~ConfigurationsBaseWidget()
{
}
void ConfigurationsBaseWidget::saveData()
{
// remove deleted configurations
foreach (const QString &removeConfigName, m_removedConfigurations) {
IConfiguration *foundConfig = m_configs->configurationContainer()->configuration(removeConfigName);
if (foundConfig)
m_configs->configurationContainer()->removeConfiguration(foundConfig->fullName());
}
// rename configurations that were renamed
QMapIterator<IConfiguration*, QString> it(m_renamedConfigurations);
while (it.hasNext()) {
it.next();
IConfiguration *config = it.key();
config->setFullName(it.value());
}
// add new configurations
foreach (IConfiguration *newConfig, m_newConfigurations)
m_configs->configurationContainer()->addConfiguration(newConfig);
QHashIterator<IFile*, QList<IConfiguration*> > fileConfigIt(m_newFilesConfigurations);
while (fileConfigIt.hasNext()) {
fileConfigIt.next();
foreach (IConfiguration *newFileConfig, fileConfigIt.value())
fileConfigIt.key()->configurationContainer()->addConfiguration(newFileConfig);
}
// save data for every configuration
QList<ConfigurationBaseWidget *> configWidgets = m_configsWidget->configWidgets();
foreach (ConfigurationBaseWidget *configWidget, configWidgets) {
if (configWidget)
configWidget->saveData();
}
}
void ConfigurationsBaseWidget::onAddNewConfig(QString newConfigName, QString copyFrom)
{
IPlatforms *platforms = m_vcProjDoc->platforms();
if (platforms && !newConfigName.isEmpty()) {
if (copyFrom.isEmpty()) {
for (int i = 0; i < platforms->platformCount(); ++i) {
IPlatform *platform = platforms->platform(i);
IConfiguration *newConfig = createConfiguration(newConfigName + QLatin1Char('|') + platform->displayName());
if (newConfig) {
newConfig->attributeContainer()->setAttribute(QLatin1String("OutputDirectory"), QLatin1String("$(SolutionDir)$(ConfigurationName)"));
newConfig->attributeContainer()->setAttribute(QLatin1String("IntermediateDirectory"), QLatin1String("$(ConfigurationName)"));
newConfig->attributeContainer()->setAttribute(QLatin1String("ConfigurationType"), QLatin1String("1"));
m_newConfigurations.append(newConfig);
addConfiguration(newConfig);
}
}
} else {
IConfiguration *config = m_configs->configurationContainer()->configuration(copyFrom);
if (config) {
for (int i = 0; i < platforms->platformCount(); ++i) {
IPlatform *platform = platforms->platform(i);
IConfiguration* newConfig = config->clone();
if (newConfig) {
newConfig->setFullName(newConfigName + QLatin1Char('|') + platform->displayName());
m_newConfigurations.append(newConfig);
addConfiguration(newConfig);
}
addConfigurationToFiles(copyFrom, newConfigName + QLatin1Char('|') + platform->displayName());
}
}
}
}
}
void ConfigurationsBaseWidget::onRenameConfig(QString newConfigName, QString oldConfigNameWithPlatform)
{
IPlatforms *platforms = m_vcProjDoc->platforms();
if (!platforms || newConfigName.isEmpty() || oldConfigNameWithPlatform.isEmpty())
return;
QStringList splits = oldConfigNameWithPlatform.split(QLatin1Char('|'));
if (splits.isEmpty())
return;
for (int i = 0; i < platforms->platformCount(); ++i) {
IPlatform *platform = platforms->platform(i);
QString targetConfigName = splits[0] + QLatin1Char('|') + platform->displayName();
QString newName = newConfigName + QLatin1Char('|') + platform->displayName();
IConfiguration *configInNew = configInNewConfigurations(targetConfigName);
// if we are renaming newly added config
if (configInNew) {
configInNew->setFullName(newName);
} else {
// we are renaming a config that is already in the model
bool targetAlreadyExists = false;
QMapIterator<IConfiguration*, QString> it(m_renamedConfigurations);
while (it.hasNext()) {
it.next();
if (it.value() == targetConfigName) {
IConfiguration* key = m_renamedConfigurations.key(targetConfigName);
if (key) {
m_renamedConfigurations.insert(key, newName);
targetAlreadyExists = true;
break;
}
}
}
if (!targetAlreadyExists) {
IConfiguration *config = m_configs->configurationContainer()->configuration(targetConfigName);
if (config)
m_renamedConfigurations.insert(config, newName);
}
}
m_configsWidget->renameConfiguration(newName, targetConfigName);
}
}
void ConfigurationsBaseWidget::onRemoveConfig(QString configNameWithPlatform)
{
IPlatforms *platforms = m_vcProjDoc->platforms();
if (!platforms || configNameWithPlatform.isEmpty())
return;
QStringList splits = configNameWithPlatform.split(QLatin1Char('|'));
if (splits.isEmpty())
return;
for (int i = 0; i < platforms->platformCount(); ++i) {
IPlatform *platform = platforms->platform(i);
QString targetConfigName = splits[0] + QLatin1Char('|') + platform->displayName();
IConfiguration *config = m_configs->configurationContainer()->configuration(targetConfigName);
// if config exists in the document model, add it to remove list
if (config) {
removeConfiguration(config);
m_removedConfigurations.append(config->fullName());
} else {
// else remove it from the list of newly added configurations
foreach (IConfiguration *configPtr, m_newConfigurations) {
if (configPtr && configPtr->fullName() == targetConfigName) {
removeConfiguration(configPtr);
m_newConfigurations.removeAll(configPtr);
break;
}
}
}
}
}
void ConfigurationsBaseWidget::addConfiguration(IConfiguration *config)
{
if (config)
m_configsWidget->addConfiguration(config->fullName(), config->createSettingsWidget());
}
void ConfigurationsBaseWidget::removeConfiguration(IConfiguration *config)
{
if (config)
m_configsWidget->removeConfiguration(config->fullName());
}
IConfiguration *ConfigurationsBaseWidget::createConfiguration(const QString &configNameWithPlatform) const
{
IConfiguration *config = new Configuration(QLatin1String("Configuration"));
config->setFullName(configNameWithPlatform);
ToolDescriptionDataManager *tDDM = ToolDescriptionDataManager::instance();
if (tDDM) {
for (int i = 0; i < tDDM->toolDescriptionCount(); ++i) {
ToolDescription *toolDesc = tDDM->toolDescription(i);
if (toolDesc) {
IConfigurationBuildTool *configTool = toolDesc->createTool();
if (configTool)
config->tools()->configurationBuildTools()->addTool(configTool);
}
}
}
return config;
}
IConfiguration *ConfigurationsBaseWidget::configInNewConfigurations(const QString &configNameWithPlatform) const
{
foreach (IConfiguration *config, m_newConfigurations) {
if (config && config->fullName() == configNameWithPlatform)
return config;
}
return 0;
}
void ConfigurationsBaseWidget::addConfigurationToFiles(const QString &copyFromConfig, const QString &targetConfigName)
{
IFiles *docFiles = m_vcProjDoc->files();
if (docFiles) {
for (int i = 0; i < docFiles->fileContainerCount(); ++i) {
IFileContainer *fileContainer = docFiles->fileContainer(i);
if (fileContainer)
addConfigurationToFilesInFilter(fileContainer, copyFromConfig, targetConfigName);
}
for (int i = 0; i < docFiles->fileCount(); ++i) {
IFile *file = docFiles->file(i);
if (file)
addConfigurationToFile(file, copyFromConfig, targetConfigName);
}
}
}
void ConfigurationsBaseWidget::addConfigurationToFilesInFilter(IFileContainer *filterPtr, const QString &copyFromConfig, const QString &targetConfigName)
{
for (int i = 0; i < filterPtr->childCount(); ++i) {
IFileContainer *fileContainer = filterPtr->fileContainer(i);
if (fileContainer)
addConfigurationToFilesInFilter(fileContainer, copyFromConfig, targetConfigName);
}
for (int i = 0; i < filterPtr->fileCount(); ++i) {
IFile *file = filterPtr->file(i);
if (file)
addConfigurationToFile(file, copyFromConfig, targetConfigName);
}
}
void ConfigurationsBaseWidget::addConfigurationToFile(IFile *filePtr, const QString &copyFromConfig, const QString &targetConfigName)
{
IConfiguration *configPtr = filePtr->configurationContainer()->configuration(copyFromConfig);
if (configPtr) {
IConfiguration *newConfig = configPtr->clone();
newConfig->setFullName(targetConfigName);
m_newFilesConfigurations[filePtr].append(newConfig);
}
}
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -0,0 +1,169 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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 "fileconfigurationsettingswidget.h"
#include "ui_fileconfigurationsettingswidget.h"
#include "../vcprojectmodel/tools/toolattributes/tooldescriptiondatamanager.h"
#include "../interfaces/itooldescription.h"
#include "../interfaces/iconfigurationbuildtool.h"
#include "../interfaces/iconfigurationbuildtools.h"
#include "../interfaces/iconfiguration.h"
#include "../interfaces/itools.h"
#include "../interfaces/iattributecontainer.h"
#include "../vcprojectmodel/vcprojectdocument_constants.h"
namespace VcProjectManager {
namespace Internal {
FileConfigurationSettingsWidget::FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, QWidget *parent) :
VcNodeWidget(parent),
ui(new Ui::FileConfigurationSettingsWidget),
m_fileBuildConfig(fileBuildConfig),
m_configBuildTool(0)
{
ui->setupUi(this);
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) {
QVBoxLayout *layout = new QVBoxLayout;
m_toolSettingsWidget = m_configBuildTool->createSettingsWidget();
layout->addWidget(m_toolSettingsWidget);
ui->m_toolWidget->setLayout(layout);
}
}
QString excludeFromBuild = m_fileBuildConfig->attributeContainer()->attributeValue(QLatin1String(VcDocConstants::VS_PROJECT_CONFIG_EXCLUDED));
if (excludeFromBuild.isEmpty() || excludeFromBuild == QLatin1String("false"))
ui->m_excludedFromBuild->setCurrentIndex(0);
else
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));
toolDesc = tDDM->toolDescription(QLatin1String(VcDocConstants::TOOL_CUSTOM));
if (toolDesc)
ui->m_tool->addItem(toolDesc->toolDisplayName(), QLatin1String(VcDocConstants::TOOL_CUSTOM));
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);
connect(ui->m_tool, SIGNAL(currentIndexChanged(int)), this, SLOT(changeTool(int)));
}
FileConfigurationSettingsWidget::~FileConfigurationSettingsWidget()
{
delete ui;
}
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);
m_toolSettingsWidget->saveData();
}
}
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;
}
}
delete oldConfigBuildTool;
}
int FileConfigurationSettingsWidget::toolIndex(const QString &toolKey)
{
for (int i = 0; i < ui->m_tool->count(); ++i) {
if (ui->m_tool->itemData(i).toString() == toolKey)
return i;
}
return -1;
}
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -0,0 +1,71 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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_FILECONFIGURATIONSETTINGSWIDGET_H
#define VCPROJECTMANAGER_INTERNAL_FILECONFIGURATIONSETTINGSWIDGET_H
#include <QWidget>
#include "vcnodewidget.h"
namespace VcProjectManager {
namespace Internal {
namespace Ui {
class FileConfigurationSettingsWidget;
}
class IConfiguration;
class IConfigurationBuildTool;
class IVisualStudioProject;
class FileConfigurationSettingsWidget : public VcNodeWidget
{
Q_OBJECT
public:
explicit FileConfigurationSettingsWidget(IConfiguration *fileBuildConfig, QWidget *parent = 0);
~FileConfigurationSettingsWidget();
void saveData();
private slots:
void changeTool(int index);
int toolIndex(const QString &toolKey);
private:
Ui::FileConfigurationSettingsWidget *ui;
IConfiguration *m_fileBuildConfig;
IConfigurationBuildTool *m_configBuildTool;
VcNodeWidget *m_toolSettingsWidget;
};
} // namespace Internal
} // namespace VcProjectManager
#endif // VCPROJECTMANAGER_INTERNAL_FILECONFIGURATIONSETTINGSWIDGET_H

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VcProjectManager::Internal::FileConfigurationSettingsWidget</class>
<widget class="QWidget" name="VcProjectManager::Internal::FileConfigurationSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>361</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Excluded From Build:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_excludedFromBuild">
<property name="minimumSize">
<size>
<width>121</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>No</string>
</property>
</item>
<item>
<property name="text">
<string>Yes</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tool:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_tool">
<property name="minimumSize">
<size>
<width>161</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="m_toolWidget" native="true"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,77 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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 "filesettingswidget.h"
#include "projectsettingswidget.h"
#include "../interfaces/ifile.h"
#include "../widgets/configurationseditwidget.h"
#include <QVBoxLayout>
namespace VcProjectManager {
namespace Internal {
FileSettingsWidget::FileSettingsWidget(IFile *file, QWidget *parent)
: VcNodeWidget(parent)
{
ProjectSettingsWidget *projectSettingsWidget = new ProjectSettingsWidget(this);
// add Configurations
m_configurationsWidget = static_cast<ConfigurationsEditWidget *>(file->createSettingsWidget());
projectSettingsWidget->addWidget(tr("Configurations"), m_configurationsWidget);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->addWidget(projectSettingsWidget);
setLayout(layout);
connect(projectSettingsWidget, SIGNAL(okButtonClicked()), this, SLOT(onOkButtonClicked()));
connect(projectSettingsWidget, SIGNAL(cancelButtonClicked()), this, SLOT(onCancelButtonClicked()));
}
void FileSettingsWidget::saveData()
{
m_configurationsWidget->saveData();
}
void FileSettingsWidget::onOkButtonClicked()
{
saveData();
hide();
emit accepted();
deleteLater();
}
void FileSettingsWidget::onCancelButtonClicked()
{
hide();
deleteLater();
}
} // namespace Internal
} // namespace VcProjectManager

View File

@@ -0,0 +1,63 @@
/**************************************************************************
**
** Copyright (c) 2013 Bojan Petrovic
** Copyright (c) 2013 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_FILESETTINGSWIDGET_H
#define VCPROJECTMANAGER_INTERNAL_FILESETTINGSWIDGET_H
#include "vcnodewidget.h"
namespace VcProjectManager {
namespace Internal {
class IFile;
class ConfigurationsEditWidget;
class FileSettingsWidget : public VcNodeWidget
{
Q_OBJECT
public:
FileSettingsWidget(IFile *file, QWidget *parent = 0);
void saveData();
private slots:
void onOkButtonClicked();
void onCancelButtonClicked();
signals:
void accepted();
private:
ConfigurationsEditWidget *m_configurationsWidget;
};
} // namespace Internal
} // namespace VcProjectManager
#endif // VCPROJECTMANAGER_INTERNAL_FILESETTINGSWIDGET_H

View File

@@ -39,10 +39,9 @@
namespace VcProjectManager {
namespace Internal {
ProjectSettingsWidget::ProjectSettingsWidget(VcProjectDocument *vcProjDoc, QWidget *parent) :
ProjectSettingsWidget::ProjectSettingsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ProjectSettingsWidget),
m_vcProjDocModel(vcProjDoc)
ui(new Ui::ProjectSettingsWidget)
{
ui->setupUi(this);
m_widgetList = new QListWidget;

View File

@@ -50,7 +50,7 @@ class ProjectSettingsWidget : public QWidget
Q_OBJECT
public:
explicit ProjectSettingsWidget(VcProjectDocument *vcProjDoc, QWidget *parent = 0);
explicit ProjectSettingsWidget(QWidget *parent = 0);
~ProjectSettingsWidget();
void addWidget(const QString &name, QWidget *widget);
@@ -65,7 +65,6 @@ private:
QListWidget *m_widgetList;
QStackedWidget *m_stackedWidgets;
Ui::ProjectSettingsWidget *ui;
VcProjectDocument *m_vcProjDocModel;
};
} // namespace Internal

View File

@@ -2,8 +2,6 @@ HEADERS += \
widgets/vcnodewidget.h \
widgets/projectsettingswidget.h \
widgets/lineedit.h \
widgets/configurationwidgets.h \
widgets/configurationswidgets.h \
widgets/configurationswidget.h \
widgets/basicconfigurationwidget.h \
widgets/schemaoptionswidget.h \
@@ -17,14 +15,16 @@ HEADERS += \
widgets/toolwidgets/toolsectionsettingswidget.h \
widgets/toolwidgets/toolsettingswidget.h \
widgets/toolwidgets/itoolattributesettingswidget.h \
widgets/toolschemawidget.h
widgets/toolschemawidget.h \
widgets/configurationbasewidget.h \
widgets/fileconfigurationsettingswidget.h \
widgets/configurationseditwidget.h \
widgets/filesettingswidget.h
SOURCES += \
widgets/vcnodewidget.cpp \
widgets/projectsettingswidget.cpp \
widgets/lineedit.cpp \
widgets/configurationwidgets.cpp \
widgets/configurationswidgets.cpp \
widgets/configurationswidget.cpp \
widgets/basicconfigurationwidget.cpp \
widgets/schemaoptionswidget.cpp \
@@ -38,7 +38,11 @@ SOURCES += \
widgets/toolwidgets/toolsectionsettingswidget.cpp \
widgets/toolwidgets/toolsettingswidget.cpp \
widgets/toolwidgets/itoolattributesettingswidget.cpp \
widgets/toolschemawidget.cpp
widgets/toolschemawidget.cpp \
widgets/configurationbasewidget.cpp \
widgets/fileconfigurationsettingswidget.cpp \
widgets/configurationseditwidget.cpp \
widgets/filesettingswidget.cpp
FORMS += \
widgets/projectsettingswidget.ui \
@@ -46,5 +50,6 @@ FORMS += \
widgets/schemaoptionswidget.ui \
widgets/newconfigitemdialog.ui \
widgets/vcenternamewidget.ui \
widgets/toolschemawidget.ui
widgets/toolschemawidget.ui \
widgets/fileconfigurationsettingswidget.ui