1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "qt4simulatortarget.h"
34 #include "qt4project.h"
35 #include "qt4runconfiguration.h"
37 #include <projectexplorer/customexecutablerunconfiguration.h>
38 #include <projectexplorer/deployconfiguration.h>
39 #include <QtGui/QApplication>
41 using namespace Qt4ProjectManager;
42 using namespace Qt4ProjectManager::Internal;
45 // -------------------------------------------------------------------------
47 // -------------------------------------------------------------------------
49 Qt4SimulatorTarget::Qt4SimulatorTarget(Qt4Project *parent, const QString &id) :
50 Qt4BaseTarget(parent, id),
51 m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)),
52 m_deployConfigurationFactory(new ProjectExplorer::DeployConfigurationFactory(this))
54 setDisplayName(defaultDisplayName());
55 setIcon(QIcon(":/projectexplorer/images/SymbianEmulator.png"));
58 Qt4SimulatorTarget::~Qt4SimulatorTarget()
62 QString Qt4SimulatorTarget::defaultDisplayName()
64 return QApplication::translate("Qt4ProjectManager::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
67 Qt4BuildConfigurationFactory *Qt4SimulatorTarget::buildConfigurationFactory() const
69 return m_buildConfigurationFactory;
72 ProjectExplorer::DeployConfigurationFactory *Qt4SimulatorTarget::deployConfigurationFactory() const
74 return m_deployConfigurationFactory;
77 void Qt4SimulatorTarget::createApplicationProFiles()
79 removeUnconfiguredCustomExectutableRunConfigurations();
81 // We use the list twice
82 QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
84 foreach (Qt4ProFileNode *pro, profiles)
87 foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
88 if (Qt4RunConfiguration *qt4rc = qobject_cast<Qt4RunConfiguration *>(rc))
89 paths.remove(qt4rc->proFilePath());
91 // Only add new runconfigurations if there are none.
92 foreach (const QString &path, paths)
93 addRunConfiguration(new Qt4RunConfiguration(this, path));
95 // Oh still none? Add a custom executable runconfiguration
96 if (runConfigurations().isEmpty()) {
97 addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this));
101 QList<ProjectExplorer::RunConfiguration *> Qt4SimulatorTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
103 QList<ProjectExplorer::RunConfiguration *> result;
104 foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
105 if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
106 if (qt4c->proFilePath() == n->path())