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 CUSTOMEXECUTABLERUNCONFIGURATION_H
34 #define CUSTOMEXECUTABLERUNCONFIGURATION_H
36 #include "applicationrunconfiguration.h"
38 #include <utils/environment.h>
40 #include <QtCore/QVariantMap>
42 namespace ProjectExplorer {
46 class CustomExecutableConfigurationWidget;
49 class CustomExecutableRunConfigurationFactory;
51 class PROJECTEXPLORER_EXPORT CustomExecutableRunConfiguration : public LocalApplicationRunConfiguration
54 // the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments
55 friend class Internal::CustomExecutableConfigurationWidget;
56 friend class CustomExecutableRunConfigurationFactory;
59 explicit CustomExecutableRunConfiguration(Target *parent);
60 ~CustomExecutableRunConfiguration();
63 * Returns the executable, looks in the environment for it and might even
64 * ask the user if none is specified
66 QString executable() const;
68 /** Returns whether this runconfiguration ever was configured with a executable
70 bool isConfigured() const;
72 LocalApplicationRunConfiguration::RunMode runMode() const;
73 QString workingDirectory() const;
74 QString commandLineArguments() const;
75 Utils::Environment environment() const;
77 QWidget *createConfigurationWidget();
78 QString dumperLibrary() const;
79 QStringList dumperLibraryLocations() const;
81 ProjectExplorer::Abi abi() const;
83 QVariantMap toMap() const;
88 void baseEnvironmentChanged();
89 void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
92 void activeBuildConfigurationChanged();
95 CustomExecutableRunConfiguration(Target *parent, CustomExecutableRunConfiguration *source);
96 virtual bool fromMap(const QVariantMap &map);
97 QString defaultDisplayName() const;
102 enum BaseEnvironmentBase { CleanEnvironmentBase = 0,
103 SystemEnvironmentBase = 1,
104 BuildEnvironmentBase = 2};
105 void setBaseEnvironmentBase(BaseEnvironmentBase env);
106 BaseEnvironmentBase baseEnvironmentBase() const;
107 Utils::Environment baseEnvironment() const;
108 QString baseEnvironmentText() const;
109 void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
110 QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
112 void setExecutable(const QString &executable);
113 QString rawExecutable() const;
114 void setCommandLineArguments(const QString &commandLineArguments);
115 QString rawCommandLineArguments() const;
116 void setBaseWorkingDirectory(const QString &workingDirectory);
117 QString baseWorkingDirectory() const;
118 void setUserName(const QString &name);
119 void setRunMode(RunMode runMode);
121 QString m_executable;
122 QString m_workingDirectory;
123 QString m_cmdArguments;
127 QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
128 BaseEnvironmentBase m_baseEnvironmentBase;
129 ProjectExplorer::BuildConfiguration *m_lastActiveBuildConfiguration;
132 class CustomExecutableRunConfigurationFactory : public IRunConfigurationFactory
137 explicit CustomExecutableRunConfigurationFactory(QObject *parent = 0);
138 ~CustomExecutableRunConfigurationFactory();
140 QStringList availableCreationIds(Target *parent) const;
141 QString displayNameForId(const QString &id) const;
143 bool canCreate(Target *parent, const QString &id) const;
144 RunConfiguration *create(Target *parent, const QString &id);
145 bool canRestore(Target *parent, const QVariantMap &map) const;
146 RunConfiguration *restore(Target *parent, const QVariantMap &map);
147 bool canClone(Target *parent, RunConfiguration *product) const;
148 RunConfiguration *clone(Target *parent, RunConfiguration *source);
151 } // namespace ProjectExplorer
153 #endif // CUSTOMEXECUTABLERUNCONFIGURATION_H