OSDN Git Service

687c80dcc9a7912f71211583be8b7114d08deabf
[qt-creator-jp/qt-creator-jp.git] / src / plugins / genericprojectmanager / genericmakestep.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 (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef GENERICMAKESTEP_H
35 #define GENERICMAKESTEP_H
36
37 #include <projectexplorer/abstractprocessstep.h>
38
39 QT_BEGIN_NAMESPACE
40 class QListWidgetItem;
41
42 namespace Ui {
43 class GenericMakeStep;
44 }
45 QT_END_NAMESPACE
46
47 namespace GenericProjectManager {
48 namespace Internal {
49
50 class GenericBuildConfiguration;
51 class GenericMakeStepConfigWidget;
52 class GenericMakeStepFactory;
53
54 class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
55 {
56     Q_OBJECT
57     friend class GenericMakeStepConfigWidget; // TODO remove again?
58     friend class GenericMakeStepFactory;
59
60 public:
61     GenericMakeStep(ProjectExplorer::BuildStepList *parent);
62     virtual ~GenericMakeStep();
63
64     GenericBuildConfiguration *genericBuildConfiguration() const;
65
66     virtual bool init();
67
68     virtual void run(QFutureInterface<bool> &fi);
69
70     virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
71     virtual bool immutable() const;
72     bool buildsTarget(const QString &target) const;
73     void setBuildTarget(const QString &target, bool on);
74     QString allArguments() const;
75     QString makeCommand() const;
76
77     QVariantMap toMap() const;
78
79 protected:
80     GenericMakeStep(ProjectExplorer::BuildStepList *parent, GenericMakeStep *bs);
81     GenericMakeStep(ProjectExplorer::BuildStepList *parent, const QString &id);
82     virtual bool fromMap(const QVariantMap &map);
83
84 private:
85     void ctor();
86
87     QStringList m_buildTargets;
88     QString m_makeArguments;
89     QString m_makeCommand;
90 };
91
92 class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
93 {
94     Q_OBJECT
95 public:
96     GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
97     virtual QString displayName() const;
98     virtual void init();
99     virtual QString summaryText() const;
100 private slots:
101     void itemChanged(QListWidgetItem*);
102     void makeLineEditTextEdited();
103     void makeArgumentsLineEditTextEdited();
104     void updateMakeOverrrideLabel();
105     void updateDetails();
106 private:
107     Ui::GenericMakeStep *m_ui;
108     GenericMakeStep *m_makeStep;
109     QString m_summaryText;
110 };
111
112 class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
113 {
114     Q_OBJECT
115
116 public:
117     explicit GenericMakeStepFactory(QObject *parent = 0);
118     virtual ~GenericMakeStepFactory();
119
120     virtual bool canCreate(ProjectExplorer::BuildStepList *parent,
121                            const QString &id) const;
122     virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent,
123                                                const QString &id);
124     virtual bool canClone(ProjectExplorer::BuildStepList *parent,
125                           ProjectExplorer::BuildStep *source) const;
126     virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
127                                               ProjectExplorer::BuildStep *source);
128     virtual bool canRestore(ProjectExplorer::BuildStepList *parent,
129                             const QVariantMap &map) const;
130     virtual ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
131                                                 const QVariantMap &map);
132
133     virtual QStringList availableCreationIds(ProjectExplorer::BuildStepList *bc) const;
134     virtual QString displayNameForId(const QString &id) const;
135 };
136
137 } // namespace Internal
138 } // namespace GenericProjectManager
139
140 #endif // GENERICMAKESTEP_H