forked from qt-creator/qt-creator
WinRT: Use ArgumentsAspect in run configuration
Follow recent changes in other run configurations. Less code for more features (Macro expander...). Change-Id: I289dfd16b217c9d91a766b7f5eafe012e6e91dba Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -38,5 +38,4 @@ SOURCES += \
|
||||
DEFINES += WINRT_LIBRARY
|
||||
|
||||
FORMS += \
|
||||
winrtpackagedeploymentstepwidget.ui \
|
||||
winrtrunconfigurationwidget.ui
|
||||
winrtpackagedeploymentstepwidget.ui
|
||||
|
@@ -37,7 +37,6 @@ QtcPlugin {
|
||||
"winrtrunconfiguration.h",
|
||||
"winrtrunconfigurationwidget.cpp",
|
||||
"winrtrunconfigurationwidget.h",
|
||||
"winrtrunconfigurationwidget.ui",
|
||||
"winrtruncontrol.cpp",
|
||||
"winrtruncontrol.h",
|
||||
"winrtrunfactories.cpp",
|
||||
|
@@ -113,8 +113,6 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
|
||||
quint16 qmlDebugPort = 0;
|
||||
if (!getFreePort(qmlDebugPort, errorMessage))
|
||||
return 0;
|
||||
runConfig->setArguments(runConfig->arguments() + QLatin1Char(' ')
|
||||
+ QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, qmlDebugPort));
|
||||
params.qmlServerAddress = QHostAddress::LocalHost;
|
||||
params.qmlServerPort = qmlDebugPort;
|
||||
}
|
||||
|
@@ -33,13 +33,14 @@
|
||||
#include "winrtconstants.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
|
||||
namespace WinRt {
|
||||
namespace Internal {
|
||||
|
||||
static const char argumentsIdC[] = "WinRtRunConfigurationArgumentsId";
|
||||
static const char uninstallAfterStopIdC[] = "WinRtRunConfigurationUninstallAfterStopId";
|
||||
|
||||
static QString pathFromId(Core::Id id)
|
||||
@@ -53,6 +54,8 @@ WinRtRunConfiguration::WinRtRunConfiguration(ProjectExplorer::Target *parent, Co
|
||||
, m_uninstallAfterStop(false)
|
||||
{
|
||||
setDisplayName(tr("Run App Package"));
|
||||
addExtraAspect(new ProjectExplorer::ArgumentsAspect(this,
|
||||
QLatin1String("WinRtRunConfigurationArgumentsId")));
|
||||
}
|
||||
|
||||
QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
||||
@@ -63,7 +66,6 @@ QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
||||
QVariantMap WinRtRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = RunConfiguration::toMap();
|
||||
map.insert(QLatin1String(argumentsIdC), m_arguments);
|
||||
map.insert(QLatin1String(uninstallAfterStopIdC), m_uninstallAfterStop);
|
||||
return map;
|
||||
}
|
||||
@@ -72,17 +74,13 @@ bool WinRtRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
setArguments(map.value(QLatin1String(argumentsIdC)).toString());
|
||||
setUninstallAfterStop(map.value(QLatin1String(uninstallAfterStopIdC)).toBool());
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinRtRunConfiguration::setArguments(const QString &args)
|
||||
QString WinRtRunConfiguration::arguments() const
|
||||
{
|
||||
if (m_arguments == args)
|
||||
return;
|
||||
m_arguments = args;
|
||||
emit argumentsChanged(m_arguments);
|
||||
return extraAspect<ProjectExplorer::ArgumentsAspect>()->arguments();
|
||||
}
|
||||
|
||||
void WinRtRunConfiguration::setUninstallAfterStop(bool b)
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
const QString &proFilePath() const { return m_proFilePath; }
|
||||
const QString &arguments() const { return m_arguments; }
|
||||
QString arguments() const;
|
||||
bool uninstallAfterStop() const { return m_uninstallAfterStop; }
|
||||
|
||||
signals:
|
||||
@@ -57,12 +57,10 @@ signals:
|
||||
void uninstallAfterStopChanged(bool);
|
||||
|
||||
public slots:
|
||||
void setArguments(const QString &args);
|
||||
void setUninstallAfterStop(bool b);
|
||||
|
||||
private:
|
||||
QString m_proFilePath;
|
||||
QString m_arguments;
|
||||
bool m_uninstallAfterStop;
|
||||
};
|
||||
|
||||
|
@@ -30,41 +30,38 @@
|
||||
|
||||
#include "winrtrunconfigurationwidget.h"
|
||||
#include "winrtrunconfiguration.h"
|
||||
#include "ui_winrtrunconfigurationwidget.h"
|
||||
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
namespace WinRt {
|
||||
namespace Internal {
|
||||
|
||||
WinRtRunConfigurationWidget::WinRtRunConfigurationWidget(WinRtRunConfiguration *rc, QWidget *parent)
|
||||
: Utils::DetailsWidget(parent)
|
||||
, m_runConfiguration(rc)
|
||||
, m_ui(new Ui::WinRtRunConfigurationWidget)
|
||||
WinRtRunConfigurationWidget::WinRtRunConfigurationWidget(WinRtRunConfiguration *rc)
|
||||
: m_runConfiguration(rc)
|
||||
{
|
||||
setState(Expanded);
|
||||
setSummaryText(tr("Launch App"));
|
||||
setWidget(new QWidget(this));
|
||||
m_ui->setupUi(widget());
|
||||
widget()->setContentsMargins(0, 0, 0, 0);
|
||||
m_ui->arguments->setText(rc->arguments());
|
||||
connect(m_ui->arguments, SIGNAL(textChanged(QString)),
|
||||
rc, SLOT(setArguments(QString)));
|
||||
connect(m_ui->uninstallAfterStop, SIGNAL(stateChanged(int)),
|
||||
SLOT(onUninstallCheckBoxChanged()));
|
||||
}
|
||||
|
||||
WinRtRunConfigurationWidget::~WinRtRunConfigurationWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
auto widget = new QWidget(this);
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
setWidget(widget);
|
||||
|
||||
void WinRtRunConfigurationWidget::setArguments(const QString &args)
|
||||
{
|
||||
m_ui->arguments->setText(args);
|
||||
}
|
||||
auto verticalLayout = new QFormLayout(widget);
|
||||
|
||||
void WinRtRunConfigurationWidget::onUninstallCheckBoxChanged()
|
||||
{
|
||||
m_runConfiguration->setUninstallAfterStop(m_ui->uninstallAfterStop->isChecked());
|
||||
rc->extraAspect<ProjectExplorer::ArgumentsAspect>()
|
||||
->addToMainConfigurationWidget(widget, verticalLayout);
|
||||
|
||||
auto uninstallAfterStop = new QCheckBox(widget);
|
||||
verticalLayout->addWidget(uninstallAfterStop);
|
||||
|
||||
uninstallAfterStop->setText(tr("Uninstall package after application stops"));
|
||||
|
||||
connect(uninstallAfterStop, &QCheckBox::stateChanged, this, [this] (int checked) {
|
||||
m_runConfiguration->setUninstallAfterStop(checked == Qt::Checked);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -36,30 +36,19 @@
|
||||
namespace WinRt {
|
||||
namespace Internal {
|
||||
|
||||
namespace Ui {
|
||||
class WinRtRunConfigurationWidget;
|
||||
}
|
||||
|
||||
class WinRtRunConfiguration;
|
||||
|
||||
class WinRtRunConfigurationWidget : public Utils::DetailsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WinRtRunConfigurationWidget(WinRtRunConfiguration *rc, QWidget *parent = 0);
|
||||
~WinRtRunConfigurationWidget();
|
||||
explicit WinRtRunConfigurationWidget(WinRtRunConfiguration *rc);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
public slots:
|
||||
void setArguments(const QString &args);
|
||||
|
||||
private slots:
|
||||
void onUninstallCheckBoxChanged();
|
||||
|
||||
private:
|
||||
WinRtRunConfiguration *m_runConfiguration;
|
||||
Ui::WinRtRunConfigurationWidget *m_ui;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WinRt::Internal::WinRtRunConfigurationWidget</class>
|
||||
<widget class="QWidget" name="WinRt::Internal::WinRtRunConfigurationWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>248</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="argumentsLabel">
|
||||
<property name="text">
|
||||
<string>Arguments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="arguments"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uninstallAfterStop">
|
||||
<property name="text">
|
||||
<string>Uninstall package after stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Reference in New Issue
Block a user