OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-desktop / qt4simulatortarget.cpp
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 (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #include "qt4simulatortarget.h"
34 #include "qt4project.h"
35 #include "qt4runconfiguration.h"
36
37 #include <projectexplorer/customexecutablerunconfiguration.h>
38 #include <projectexplorer/deployconfiguration.h>
39 #include <QtGui/QApplication>
40
41 using namespace Qt4ProjectManager;
42 using namespace Qt4ProjectManager::Internal;
43
44
45 // -------------------------------------------------------------------------
46 // Qt4Target
47 // -------------------------------------------------------------------------
48
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))
53 {
54     setDisplayName(defaultDisplayName());
55     setIcon(QIcon(":/projectexplorer/images/SymbianEmulator.png"));
56 }
57
58 Qt4SimulatorTarget::~Qt4SimulatorTarget()
59 {
60 }
61
62 QString Qt4SimulatorTarget::defaultDisplayName()
63 {
64     return QApplication::translate("Qt4ProjectManager::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
65 }
66
67 Qt4BuildConfigurationFactory *Qt4SimulatorTarget::buildConfigurationFactory() const
68 {
69     return m_buildConfigurationFactory;
70 }
71
72 ProjectExplorer::DeployConfigurationFactory *Qt4SimulatorTarget::deployConfigurationFactory() const
73 {
74     return m_deployConfigurationFactory;
75 }
76
77 void Qt4SimulatorTarget::createApplicationProFiles()
78 {
79     removeUnconfiguredCustomExectutableRunConfigurations();
80
81     // We use the list twice
82     QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
83     QSet<QString> paths;
84     foreach (Qt4ProFileNode *pro, profiles)
85         paths << pro->path();
86
87     foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
88         if (Qt4RunConfiguration *qt4rc = qobject_cast<Qt4RunConfiguration *>(rc))
89             paths.remove(qt4rc->proFilePath());
90
91     // Only add new runconfigurations if there are none.
92     foreach (const QString &path, paths)
93         addRunConfiguration(new Qt4RunConfiguration(this, path));
94
95     // Oh still none? Add a custom executable runconfiguration
96     if (runConfigurations().isEmpty()) {
97         addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this));
98     }
99 }
100
101 QList<ProjectExplorer::RunConfiguration *> Qt4SimulatorTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
102 {
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())
107                 result << rc;
108     return result;
109 }