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 #ifndef QT4RUNCONFIGURATION_H
34 #define QT4RUNCONFIGURATION_H
36 #include <projectexplorer/applicationrunconfiguration.h>
38 #include <utils/environment.h>
40 #include <QtCore/QStringList>
41 #include <QtGui/QWidget>
42 #include <QtCore/QMetaType>
53 class DebuggerLanguageChooser;
57 namespace ProjectExplorer {
58 class EnvironmentWidget;
61 namespace Qt4ProjectManager {
67 class Qt4DesktopTarget;
70 class Qt4RunConfigurationFactory;
72 class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
75 // to change the display name and arguments and set the userenvironmentchanges
76 friend class Qt4RunConfigurationWidget;
77 friend class Qt4RunConfigurationFactory;
80 Qt4RunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath);
81 virtual ~Qt4RunConfiguration();
83 Qt4DesktopTarget *qt4Target() const;
85 virtual bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
86 using ProjectExplorer::LocalApplicationRunConfiguration::isEnabled;
87 virtual QWidget *createConfigurationWidget();
89 virtual QString executable() const;
90 virtual RunMode runMode() const;
91 virtual QString workingDirectory() const;
92 virtual QString commandLineArguments() const;
93 virtual Utils::Environment environment() const;
94 virtual QString dumperLibrary() const;
95 virtual QStringList dumperLibraryLocations() const;
97 bool isUsingDyldImageSuffix() const;
98 void setUsingDyldImageSuffix(bool state);
100 QString proFilePath() const;
102 // TODO detectQtShadowBuild() ? how did this work ?
103 QVariantMap toMap() const;
105 ProjectExplorer::OutputFormatter *createOutputFormatter() const;
108 void commandLineArgumentsChanged(const QString&);
109 void baseWorkingDirectoryChanged(const QString&);
110 void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
111 void usingDyldImageSuffixChanged(bool);
112 void baseEnvironmentChanged();
113 void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
115 // Note: These signals might not get emitted for every change!
116 void effectiveTargetInformationChanged();
119 void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success);
120 void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
123 Qt4RunConfiguration(Qt4BaseTarget *parent, Qt4RunConfiguration *source);
124 virtual bool fromMap(const QVariantMap &map);
127 void handleParseState(bool success);
128 void setRunMode(RunMode runMode);
129 void setBaseWorkingDirectory(const QString &workingDirectory);
130 QString baseWorkingDirectory() const;
131 void setCommandLineArguments(const QString &argumentsString);
132 QString rawCommandLineArguments() const;
133 enum BaseEnvironmentBase { CleanEnvironmentBase = 0,
134 SystemEnvironmentBase = 1,
135 BuildEnvironmentBase = 2 };
136 QString defaultDisplayName();
137 void setBaseEnvironmentBase(BaseEnvironmentBase env);
138 BaseEnvironmentBase baseEnvironmentBase() const;
142 Utils::Environment baseEnvironment() const;
143 QString baseEnvironmentText() const;
144 void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
145 QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
148 QString m_commandLineArguments;
149 QString m_proFilePath; // Full path to the Application Pro File
151 // Cached startup sub project information
152 ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode;
154 bool m_isUsingDyldImageSuffix;
155 QString m_userWorkingDirectory;
156 QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
157 BaseEnvironmentBase m_baseEnvironmentBase;
161 class Qt4RunConfigurationWidget : public QWidget
166 Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4runconfigration, QWidget *parent);
167 ~Qt4RunConfigurationWidget();
170 void showEvent(QShowEvent *event);
171 void hideEvent(QHideEvent *event);
174 void runConfigurationEnabledChange(bool);
175 void workDirectoryEdited();
176 void workingDirectoryReseted();
177 void argumentsEdited(const QString &arguments);
178 void userChangesEdited();
180 void workingDirectoryChanged(const QString &workingDirectory);
181 void commandLineArgumentsChanged(const QString &args);
182 void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
183 void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges);
184 void baseEnvironmentChanged();
186 void effectiveTargetInformationChanged();
187 void termToggled(bool);
188 void usingDyldImageSuffixToggled(bool);
189 void usingDyldImageSuffixChanged(bool);
190 void baseEnvironmentSelected(int index);
191 void useCppDebuggerToggled(bool toggled);
192 void useQmlDebuggerToggled(bool toggled);
193 void qmlDebugServerPortChanged(uint port);
196 Qt4RunConfiguration *m_qt4RunConfiguration;
198 QLineEdit *m_executableLineEdit;
199 Utils::PathChooser *m_workingDirectoryEdit;
200 QLineEdit *m_argumentsLineEdit;
201 QCheckBox *m_useTerminalCheck;
202 QCheckBox *m_usingDyldImageSuffix;
203 QLineEdit *m_qmlDebugPort;
205 QComboBox *m_baseEnvironmentComboBox;
206 Utils::DetailsWidget *m_detailsContainer;
207 Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
208 ProjectExplorer::EnvironmentWidget *m_environmentWidget;
212 class Qt4RunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
217 explicit Qt4RunConfigurationFactory(QObject *parent = 0);
218 virtual ~Qt4RunConfigurationFactory();
220 virtual bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
221 virtual ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
222 virtual bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
223 virtual ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
224 virtual bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
225 virtual ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
227 QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
228 QString displayNameForId(const QString &id) const;
231 } // namespace Internal
232 } // namespace Qt4ProjectManager
234 #endif // QT4RUNCONFIGURATION_H