2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef BUILDSTEP_H
|
|
|
|
|
#define BUILDSTEP_H
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
#include "projectconfiguration.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projectexplorer_export.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QFutureInterface>
|
|
|
|
|
#include <QWidget>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
2011-08-18 13:46:52 +02:00
|
|
|
class Task;
|
2008-12-02 12:01:29 +01:00
|
|
|
class BuildConfiguration;
|
2010-07-16 14:00:41 +02:00
|
|
|
class BuildStepList;
|
2011-02-21 17:38:12 +01:00
|
|
|
class DeployConfiguration;
|
2010-07-16 14:00:41 +02:00
|
|
|
class Target;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
class BuildStepConfigWidget;
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
// Documentation inside.
|
2010-01-14 17:41:29 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT BuildStep : public ProjectConfiguration
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
protected:
|
2012-03-15 17:17:40 +01:00
|
|
|
BuildStep(BuildStepList *bsl, const Core::Id id);
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep(BuildStepList *bsl, BuildStep *bs);
|
2009-10-27 14:16:28 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
|
|
|
|
virtual ~BuildStep();
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
virtual bool init() = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
virtual void run(QFutureInterface<bool> &fi) = 0;
|
|
|
|
|
|
|
|
|
|
virtual BuildStepConfigWidget *createConfigWidget() = 0;
|
|
|
|
|
|
|
|
|
|
virtual bool immutable() const;
|
2011-07-07 15:15:43 +02:00
|
|
|
virtual bool runInGuiThread() const;
|
|
|
|
|
virtual void cancel();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-01-23 14:55:58 +01:00
|
|
|
virtual bool fromMap(const QVariantMap &map);
|
|
|
|
|
virtual QVariantMap toMap() const;
|
|
|
|
|
|
|
|
|
|
bool enabled() const;
|
|
|
|
|
void setEnabled(bool b);
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildConfiguration *buildConfiguration() const;
|
2011-02-21 17:38:12 +01:00
|
|
|
DeployConfiguration *deployConfiguration() const;
|
2011-10-24 13:10:38 +00:00
|
|
|
ProjectConfiguration *projectConfiguration() const;
|
2010-07-16 14:00:41 +02:00
|
|
|
Target *target() const;
|
2011-10-24 13:10:38 +00:00
|
|
|
Project *project() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-15 10:29:38 +02:00
|
|
|
enum OutputFormat { NormalOutput, ErrorOutput, MessageOutput, ErrorMessageOutput };
|
2011-03-31 18:22:22 +02:00
|
|
|
enum OutputNewlineSetting { DoAppendNewline, DontAppendNewline };
|
2010-07-15 10:29:38 +02:00
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
signals:
|
2010-03-12 13:53:00 +01:00
|
|
|
void addTask(const ProjectExplorer::Task &task);
|
2011-03-31 18:22:22 +02:00
|
|
|
|
|
|
|
|
void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format,
|
2011-04-04 15:31:30 +02:00
|
|
|
ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline) const;
|
2011-07-07 15:15:43 +02:00
|
|
|
|
|
|
|
|
void finished();
|
2012-01-23 14:55:58 +01:00
|
|
|
|
|
|
|
|
void enabledChanged();
|
|
|
|
|
private:
|
|
|
|
|
bool m_enabled;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT IBuildStepFactory :
|
|
|
|
|
public QObject
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-01-14 17:41:29 +01:00
|
|
|
explicit IBuildStepFactory(QObject *parent = 0);
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual ~IBuildStepFactory();
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// used to show the list of possible additons to a target, returns a list of types
|
2012-03-15 17:17:40 +01:00
|
|
|
virtual QList<Core::Id> availableCreationIds(BuildStepList *parent) const = 0;
|
2010-01-14 17:41:29 +01:00
|
|
|
// used to translate the types to names to display to the user
|
2012-03-15 17:17:40 +01:00
|
|
|
virtual QString displayNameForId(const Core::Id id) const = 0;
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
virtual bool canCreate(BuildStepList *parent, const Core::Id id) const = 0;
|
|
|
|
|
virtual BuildStep *create(BuildStepList *parent, const Core::Id id) = 0;
|
2010-01-14 17:41:29 +01:00
|
|
|
// used to recreate the runConfigurations when restoring settings
|
2010-07-16 14:00:41 +02:00
|
|
|
virtual bool canRestore(BuildStepList *parent, const QVariantMap &map) const = 0;
|
|
|
|
|
virtual BuildStep *restore(BuildStepList *parent, const QVariantMap &map) = 0;
|
|
|
|
|
virtual bool canClone(BuildStepList *parent, BuildStep *product) const = 0;
|
|
|
|
|
virtual BuildStep *clone(BuildStepList *parent, BuildStep *product) = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
|
2009-10-27 14:16:28 +01:00
|
|
|
: public QWidget
|
2009-08-06 15:31:32 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
BuildStepConfigWidget()
|
2009-10-27 14:16:28 +01:00
|
|
|
: QWidget()
|
2009-08-06 15:31:32 +02:00
|
|
|
{}
|
|
|
|
|
virtual QString summaryText() const = 0;
|
2011-09-09 09:54:37 +00:00
|
|
|
virtual QString additionalSummaryText() const { return QString(); }
|
2009-10-27 14:16:28 +01:00
|
|
|
virtual QString displayName() const = 0;
|
2011-12-08 14:29:24 +01:00
|
|
|
virtual bool showWidget() const { return true; }
|
2011-09-09 09:54:37 +00:00
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
signals:
|
|
|
|
|
void updateSummary();
|
2011-09-09 09:54:37 +00:00
|
|
|
void updateAdditionalSummary();
|
2009-08-06 15:31:32 +02:00
|
|
|
};
|
|
|
|
|
|
2012-01-09 16:23:40 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget
|
|
|
|
|
: public BuildStepConfigWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
SimpleBuildStepConfigWidget(BuildStep *step)
|
|
|
|
|
: m_step(step)
|
|
|
|
|
{
|
|
|
|
|
connect(m_step, SIGNAL(displayNameChanged()), SIGNAL(updateSummary()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~SimpleBuildStepConfigWidget() {}
|
|
|
|
|
|
2012-01-13 14:20:45 +01:00
|
|
|
QString summaryText() const { return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); }
|
2012-01-09 16:23:40 +01:00
|
|
|
QString displayName() const { return m_step->displayName(); }
|
|
|
|
|
bool showWidget() const { return false; }
|
|
|
|
|
BuildStep *step() const { return m_step; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
BuildStep *m_step;
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
} // namespace ProjectExplorer
|
|
|
|
|
|
2010-07-15 10:29:38 +02:00
|
|
|
Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputFormat)
|
2011-03-31 18:22:22 +02:00
|
|
|
Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputNewlineSetting)
|
2010-07-15 10:29:38 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif // BUILDSTEP_H
|