forked from qt-creator/qt-creator
Qbs: Use new ArgumentsAspect
Change-Id: Ib1ea9ab9d7c1e15db2d60081e81ae0f4478d9bc1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
#include <projectexplorer/localapplicationruncontrol.h>
|
#include <projectexplorer/localapplicationruncontrol.h>
|
||||||
#include <projectexplorer/localenvironmentaspect.h>
|
#include <projectexplorer/localenvironmentaspect.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
@@ -68,7 +69,6 @@ namespace QbsProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
||||||
const char COMMAND_LINE_ARGUMENTS_KEY[] = "Qbs.RunConfiguration.CommandLineArguments";
|
|
||||||
const char USE_TERMINAL_KEY[] = "Qbs.RunConfiguration.UseTerminal";
|
const char USE_TERMINAL_KEY[] = "Qbs.RunConfiguration.UseTerminal";
|
||||||
const char USER_WORKING_DIRECTORY_KEY[] = "Qbs.RunConfiguration.UserWorkingDirectory";
|
const char USER_WORKING_DIRECTORY_KEY[] = "Qbs.RunConfiguration.UserWorkingDirectory";
|
||||||
|
|
||||||
@@ -118,6 +118,7 @@ QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
|
|||||||
m_currentBuildStepList(0)
|
m_currentBuildStepList(0)
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this));
|
addExtraAspect(new LocalEnvironmentAspect(this));
|
||||||
|
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qbs.RunConfiguration.CommandLineArguments")));
|
||||||
|
|
||||||
m_runModeForced = false;
|
m_runModeForced = false;
|
||||||
m_runMode = isConsoleApplication() ? ApplicationLauncher::Console : ApplicationLauncher::Gui;
|
m_runMode = isConsoleApplication() ? ApplicationLauncher::Console : ApplicationLauncher::Gui;
|
||||||
@@ -128,7 +129,6 @@ QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
|
|||||||
QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) :
|
QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) :
|
||||||
LocalApplicationRunConfiguration(parent, source),
|
LocalApplicationRunConfiguration(parent, source),
|
||||||
m_uniqueProductName(source->m_uniqueProductName),
|
m_uniqueProductName(source->m_uniqueProductName),
|
||||||
m_commandLineArguments(source->m_commandLineArguments),
|
|
||||||
m_runMode(source->m_runMode),
|
m_runMode(source->m_runMode),
|
||||||
m_runModeForced(source->m_runModeForced),
|
m_runModeForced(source->m_runModeForced),
|
||||||
m_userWorkingDirectory(source->m_userWorkingDirectory),
|
m_userWorkingDirectory(source->m_userWorkingDirectory),
|
||||||
@@ -181,7 +181,6 @@ QWidget *QbsRunConfiguration::createConfigurationWidget()
|
|||||||
QVariantMap QbsRunConfiguration::toMap() const
|
QVariantMap QbsRunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(LocalApplicationRunConfiguration::toMap());
|
QVariantMap map(LocalApplicationRunConfiguration::toMap());
|
||||||
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments);
|
|
||||||
if (m_runModeForced)
|
if (m_runModeForced)
|
||||||
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == ApplicationLauncher::Console);
|
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == ApplicationLauncher::Console);
|
||||||
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
|
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
|
||||||
@@ -190,7 +189,6 @@ QVariantMap QbsRunConfiguration::toMap() const
|
|||||||
|
|
||||||
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString();
|
|
||||||
if (map.contains(QLatin1String(USE_TERMINAL_KEY))) {
|
if (map.contains(QLatin1String(USE_TERMINAL_KEY))) {
|
||||||
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ?
|
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ?
|
||||||
ApplicationLauncher::Console : ApplicationLauncher::Gui;
|
ApplicationLauncher::Console : ApplicationLauncher::Gui;
|
||||||
@@ -287,12 +285,7 @@ QString QbsRunConfiguration::baseWorkingDirectory() const
|
|||||||
|
|
||||||
QString QbsRunConfiguration::commandLineArguments() const
|
QString QbsRunConfiguration::commandLineArguments() const
|
||||||
{
|
{
|
||||||
return macroExpander()->expandProcessArgs(m_commandLineArguments);
|
return extraAspect<ArgumentsAspect>()->arguments();
|
||||||
}
|
|
||||||
|
|
||||||
QString QbsRunConfiguration::rawCommandLineArguments() const
|
|
||||||
{
|
|
||||||
return m_commandLineArguments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfiguration::setBaseWorkingDirectory(const QString &wd)
|
void QbsRunConfiguration::setBaseWorkingDirectory(const QString &wd)
|
||||||
@@ -306,12 +299,6 @@ void QbsRunConfiguration::setBaseWorkingDirectory(const QString &wd)
|
|||||||
emit baseWorkingDirectoryChanged(newWorkingDirectory);
|
emit baseWorkingDirectoryChanged(newWorkingDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfiguration::setCommandLineArguments(const QString &argumentsString)
|
|
||||||
{
|
|
||||||
m_commandLineArguments = argumentsString;
|
|
||||||
emit commandLineArgumentsChanged(argumentsString);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsRunConfiguration::setRunMode(ApplicationLauncher::Mode runMode)
|
void QbsRunConfiguration::setRunMode(ApplicationLauncher::Mode runMode)
|
||||||
{
|
{
|
||||||
if (m_runMode == runMode)
|
if (m_runMode == runMode)
|
||||||
@@ -416,10 +403,7 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
|||||||
setExecutableLineText();
|
setExecutableLineText();
|
||||||
toplayout->addRow(tr("Executable:"), m_executableLineLabel);
|
toplayout->addRow(tr("Executable:"), m_executableLineLabel);
|
||||||
|
|
||||||
QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
|
m_rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||||
m_argumentsLineEdit = new QLineEdit(m_rc->rawCommandLineArguments(), this);
|
|
||||||
argumentsLabel->setBuddy(m_argumentsLineEdit);
|
|
||||||
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
|
|
||||||
|
|
||||||
m_workingDirectoryEdit = new Utils::PathChooser(this);
|
m_workingDirectoryEdit = new Utils::PathChooser(this);
|
||||||
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History"));
|
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History"));
|
||||||
@@ -456,8 +440,6 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
|
|||||||
connect(resetButton, SIGNAL(clicked()),
|
connect(resetButton, SIGNAL(clicked()),
|
||||||
this, SLOT(workingDirectoryWasReset()));
|
this, SLOT(workingDirectoryWasReset()));
|
||||||
|
|
||||||
connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
|
|
||||||
this, SLOT(argumentsEdited(QString)));
|
|
||||||
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(termToggled(bool)));
|
this, SLOT(termToggled(bool)));
|
||||||
|
|
||||||
@@ -509,13 +491,6 @@ void QbsRunConfigurationWidget::workingDirectoryWasReset()
|
|||||||
m_rc->setBaseWorkingDirectory(QString());
|
m_rc->setBaseWorkingDirectory(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfigurationWidget::argumentsEdited(const QString &args)
|
|
||||||
{
|
|
||||||
m_ignoreChange = true;
|
|
||||||
m_rc->setCommandLineArguments(args);
|
|
||||||
m_ignoreChange = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsRunConfigurationWidget::termToggled(bool on)
|
void QbsRunConfigurationWidget::termToggled(bool on)
|
||||||
{
|
{
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
@@ -545,13 +520,6 @@ void QbsRunConfigurationWidget::workingDirectoryChanged(const QString &workingDi
|
|||||||
m_workingDirectoryEdit->setPath(workingDirectory);
|
m_workingDirectoryEdit->setPath(workingDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
|
|
||||||
{
|
|
||||||
if (m_ignoreChange)
|
|
||||||
return;
|
|
||||||
m_argumentsLineEdit->setText(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsRunConfigurationWidget::runModeChanged(ApplicationLauncher::Mode runMode)
|
void QbsRunConfigurationWidget::runModeChanged(ApplicationLauncher::Mode runMode)
|
||||||
{
|
{
|
||||||
if (!m_ignoreChange)
|
if (!m_ignoreChange)
|
||||||
|
@@ -94,7 +94,6 @@ public:
|
|||||||
bool isConsoleApplication() const;
|
bool isConsoleApplication() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void commandLineArgumentsChanged(const QString&);
|
|
||||||
void baseWorkingDirectoryChanged(const QString&);
|
void baseWorkingDirectoryChanged(const QString&);
|
||||||
void runModeChanged(ProjectExplorer::ApplicationLauncher::Mode runMode);
|
void runModeChanged(ProjectExplorer::ApplicationLauncher::Mode runMode);
|
||||||
void targetInformationChanged();
|
void targetInformationChanged();
|
||||||
@@ -111,8 +110,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void setBaseWorkingDirectory(const QString &workingDirectory);
|
void setBaseWorkingDirectory(const QString &workingDirectory);
|
||||||
QString baseWorkingDirectory() const;
|
QString baseWorkingDirectory() const;
|
||||||
void setCommandLineArguments(const QString &argumentsString);
|
|
||||||
QString rawCommandLineArguments() const;
|
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
qbs::InstallOptions installOptions() const;
|
qbs::InstallOptions installOptions() const;
|
||||||
QString installRoot() const;
|
QString installRoot() const;
|
||||||
@@ -122,7 +119,6 @@ private:
|
|||||||
void updateTarget();
|
void updateTarget();
|
||||||
|
|
||||||
QString m_uniqueProductName;
|
QString m_uniqueProductName;
|
||||||
QString m_commandLineArguments;
|
|
||||||
|
|
||||||
// Cached startup sub project information
|
// Cached startup sub project information
|
||||||
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
|
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
|
||||||
@@ -144,11 +140,9 @@ private slots:
|
|||||||
void runConfigurationEnabledChange();
|
void runConfigurationEnabledChange();
|
||||||
void workDirectoryEdited();
|
void workDirectoryEdited();
|
||||||
void workingDirectoryWasReset();
|
void workingDirectoryWasReset();
|
||||||
void argumentsEdited(const QString &arguments);
|
|
||||||
void environmentWasChanged();
|
void environmentWasChanged();
|
||||||
|
|
||||||
void workingDirectoryChanged(const QString &workingDirectory);
|
void workingDirectoryChanged(const QString &workingDirectory);
|
||||||
void commandLineArgumentsChanged(const QString &args);
|
|
||||||
void runModeChanged(ProjectExplorer::ApplicationLauncher::Mode runMode);
|
void runModeChanged(ProjectExplorer::ApplicationLauncher::Mode runMode);
|
||||||
|
|
||||||
void termToggled(bool);
|
void termToggled(bool);
|
||||||
@@ -165,7 +159,6 @@ private:
|
|||||||
QLabel *m_disabledReason;
|
QLabel *m_disabledReason;
|
||||||
QLabel *m_executableLineLabel;
|
QLabel *m_executableLineLabel;
|
||||||
Utils::PathChooser *m_workingDirectoryEdit;
|
Utils::PathChooser *m_workingDirectoryEdit;
|
||||||
QLineEdit *m_argumentsLineEdit;
|
|
||||||
QCheckBox *m_useTerminalCheck;
|
QCheckBox *m_useTerminalCheck;
|
||||||
QCheckBox *m_usingDyldImageSuffix;
|
QCheckBox *m_usingDyldImageSuffix;
|
||||||
QLineEdit *m_qmlDebugPort;
|
QLineEdit *m_qmlDebugPort;
|
||||||
|
Reference in New Issue
Block a user