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 **************************************************************************/
34 #ifndef CMAKERUNCONFIGURATION_H
35 #define CMAKERUNCONFIGURATION_H
37 #include <projectexplorer/applicationrunconfiguration.h>
38 #include <projectexplorer/persistentsettings.h>
39 #include <projectexplorer/environmenteditmodel.h>
40 #include <utils/environment.h>
41 #include <utils/pathchooser.h>
42 #include <utils/detailswidget.h>
49 class DebuggerLanguageChooser;
52 namespace CMakeProjectManager {
55 class CMakeBuildConfiguration;
58 class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
61 friend class CMakeRunConfigurationWidget;
62 friend class CMakeRunConfigurationFactory;
65 CMakeRunConfiguration(CMakeTarget *parent, const QString &target,
66 const QString &workingDirectory, const QString &title);
67 ~CMakeRunConfiguration();
69 CMakeTarget *cmakeTarget() const;
70 CMakeBuildConfiguration *activeBuildConfiguration() const;
72 QString executable() const;
73 RunMode runMode() const;
74 QString workingDirectory() const;
75 QString commandLineArguments() const;
76 Utils::Environment environment() const;
77 QWidget *createConfigurationWidget();
79 void setExecutable(const QString &executable);
80 void setBaseWorkingDirectory(const QString &workingDirectory);
82 QString title() const;
84 QString dumperLibrary() const;
85 QStringList dumperLibraryLocations() const;
86 ProjectExplorer::ToolChainType toolChainType() const;
88 QVariantMap toMap() const;
90 void setEnabled(bool b);
92 bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const;
93 using LocalApplicationRunConfiguration::isEnabled;
96 void baseEnvironmentChanged();
97 void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
98 void baseWorkingDirectoryChanged(const QString&);
101 void setCommandLineArguments(const QString &newText);
104 CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source);
105 virtual bool fromMap(const QVariantMap &map);
106 QString defaultDisplayName() const;
109 void setUserWorkingDirectory(const QString &workingDirectory);
110 QString baseWorkingDirectory() const;
113 enum BaseEnvironmentBase { CleanEnvironmentBase = 0,
114 SystemEnvironmentBase = 1,
115 BuildEnvironmentBase = 2};
116 void setBaseEnvironmentBase(BaseEnvironmentBase env);
117 BaseEnvironmentBase baseEnvironmentBase() const;
118 Utils::Environment baseEnvironment() const;
119 QString baseEnvironmentText() const;
121 void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
122 QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
125 QString m_buildTarget;
126 QString m_workingDirectory;
127 QString m_userWorkingDirectory;
130 QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
131 BaseEnvironmentBase m_baseEnvironmentBase;
135 class CMakeRunConfigurationWidget : public QWidget
139 explicit CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent = 0);
142 void setArguments(const QString &args);
143 void baseEnvironmentChanged();
144 void userEnvironmentChangesChanged();
145 void userChangesChanged();
146 void setWorkingDirectory();
147 void resetWorkingDirectory();
148 void useCppDebuggerToggled(bool toggled);
149 void useQmlDebuggerToggled(bool toggled);
150 void qmlDebugServerPortChanged(uint port);
153 void baseEnvironmentComboBoxChanged(int index);
154 void workingDirectoryChanged(const QString &workingDirectory);
159 CMakeRunConfiguration *m_cmakeRunConfiguration;
160 Utils::PathChooser *m_workingDirectoryEdit;
161 QComboBox *m_baseEnvironmentComboBox;
162 Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
163 ProjectExplorer::EnvironmentWidget *m_environmentWidget;
164 Utils::DetailsWidget *m_detailsContainer;
167 class CMakeRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
172 explicit CMakeRunConfigurationFactory(QObject *parent = 0);
173 ~CMakeRunConfigurationFactory();
175 bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
176 ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
177 bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
178 ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
179 bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
180 ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product);
182 QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
183 QString displayNameForId(const QString &id) const;
189 #endif // CMAKERUNCONFIGURATION_H