qmakestep.h 5.73 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 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 QMAKESTEP_H
#define QMAKESTEP_H

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

36
#include <QStringList>
37

38 39
namespace Utils { class FileName; }

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

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

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

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

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

dt's avatar
dt committed
58
public:
59
    explicit QMakeStepFactory(QObject *parent = 0);
dt's avatar
dt committed
60
    virtual ~QMakeStepFactory();
61 62
    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
63 64 65 66
    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);
67 68
    QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
    QString displayNameForId(const Core::Id id) const;
dt's avatar
dt committed
69 70
};

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

con's avatar
con committed
73

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

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

con's avatar
con committed
85
public:
Tobias Hunger's avatar
Tobias Hunger committed
86
    explicit QMakeStep(ProjectExplorer::BuildStepList *parent);
87 88
    virtual ~QMakeStep();

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

97
    // the complete argument line
98
    QString allArguments(bool shorted = false);
99 100 101 102 103
    // 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
104
    QStringList parserArguments();
105
    // arguments set by the user
106
    QString userArguments();
107
    Utils::FileName mkspec();
108
    void setUserArguments(const QString &arguments);
109 110
    bool linkQmlDebuggingLibrary() const;
    void setLinkQmlDebuggingLibrary(bool enable);
111

112
    QVariantMap toMap() const;
113

114
signals:
115
    void userArgumentsChanged();
116
    void linkQmlDebuggingLibraryChanged();
117

con's avatar
con committed
118
protected:
Tobias Hunger's avatar
Tobias Hunger committed
119
    QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
120
    QMakeStep(ProjectExplorer::BuildStepList *parent, const Core::Id id);
121 122
    virtual bool fromMap(const QVariantMap &map);

con's avatar
con committed
123
    virtual void processStartupFailed();
124
    virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status);
con's avatar
con committed
125 126

private:
127 128
    void ctor();

con's avatar
con committed
129 130
    // last values
    bool m_forced;
131
    bool m_needToRunQMake; // set in init(), read in run()
132
    QString m_userArgs;
133
    QmlLibraryLink m_linkQmlDebuggingLibrary;
dt's avatar
dt committed
134 135
    bool m_scriptTemplate;
    QList<ProjectExplorer::Task> m_tasks;
con's avatar
con committed
136 137 138 139 140 141 142 143
};


class QMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
    Q_OBJECT
public:
    QMakeStepConfigWidget(QMakeStep *step);
144
    ~QMakeStepConfigWidget();
dt's avatar
dt committed
145
    QString summaryText() const;
146
    QString additionalSummaryText() const;
147
    QString displayName() const;
con's avatar
con committed
148
private slots:
149
    // slots for handling buildconfiguration/step signals
150
    void qtVersionChanged();
151 152
    void qmakeBuildConfigChanged();
    void userArgumentsChanged();
153
    void linkQmlDebuggingLibraryChanged();
154 155 156 157

    // slots for dealing with user changes in our UI
    void qmakeArgumentsLineEdited();
    void buildConfigurationSelected();
158 159
    void linkQmlDebuggingLibraryChecked(bool checked);

160 161 162
private slots:
    void recompileMessageBoxFinished(int button);

con's avatar
con committed
163
private:
164
    void updateSummaryLabel();
165
    void updateQmlDebuggingOption();
166
    void updateEffectiveQMakeCall();
167 168 169

    void setSummaryText(const QString &);

170
    Internal::Ui::QMakeStep *m_ui;
con's avatar
con committed
171
    QMakeStep *m_step;
dt's avatar
dt committed
172
    QString m_summaryText;
173
    QString m_additionalSummaryText;
174
    bool m_ignoreChange;
con's avatar
con committed
175 176
};

177
} // namespace QmakeProjectManager
con's avatar
con committed
178 179

#endif // QMAKESTEP_H