OSDN Git Service

make addOutput() signal const
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / buildstep.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef BUILDSTEP_H
34 #define BUILDSTEP_H
35
36 #include "projectconfiguration.h"
37 #include "projectexplorer_export.h"
38 #include "task.h"
39
40 #include <QtCore/QFutureInterface>
41 #include <QtGui/QWidget>
42
43 namespace ProjectExplorer {
44
45 class BuildConfiguration;
46 class BuildStepList;
47 class DeployConfiguration;
48 class Target;
49
50 class BuildStepConfigWidget;
51
52 // Documentation inside.
53 class PROJECTEXPLORER_EXPORT BuildStep : public ProjectConfiguration
54 {
55     Q_OBJECT
56
57 protected:
58     BuildStep(BuildStepList *bsl, const QString &id);
59     BuildStep(BuildStepList *bsl, BuildStep *bs);
60
61 public:
62     virtual ~BuildStep();
63
64     virtual bool init() = 0;
65
66     virtual void run(QFutureInterface<bool> &fi) = 0;
67
68     virtual BuildStepConfigWidget *createConfigWidget() = 0;
69
70     virtual bool immutable() const;
71
72     BuildConfiguration *buildConfiguration() const;
73     DeployConfiguration *deployConfiguration() const;
74     Target *target() const;
75
76     enum OutputFormat { NormalOutput, ErrorOutput, MessageOutput, ErrorMessageOutput };
77     enum OutputNewlineSetting { DoAppendNewline, DontAppendNewline };
78
79 signals:
80     void addTask(const ProjectExplorer::Task &task);
81
82     void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format,
83         ProjectExplorer::BuildStep::OutputNewlineSetting newlineSetting = DoAppendNewline) const;
84 };
85
86 class PROJECTEXPLORER_EXPORT IBuildStepFactory :
87     public QObject
88 {
89     Q_OBJECT
90
91 public:
92     explicit IBuildStepFactory(QObject *parent = 0);
93     virtual ~IBuildStepFactory();
94
95     // used to show the list of possible additons to a target, returns a list of types
96     virtual QStringList availableCreationIds(BuildStepList *parent) const = 0;
97     // used to translate the types to names to display to the user
98     virtual QString displayNameForId(const QString &id) const = 0;
99
100     virtual bool canCreate(BuildStepList *parent, const QString &id) const = 0;
101     virtual BuildStep *create(BuildStepList *parent, const QString &id) = 0;
102     // used to recreate the runConfigurations when restoring settings
103     virtual bool canRestore(BuildStepList *parent, const QVariantMap &map) const = 0;
104     virtual BuildStep *restore(BuildStepList *parent, const QVariantMap &map) = 0;
105     virtual bool canClone(BuildStepList *parent, BuildStep *product) const = 0;
106     virtual BuildStep *clone(BuildStepList *parent, BuildStep *product) = 0;
107 };
108
109 class PROJECTEXPLORER_EXPORT BuildConfigWidget
110     : public QWidget
111 {
112     Q_OBJECT
113 public:
114     BuildConfigWidget()
115         :QWidget(0)
116         {}
117
118     virtual QString displayName() const = 0;
119
120     // This is called to set up the config widget before showing it
121     virtual void init(BuildConfiguration *bc) = 0;
122
123 signals:
124     void displayNameChanged(const QString &);
125 };
126
127 class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
128     : public QWidget
129 {
130     Q_OBJECT
131 public:
132     BuildStepConfigWidget()
133         : QWidget()
134         {}
135     virtual void init() = 0;
136     virtual QString summaryText() const = 0;
137     virtual QString displayName() const = 0;
138 signals:
139     void updateSummary();
140 };
141
142 } // namespace ProjectExplorer
143
144 Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputFormat)
145 Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputNewlineSetting)
146
147 #endif // BUILDSTEP_H