From 29e8e70b1cc1da43541eb06023ecb8699a46bdd7 Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Tue, 6 Apr 2010 16:56:47 +0200 Subject: [PATCH] Add skeleton for Maemo package creation build step. (No actual functionality yet.) Reviewed-by: kh1 --- .../qt-maemo/maemomanager.cpp | 24 ++-- .../qt4projectmanager/qt-maemo/maemomanager.h | 2 + .../qt-maemo/maemopackagecreationfactory.cpp | 123 ++++++++++++++++++ .../qt-maemo/maemopackagecreationfactory.h | 86 ++++++++++++ .../qt-maemo/maemopackagecreationstep.cpp | 96 ++++++++++++++ .../qt-maemo/maemopackagecreationstep.h | 70 ++++++++++ .../qt4projectmanager/qt-maemo/qt-maemo.pri | 8 +- src/plugins/qt4projectmanager/qt4target.cpp | 3 + 8 files changed, 402 insertions(+), 10 deletions(-) create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp index bf74a0f501c..0578238785b 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp @@ -32,6 +32,7 @@ #include "maemodeviceconfigurations.h" #include "maemogdbsettingspage.h" +#include "maemopackagecreationfactory.h" #include "maemorunfactories.h" #include "maemosettingspage.h" #include "maemotoolchain.h" @@ -63,6 +64,7 @@ MaemoManager::MaemoManager() : QObject(0) , m_runControlFactory(new MaemoRunControlFactory(this)) , m_runConfigurationFactory(new MaemoRunConfigurationFactory(this)) + , m_packageCreationFactory(new MaemoPackageCreationFactory(this)) , m_settingsPage(new MaemoSettingsPage(this)) , m_gdbSettingsPage(new MaemoGdbSettingsPage(this)) , m_qemuCommand(0) @@ -76,18 +78,24 @@ MaemoManager::MaemoManager() icon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize, QIcon::Normal, QIcon::On); - ExtensionSystem::PluginManager::instance()->addObject(m_runControlFactory); - ExtensionSystem::PluginManager::instance()->addObject(m_runConfigurationFactory); - ExtensionSystem::PluginManager::instance()->addObject(m_settingsPage); - ExtensionSystem::PluginManager::instance()->addObject(m_gdbSettingsPage); + ExtensionSystem::PluginManager *pluginManager + = ExtensionSystem::PluginManager::instance(); + pluginManager->addObject(m_runControlFactory); + pluginManager->addObject(m_runConfigurationFactory); + pluginManager->addObject(m_packageCreationFactory); + pluginManager->addObject(m_settingsPage); + pluginManager->addObject(m_gdbSettingsPage); } MaemoManager::~MaemoManager() { - ExtensionSystem::PluginManager::instance()->removeObject(m_runControlFactory); - ExtensionSystem::PluginManager::instance()->removeObject(m_runConfigurationFactory); - ExtensionSystem::PluginManager::instance()->removeObject(m_settingsPage); - ExtensionSystem::PluginManager::instance()->removeObject(m_gdbSettingsPage); + ExtensionSystem::PluginManager *pluginManager + = ExtensionSystem::PluginManager::instance(); + pluginManager->removeObject(m_runControlFactory); + pluginManager->removeObject(m_runConfigurationFactory); + pluginManager->removeObject(m_packageCreationFactory); + pluginManager->removeObject(m_settingsPage); + pluginManager->removeObject(m_gdbSettingsPage); m_instance = 0; } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h index 54eeedf6c9f..7fa58e7c838 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h @@ -54,6 +54,7 @@ namespace Qt4ProjectManager { namespace Internal { class MaemoGdbSettingsPage; +class MaemoPackageCreationFactory; class MaemoRunControlFactory; class MaemoRunConfigurationFactory; class MaemoSettingsPage; @@ -90,6 +91,7 @@ private: MaemoRunControlFactory *m_runControlFactory; MaemoRunConfigurationFactory *m_runConfigurationFactory; + MaemoPackageCreationFactory *m_packageCreationFactory; MaemoSettingsPage *m_settingsPage; MaemoGdbSettingsPage *m_gdbSettingsPage; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp new file mode 100644 index 00000000000..544d6342148 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "maemopackagecreationfactory.h" + +#include "maemopackagecreationstep.h" + +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/target.h> +#include <qt4projectmanagerconstants.h> + +using ProjectExplorer::BuildConfiguration; +using ProjectExplorer::StepType; +using ProjectExplorer::BuildStep; + +namespace Qt4ProjectManager { +namespace Internal { + +MaemoPackageCreationFactory::MaemoPackageCreationFactory(QObject *parent) + : ProjectExplorer::IBuildStepFactory(parent) +{ + +} + +QStringList MaemoPackageCreationFactory::availableCreationIds(BuildConfiguration *parent, + StepType type) const +{ + QStringList ids; + if (type == ProjectExplorer::Build + && parent->target()->id() == Constants::MAEMO_DEVICE_TARGET_ID) + ids << MaemoPackageCreationStep::CreatePackageId; + return ids; +} + +QString MaemoPackageCreationFactory::displayNameForId(const QString &id) const +{ + return id == MaemoPackageCreationStep::CreatePackageId + ? tr("Maemo Package Creation") + : QString(); +} + +bool MaemoPackageCreationFactory::canCreate(BuildConfiguration *parent, + StepType type, const QString &id) const +{ + return type == ProjectExplorer::Build + && id == MaemoPackageCreationStep::CreatePackageId + && parent->target()->id() == Constants::MAEMO_DEVICE_TARGET_ID; +} + +BuildStep *MaemoPackageCreationFactory::create(BuildConfiguration *parent, + ProjectExplorer::StepType type, const QString &id) +{ + Q_ASSERT(canCreate(parent, type, id)); + return new MaemoPackageCreationStep(parent); +} + +bool MaemoPackageCreationFactory::canRestore(BuildConfiguration *parent, + StepType type, const QVariantMap &map) const +{ + qDebug("%s: %d", Q_FUNC_INFO, canCreate(parent, type, ProjectExplorer::idFromMap(map))); + return canCreate(parent, type, ProjectExplorer::idFromMap(map)); +} + +BuildStep *MaemoPackageCreationFactory::restore(BuildConfiguration *parent, + StepType type, const QVariantMap &map) +{ + Q_ASSERT(canRestore(parent, type, map)); + return new MaemoPackageCreationStep(parent); +} + +bool MaemoPackageCreationFactory::canClone(BuildConfiguration *parent, + StepType type, BuildStep *product) const +{ + return canCreate(parent, type, product->id()); +} + +BuildStep *MaemoPackageCreationFactory::clone(BuildConfiguration *parent, + StepType type, BuildStep *product) +{ + Q_ASSERT(canClone(parent, type, product)); + return new MaemoPackageCreationStep(parent, static_cast<MaemoPackageCreationStep *>(product)); +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h new file mode 100644 index 00000000000..88157e8654b --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAEMOPACKAGECREATIONFACTORY_H +#define MAEMOPACKAGECREATIONFACTORY_H + +#include <projectexplorer/buildstep.h> + +namespace Qt4ProjectManager { +namespace Internal { + +class MaemoPackageCreationFactory : public ProjectExplorer::IBuildStepFactory +{ +public: + MaemoPackageCreationFactory(QObject *parent); + + virtual QStringList availableCreationIds(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type) const; + virtual QString displayNameForId(const QString &id) const; + + virtual bool canCreate(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, + const QString &id) const; + virtual ProjectExplorer::BuildStep * + create(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, const QString &id); + + virtual bool canRestore(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, + const QVariantMap &map) const; + virtual ProjectExplorer::BuildStep * + restore(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, const QVariantMap &map); + + virtual bool canClone(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, + ProjectExplorer::BuildStep *product) const; + virtual ProjectExplorer::BuildStep * + clone(ProjectExplorer::BuildConfiguration *parent, + ProjectExplorer::StepType type, + ProjectExplorer::BuildStep *product); + +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // MAEMOPACKAGECREATIONFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp new file mode 100644 index 00000000000..1e585b2499c --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "maemopackagecreationstep.h" + +#include <QtGui/QWidget> + +using ProjectExplorer::BuildConfiguration; +using ProjectExplorer::BuildStepConfigWidget; + + +namespace Qt4ProjectManager { +namespace Internal { + +class MaemoPackageCreationWidget : public ProjectExplorer::BuildStepConfigWidget +{ +public: + MaemoPackageCreationWidget(MaemoPackageCreationStep *step) + : ProjectExplorer::BuildStepConfigWidget(), m_step(step) {} + virtual void init() {} + virtual QString summaryText() const { return tr("Package Creation"); } + virtual QString displayName() const { return m_step->displayName(); } +private: + MaemoPackageCreationStep *m_step; +}; + +MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig) + : ProjectExplorer::BuildStep(buildConfig, CreatePackageId) +{ +} + +MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig, + MaemoPackageCreationStep *other) + : BuildStep(buildConfig, other) +{ + +} + +bool MaemoPackageCreationStep::init() +{ + return true; +} + +void MaemoPackageCreationStep::run(QFutureInterface<bool> &fi) +{ + qDebug("%s", Q_FUNC_INFO); + fi.reportResult(true); +} + +BuildStepConfigWidget *MaemoPackageCreationStep::createConfigWidget() +{ + return new MaemoPackageCreationWidget(this); +} + +const QLatin1String MaemoPackageCreationStep::CreatePackageId("Qt4ProjectManager.MaemoPackageCreationStep"); + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h new file mode 100644 index 00000000000..072e2a202bb --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAEMOPACKAGECREATIONSTEP_H +#define MAEMOPACKAGECREATIONSTEP_H + +#include <projectexplorer/buildstep.h> + +namespace Qt4ProjectManager { +namespace Internal { + +class MaemoPackageCreationStep : public ProjectExplorer::BuildStep +{ + friend class MaemoPackageCreationFactory; +public: + MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig); +private: + MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig, + MaemoPackageCreationStep *other); + + virtual bool init(); + virtual void run(QFutureInterface<bool> &fi); + virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); + virtual bool immutable() const { return true; } + + static const QLatin1String CreatePackageId; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // MAEMOPACKAGECREATIONSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri index fec31a638ed..c5118f77ded 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri @@ -16,7 +16,9 @@ HEADERS += \ $$PWD/maemosettingswidget.h \ $$PWD/maemosshconnection.h \ $$PWD/maemosshthread.h \ - $$PWD/maemotoolchain.h + $$PWD/maemotoolchain.h \ + $$PWD/maemopackagecreationstep.h \ + $$PWD/maemopackagecreationfactory.h SOURCES += \ $$PWD/maemoconfigtestdialog.cpp \ @@ -31,7 +33,9 @@ SOURCES += \ $$PWD/maemosettingswidget.cpp \ $$PWD/maemosshconnection.cpp \ $$PWD/maemosshthread.cpp \ - $$PWD/maemotoolchain.cpp + $$PWD/maemotoolchain.cpp \ + $$PWD/maemopackagecreationstep.cpp \ + $$PWD/maemopackagecreationfactory.cpp FORMS += \ $$PWD/maemoconfigtestdialog.ui \ diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 900502b5389..47c96709a71 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -35,6 +35,7 @@ #include "qt4project.h" #include "qt4runconfiguration.h" #include "qt4projectmanagerconstants.h" +#include "qt-maemo/maemopackagecreationstep.h" #include "qt-maemo/maemorunconfiguration.h" #include "qt-s60/s60devicerunconfiguration.h" #include "qt-s60/s60emulatorrunconfiguration.h" @@ -279,6 +280,8 @@ Qt4BuildConfiguration *Qt4Target::addQt4BuildConfiguration(QString displayName, if (id() == Constants::S60_DEVICE_TARGET_ID) { S60CreatePackageStep *packageStep = new S60CreatePackageStep(bc); bc->insertStep(ProjectExplorer::Build, 2, packageStep); + } else if (id() == Constants::MAEMO_DEVICE_TARGET_ID) { + bc->insertStep(ProjectExplorer::Build, 2, new MaemoPackageCreationStep(bc)); } MakeStep* cleanStep = new MakeStep(bc); -- GitLab