forked from qt-creator/qt-creator
ProjectExplorer: Drop LocalApplicationRunConfiguration
The functionality can be provided by producing a suitable Runnable in the derived classes directly. Change-Id: I7b8e8fe33fffd2b00176b6cf6633eca4e152e466 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -52,7 +52,7 @@ namespace QmlProjectManager {
|
||||
const char M_CURRENT_FILE[] = "CurrentFile";
|
||||
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent, Id id) :
|
||||
LocalApplicationRunConfiguration(parent, id),
|
||||
RunConfiguration(parent, id),
|
||||
m_scriptFile(QLatin1String(M_CURRENT_FILE)),
|
||||
m_isEnabled(false)
|
||||
{
|
||||
@@ -61,9 +61,20 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent, Id id) :
|
||||
ctor();
|
||||
}
|
||||
|
||||
Runnable QmlProjectRunConfiguration::runnable() const
|
||||
{
|
||||
StandardRunnable r;
|
||||
r.executable = executable();
|
||||
r.commandLineArguments = commandLineArguments();
|
||||
r.runMode = ApplicationLauncher::Gui;
|
||||
r.workingDirectory = canonicalCapsPath(target()->project()->projectFilePath()
|
||||
.toFileInfo().absolutePath());
|
||||
return r;
|
||||
}
|
||||
|
||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent,
|
||||
QmlProjectRunConfiguration *source) :
|
||||
LocalApplicationRunConfiguration(parent, source),
|
||||
RunConfiguration(parent, source),
|
||||
m_currentFileFilename(source->m_currentFileFilename),
|
||||
m_mainScriptFilename(source->m_mainScriptFilename),
|
||||
m_scriptFile(source->m_scriptFile),
|
||||
@@ -114,11 +125,6 @@ QString QmlProjectRunConfiguration::executable() const
|
||||
return version->qmlviewerCommand();
|
||||
}
|
||||
|
||||
ApplicationLauncher::Mode QmlProjectRunConfiguration::runMode() const
|
||||
{
|
||||
return ApplicationLauncher::Gui;
|
||||
}
|
||||
|
||||
QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
// arguments in .user file
|
||||
@@ -139,11 +145,6 @@ QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||
return args;
|
||||
}
|
||||
|
||||
QString QmlProjectRunConfiguration::workingDirectory() const
|
||||
{
|
||||
return canonicalCapsPath(target()->project()->projectFilePath().toFileInfo().absolutePath());
|
||||
}
|
||||
|
||||
/* QtDeclarative checks explicitly that the capitalization for any URL / path
|
||||
is exactly like the capitalization on disk.*/
|
||||
QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "qmlprojectmanager_global.h"
|
||||
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Internal {
|
||||
class QmlProjectRunConfigurationWidget;
|
||||
}
|
||||
|
||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
|
||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Internal::QmlProjectRunConfigurationFactory;
|
||||
@@ -56,11 +56,8 @@ class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplor
|
||||
public:
|
||||
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
||||
|
||||
QString executable() const override;
|
||||
ProjectExplorer::ApplicationLauncher::Mode runMode() const override;
|
||||
QString commandLineArguments() const override;
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
|
||||
QString workingDirectory() const override;
|
||||
QtSupport::BaseQtVersion *qtVersion() const;
|
||||
|
||||
enum MainScriptSource {
|
||||
@@ -96,6 +93,10 @@ protected:
|
||||
|
||||
private:
|
||||
void ctor();
|
||||
|
||||
QString executable() const;
|
||||
QString commandLineArguments() const;
|
||||
|
||||
static bool isValidVersion(QtSupport::BaseQtVersion *version);
|
||||
|
||||
static QString canonicalCapsPath(const QString &filePath);
|
||||
|
||||
Reference in New Issue
Block a user