cmakeprojectmanager.h 3.9 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
**
9
** Commercial Usage
10
**
11 12 13 14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
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
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30 31 32
#ifndef CMAKEPROJECTMANAGER_H
#define CMAKEPROJECTMANAGER_H

33
#include <coreplugin/dialogs/ioptionspage.h>
con's avatar
con committed
34
#include <projectexplorer/iprojectmanager.h>
35
#include <projectexplorer/environment.h>
36
#include <utils/pathchooser.h>
dt's avatar
dt committed
37 38 39
#include <QtCore/QFuture>
#include <QtCore/QStringList>
#include <QtCore/QDir>
con's avatar
con committed
40

41
QT_FORWARD_DECLARE_CLASS(QProcess)
42
QT_FORWARD_DECLARE_CLASS(QLabel)
43

con's avatar
con committed
44 45 46
namespace CMakeProjectManager {
namespace Internal {

47 48
class CMakeSettingsPage;

con's avatar
con committed
49 50 51 52
class CMakeManager : public ProjectExplorer::IProjectManager
{
    Q_OBJECT
public:
53
    CMakeManager(CMakeSettingsPage *cmakeSettingsPage);
con's avatar
con committed
54

dt's avatar
dt committed
55
    virtual Core::Context projectContext() const;
con's avatar
con committed
56 57 58 59
    virtual int projectLanguage() const;

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

dt's avatar
dt committed
61
    QString cmakeExecutable() const;
62 63 64
    bool isCMakeExecutableValid() const;

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

66 67 68 69 70 71
    void createXmlFile(QProcess *process,
                       const QStringList &arguments,
                       const QString &sourceDirectory,
                       const QDir &buildDirectory,
                       const ProjectExplorer::Environment &env,
                       const QString &generator);
72
    bool hasCodeBlocksMsvcGenerator() const;
73
    static QString findCbpFile(const QDir &);
74 75

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

class CMakeSettingsPage : public Core::IOptionsPage
{
    Q_OBJECT
public:
    CMakeSettingsPage();
    virtual ~CMakeSettingsPage();
90
    virtual QString id() const;
91
    virtual QString displayName() const;
92
    virtual QString category() const;
93
    virtual QString displayCategory() const;
94
    virtual QIcon categoryIcon() const;
95 96 97 98 99 100

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

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

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

} // namespace Internal
} // namespace CMakeProjectManager

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