OSDN Git Service

3f02f7393297e0669bc3d8785e966a376a4b7b52
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / gcctoolchainfactories.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 GCCTOOLCHAINFACTORIES_H
35 #define GCCTOOLCHAINFACTORIES_H
36
37 #include "toolchain.h"
38 #include "toolchainconfigwidget.h"
39 #include "abi.h"
40
41 #include <QtCore/QList>
42
43 QT_BEGIN_NAMESPACE
44 class QComboBox;
45 QT_END_NAMESPACE
46
47 namespace Utils {
48 class PathChooser;
49 }
50
51 namespace ProjectExplorer {
52 class GccToolChain;
53
54 namespace Internal {
55
56 class GccToolChainFactory : public ToolChainFactory
57 {
58     Q_OBJECT
59
60 public:
61     // Name used to display the name of the tool chain that will be created.
62     QString displayName() const;
63     QString id() const;
64
65     QList<ToolChain *> autoDetect();
66
67     bool canCreate();
68     ToolChain *create();
69
70     // Used by the ToolChainManager to restore user-generated tool chains
71     bool canRestore(const QVariantMap &data);
72     ToolChain *restore(const QVariantMap &data);
73
74 protected:
75     virtual GccToolChain *createToolChain(bool autoDetect);
76     QList<ToolChain *> autoDetectToolchains(const QString &compiler,
77                                             const QStringList &debuggers,
78                                             const Abi &);
79 };
80
81 // --------------------------------------------------------------------------
82 // GccToolChainConfigWidget
83 // --------------------------------------------------------------------------
84
85 class GccToolChainConfigWidget : public ToolChainConfigWidget
86 {
87     Q_OBJECT
88
89 public:
90     GccToolChainConfigWidget(GccToolChain *);
91     void apply();
92     void discard() { setFromToolchain(); }
93     bool isDirty() const;
94
95 private slots:
96     void handlePathChange();
97     void handleAbiChange();
98
99 private:
100     void populateAbiList(const QList<Abi> &);
101     void setFromToolchain();
102
103     Utils::PathChooser *m_compilerPath;
104     QComboBox *m_abiComboBox;
105     QString m_autoDebuggerCommand;
106
107     QList<Abi> m_abiList;
108 };
109
110 // --------------------------------------------------------------------------
111 // MingwToolChainFactory
112 // --------------------------------------------------------------------------
113
114 class MingwToolChainFactory : public GccToolChainFactory
115 {
116     Q_OBJECT
117
118 public:
119     // Name used to display the name of the tool chain that will be created.
120     QString displayName() const;
121     QString id() const;
122
123     QList<ToolChain *> autoDetect();
124
125     bool canCreate();
126     ToolChain *create();
127
128     // Used by the ToolChainManager to restore user-generated tool chains
129     bool canRestore(const QVariantMap &data);
130     ToolChain *restore(const QVariantMap &data);
131
132 protected:
133     GccToolChain *createToolChain(bool autoDetect);
134 };
135
136 // --------------------------------------------------------------------------
137 // LinuxIccToolChainFactory
138 // --------------------------------------------------------------------------
139
140 class LinuxIccToolChainFactory : public GccToolChainFactory
141 {
142     Q_OBJECT
143
144 public:
145     // Name used to display the name of the tool chain that will be created.
146     QString displayName() const;
147     QString id() const;
148
149     QList<ToolChain *> autoDetect();
150
151     ToolChain *create();
152
153     // Used by the ToolChainManager to restore user-generated tool chains
154     bool canRestore(const QVariantMap &data);
155     ToolChain *restore(const QVariantMap &data);
156
157 protected:
158     GccToolChain *createToolChain(bool autoDetect);
159 };
160
161 } // namespace Internal
162 } // namespace ProjectExplorer
163
164 #endif // GCCTOOLCHAINFACTORIES_H