OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / cmakeprojectmanager / cmakeprojectmanager.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef CMAKEPROJECTMANAGER_H
35 #define CMAKEPROJECTMANAGER_H
36
37 #include <projectexplorer/iprojectmanager.h>
38 #include <coreplugin/dialogs/ioptionspage.h>
39 #include <coreplugin/icontext.h>
40
41 #include <utils/environment.h>
42 #include <utils/pathchooser.h>
43
44 #include <QtCore/QFuture>
45 #include <QtCore/QStringList>
46 #include <QtCore/QDir>
47
48 QT_FORWARD_DECLARE_CLASS(QProcess)
49 QT_FORWARD_DECLARE_CLASS(QLabel)
50
51 namespace Utils {
52 class QtcProcess;
53 }
54
55 namespace CMakeProjectManager {
56 namespace Internal {
57
58 class CMakeSettingsPage;
59
60 class CMakeManager : public ProjectExplorer::IProjectManager
61 {
62     Q_OBJECT
63 public:
64     CMakeManager(CMakeSettingsPage *cmakeSettingsPage);
65
66     virtual Core::Context projectContext() const;
67     virtual Core::Context projectLanguage() const;
68
69     virtual ProjectExplorer::Project *openProject(const QString &fileName);
70     virtual QString mimeType() const;
71
72     QString cmakeExecutable() const;
73     bool isCMakeExecutableValid() const;
74
75     void setCMakeExecutable(const QString &executable);
76
77     void createXmlFile(Utils::QtcProcess *process,
78                        const QString &arguments,
79                        const QString &sourceDirectory,
80                        const QDir &buildDirectory,
81                        const Utils::Environment &env,
82                        const QString &generator);
83     bool hasCodeBlocksMsvcGenerator() const;
84     static QString findCbpFile(const QDir &);
85
86     static QString findDumperLibrary(const Utils::Environment &env);
87 private:
88     static QString qtVersionForQMake(const QString &qmakePath);
89     static QPair<QString, QString> findQtDir(const Utils::Environment &env);
90     Core::Context m_projectContext;
91     Core::Context m_projectLanguage;
92     CMakeSettingsPage *m_settingsPage;
93 };
94
95 class CMakeSettingsPage : public Core::IOptionsPage
96 {
97     Q_OBJECT
98 public:
99     CMakeSettingsPage();
100     virtual ~CMakeSettingsPage();
101     virtual QString id() const;
102     virtual QString displayName() const;
103     virtual QString category() const;
104     virtual QString displayCategory() const;
105     virtual QIcon categoryIcon() const;
106
107     virtual QWidget *createPage(QWidget *parent);
108     virtual void apply();
109     virtual void finish();
110
111     QString cmakeExecutable() const;
112     void setCMakeExecutable(const QString &executable);
113     bool isCMakeExecutableValid();
114     bool hasCodeBlocksMsvcGenerator() const;
115 private slots:
116     void cmakeFinished();
117 private:
118     void saveSettings() const;
119     void startProcess();
120     QString findCmakeExecutable() const;
121     void updateInfo();
122
123     Utils::PathChooser *m_pathchooser;
124     QString m_cmakeExecutable;
125     enum STATE { VALID, INVALID, RUNNING } m_state;
126     QProcess *m_process;
127     QString m_version;
128     bool m_hasCodeBlocksMsvcGenerator;
129 };
130
131 } // namespace Internal
132 } // namespace CMakeProjectManager
133
134 #endif // CMAKEPROJECTMANAGER_H