OSDN Git Service

62b9d539cf8fe47bbe9515703bd5d966fe1ef588
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-maemo / maemorunconfiguration.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 MAEMORUNCONFIGURATION_H
35 #define MAEMORUNCONFIGURATION_H
36
37 #include "maemoconstants.h"
38 #include "maemodeviceconfigurations.h"
39 #include "maemodeployable.h"
40
41 #include <utils/environment.h>
42
43 #include <projectexplorer/runconfiguration.h>
44
45 #include <QtCore/QDateTime>
46 #include <QtCore/QStringList>
47
48 QT_FORWARD_DECLARE_CLASS(QWidget)
49
50 namespace Qt4ProjectManager {
51
52 class Qt4BuildConfiguration;
53 class Qt4Project;
54 class Qt4BaseTarget;
55
56 namespace Internal {
57
58 class Qt4ProFileNode;
59 class AbstractQt4MaemoTarget;
60
61 class MaemoDeviceConfigListModel;
62 class MaemoDeployStep;
63 class MaemoManager;
64 class MaemoRemoteMountsModel;
65 class MaemoRunConfigurationFactory;
66 class MaemoToolChain;
67
68 class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
69 {
70     Q_OBJECT
71     friend class MaemoRunConfigurationFactory;
72
73 public:
74     enum BaseEnvironmentBase {
75         CleanEnvironmentBase = 0,
76         SystemEnvironmentBase = 1
77     };
78
79     enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
80
81     MaemoRunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath);
82     virtual ~MaemoRunConfiguration();
83
84     using ProjectExplorer::RunConfiguration::isEnabled;
85     bool isEnabled(ProjectExplorer::BuildConfiguration *config) const;
86     QWidget *createConfigurationWidget();
87     ProjectExplorer::OutputFormatter *createOutputFormatter() const;
88     AbstractQt4MaemoTarget *maemoTarget() const;
89     Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
90
91     MaemoDeployStep *deployStep() const;
92     MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
93
94     const MaemoToolChain *toolchain() const;
95     QString localExecutableFilePath() const;
96     QString remoteExecutableFilePath() const;
97     const QString sysRoot() const;
98     const QString targetRoot() const;
99     const QString arguments() const;
100     void setArguments(const QString &args);
101     QSharedPointer<const MaemoDeviceConfig> deviceConfig() const;
102     MaemoPortList freePorts() const;
103     bool useRemoteGdb() const;
104     void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; }
105     void updateFactoryState() { emit isEnabledChanged(true); }
106     DebuggingType debuggingType() const;
107
108     const QString gdbCmd() const;
109     const QString dumperLib() const;
110     QString localDirToMountForRemoteGdb() const;
111     QString remoteProjectSourcesMountPoint() const;
112
113     virtual QVariantMap toMap() const;
114
115     QString baseEnvironmentText() const;
116     BaseEnvironmentBase baseEnvironmentBase() const;
117     void setBaseEnvironmentBase(BaseEnvironmentBase env);
118
119     Utils::Environment environment() const;
120     Utils::Environment baseEnvironment() const;
121
122     QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
123     void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
124
125     Utils::Environment systemEnvironment() const;
126     void setSystemEnvironment(const Utils::Environment &environment);
127
128     int portsUsedByDebuggers() const;
129
130     QString proFilePath() const;
131
132 signals:
133     void deviceConfigurationChanged(ProjectExplorer::Target *target);
134     void targetInformationChanged() const;
135
136     void baseEnvironmentChanged();
137     void systemEnvironmentChanged();
138     void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
139
140 protected:
141     MaemoRunConfiguration(Qt4BaseTarget *parent, MaemoRunConfiguration *source);
142     virtual bool fromMap(const QVariantMap &map);
143     QString defaultDisplayName();
144
145 private slots:
146     void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success);
147     void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
148     void updateDeviceConfigurations();
149     void handleDeployConfigChanged();
150
151 private:
152     void init();
153     void handleParseState(bool success);
154
155     QString m_proFilePath;
156     mutable QString m_gdbPath;
157     MaemoRemoteMountsModel *m_remoteMounts;
158     QString m_arguments;
159     bool m_useRemoteGdb;
160
161     BaseEnvironmentBase m_baseEnvironmentBase;
162     Utils::Environment m_systemEnvironment;
163     QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
164     bool m_validParse;
165 };
166
167     } // namespace Internal
168 } // namespace Qt4ProjectManager
169
170 #endif // MAEMORUNCONFIGURATION_H