1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "qt4buildconfiguration.h"
38 #include <projectexplorer/target.h>
40 #include <QtGui/QPixmap>
42 namespace Qt4ProjectManager {
48 class Qt4TargetFactory;
49 class Qt4BuildConfigurationFactory;
50 class Qt4DeployConfigurationFactory;
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)
58 QtVersion::QmakeBuildConfigs buildConfig;
59 QString additionalArguments;
64 class Qt4Target : public ProjectExplorer::Target
67 friend class Internal::Qt4TargetFactory;
70 explicit Qt4Target(Qt4Project *parent, const QString &id);
73 ProjectExplorer::BuildConfigWidget *createConfigWidget();
75 Qt4BuildConfiguration *activeBuildConfiguration() const;
76 Qt4ProjectManager::Qt4Project *qt4Project() const;
78 Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName,
80 QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
81 QString additionalArguments,
83 void addRunConfigurationForPath(const QString &proFilePath);
85 Internal::Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
86 ProjectExplorer::DeployConfigurationFactory *deployConfigurationFactory() const;
88 QList<ProjectExplorer::ToolChainType> filterToolChainTypes(const QList<ProjectExplorer::ToolChainType> &candidates) const;
89 ProjectExplorer::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChainType> &candidates) const;
91 QString defaultBuildDirectory() const;
92 static QString defaultShadowBuildDirectory(const QString &projectLocation, const QString &id);
94 bool fromMap(const QVariantMap &map);
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 *);
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();
112 const QPixmap m_connectedPixmap;
113 const QPixmap m_disconnectedPixmap;
115 Internal::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
116 Internal::Qt4DeployConfigurationFactory *m_deployConfigurationFactory;
120 class Qt4TargetFactory : public ProjectExplorer::ITargetFactory
125 Qt4TargetFactory(QObject *parent = 0);
128 virtual bool supportsTargetId(const QString &id) const;
130 QStringList availableCreationIds(ProjectExplorer::Project *parent) const;
131 QString displayNameForId(const QString &id) const;
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);
142 } // namespace Qt4ProjectManager
144 #endif // QT4TARGET_H