mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-08 14:41:57 +08:00
moved gui ipc reader start out of ctor
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
#include "IpcReader.h"
|
||||
#include "Ipc.h"
|
||||
|
||||
IpcClient::IpcClient()
|
||||
IpcClient::IpcClient() :
|
||||
m_ReaderStarted(false)
|
||||
{
|
||||
m_Socket = new QTcpSocket(this);
|
||||
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
|
||||
@@ -31,7 +32,6 @@ IpcClient::IpcClient()
|
||||
|
||||
m_Reader = new IpcReader(m_Socket);
|
||||
connect(m_Reader, SIGNAL(readLogLine(const QString&)), this, SLOT(handleReadLogLine(const QString&)));
|
||||
m_Reader->start();
|
||||
}
|
||||
|
||||
IpcClient::~IpcClient()
|
||||
@@ -51,6 +51,11 @@ void IpcClient::connectToHost()
|
||||
{
|
||||
infoMessage("connecting to service...");
|
||||
m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT);
|
||||
|
||||
if (!m_ReaderStarted) {
|
||||
m_Reader->start();
|
||||
m_ReaderStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IpcClient::error(QAbstractSocket::SocketError error)
|
||||
|
||||
@@ -52,4 +52,5 @@ signals:
|
||||
private:
|
||||
QTcpSocket* m_Socket;
|
||||
IpcReader* m_Reader;
|
||||
bool m_ReaderStarted;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user