genericbuildconfiguration.h 3.84 KB
Newer Older
dt's avatar
dt committed
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
dt's avatar
dt committed
6
**
Eike Ziller's avatar
Eike Ziller committed
7
** Contact: http://www.qt-project.org/
dt's avatar
dt committed
8 9 10 11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12 13 14 15 16 17
** 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.
dt's avatar
dt committed
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21 22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23 24 25 26 27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
dt's avatar
dt committed
28 29 30 31 32 33 34
**
**************************************************************************/

#ifndef GENERICBUILDCONFIGURATION_H
#define GENERICBUILDCONFIGURATION_H

#include <projectexplorer/buildconfiguration.h>
Tobias Hunger's avatar
Tobias Hunger committed
35 36 37
#include <projectexplorer/buildstep.h> // for BuildConfigWidget

namespace Utils { class PathChooser; }
dt's avatar
dt committed
38 39

namespace GenericProjectManager {
40 41
namespace Internal {

Tobias Hunger's avatar
Tobias Hunger committed
42
class GenericTarget;
43
class GenericBuildConfigurationFactory;
dt's avatar
dt committed
44 45 46

class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
47
    Q_OBJECT
48 49
    friend class GenericBuildConfigurationFactory;

dt's avatar
dt committed
50
public:
Tobias Hunger's avatar
Tobias Hunger committed
51
    explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
52

Tobias Hunger's avatar
Tobias Hunger committed
53
    ProjectExplorer::BuildConfigWidget *createConfigWidget();
hjk's avatar
hjk committed
54
    QString buildDirectory() const;
55 56

    QString rawBuildDirectory() const;
57
    void setBuildDirectory(const QString &buildDirectory);
58

59
    QVariantMap toMap() const;
60
    ProjectExplorer::IOutputParser *createOutputParser() const;
61 62
    BuildType buildType() const;

63
protected:
Tobias Hunger's avatar
Tobias Hunger committed
64 65
    GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source);
    GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
66 67
    virtual bool fromMap(const QVariantMap &map);

dt's avatar
dt committed
68 69
private:
    QString m_buildDirectory;
dt's avatar
dt committed
70 71
};

72 73 74 75 76
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
{
    Q_OBJECT

public:
77
    explicit GenericBuildConfigurationFactory(QObject *parent = 0);
78
    ~GenericBuildConfigurationFactory();
79

Tobias Hunger's avatar
Tobias Hunger committed
80
    QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
81
    QString displayNameForId(const Core::Id id) const;
82

Tobias Hunger's avatar
Tobias Hunger committed
83 84 85
    bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
    ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
    bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
Tobias Hunger's avatar
Tobias Hunger committed
86
    ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
Tobias Hunger's avatar
Tobias Hunger committed
87
    bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
Tobias Hunger's avatar
Tobias Hunger committed
88
    ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
Tobias Hunger's avatar
Tobias Hunger committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

private:
    bool canHandle(const ProjectExplorer::Target *t) const;
};

class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
{
    Q_OBJECT

public:
    GenericBuildSettingsWidget();

    QString displayName() const;

    void init(ProjectExplorer::BuildConfiguration *bc);

private slots:
    void buildDirectoryChanged();

private:
    Utils::PathChooser *m_pathChooser;
    GenericBuildConfiguration *m_buildConfiguration;
111 112
};

dt's avatar
dt committed
113
} // namespace Internal
Tobias Hunger's avatar
Tobias Hunger committed
114
} // namespace GenericProjectManager
hjk's avatar
hjk committed
115

dt's avatar
dt committed
116
#endif // GENERICBUILDCONFIGURATION_H