aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-10-17 15:21:30 +0200
committerhjk <hjk@qt.io>2018-10-19 07:25:42 +0000
commit0ccee2cfc5011553ed65c391f80d037f68861568 (patch)
tree131c1ae6e270db6aaddb976540d1ccfe198c2b28
parent2b01e9c1c58c525ee16b2d2d029c32ff91a67576 (diff)
WinRT: Use an aspect in WinRtPackageDeploymentStep
Less code. Change-Id: If168fe0a2ff6b60bbac638689d8979d9c630bfad Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/plugins/winrt/winrt.pro5
-rw-r--r--src/plugins/winrt/winrt.qbs3
-rw-r--r--src/plugins/winrt/winrtconstants.h1
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstep.cpp50
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstep.h8
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstepwidget.cpp69
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstepwidget.h55
-rw-r--r--src/plugins/winrt/winrtpackagedeploymentstepwidget.ui47
8 files changed, 22 insertions, 216 deletions
diff --git a/src/plugins/winrt/winrt.pro b/src/plugins/winrt/winrt.pro
index 48a7bf69f5..15b4a3bb98 100644
--- a/src/plugins/winrt/winrt.pro
+++ b/src/plugins/winrt/winrt.pro
@@ -7,7 +7,6 @@ HEADERS += \
winrtdevice.h \
winrtdevicefactory.h \
winrtpackagedeploymentstep.h \
- winrtpackagedeploymentstepwidget.h \
winrtphoneqtversion.h \
winrtplugin.h \
winrtqtversion.h \
@@ -22,7 +21,6 @@ SOURCES += \
winrtdevice.cpp \
winrtdevicefactory.cpp \
winrtpackagedeploymentstep.cpp \
- winrtpackagedeploymentstepwidget.cpp \
winrtphoneqtversion.cpp \
winrtplugin.cpp \
winrtqtversion.cpp \
@@ -33,8 +31,5 @@ SOURCES += \
DEFINES += WINRT_LIBRARY
-FORMS += \
- winrtpackagedeploymentstepwidget.ui
-
RESOURCES += \
winrt.qrc
diff --git a/src/plugins/winrt/winrt.qbs b/src/plugins/winrt/winrt.qbs
index 2c072e4b5f..9053161c5c 100644
--- a/src/plugins/winrt/winrt.qbs
+++ b/src/plugins/winrt/winrt.qbs
@@ -23,9 +23,6 @@ QtcPlugin {
"winrtdevicefactory.h",
"winrtpackagedeploymentstep.cpp",
"winrtpackagedeploymentstep.h",
- "winrtpackagedeploymentstepwidget.cpp",
- "winrtpackagedeploymentstepwidget.h",
- "winrtpackagedeploymentstepwidget.ui",
"winrtphoneqtversion.cpp",
"winrtphoneqtversion.h",
"winrtplugin.cpp",
diff --git a/src/plugins/winrt/winrtconstants.h b/src/plugins/winrt/winrtconstants.h
index d185a0df26..03a6fbd36a 100644
--- a/src/plugins/winrt/winrtconstants.h
+++ b/src/plugins/winrt/winrtconstants.h
@@ -33,7 +33,6 @@ const char WINRT_DEVICE_TYPE_LOCAL[] = "WinRt.Device.Local";
const char WINRT_DEVICE_TYPE_EMULATOR[] = "WinRt.Device.Emulator";
const char WINRT_DEVICE_TYPE_PHONE[] = "WinRt.Device.Phone";
const char WINRT_BUILD_STEP_DEPLOY[] = "WinRt.BuildStep.Deploy";
-const char WINRT_BUILD_STEP_DEPLOY_ARGUMENTS[] = "WinRt.BuildStep.Deploy.Arguments";
const char WINRT_WINRTQT[] = "WinRt.QtVersion.WindowsRuntime";
const char WINRT_WINPHONEQT[] = "WinRt.QtVersion.WindowsPhone";
const char WINRT_QTMAP_SUBKEYNAME[] = "WinRt";
diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
index 177d114cab..d6a6f10f1f 100644
--- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp
+++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp
@@ -26,7 +26,6 @@
#include "winrtpackagedeploymentstep.h"
#include "winrtconstants.h"
-#include "winrtpackagedeploymentstepwidget.h"
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
@@ -40,9 +39,10 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
-#include <utils/qtcprocess.h>
+#include <QLayout>
#include <QRegularExpression>
+#include <QToolButton>
using namespace ProjectExplorer;
using Utils::QtcProcess;
@@ -54,7 +54,12 @@ WinRtPackageDeploymentStep::WinRtPackageDeploymentStep(BuildStepList *bsl)
: AbstractProcessStep(bsl, Constants::WINRT_BUILD_STEP_DEPLOY)
{
setDisplayName(tr("Run windeployqt"));
- m_args = defaultWinDeployQtArguments();
+
+ m_argsAspect = addAspect<BaseStringAspect>();
+ m_argsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
+ m_argsAspect->setSettingsKey("WinRt.BuildStep.Deploy.Arguments");
+ m_argsAspect->setValue(defaultWinDeployQtArguments());
+ m_argsAspect->setLabelText(tr("Arguments:"));
}
bool WinRtPackageDeploymentStep::init(QList<const BuildStep *> &earlierSteps)
@@ -85,7 +90,7 @@ bool WinRtPackageDeploymentStep::init(QList<const BuildStep *> &earlierSteps)
return false;
QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(m_targetFilePath));
- args += QLatin1Char(' ') + m_args;
+ args += ' ' + m_argsAspect->value();
if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT)) {
m_createMappingFile = true;
@@ -216,17 +221,19 @@ void WinRtPackageDeploymentStep::stdOutput(const QString &line)
BuildStepConfigWidget *WinRtPackageDeploymentStep::createConfigWidget()
{
- return new WinRtPackageDeploymentStepWidget(this);
-}
+ auto widget = AbstractProcessStep::createConfigWidget();
-void WinRtPackageDeploymentStep::setWinDeployQtArguments(const QString &args)
-{
- m_args = args;
-}
+ auto restoreDefaultButton = new QToolButton(widget);
+ restoreDefaultButton->setText(tr("Restore Default Arguments"));
+ connect(restoreDefaultButton, &QToolButton::clicked, this, [this] {
+ m_argsAspect->setValue(defaultWinDeployQtArguments());
+ });
-QString WinRtPackageDeploymentStep::winDeployQtArguments() const
-{
- return m_args;
+ // Smuggle in the extra button. We know that there's exactly one aspect.
+ QTC_ASSERT(widget->layout()->count() == 2, return widget);
+ widget->layout()->itemAt(1)->layout()->addWidget(restoreDefaultButton);
+
+ return widget;
}
QString WinRtPackageDeploymentStep::defaultWinDeployQtArguments() const
@@ -253,23 +260,6 @@ void WinRtPackageDeploymentStep::raiseWarning(const QString &warningMessage)
emit addOutput(warningMessage, BuildStep::OutputFormat::NormalMessage);
}
-bool WinRtPackageDeploymentStep::fromMap(const QVariantMap &map)
-{
- if (!AbstractProcessStep::fromMap(map))
- return false;
- QVariant v = map.value(QLatin1String(Constants::WINRT_BUILD_STEP_DEPLOY_ARGUMENTS));
- if (v.isValid())
- m_args = v.toString();
- return true;
-}
-
-QVariantMap WinRtPackageDeploymentStep::toMap() const
-{
- QVariantMap map = AbstractProcessStep::toMap();
- map.insert(QLatin1String(Constants::WINRT_BUILD_STEP_DEPLOY_ARGUMENTS), m_args);
- return map;
-}
-
bool WinRtPackageDeploymentStep::parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *icons, QString *executable)
{
if (!icons->isEmpty())
diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.h b/src/plugins/winrt/winrtpackagedeploymentstep.h
index 55d6d01203..e7e4144251 100644
--- a/src/plugins/winrt/winrtpackagedeploymentstep.h
+++ b/src/plugins/winrt/winrtpackagedeploymentstep.h
@@ -26,6 +26,7 @@
#pragma once
#include <projectexplorer/abstractprocessstep.h>
+#include <projectexplorer/projectconfigurationaspects.h>
namespace WinRt {
namespace Internal {
@@ -43,20 +44,15 @@ public:
void stdOutput(const QString &line) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
- void setWinDeployQtArguments(const QString &args);
- QString winDeployQtArguments() const;
QString defaultWinDeployQtArguments() const;
void raiseError(const QString &errorMessage);
void raiseWarning(const QString &warningMessage);
- bool fromMap(const QVariantMap &map) override;
- QVariantMap toMap() const override;
-
private:
bool parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *items, QString *executable);
- QString m_args;
+ ProjectExplorer::BaseStringAspect *m_argsAspect = nullptr;
QString m_targetFilePath;
QString m_targetDirPath;
QString m_executablePathInManifest;
diff --git a/src/plugins/winrt/winrtpackagedeploymentstepwidget.cpp b/src/plugins/winrt/winrtpackagedeploymentstepwidget.cpp
deleted file mode 100644
index 7f75bdf347..0000000000
--- a/src/plugins/winrt/winrtpackagedeploymentstepwidget.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** 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
-** 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.
-**
-** 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.
-**
-****************************************************************************/
-
-#include "winrtpackagedeploymentstepwidget.h"
-#include <ui_winrtpackagedeploymentstepwidget.h>
-#include <utils/utilsicons.h>
-#include <QIcon>
-
-namespace WinRt {
-namespace Internal {
-
-WinRtPackageDeploymentStepWidget::WinRtPackageDeploymentStepWidget(WinRtPackageDeploymentStep *step)
- : BuildStepConfigWidget(step)
- , m_ui(new Ui::WinRtPackageDeploymentStepWidget)
- , m_step(step)
-{
- m_ui->setupUi(this);
- m_ui->leArguments->setText(m_step->winDeployQtArguments());
- m_ui->btnRestoreDefaultArgs->setIcon(Utils::Icons::RESET.icon());
- connect(m_ui->btnRestoreDefaultArgs, &QToolButton::pressed,
- this, &WinRtPackageDeploymentStepWidget::restoreDefaultArguments);
- connect(m_ui->leArguments, &QLineEdit::textChanged,
- m_step, &WinRtPackageDeploymentStep::setWinDeployQtArguments);
-}
-
-WinRtPackageDeploymentStepWidget::~WinRtPackageDeploymentStepWidget()
-{
- delete m_ui;
-}
-
-QString WinRtPackageDeploymentStepWidget::summaryText() const
-{
- return displayName();
-}
-
-QString WinRtPackageDeploymentStepWidget::displayName() const
-{
- return m_step->displayName();
-}
-
-void WinRtPackageDeploymentStepWidget::restoreDefaultArguments()
-{
- m_ui->leArguments->setText(m_step->defaultWinDeployQtArguments());
-}
-
-} // namespace Internal
-} // namespace WinRt
diff --git a/src/plugins/winrt/winrtpackagedeploymentstepwidget.h b/src/plugins/winrt/winrtpackagedeploymentstepwidget.h
deleted file mode 100644
index 2a7f92f646..0000000000
--- a/src/plugins/winrt/winrtpackagedeploymentstepwidget.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** 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
-** 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.
-**
-** 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.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "winrtpackagedeploymentstep.h"
-
-#include <projectexplorer/buildstep.h>
-
-namespace WinRt {
-namespace Internal {
-
-namespace Ui { class WinRtPackageDeploymentStepWidget; }
-
-class WinRtPackageDeploymentStepWidget : public ProjectExplorer::BuildStepConfigWidget
-{
- Q_OBJECT
-public:
- WinRtPackageDeploymentStepWidget(WinRtPackageDeploymentStep *step);
- ~WinRtPackageDeploymentStepWidget();
-
- virtual QString summaryText() const;
- virtual QString displayName() const;
-
-private:
- void restoreDefaultArguments();
-
- Ui::WinRtPackageDeploymentStepWidget *m_ui;
- WinRtPackageDeploymentStep *m_step;
-};
-
-} // namespace Internal
-} // namespace WinRt
diff --git a/src/plugins/winrt/winrtpackagedeploymentstepwidget.ui b/src/plugins/winrt/winrtpackagedeploymentstepwidget.ui
deleted file mode 100644
index e3ce32adfc..0000000000
--- a/src/plugins/winrt/winrtpackagedeploymentstepwidget.ui
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>WinRt::Internal::WinRtPackageDeploymentStepWidget</class>
- <widget class="QWidget" name="WinRt::Internal::WinRtPackageDeploymentStepWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>59</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Arguments:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="leArguments"/>
- </item>
- <item>
- <widget class="QToolButton" name="btnRestoreDefaultArgs">
- <property name="text">
- <string>Restore Default Arguments</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>