From c8215657519d730909b4ce8f626a1ac39f2d51bd Mon Sep 17 00:00:00 2001 From: Radovan Zivkovic Date: Fri, 11 Oct 2013 10:26:19 +0200 Subject: Platform implements IPlatform interface. Change-Id: Id463cd1c19dc78480eb502a95e3faf1af021960f Reviewed-by: Tobias Hunger --- .../vcprojectmanager/interfaces/interfaces.pri | 3 +- .../vcprojectmanager/interfaces/iplatform.h | 52 ++++++++++++++++++++++ .../vcprojectmanager/vcprojectmodel/platform.cpp | 2 +- .../vcprojectmanager/vcprojectmodel/platform.h | 9 ++-- .../vcprojectmanager/vcprojectmodel/platforms.cpp | 4 +- .../widgets/configurationswidgets.cpp | 12 ++--- 6 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 src/plugins/vcprojectmanager/interfaces/iplatform.h diff --git a/src/plugins/vcprojectmanager/interfaces/interfaces.pri b/src/plugins/vcprojectmanager/interfaces/interfaces.pri index f9087a2ff6..c7bd816b5e 100644 --- a/src/plugins/vcprojectmanager/interfaces/interfaces.pri +++ b/src/plugins/vcprojectmanager/interfaces/interfaces.pri @@ -24,4 +24,5 @@ HEADERS += \ interfaces/iglobals.h \ interfaces/ireferences.h \ interfaces/itoolfile.h \ - interfaces/itoolfiles.h + interfaces/itoolfiles.h \ + interfaces/iplatform.h diff --git a/src/plugins/vcprojectmanager/interfaces/iplatform.h b/src/plugins/vcprojectmanager/interfaces/iplatform.h new file mode 100644 index 0000000000..237b6f158e --- /dev/null +++ b/src/plugins/vcprojectmanager/interfaces/iplatform.h @@ -0,0 +1,52 @@ +/************************************************************************** +** +** 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_IPLATFORM_H +#define VCPROJECTMANAGER_INTERNAL_IPLATFORM_H + +#include "../vcprojectmodel/ivcprojectnodemodel.h" + +#include + +namespace VcProjectManager { +namespace Internal { + +class IPlatform : public IVcProjectXMLNode +{ +public: + virtual ~IPlatform() {} + + virtual QString displayName() const = 0; + virtual void setName(const QString &displayName) = 0; +}; + +} // namespace Internal +} // namespace VcProjectManager + +#endif // VCPROJECTMANAGER_INTERNAL_IPLATFORM_H diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/platform.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/platform.cpp index 5632ce4166..bb69a761e3 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/platform.cpp +++ b/src/plugins/vcprojectmanager/vcprojectmodel/platform.cpp @@ -73,7 +73,7 @@ QDomNode Platform::toXMLDomNode(QDomDocument &domXMLDocument) const return platformNode; } -QString Platform::name() const +QString Platform::displayName() const { return m_name; } diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/platform.h b/src/plugins/vcprojectmanager/vcprojectmodel/platform.h index 46203ae016..cf6a610285 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/platform.h +++ b/src/plugins/vcprojectmanager/vcprojectmodel/platform.h @@ -30,15 +30,14 @@ #ifndef VCPROJECTMANAGER_INTERNAL_PLATFORM_H #define VCPROJECTMANAGER_INTERNAL_PLATFORM_H -#include "ivcprojectnodemodel.h" +#include "../interfaces/iplatform.h" -#include #include namespace VcProjectManager { namespace Internal { -class Platform : public IVcProjectXMLNode +class Platform : public IPlatform { public: typedef QSharedPointer Ptr; @@ -52,8 +51,8 @@ public: VcNodeWidget* createSettingsWidget(); QDomNode toXMLDomNode(QDomDocument &domXMLDocument) const; - QString name() const; - void setName(const QString &name); + QString displayName() const; + void setName(const QString &displayName); private: void processNodeAttributes(const QDomElement &element); diff --git a/src/plugins/vcprojectmanager/vcprojectmodel/platforms.cpp b/src/plugins/vcprojectmanager/vcprojectmodel/platforms.cpp index ff74391016..88b8c05e41 100644 --- a/src/plugins/vcprojectmanager/vcprojectmodel/platforms.cpp +++ b/src/plugins/vcprojectmanager/vcprojectmodel/platforms.cpp @@ -108,7 +108,7 @@ void Platforms::addPlatform(Platform::Ptr platform) return; foreach (const Platform::Ptr &platf, m_platforms) { - if (platf->name() == platform->name()) + if (platf->displayName() == platform->displayName()) return; } m_platforms.append(platform); @@ -122,7 +122,7 @@ void Platforms::removePlatform(Platform::Ptr platform) void Platforms::removePlatform(const QString &platformName) { foreach (const Platform::Ptr &platform, m_platforms) { - if (platform->name() == platformName) { + if (platform->displayName() == platformName) { removePlatform(platform); return; } diff --git a/src/plugins/vcprojectmanager/widgets/configurationswidgets.cpp b/src/plugins/vcprojectmanager/widgets/configurationswidgets.cpp index 6089b90782..eec920f66b 100644 --- a/src/plugins/vcprojectmanager/widgets/configurationswidgets.cpp +++ b/src/plugins/vcprojectmanager/widgets/configurationswidgets.cpp @@ -124,7 +124,7 @@ void ConfigurationsBaseWidget::onAddNewConfig(QString newConfigName, QString cop if (copyFrom.isEmpty()) { QList platformList = platforms->platforms(); foreach (const Platform::Ptr &platform, platformList) { - IConfiguration *newConfig = createConfiguration(newConfigName + QLatin1Char('|') + platform->name()); + IConfiguration *newConfig = createConfiguration(newConfigName + QLatin1Char('|') + platform->displayName()); if (newConfig) { newConfig->attributeContainer()->setAttribute(QLatin1String("OutputDirectory"), QLatin1String("$(SolutionDir)$(ConfigurationName)")); @@ -144,12 +144,12 @@ void ConfigurationsBaseWidget::onAddNewConfig(QString newConfigName, QString cop IConfiguration* newConfig = config->clone(); if (newConfig) { - newConfig->setFullName(newConfigName + QLatin1Char('|') + platform->name()); + newConfig->setFullName(newConfigName + QLatin1Char('|') + platform->displayName()); m_newConfigurations.append(newConfig); addConfiguration(newConfig); } - addConfigurationToFiles(copyFrom, newConfigName + QLatin1Char('|') + platform->name()); + addConfigurationToFiles(copyFrom, newConfigName + QLatin1Char('|') + platform->displayName()); } } } @@ -170,8 +170,8 @@ void ConfigurationsBaseWidget::onRenameConfig(QString newConfigName, QString old QList platformList = platforms->platforms(); foreach (const Platform::Ptr &platform, platformList) { - QString targetConfigName = splits[0] + QLatin1Char('|') + platform->name(); - QString newName = newConfigName + QLatin1Char('|') + platform->name(); + QString targetConfigName = splits[0] + QLatin1Char('|') + platform->displayName(); + QString newName = newConfigName + QLatin1Char('|') + platform->displayName(); IConfiguration *configInNew = configInNewConfigurations(targetConfigName); // if we are renaming newly added config @@ -221,7 +221,7 @@ void ConfigurationsBaseWidget::onRemoveConfig(QString configNameWithPlatform) QList platformList = platforms->platforms(); foreach (const Platform::Ptr &platform, platformList) { - QString targetConfigName = splits[0] + QLatin1Char('|') + platform->name(); + 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 -- cgit v1.2.3