qmakestep.h 6.21 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3
** Copyright (C) 2014 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
** 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
Eike Ziller's avatar
Eike Ziller committed
13 14
** conditions see http://www.qt.io/licensing.  For further information
** use the contact form at http://www.qt.io/contact-us.
15
**
16
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
** Alternatively, this file may be used under the terms of the GNU Lesser
Eike Ziller's avatar
Eike Ziller committed
18 19 20 21 22 23
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
hjk's avatar
hjk committed
24 25 26
**
** 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
27 28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
29
****************************************************************************/
hjk's avatar
hjk committed
30

con's avatar
con committed
31 32 33
#ifndef QMAKESTEP_H
#define QMAKESTEP_H

34
#include "qmakeprojectmanager_global.h"
35 36
#include <projectexplorer/abstractprocessstep.h>

37
#include <QStringList>
38

39 40
namespace Utils { class FileName; }

dt's avatar
dt committed
41 42 43 44 45
namespace ProjectExplorer {
class BuildStep;
class IBuildStepFactory;
class Project;
}
con's avatar
con committed
46

47
namespace QmakeProjectManager {
48
class QmakeBuildConfiguration;
49
class QmakeProject;
dt's avatar
dt committed
50

dt's avatar
dt committed
51
namespace Internal {
dt's avatar
dt committed
52

hjk's avatar
hjk committed
53 54
namespace Ui { class QMakeStep; }

dt's avatar
dt committed
55 56 57
class QMakeStepFactory : public ProjectExplorer::IBuildStepFactory
{
    Q_OBJECT
58

dt's avatar
dt committed
59
public:
60
    explicit QMakeStepFactory(QObject *parent = 0);
dt's avatar
dt committed
61
    virtual ~QMakeStepFactory();
62 63
    bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
    ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
Tobias Hunger's avatar
Tobias Hunger committed
64 65 66 67
    bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *bs) const;
    ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *bs);
    bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
    ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
68
    QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
69
    QString displayNameForId(Core::Id id) const;
dt's avatar
dt committed
70 71
};

dt's avatar
dt committed
72 73
} // namespace Internal

con's avatar
con committed
74

75
class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractProcessStep
con's avatar
con committed
76 77
{
    Q_OBJECT
78 79
    friend class Internal::QMakeStepFactory;

80 81 82 83 84 85
    enum QmlLibraryLink {
        DoNotLink = 0,
        DoLink,
        DebugLink
    };

86 87 88
    // used in DebuggerRunConfigurationAspect
    Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged)

con's avatar
con committed
89
public:
Tobias Hunger's avatar
Tobias Hunger committed
90
    explicit QMakeStep(ProjectExplorer::BuildStepList *parent);
91 92
    virtual ~QMakeStep();

93
    QmakeBuildConfiguration *qmakeBuildConfiguration() const;
94
    virtual bool init();
con's avatar
con committed
95 96 97 98 99
    virtual void run(QFutureInterface<bool> &);
    virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
    virtual bool immutable() const;
    void setForced(bool b);
    bool forced();
100

101
    // the complete argument line
102
    QString allArguments(bool shorted = false);
103 104 105 106 107
    // deduced arguments e.g. qmljs debugging
    QStringList deducedArguments();
    // deduced arguments with -after, e.g. OBJECTS_DIR for symbian
    QStringList deducedArgumentsAfter();
    // arguments passed to the pro file parser
108
    QStringList parserArguments();
109
    // arguments set by the user
110
    QString userArguments();
111
    Utils::FileName mkspec();
112
    void setUserArguments(const QString &arguments);
113 114
    bool linkQmlDebuggingLibrary() const;
    void setLinkQmlDebuggingLibrary(bool enable);
115 116
    bool useQtQuickCompiler() const;
    void setUseQtQuickCompiler(bool enable);
117

118
    QVariantMap toMap() const;
119

120
signals:
121
    void userArgumentsChanged();
122
    void linkQmlDebuggingLibraryChanged();
123
    void useQtQuickCompilerChanged();
124

con's avatar
con committed
125
protected:
Tobias Hunger's avatar
Tobias Hunger committed
126
    QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
127
    QMakeStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
128 129
    virtual bool fromMap(const QVariantMap &map);

con's avatar
con committed
130
    virtual void processStartupFailed();
131
    virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status);
con's avatar
con committed
132 133

private:
134 135
    void ctor();

con's avatar
con committed
136 137
    // last values
    bool m_forced;
138
    bool m_needToRunQMake; // set in init(), read in run()
139
    QString m_userArgs;
140
    QmlLibraryLink m_linkQmlDebuggingLibrary;
141
    bool m_useQtQuickCompiler;
dt's avatar
dt committed
142
    bool m_scriptTemplate;
con's avatar
con committed
143 144 145 146 147 148 149 150
};


class QMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
    Q_OBJECT
public:
    QMakeStepConfigWidget(QMakeStep *step);
151
    ~QMakeStepConfigWidget();
dt's avatar
dt committed
152
    QString summaryText() const;
153
    QString additionalSummaryText() const;
154
    QString displayName() const;
con's avatar
con committed
155
private slots:
156
    // slots for handling buildconfiguration/step signals
157
    void qtVersionChanged();
158 159
    void qmakeBuildConfigChanged();
    void userArgumentsChanged();
160
    void linkQmlDebuggingLibraryChanged();
161
    void useQtQuickCompilerChanged();
162 163 164 165

    // slots for dealing with user changes in our UI
    void qmakeArgumentsLineEdited();
    void buildConfigurationSelected();
166
    void linkQmlDebuggingLibraryChecked(bool checked);
167
    void useQtQuickCompilerChecked(bool checked);
168

169 170 171
private slots:
    void recompileMessageBoxFinished(int button);

con's avatar
con committed
172
private:
173
    void updateSummaryLabel();
174
    void updateQmlDebuggingOption();
175
    void updateQtQuickCompilerOption();
176
    void updateEffectiveQMakeCall();
177
    void askForRebuild();
178 179 180

    void setSummaryText(const QString &);

181
    Internal::Ui::QMakeStep *m_ui;
con's avatar
con committed
182
    QMakeStep *m_step;
dt's avatar
dt committed
183
    QString m_summaryText;
184
    QString m_additionalSummaryText;
185
    bool m_ignoreChange;
con's avatar
con committed
186 187
};

188
} // namespace QmakeProjectManager
con's avatar
con committed
189 190

#endif // QMAKESTEP_H