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 QMLPROJECTRUNCONFIGURATION_H
35 #define QMLPROJECTRUNCONFIGURATION_H
37 #include "qmlprojectmanager_global.h"
38 #include <projectexplorer/runconfiguration.h>
39 #include <QWeakPointer>
43 QT_FORWARD_DECLARE_CLASS(QStringListModel)
51 class EnvironmentItem;
54 namespace Qt4ProjectManager {
58 namespace QmlProjectManager {
61 class QmlProjectTarget;
62 class QmlProjectRunConfigurationFactory;
63 class QmlProjectRunConfigurationWidget;
66 class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
69 friend class Internal::QmlProjectRunConfigurationFactory;
70 friend class Internal::QmlProjectRunConfigurationWidget;
72 // used in qmldumptool.cpp
73 Q_PROPERTY(int qtVersionId READ qtVersionId)
76 QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent);
77 virtual ~QmlProjectRunConfiguration();
79 Internal::QmlProjectTarget *qmlTarget() const;
81 QString viewerPath() const;
82 QString observerPath() const;
83 QString viewerArguments() const;
84 QString workingDirectory() const;
85 int qtVersionId() const;
86 Qt4ProjectManager::QtVersion *qtVersion() const;
88 enum MainScriptSource {
93 MainScriptSource mainScriptSource() const;
94 void setScriptSource(MainScriptSource source, const QString &settingsPath = QString());
96 QString mainScript() const;
98 Utils::Environment environment() const;
101 bool isEnabled(ProjectExplorer::BuildConfiguration *bc) const;
102 virtual QWidget *createConfigurationWidget();
103 ProjectExplorer::OutputFormatter *createOutputFormatter() const;
104 QVariantMap toMap() const;
107 void changeCurrentFile(Core::IEditor*);
110 void updateEnabled();
111 void updateQtVersions();
114 QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent,
115 QmlProjectRunConfiguration *source);
116 virtual bool fromMap(const QVariantMap &map);
117 void setEnabled(bool value);
121 static bool isValidVersion(Qt4ProjectManager::QtVersion *version);
122 void setQtVersionId(int id);
124 static QString canonicalCapsPath(const QString &filePath);
126 Utils::Environment baseEnvironment() const;
127 void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff);
128 QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
130 // absolute path to current file (if being used)
131 QString m_currentFileFilename;
132 // absolute path to selected main script (if being used)
133 QString m_mainScriptFilename;
136 QString m_scriptFile;
137 QString m_qmlViewerArgs;
139 Internal::QmlProjectTarget *m_projectTarget;
140 QWeakPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
142 bool m_usingCurrentFile;
145 QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
148 } // namespace QmlProjectManager
150 #endif // QMLPROJECTRUNCONFIGURATION_H