2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01: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:
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep(BuildStepList *bsl, const QString &id);
|
|
|
|
|
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
|
2010-07-16 14:00:41 +02:00
|
|
|
virtual QStringList 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
|
2010-01-07 18:17:24 +01:00
|
|
|
virtual QString displayNameForId(const QString &id) const = 0;
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
virtual bool canCreate(BuildStepList *parent, const QString &id) const = 0;
|
|
|
|
|
virtual BuildStep *create(BuildStepList *parent, const QString &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 BuildConfigWidget
|
2008-12-02 12:01:29 +01:00
|
|
|
: public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2009-08-06 15:31:32 +02:00
|
|
|
BuildConfigWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
:QWidget(0)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
virtual QString displayName() const = 0;
|
|
|
|
|
|
|
|
|
|
// This is called to set up the config widget before showing it
|
2009-11-24 15:36:31 +01:00
|
|
|
virtual void init(BuildConfiguration *bc) = 0;
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void displayNameChanged(const QString &);
|
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
|