From 28a79d4767ba50f495a6daa286a48d2b070c7aa4 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 28 Dec 2022 15:10:43 +0100 Subject: [PATCH] Handle readyRead signal from socket in FileProviderSocketController Signed-off-by: Claudio Cambra --- src/gui/macOS/fileprovidersocketcontroller.cpp | 11 +++++++++++ src/gui/macOS/fileprovidersocketcontroller.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/gui/macOS/fileprovidersocketcontroller.cpp b/src/gui/macOS/fileprovidersocketcontroller.cpp index fd1ff5360..04cf67964 100644 --- a/src/gui/macOS/fileprovidersocketcontroller.cpp +++ b/src/gui/macOS/fileprovidersocketcontroller.cpp @@ -26,6 +26,8 @@ FileProviderSocketController::FileProviderSocketController(QLocalSocket *socket, : QObject{parent} , _socket(socket) { + connect(socket, &QLocalSocket::readyRead, + this, &FileProviderSocketController::slotReadyRead); connect(socket, &QLocalSocket::disconnected, this, &FileProviderSocketController::slotOnDisconnected); connect(socket, &QLocalSocket::destroyed, @@ -46,6 +48,15 @@ void FileProviderSocketController::slotSocketDestroyed(QObject *object) Q_EMIT socketDestroyed(_socket); } +void FileProviderSocketController::slotReadyRead() +{ + Q_ASSERT(_socket); + while(_socket->canReadLine()) { + const QString line = QString::fromUtf8(_socket->readLine().trimmed()).normalized(QString::NormalizationForm_C); + Q_UNUSED(line); + } +} + } } diff --git a/src/gui/macOS/fileprovidersocketcontroller.h b/src/gui/macOS/fileprovidersocketcontroller.h index f660a38e6..6a17eb826 100644 --- a/src/gui/macOS/fileprovidersocketcontroller.h +++ b/src/gui/macOS/fileprovidersocketcontroller.h @@ -35,6 +35,7 @@ signals: private slots: void slotOnDisconnected(); void slotSocketDestroyed(QObject *object); + void slotReadyRead(); private: QPointer _socket; -- 2.39.5