OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / processstep.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 PROCESSSTEP_H
34 #define PROCESSSTEP_H
35
36 #include "ui_processstep.h"
37 #include "abstractprocessstep.h"
38 #include "environment.h"
39
40 namespace ProjectExplorer {
41
42 namespace Internal {
43
44 class ProcessStepFactory : public IBuildStepFactory
45 {
46     Q_OBJECT
47
48 public:
49     ProcessStepFactory();
50     ~ProcessStepFactory();
51
52     virtual QStringList availableCreationIds(BuildStepList *parent) const;
53     virtual QString displayNameForId(const QString &id) const;
54
55     virtual bool canCreate(BuildStepList *parent, const QString &id) const;
56     virtual BuildStep *create(BuildStepList *parent, const QString &id);
57     virtual bool canRestore(BuildStepList *parent, const QVariantMap &map) const;
58     virtual BuildStep *restore(BuildStepList *parent, const QVariantMap &map);
59     virtual bool canClone(BuildStepList *parent, BuildStep *product) const;
60     virtual BuildStep *clone(BuildStepList *parent, BuildStep *product);
61 };
62
63 class ProcessStep : public ProjectExplorer::AbstractProcessStep
64 {
65     Q_OBJECT
66     friend class ProcessStepFactory;
67
68 public:
69     explicit ProcessStep(BuildStepList *bsl);
70     virtual ~ProcessStep();
71
72     virtual bool init();
73     virtual void run(QFutureInterface<bool> &);
74
75     virtual BuildStepConfigWidget *createConfigWidget();
76     virtual bool immutable() const;
77
78     QString command() const;
79     QString arguments() const;
80     bool enabled() const;
81     QString workingDirectory() const;
82
83     void setCommand(const QString &command);
84     void setArguments(const QString &arguments);
85     void setEnabled(bool enabled);
86     void setWorkingDirectory(const QString &workingDirectory);
87
88     QVariantMap toMap() const;
89
90 protected:
91     ProcessStep(BuildStepList *bsl, ProcessStep *bs);
92     ProcessStep(BuildStepList *bsl, const QString &id);
93
94     bool fromMap(const QVariantMap &map);
95
96 private:
97     void ctor();
98
99     QString m_command;
100     QString m_arguments;
101     QString m_workingDirectory;
102     Utils::Environment m_env;
103     bool m_enabled;
104 };
105
106 class ProcessStepConfigWidget : public BuildStepConfigWidget
107 {
108     Q_OBJECT
109 public:
110     ProcessStepConfigWidget(ProcessStep *step);
111     virtual QString displayName() const;
112     virtual void init();
113     virtual QString summaryText() const;
114 private slots:
115     void commandLineEditTextEdited();
116     void workingDirectoryLineEditTextEdited();
117     void commandArgumentsLineEditTextEdited();
118     void enabledCheckBoxClicked(bool);
119 private:
120     void updateDetails();
121     ProcessStep *m_step;
122     Ui::ProcessStepWidget m_ui;
123     QString m_summaryText;
124 };
125
126 } // namespace Internal
127 } // namespace ProjectExplorer
128
129 #endif // PROCESSSTEP_H