aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2013-05-06 11:16:41 +0200
committerTobias Hunger <tobias.hunger@digia.com>2013-05-13 14:06:19 +0200
commit9fa9c227db52f4fac3ad70f973dec17d6e5308c5 (patch)
tree3f08707b48b74d43d62bb9eeaca9da48a8bb7287
parentd389c45b1b4255d4675a6163f99fadcfc7085498 (diff)
Qbs: Add QbsDeployConfigurationFactory
Add QbsDeployConfigurationFactory and mark the QbsProject to not work with the default deployment for Desktop projects. Change-Id: I9230d5017b475d53cf13e86b4a073c248fedfaf0 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r--src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp141
-rw-r--r--src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h72
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp5
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.h2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.pro2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.qbs2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp2
7 files changed, 226 insertions, 0 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp
new file mode 100644
index 0000000000..b36bd46a09
--- /dev/null
+++ b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qbsdeployconfigurationfactory.h"
+
+#include "qbsinstallstep.h"
+#include "qbsproject.h"
+
+#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/target.h>
+
+namespace QbsProjectManager {
+namespace Internal {
+
+// --------------------------------------------------------------------
+// Helpers:
+// --------------------------------------------------------------------
+
+static QString genericQbsDisplayName() {
+ return QCoreApplication::translate("Qbs", "Qbs Install");
+}
+
+static Core::Id genericQbsDeployConfigurationId()
+{
+ return Core::Id("Qbs.Deploy");
+}
+
+// --------------------------------------------------------------------
+// QbsDeployConfiguration:
+// --------------------------------------------------------------------
+
+QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id) :
+ ProjectExplorer::DeployConfiguration(target, id)
+{ }
+
+QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target,
+ ProjectExplorer::DeployConfiguration *source) :
+ ProjectExplorer::DeployConfiguration(target, source)
+{
+ cloneSteps(source);
+}
+
+// --------------------------------------------------------------------
+// QbsDeployConfigurationFactory:
+// --------------------------------------------------------------------
+
+QbsDeployConfigurationFactory::QbsDeployConfigurationFactory(QObject *parent) :
+ ProjectExplorer::DeployConfigurationFactory(parent)
+{
+ setObjectName(QLatin1String("QbsDeployConfiguration"));
+}
+
+QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
+{
+ QList<Core::Id> ids;
+ if (qobject_cast<QbsProject *>(parent->project()))
+ ids << genericQbsDeployConfigurationId();
+ return ids;
+}
+
+QString QbsDeployConfigurationFactory::displayNameForId(const Core::Id id) const
+{
+ if (id == genericQbsDeployConfigurationId())
+ return genericQbsDisplayName();
+ return QString();
+}
+
+bool QbsDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
+ const Core::Id id) const
+{
+ return availableCreationIds(parent).contains(id);
+}
+
+ProjectExplorer::DeployConfiguration
+*QbsDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
+{
+ Q_ASSERT(canCreate(parent, id));
+
+ QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
+ dc->setDisplayName(genericQbsDisplayName());
+ dc->stepList()->insertStep(0, new QbsInstallStep(dc->stepList()));
+ return dc;
+}
+
+bool QbsDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
+ const QVariantMap &map) const
+{
+ return canCreate(parent, ProjectExplorer::idFromMap(map));
+}
+
+ProjectExplorer::DeployConfiguration
+*QbsDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
+{
+ if (!canRestore(parent, map))
+ return 0;
+ Core::Id id = ProjectExplorer::idFromMap(map);
+ QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
+ if (!dc->fromMap(map)) {
+ delete dc;
+ return 0;
+ }
+ return dc;
+}
+
+ProjectExplorer::DeployConfiguration
+*QbsDeployConfigurationFactory::clone(ProjectExplorer::Target *parent,
+ ProjectExplorer::DeployConfiguration *product)
+{
+ if (!canClone(parent, product))
+ return 0;
+ return new QbsDeployConfiguration(parent, qobject_cast<QbsDeployConfiguration *>(product));
+}
+
+} // namespace Internal
+} // namespace QbsProjectManager
diff --git a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h
new file mode 100644
index 0000000000..7d021be0ed
--- /dev/null
+++ b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QBSDEPLOYCONFIGURATIONFACTORY_H
+#define QBSDEPLOYCONFIGURATIONFACTORY_H
+
+#include <projectexplorer/deployconfiguration.h>
+
+namespace QbsProjectManager {
+namespace Internal {
+
+class QbsDeployConfigurationFactory;
+
+class QbsDeployConfiguration : public ProjectExplorer::DeployConfiguration
+{
+ Q_OBJECT
+
+private:
+ QbsDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id);
+ QbsDeployConfiguration(ProjectExplorer::Target *target,
+ ProjectExplorer::DeployConfiguration *source);
+
+ friend class QbsDeployConfigurationFactory;
+};
+
+class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
+{
+ Q_OBJECT
+
+public:
+ explicit QbsDeployConfigurationFactory(QObject *parent = 0);
+
+ QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QString displayNameForId(const Core::Id id) const;
+ bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
+ ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
+ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+ ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
+ ProjectExplorer::DeployConfiguration *product);
+};
+
+} // namespace Internal
+} // namespace QbsProjectManager
+
+#endif // QBSDEPLOYCONFIGURATIONFACTORY_H
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index bf1bad50d8..194812e9f3 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -239,6 +239,11 @@ const qbs::ProjectData *QbsProject::qbsProjectData() const
return m_rootProjectNode->projectData();
}
+bool QbsProject::needsSpecialDeployment() const
+{
+ return true;
+}
+
void QbsProject::handleQbsParsingDone(bool success)
{
QTC_ASSERT(m_qbsSetupProjectJob, return);
diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h
index 5e1ec70e88..cf840a9293 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.h
+++ b/src/plugins/qbsprojectmanager/qbsproject.h
@@ -94,6 +94,8 @@ public:
const qbs::Project *qbsProject() const;
const qbs::ProjectData *qbsProjectData() const;
+ bool needsSpecialDeployment() const;
+
public slots:
void invalidate();
void parseCurrentBuildConfiguration();
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
index d228910150..5d6c88eb44 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
@@ -18,6 +18,7 @@ HEADERS = \
qbsbuildconfigurationwidget.h \
qbsbuildstep.h \
qbscleanstep.h \
+ qbsdeployconfigurationfactory.h \
qbsinstallstep.h \
qbslogsink.h \
qbsnodes.h \
@@ -35,6 +36,7 @@ SOURCES = \
qbsbuildconfigurationwidget.cpp \
qbsbuildstep.cpp \
qbscleanstep.cpp \
+ qbsdeployconfigurationfactory.cpp \
qbsinstallstep.cpp \
qbslogsink.cpp \
qbsnodes.cpp \
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
index 346751eb50..e15372c23a 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
@@ -59,6 +59,8 @@ QtcPlugin {
"qbscleanstep.cpp",
"qbscleanstep.h",
"qbscleanstepconfigwidget.ui",
+ "qbsdeployconfigurationfactory.cpp",
+ "qbsdeployconfigurationfactory.h",
"qbsinstallstep.cpp",
"qbsinstallstep.h",
"qbsinstallstepconfigwidget.ui",
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index 481392169c..4b93d17c37 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -32,6 +32,7 @@
#include "qbsbuildconfiguration.h"
#include "qbsbuildstep.h"
#include "qbscleanstep.h"
+#include "qbsdeployconfigurationfactory.h"
#include "qbsinstallstep.h"
#include "qbsproject.h"
#include "qbsprojectmanager.h"
@@ -83,6 +84,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new QbsBuildStepFactory);
addAutoReleasedObject(new QbsCleanStepFactory);
addAutoReleasedObject(new QbsInstallStepFactory);
+ addAutoReleasedObject(new QbsDeployConfigurationFactory);
//menus
// Build Menu: