OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt4target.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 QT4TARGET_H
35 #define QT4TARGET_H
36
37 #include "qt4buildconfiguration.h"
38 #include <projectexplorer/target.h>
39
40 #include <QtGui/QPixmap>
41
42 namespace Qt4ProjectManager {
43
44 class Qt4Project;
45
46 namespace Internal {
47 class Qt4ProFileNode;
48 class Qt4TargetFactory;
49 class Qt4BuildConfigurationFactory;
50 class Qt4DeployConfigurationFactory;
51
52 struct BuildConfigurationInfo {
53     explicit BuildConfigurationInfo(QtVersion *v = 0, QtVersion::QmakeBuildConfigs bc = QtVersion::QmakeBuildConfig(0),
54                                     const QString &aa = QString(), const QString &d = QString()) :
55         version(v), buildConfig(bc), additionalArguments(aa), directory(d)
56     { }
57     QtVersion *version;
58     QtVersion::QmakeBuildConfigs buildConfig;
59     QString additionalArguments;
60     QString directory;
61 };
62 }
63
64 class Qt4Target : public ProjectExplorer::Target
65 {
66     Q_OBJECT
67     friend class Internal::Qt4TargetFactory;
68
69 public:
70     explicit Qt4Target(Qt4Project *parent, const QString &id);
71     virtual ~Qt4Target();
72
73     ProjectExplorer::BuildConfigWidget *createConfigWidget();
74
75     Qt4BuildConfiguration *activeBuildConfiguration() const;
76     Qt4ProjectManager::Qt4Project *qt4Project() const;
77
78     Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName,
79                                                               QtVersion *qtversion,
80                                                               QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
81                                                               QString additionalArguments,
82                                                               QString directory);
83     void addRunConfigurationForPath(const QString &proFilePath);
84
85     Internal::Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
86     ProjectExplorer::DeployConfigurationFactory *deployConfigurationFactory() const;
87
88     QList<ProjectExplorer::ToolChainType> filterToolChainTypes(const QList<ProjectExplorer::ToolChainType> &candidates) const;
89     ProjectExplorer::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChainType> &candidates) const;
90
91     QString defaultBuildDirectory() const;
92     static QString defaultShadowBuildDirectory(const QString &projectLocation, const QString &id);
93
94     bool fromMap(const QVariantMap &map);
95
96 signals:
97     void buildDirectoryInitialized();
98     /// emitted if the build configuration changed in a way that
99     /// should trigger a reevaluation of all .pro files
100     void proFileEvaluateNeeded(Qt4ProjectManager::Qt4Target *);
101
102 private slots:
103     void updateQtVersion();
104     void onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
105     void onAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
106     void slotUpdateDeviceInformation();
107     void onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *bc);
108     void emitProFileEvaluateNeeded();
109     void updateToolTipAndIcon();
110
111 private:
112     const QPixmap m_connectedPixmap;
113     const QPixmap m_disconnectedPixmap;
114
115     Internal::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
116     Internal::Qt4DeployConfigurationFactory *m_deployConfigurationFactory;
117 };
118
119 namespace Internal {
120 class Qt4TargetFactory : public ProjectExplorer::ITargetFactory
121 {
122     Q_OBJECT
123
124 public:
125     Qt4TargetFactory(QObject *parent = 0);
126     ~Qt4TargetFactory();
127
128     virtual bool supportsTargetId(const QString &id) const;
129
130     QStringList availableCreationIds(ProjectExplorer::Project *parent) const;
131     QString displayNameForId(const QString &id) const;
132
133     bool canCreate(ProjectExplorer::Project *parent, const QString &id) const;
134     Qt4ProjectManager::Qt4Target *create(ProjectExplorer::Project *parent, const QString &id);
135     Qt4ProjectManager::Qt4Target *create(ProjectExplorer::Project *parent, const QString &id, QList<QtVersion *> versions);
136     Qt4ProjectManager::Qt4Target *create(ProjectExplorer::Project *parent, const QString &id, QList<Internal::BuildConfigurationInfo> infos);
137     bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
138     Qt4ProjectManager::Qt4Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
139 };
140 }
141
142 } // namespace Qt4ProjectManager
143
144 #endif // QT4TARGET_H