makestep.h 4.72 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8
9
10
11
12
13
14
** 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.
15
**
16
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
18
19
20
21
22
23
24
25
** 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
con's avatar
con committed
26
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30
31
32
#ifndef MAKESTEP_H
#define MAKESTEP_H

Daniel Teske's avatar
Daniel Teske committed
33
34
#include "qt4projectmanager_global.h"

Tobias Hunger's avatar
Tobias Hunger committed
35
#include <projectexplorer/abstractprocessstep.h>
36

dt's avatar
dt committed
37
38
39
namespace ProjectExplorer {
class BuildStep;
class IBuildStepFactory;
40
class Task;
dt's avatar
dt committed
41
42
}

con's avatar
con committed
43
namespace Qt4ProjectManager {
hjk's avatar
hjk committed
44

dt's avatar
dt committed
45
class Qt4BuildConfiguration;
46
class MakeStepConfigWidget;
dt's avatar
dt committed
47

48
49
namespace Internal {

hjk's avatar
hjk committed
50
51
namespace Ui { class MakeStep; }

52
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
dt's avatar
dt committed
53
54
{
    Q_OBJECT
55

dt's avatar
dt committed
56
public:
57
    explicit MakeStepFactory(QObject *parent = 0);
dt's avatar
dt committed
58
    virtual ~MakeStepFactory();
59

60
61
    bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const;
    ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id);
Tobias Hunger's avatar
Tobias Hunger committed
62
63
64
65
66
    bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) const;
    ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
    bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
    ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);

67
68
    QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
    QString displayNameForId(const Core::Id id) const;
dt's avatar
dt committed
69
};
dt's avatar
dt committed
70
} //namespace Internal
dt's avatar
dt committed
71

con's avatar
con committed
72
73
class Qt4Project;

74
class QT4PROJECTMANAGER_EXPORT MakeStep : public ProjectExplorer::AbstractProcessStep
con's avatar
con committed
75
76
{
    Q_OBJECT
77
    friend class Internal::MakeStepFactory;
78
    friend class MakeStepConfigWidget;
79

con's avatar
con committed
80
public:
Tobias Hunger's avatar
Tobias Hunger committed
81
    explicit MakeStep(ProjectExplorer::BuildStepList *bsl);
82
    virtual ~MakeStep();
dt's avatar
dt committed
83

84
    Qt4BuildConfiguration *qt4BuildConfiguration() const;
dt's avatar
dt committed
85

86
    virtual bool init();
con's avatar
con committed
87
    virtual void run(QFutureInterface<bool> &);
88
89
    bool processSucceeded(int exitCode, QProcess::ExitStatus status);

con's avatar
con committed
90
91
    virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
    virtual bool immutable() const;
92
93
    QString userArguments();
    void setUserArguments(const QString &arguments);
94
    void setClean(bool clean);
95
    bool isClean() const;
96
    QString makeCommand() const;
97

98
    QVariantMap toMap() const;
99

100
signals:
101
    void userArgumentsChanged();
102
103

protected:
Tobias Hunger's avatar
Tobias Hunger committed
104
    MakeStep(ProjectExplorer::BuildStepList *bsl, MakeStep *bs);
105
    MakeStep(ProjectExplorer::BuildStepList *bsl, const Core::Id id);
106
107
    virtual bool fromMap(const QVariantMap &map);

con's avatar
con committed
108
private:
109
    void ctor();
110
    void setMakeCommand(const QString &make);
111
    QStringList automaticallyAddedArguments() const;
112
    bool m_clean;
Daniel Teske's avatar
Daniel Teske committed
113
    bool m_scriptTarget;
114
    QString m_makeFileToCheck;
115
    QString m_userArgs;
116
    QString m_makeCmd;
117
    QList<ProjectExplorer::Task> m_tasks;
con's avatar
con committed
118
119
120
121
122
123
};

class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
    Q_OBJECT
public:
124
125
126
    explicit MakeStepConfigWidget(MakeStep *makeStep);
    virtual ~MakeStepConfigWidget();

con's avatar
con committed
127
    QString displayName() const;
dt's avatar
dt committed
128
    QString summaryText() const;
con's avatar
con committed
129
private slots:
130
131
132
133
    // User changes to our widgets
    void makeEdited();
    void makeArgumentsLineEdited();

dt's avatar
dt committed
134
    void updateDetails();
135
    void userArgumentsChanged();
136
    void activeBuildConfigurationChanged();
con's avatar
con committed
137
private:
Tobias Hunger's avatar
Tobias Hunger committed
138
139
    void setSummaryText(const QString &text);

140
    Internal::Ui::MakeStep *m_ui;
con's avatar
con committed
141
    MakeStep *m_makeStep;
dt's avatar
dt committed
142
    QString m_summaryText;
143
    ProjectExplorer::BuildConfiguration *m_bc;
144
    bool m_ignoreChange;
con's avatar
con committed
145
146
147
148
149
};

} // Qt4ProjectManager

#endif // MAKESTEP_H