2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-02-16 13:39:13 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
#include "qmlprojectmanager_global.h"
|
2011-01-20 14:03:07 +01:00
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2011-01-20 14:03:07 +01:00
|
|
|
|
2012-09-24 13:48:18 +02:00
|
|
|
#include <QPointer>
|
2010-04-13 10:58:30 +02:00
|
|
|
|
2010-12-16 12:05:48 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QStringListModel)
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Core { class IEditor; }
|
2010-03-05 11:11:05 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace QtSupport { class BaseQtVersion; }
|
2010-10-04 15:03:01 +02:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace QmlProjectManager {
|
2012-10-09 16:20:26 +02:00
|
|
|
class QmlProject;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
namespace Internal {
|
2010-11-29 09:45:30 +01:00
|
|
|
class QmlProjectRunConfigurationFactory;
|
2010-11-29 11:42:58 +01:00
|
|
|
class QmlProjectRunConfigurationWidget;
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
2010-02-16 13:39:13 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
friend class Internal::QmlProjectRunConfigurationFactory;
|
2010-11-29 11:42:58 +01:00
|
|
|
friend class Internal::QmlProjectRunConfigurationWidget;
|
2012-10-09 16:20:26 +02:00
|
|
|
friend class QmlProject; // to call updateEnabled()
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
public:
|
2012-08-23 14:53:03 +02:00
|
|
|
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
ProjectExplorer::Runnable runnable() const override;
|
2013-10-11 11:20:11 +02:00
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion *qtVersion() const;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2010-12-03 17:04:29 +01:00
|
|
|
enum MainScriptSource {
|
|
|
|
|
FileInEditor,
|
|
|
|
|
FileInProjectFile,
|
|
|
|
|
FileInSettings
|
|
|
|
|
};
|
|
|
|
|
MainScriptSource mainScriptSource() const;
|
|
|
|
|
void setScriptSource(MainScriptSource source, const QString &settingsPath = QString());
|
|
|
|
|
|
2010-11-29 11:42:58 +01:00
|
|
|
QString mainScript() const;
|
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
// RunConfiguration
|
2015-11-13 11:06:27 +01:00
|
|
|
QString disabledReason() const override;
|
|
|
|
|
virtual QWidget *createConfigurationWidget() override;
|
|
|
|
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
|
|
|
|
QVariantMap toMap() const override;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2015-11-13 11:06:27 +01:00
|
|
|
ProjectExplorer::Abi abi() const override;
|
2014-01-16 12:16:25 +01:00
|
|
|
signals:
|
|
|
|
|
void scriptSourceChanged();
|
2011-02-01 18:36:00 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
protected:
|
2012-04-24 15:49:09 +02:00
|
|
|
QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
|
2010-11-29 09:45:30 +01:00
|
|
|
QmlProjectRunConfiguration *source);
|
2015-11-13 11:06:27 +01:00
|
|
|
virtual bool fromMap(const QVariantMap &map) override;
|
2010-02-16 13:39:13 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void ctor();
|
2016-01-25 15:00:20 +01:00
|
|
|
|
2016-07-01 12:19:37 +03:00
|
|
|
void changeCurrentFile(Core::IEditor* = 0);
|
2017-07-17 14:34:05 +02:00
|
|
|
void updateEnabledState() final;
|
2016-07-01 12:19:37 +03:00
|
|
|
|
2016-01-25 15:00:20 +01:00
|
|
|
QString executable() const;
|
|
|
|
|
QString commandLineArguments() const;
|
|
|
|
|
|
2011-05-20 21:40:53 +02:00
|
|
|
static bool isValidVersion(QtSupport::BaseQtVersion *version);
|
2012-11-28 20:28:42 +02:00
|
|
|
|
2010-12-21 12:39:14 +01:00
|
|
|
static QString canonicalCapsPath(const QString &filePath);
|
2010-02-16 13:39:13 +01:00
|
|
|
|
2010-03-05 11:11:05 +01:00
|
|
|
// absolute path to current file (if being used)
|
|
|
|
|
QString m_currentFileFilename;
|
|
|
|
|
// absolute path to selected main script (if being used)
|
|
|
|
|
QString m_mainScriptFilename;
|
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
QString m_scriptFile;
|
|
|
|
|
QString m_qmlViewerArgs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlProjectManager
|