cmakeprojectmanager.h 4.03 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2 3 4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
con's avatar
con committed
9
** No Commercial Usage
10
**
con's avatar
con committed
11 12 13 14
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
15
**
16
** GNU Lesser General Public License Usage
17
**
18 19 20 21 22 23
** 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.
24
**
con's avatar
con committed
25 26 27 28 29 30
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
con's avatar
con committed
31
**
32
**************************************************************************/
hjk's avatar
hjk committed
33

con's avatar
con committed
34 35 36
#ifndef CMAKEPROJECTMANAGER_H
#define CMAKEPROJECTMANAGER_H

37
#include <coreplugin/dialogs/ioptionspage.h>
con's avatar
con committed
38
#include <projectexplorer/iprojectmanager.h>
39
#include <utils/environment.h>
40
#include <utils/pathchooser.h>
dt's avatar
dt committed
41 42 43
#include <QtCore/QFuture>
#include <QtCore/QStringList>
#include <QtCore/QDir>
con's avatar
con committed
44

45
QT_FORWARD_DECLARE_CLASS(QProcess)
46
QT_FORWARD_DECLARE_CLASS(QLabel)
47

con's avatar
con committed
48 49 50
namespace CMakeProjectManager {
namespace Internal {

51 52
class CMakeSettingsPage;

con's avatar
con committed
53 54 55 56
class CMakeManager : public ProjectExplorer::IProjectManager
{
    Q_OBJECT
public:
57
    CMakeManager(CMakeSettingsPage *cmakeSettingsPage);
con's avatar
con committed
58

dt's avatar
dt committed
59
    virtual Core::Context projectContext() const;
60
    virtual Core::Context projectLanguage() const;
con's avatar
con committed
61 62 63

    virtual ProjectExplorer::Project *openProject(const QString &fileName);
    virtual QString mimeType() const;
64

dt's avatar
dt committed
65
    QString cmakeExecutable() const;
66 67 68
    bool isCMakeExecutableValid() const;

    void setCMakeExecutable(const QString &executable);
dt's avatar
dt committed
69

70 71 72 73
    void createXmlFile(QProcess *process,
                       const QStringList &arguments,
                       const QString &sourceDirectory,
                       const QDir &buildDirectory,
74
                       const Utils::Environment &env,
75
                       const QString &generator);
76
    bool hasCodeBlocksMsvcGenerator() const;
77
    static QString findCbpFile(const QDir &);
78

79
    static QString findDumperLibrary(const Utils::Environment &env);
con's avatar
con committed
80
private:
81
    static QString qtVersionForQMake(const QString &qmakePath);
82
    static QPair<QString, QString> findQtDir(const Utils::Environment &env);
dt's avatar
dt committed
83
    Core::Context m_projectContext;
84
    Core::Context m_projectLanguage;
85 86 87 88 89 90 91 92 93
    CMakeSettingsPage *m_settingsPage;
};

class CMakeSettingsPage : public Core::IOptionsPage
{
    Q_OBJECT
public:
    CMakeSettingsPage();
    virtual ~CMakeSettingsPage();
94
    virtual QString id() const;
95
    virtual QString displayName() const;
96
    virtual QString category() const;
97
    virtual QString displayCategory() const;
98
    virtual QIcon categoryIcon() const;
99 100 101 102 103 104

    virtual QWidget *createPage(QWidget *parent);
    virtual void apply();
    virtual void finish();

    QString cmakeExecutable() const;
105 106
    void setCMakeExecutable(const QString &executable);
    bool isCMakeExecutableValid();
107
    bool hasCodeBlocksMsvcGenerator() const;
108 109
private slots:
    void cmakeFinished();
110 111
private:
    void saveSettings() const;
112
    void startProcess();
113
    QString findCmakeExecutable() const;
114
    void updateInfo();
dt's avatar
dt committed
115

116
    Utils::PathChooser *m_pathchooser;
117 118 119 120 121
    QString m_cmakeExecutable;
    enum STATE { VALID, INVALID, RUNNING } m_state;
    QProcess *m_process;
    QString m_version;
    bool m_hasCodeBlocksMsvcGenerator;
con's avatar
con committed
122
};
hjk's avatar
hjk committed
123 124 125 126

} // namespace Internal
} // namespace CMakeProjectManager

con's avatar
con committed
127
#endif // CMAKEPROJECTMANAGER_H