summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-05-04 08:01:57 +0200
committerhjk <hjk@qt.io>2022-05-04 11:40:20 +0000
commit2b9ec0c3d9f87c0b5e9f1d2efa34d79b49456003 (patch)
tree67cef1a215162a40c829bcae4bd8d2fa345faefc
parenta1b9619b5ebc0e71a50c4159d595f7a42398c6ce (diff)
downloadqt-creator-2b9ec0c3d9f87c0b5e9f1d2efa34d79b49456003.tar.gz
Boot2Qt: Merge qdbmakedefaultappservice into build step files
Not worth a separate compilation unit and pimpling. Change-Id: Ie7649938bc8c97061ccac0a37c075a6bd7900c97 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--src/plugins/boot2qt/CMakeLists.txt1
-rw-r--r--src/plugins/boot2qt/boot2qt.qbs2
-rw-r--r--src/plugins/boot2qt/qdbmakedefaultappservice.cpp97
-rw-r--r--src/plugins/boot2qt/qdbmakedefaultappservice.h52
-rw-r--r--src/plugins/boot2qt/qdbmakedefaultappstep.cpp97
5 files changed, 81 insertions, 168 deletions
diff --git a/src/plugins/boot2qt/CMakeLists.txt b/src/plugins/boot2qt/CMakeLists.txt
index e7915322fd..d644dedbe0 100644
--- a/src/plugins/boot2qt/CMakeLists.txt
+++ b/src/plugins/boot2qt/CMakeLists.txt
@@ -9,7 +9,6 @@ add_qtc_plugin(Boot2Qt
qdbdeployconfigurationfactory.cpp qdbdeployconfigurationfactory.h
qdbdevice.cpp qdbdevice.h
qdbdevicedebugsupport.cpp qdbdevicedebugsupport.h
- qdbmakedefaultappservice.cpp qdbmakedefaultappservice.h
qdbmakedefaultappstep.cpp qdbmakedefaultappstep.h
qdbplugin.cpp qdbplugin.h
qdbqtversion.cpp qdbqtversion.h
diff --git a/src/plugins/boot2qt/boot2qt.qbs b/src/plugins/boot2qt/boot2qt.qbs
index 3487e3eb94..209ea96cc7 100644
--- a/src/plugins/boot2qt/boot2qt.qbs
+++ b/src/plugins/boot2qt/boot2qt.qbs
@@ -27,8 +27,6 @@ QtcPlugin {
"qdbdevice.h",
"qdbdevicedebugsupport.cpp",
"qdbdevicedebugsupport.h",
- "qdbmakedefaultappservice.cpp",
- "qdbmakedefaultappservice.h",
"qdbmakedefaultappstep.cpp",
"qdbmakedefaultappstep.h",
"qdbplugin.cpp",
diff --git a/src/plugins/boot2qt/qdbmakedefaultappservice.cpp b/src/plugins/boot2qt/qdbmakedefaultappservice.cpp
deleted file mode 100644
index 801c77eec7..0000000000
--- a/src/plugins/boot2qt/qdbmakedefaultappservice.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 "qdbmakedefaultappservice.h"
-
-#include "qdbconstants.h"
-#include "qdbrunconfiguration.h"
-
-#include <projectexplorer/devicesupport/idevice.h>
-#include <projectexplorer/target.h>
-#include <utils/qtcprocess.h>
-
-using namespace Utils;
-
-namespace Qdb {
-namespace Internal {
-
-class QdbMakeDefaultAppServicePrivate
-{
-public:
- bool m_makeDefault = true;
- QtcProcess m_process;
-};
-
-QdbMakeDefaultAppService::QdbMakeDefaultAppService(QObject *parent)
- : AbstractRemoteLinuxDeployService(parent),
- d(new QdbMakeDefaultAppServicePrivate)
-{
- connect(&d->m_process, &QtcProcess::done, this, [this] {
- if (d->m_process.error() != QProcess::UnknownError)
- emit errorMessage(tr("Remote process failed: %1").arg(d->m_process.errorString()));
- else if (d->m_makeDefault)
- emit progressMessage(tr("Application set as the default one."));
- else
- emit progressMessage(tr("Reset the default application."));
-
- stopDeployment();
- });
- connect(&d->m_process, &QtcProcess::readyReadStandardError, this, [this] {
- emit stdErrData(QString::fromUtf8(d->m_process.readAllStandardError()));
- });
-}
-
-QdbMakeDefaultAppService::~QdbMakeDefaultAppService() = default;
-
-void QdbMakeDefaultAppService::setMakeDefault(bool makeDefault)
-{
- d->m_makeDefault = makeDefault;
-}
-
-void QdbMakeDefaultAppService::doDeploy()
-{
- QString remoteExe;
-
- if (ProjectExplorer::RunConfiguration *rc = target()->activeRunConfiguration()) {
- if (auto exeAspect = rc->aspect<ProjectExplorer::ExecutableAspect>())
- remoteExe = exeAspect->executable().toString();
- }
-
- const QString args = d->m_makeDefault && !remoteExe.isEmpty()
- ? QStringLiteral("--make-default ") + remoteExe
- : QStringLiteral("--remove-default");
- d->m_process.setCommand(
- {deviceConfiguration()->mapToGlobalPath(Constants::AppcontrollerFilepath), {args}});
- d->m_process.start();
-}
-
-void QdbMakeDefaultAppService::stopDeployment()
-{
- d->m_process.close();
- handleDeploymentDone();
-}
-
-} // namespace Internal
-} // namespace Qdb
diff --git a/src/plugins/boot2qt/qdbmakedefaultappservice.h b/src/plugins/boot2qt/qdbmakedefaultappservice.h
deleted file mode 100644
index bf1bcfda1f..0000000000
--- a/src/plugins/boot2qt/qdbmakedefaultappservice.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 <remotelinux/abstractremotelinuxdeployservice.h>
-
-namespace Qdb {
-namespace Internal {
-
-class QdbMakeDefaultAppServicePrivate;
-
-class QdbMakeDefaultAppService : public RemoteLinux::AbstractRemoteLinuxDeployService
-{
- Q_OBJECT
-public:
- QdbMakeDefaultAppService(QObject *parent = 0);
- ~QdbMakeDefaultAppService();
- void setMakeDefault(bool makeDefault);
-
-private:
- bool isDeploymentNecessary() const final { return true; }
- void doDeploy() final;
- void stopDeployment() final;
-
- std::unique_ptr<QdbMakeDefaultAppServicePrivate> d;
-};
-
-} // namespace Internal
-} // namespace Qdb
diff --git a/src/plugins/boot2qt/qdbmakedefaultappstep.cpp b/src/plugins/boot2qt/qdbmakedefaultappstep.cpp
index a88a6391f8..412db8f4f5 100644
--- a/src/plugins/boot2qt/qdbmakedefaultappstep.cpp
+++ b/src/plugins/boot2qt/qdbmakedefaultappstep.cpp
@@ -26,41 +26,106 @@
#include "qdbmakedefaultappstep.h"
#include "qdbconstants.h"
-#include "qdbmakedefaultappservice.h"
+#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/runconfigurationaspects.h>
+#include <projectexplorer/target.h>
#include <remotelinux/abstractremotelinuxdeploystep.h>
+#include <utils/commandline.h>
+#include <utils/qtcprocess.h>
+
using namespace ProjectExplorer;
using namespace Utils;
namespace Qdb {
namespace Internal {
-class QdbMakeDefaultAppStep final : public RemoteLinux::AbstractRemoteLinuxDeployStep
+// QdbMakeDefaultAppService
+
+class QdbMakeDefaultAppService : public RemoteLinux::AbstractRemoteLinuxDeployService
{
- Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbMakeDefaultAppStep)
+ Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbMakeDefaultAppService)
public:
- QdbMakeDefaultAppStep(BuildStepList *bsl, Utils::Id id);
+ QdbMakeDefaultAppService()
+ {
+ connect(&m_process, &QtcProcess::done, this, [this] {
+ if (m_process.error() != QProcess::UnknownError)
+ emit errorMessage(tr("Remote process failed: %1").arg(m_process.errorString()));
+ else if (m_makeDefault)
+ emit progressMessage(tr("Application set as the default one."));
+ else
+ emit progressMessage(tr("Reset the default application."));
+
+ stopDeployment();
+ });
+ connect(&m_process, &QtcProcess::readyReadStandardError, this, [this] {
+ emit stdErrData(QString::fromUtf8(m_process.readAllStandardError()));
+ });
+ }
+
+ void setMakeDefault(bool makeDefault)
+ {
+ m_makeDefault = makeDefault;
+ }
+
+private:
+ bool isDeploymentNecessary() const final { return true; }
+
+ void doDeploy() final
+ {
+ QString remoteExe;
+
+ if (RunConfiguration *rc = target()->activeRunConfiguration()) {
+ if (auto exeAspect = rc->aspect<ExecutableAspect>())
+ remoteExe = exeAspect->executable().toString();
+ }
+
+ const QString args = m_makeDefault && !remoteExe.isEmpty()
+ ? QStringLiteral("--make-default ") + remoteExe
+ : QStringLiteral("--remove-default");
+ m_process.setCommand(
+ {deviceConfiguration()->mapToGlobalPath(Constants::AppcontrollerFilepath), {args}});
+ m_process.start();
+ }
+
+ void stopDeployment() final
+ {
+ m_process.close();
+ handleDeploymentDone();
+ }
+
+ bool m_makeDefault = true;
+ QtcProcess m_process;
};
-QdbMakeDefaultAppStep::QdbMakeDefaultAppStep(BuildStepList *bsl, Utils::Id id)
- : AbstractRemoteLinuxDeployStep(bsl, id)
+
+// QdbMakeDefaultAppStep
+
+class QdbMakeDefaultAppStep final : public RemoteLinux::AbstractRemoteLinuxDeployStep
{
- auto service = createDeployService<QdbMakeDefaultAppService>();
+ Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbMakeDefaultAppStep)
- auto selection = addAspect<SelectionAspect>();
- selection->setSettingsKey("QdbMakeDefaultDeployStep.MakeDefault");
- selection->addOption(tr("Set this application to start by default"));
- selection->addOption(tr("Reset default application"));
+public:
+ QdbMakeDefaultAppStep(BuildStepList *bsl, Id id)
+ : AbstractRemoteLinuxDeployStep(bsl, id)
+ {
+ auto service = createDeployService<QdbMakeDefaultAppService>();
+
+ auto selection = addAspect<SelectionAspect>();
+ selection->setSettingsKey("QdbMakeDefaultDeployStep.MakeDefault");
+ selection->addOption(tr("Set this application to start by default"));
+ selection->addOption(tr("Reset default application"));
+
+ setInternalInitializer([service, selection] {
+ service->setMakeDefault(selection->value() == 0);
+ return service->isDeploymentPossible();
+ });
+ }
+};
- setInternalInitializer([service, selection] {
- service->setMakeDefault(selection->value() == 0);
- return service->isDeploymentPossible();
- });
-}
// QdbMakeDefaultAppStepFactory