forked from qt-creator/qt-creator
ProjectExplorer: Dissolve DeviceProcess
Move remaining device member to subclasses where needed. Change-Id: I1a872315579c7f6529e8937d57511a9e99e06926 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -98,7 +98,7 @@ namespace Internal {
|
||||
static Q_LOGGING_CATEGORY(dockerDeviceLog, "qtc.docker.device", QtWarningMsg);
|
||||
#define LOG(x) qCDebug(dockerDeviceLog) << this << x << '\n'
|
||||
|
||||
class DockerDeviceProcess : public ProjectExplorer::DeviceProcess
|
||||
class DockerDeviceProcess : public Utils::QtcProcess
|
||||
{
|
||||
public:
|
||||
DockerDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = nullptr);
|
||||
@@ -106,11 +106,13 @@ public:
|
||||
|
||||
void start() override;
|
||||
void interrupt() override;
|
||||
|
||||
const QSharedPointer<const IDevice> m_device;
|
||||
};
|
||||
|
||||
DockerDeviceProcess::DockerDeviceProcess(const QSharedPointer<const IDevice> &device,
|
||||
QObject *parent)
|
||||
: DeviceProcess(device, parent)
|
||||
: QtcProcess(parent), m_device(device)
|
||||
{
|
||||
setProcessMode(ProcessMode::Writer);
|
||||
}
|
||||
@@ -118,7 +120,7 @@ DockerDeviceProcess::DockerDeviceProcess(const QSharedPointer<const IDevice> &de
|
||||
void DockerDeviceProcess::start()
|
||||
{
|
||||
QTC_ASSERT(state() == QProcess::NotRunning, return);
|
||||
DockerDevice::ConstPtr dockerDevice = qSharedPointerCast<const DockerDevice>(device());
|
||||
DockerDevice::ConstPtr dockerDevice = qSharedPointerCast<const DockerDevice>(m_device);
|
||||
QTC_ASSERT(dockerDevice, return);
|
||||
|
||||
connect(this, &QtcProcess::readyReadStandardOutput, this, [this] {
|
||||
@@ -139,7 +141,7 @@ void DockerDeviceProcess::start()
|
||||
|
||||
void DockerDeviceProcess::interrupt()
|
||||
{
|
||||
device()->signalOperation()->interruptProcess(processId());
|
||||
m_device->signalOperation()->interruptProcess(processId());
|
||||
}
|
||||
|
||||
class DockerPortsGatheringMethod : public PortsGatheringMethod
|
||||
|
@@ -54,7 +54,6 @@ add_qtc_plugin(ProjectExplorer
|
||||
devicesupport/devicefactoryselectiondialog.cpp devicesupport/devicefactoryselectiondialog.h devicesupport/devicefactoryselectiondialog.ui
|
||||
devicesupport/devicemanager.cpp devicesupport/devicemanager.h
|
||||
devicesupport/devicemanagermodel.cpp devicesupport/devicemanagermodel.h
|
||||
devicesupport/deviceprocess.cpp devicesupport/deviceprocess.h
|
||||
devicesupport/deviceprocessesdialog.cpp devicesupport/deviceprocessesdialog.h
|
||||
devicesupport/deviceprocesslist.cpp devicesupport/deviceprocesslist.h
|
||||
devicesupport/devicesettingspage.cpp devicesupport/devicesettingspage.h
|
||||
|
@@ -1,47 +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 "deviceprocess.h"
|
||||
|
||||
#include "idevice.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
DeviceProcess::DeviceProcess(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: QtcProcess(parent), m_device(device)
|
||||
{
|
||||
}
|
||||
|
||||
IDevice::ConstPtr DeviceProcess::device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -1,52 +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 "../projectexplorer_export.h"
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class IDevice;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT DeviceProcess : public Utils::QtcProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
explicit DeviceProcess(const QSharedPointer<const IDevice> &device,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QSharedPointer<const IDevice> device() const;
|
||||
|
||||
private:
|
||||
const QSharedPointer<const IDevice> m_device;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -51,6 +51,7 @@ public:
|
||||
SshDeviceProcessPrivate(SshDeviceProcess *q) : q(q) {}
|
||||
|
||||
SshDeviceProcess * const q;
|
||||
QSharedPointer<const IDevice> m_device;
|
||||
QSsh::SshConnection *connection = nullptr;
|
||||
QSsh::SshRemoteProcessPtr remoteProcess;
|
||||
QString processName;
|
||||
@@ -66,9 +67,10 @@ public:
|
||||
};
|
||||
|
||||
SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: DeviceProcess(device, parent),
|
||||
: QtcProcess(parent),
|
||||
d(std::make_unique<SshDeviceProcessPrivate>(this))
|
||||
{
|
||||
d->m_device = device;
|
||||
connect(&d->killTimer, &QTimer::timeout, this, &SshDeviceProcess::handleKillOperationTimeout);
|
||||
}
|
||||
|
||||
@@ -82,6 +84,11 @@ void SshDeviceProcess::emitFinished()
|
||||
handleProcessFinished(QtcProcess::errorString());
|
||||
}
|
||||
|
||||
const QSharedPointer<const IDevice> &SshDeviceProcess::device() const
|
||||
{
|
||||
return d->m_device;
|
||||
}
|
||||
|
||||
SshDeviceProcess::~SshDeviceProcess()
|
||||
{
|
||||
d->setState(SshDeviceProcessPrivate::Inactive);
|
||||
@@ -98,7 +105,7 @@ void SshDeviceProcess::start()
|
||||
d->processName = commandLine().executable().toString();
|
||||
d->displayName = extraData("Ssh.X11ForwardToDisplay").toString();
|
||||
|
||||
QSsh::SshConnectionParameters params = device()->sshParameters();
|
||||
QSsh::SshConnectionParameters params = d->m_device->sshParameters();
|
||||
params.x11DisplayName = d->displayName;
|
||||
d->connection = QSsh::SshConnectionManager::acquireConnection(params);
|
||||
connect(d->connection, &QSsh::SshConnection::errorOccurred,
|
||||
@@ -287,7 +294,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal)
|
||||
break;
|
||||
case SshDeviceProcessPrivate::Connected:
|
||||
case SshDeviceProcessPrivate::ProcessRunning:
|
||||
DeviceProcessSignalOperation::Ptr signalOperation = q->device()->signalOperation();
|
||||
DeviceProcessSignalOperation::Ptr signalOperation = m_device->signalOperation();
|
||||
const qint64 processId = q->processId();
|
||||
if (signal == Signal::Interrupt) {
|
||||
if (processId != 0)
|
||||
|
@@ -25,13 +25,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "deviceprocess.h"
|
||||
#include "idevice.h"
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT SshDeviceProcess : public DeviceProcess
|
||||
class PROJECTEXPLORER_EXPORT SshDeviceProcess : public Utils::QtcProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -57,6 +59,8 @@ protected:
|
||||
void emitStarted() override;
|
||||
void emitFinished() override;
|
||||
|
||||
const QSharedPointer<const IDevice> &device() const;
|
||||
|
||||
private:
|
||||
void handleConnected();
|
||||
void handleConnectionError();
|
||||
|
@@ -211,7 +211,6 @@ Project {
|
||||
"devicefactoryselectiondialog.cpp", "devicefactoryselectiondialog.h", "devicefactoryselectiondialog.ui",
|
||||
"devicemanager.cpp", "devicemanager.h",
|
||||
"devicemanagermodel.cpp", "devicemanagermodel.h",
|
||||
"deviceprocess.cpp", "deviceprocess.h",
|
||||
"deviceprocessesdialog.cpp", "deviceprocessesdialog.h",
|
||||
"deviceprocesslist.cpp", "deviceprocesslist.h",
|
||||
"devicesettingspage.cpp", "devicesettingspage.h",
|
||||
|
Reference in New Issue
Block a user