Get rid of IDevice::createProcess()

And most of QtcProcess subclasses.

Change-Id: Ic891defbf49736442243f9ee0f9d28d140e0ba9d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-05-02 16:02:53 +02:00
parent a6940abc29
commit 85cb7d2b71
26 changed files with 3 additions and 845 deletions

View File

@@ -104,52 +104,6 @@ const QString s_pidMarker = "__qtc$$qtc__";
static Q_LOGGING_CATEGORY(dockerDeviceLog, "qtc.docker.device", QtWarningMsg);
#define LOG(x) qCDebug(dockerDeviceLog) << this << x << '\n'
class DockerDeviceProcess : public Utils::QtcProcess
{
public:
DockerDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = nullptr);
~DockerDeviceProcess() {}
void startImpl() override;
void interrupt() override;
const QSharedPointer<const IDevice> m_device;
};
DockerDeviceProcess::DockerDeviceProcess(const QSharedPointer<const IDevice> &device,
QObject *parent)
: QtcProcess(parent), m_device(device)
{
setProcessMode(ProcessMode::Writer);
}
void DockerDeviceProcess::startImpl()
{
QTC_ASSERT(state() == QProcess::NotRunning, return);
DockerDevice::ConstPtr dockerDevice = qSharedPointerCast<const DockerDevice>(m_device);
QTC_ASSERT(dockerDevice, return);
connect(this, &QtcProcess::readyReadStandardOutput, this, [this] {
MessageManager::writeSilently(QString::fromLocal8Bit(readAllStandardError()));
});
connect(this, &QtcProcess::readyReadStandardError, this, [this] {
MessageManager::writeDisrupting(QString::fromLocal8Bit(readAllStandardError()));
});
CommandLine command = commandLine();
command.setExecutable(
command.executable().withNewPath(dockerDevice->mapToDevicePath(command.executable())));
setCommand(command);
LOG("Running process:" << command.toUserOutput() << "in" << workingDirectory().toUserOutput());
QtcProcess::startImpl();
}
void DockerDeviceProcess::interrupt()
{
m_device->signalOperation()->interruptProcess(processId());
}
class DockerPortsGatheringMethod : public PortsGatheringMethod
{
CommandLine commandLine(QAbstractSocket::NetworkLayerProtocol protocol) const override
@@ -655,11 +609,6 @@ QVariantMap DockerDevice::toMap() const
return map;
}
QtcProcess *DockerDevice::createProcess(QObject *parent) const
{
return new DockerDeviceProcess(sharedFromThis(), parent);
}
ProcessInterface *DockerDevice::createProcessInterface() const
{
return new DockerProcessImpl(d);