Commit 0493a0e3 authored by hjk's avatar hjk
Browse files

Qbs: Use new ArgumentsAspect



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