moved gui ipc reader start out of ctor

This commit is contained in:
Nick Bolton 2012-07-11 20:01:58 +00:00
parent 19ccba8126
commit 78244c25bd
2 changed files with 8 additions and 2 deletions

View File

@ -23,7 +23,8 @@
#include "IpcReader.h" #include "IpcReader.h"
#include "Ipc.h" #include "Ipc.h"
IpcClient::IpcClient() IpcClient::IpcClient() :
m_ReaderStarted(false)
{ {
m_Socket = new QTcpSocket(this); m_Socket = new QTcpSocket(this);
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected())); connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
@ -31,7 +32,6 @@ IpcClient::IpcClient()
m_Reader = new IpcReader(m_Socket); m_Reader = new IpcReader(m_Socket);
connect(m_Reader, SIGNAL(readLogLine(const QString&)), this, SLOT(handleReadLogLine(const QString&))); connect(m_Reader, SIGNAL(readLogLine(const QString&)), this, SLOT(handleReadLogLine(const QString&)));
m_Reader->start();
} }
IpcClient::~IpcClient() IpcClient::~IpcClient()
@ -51,6 +51,11 @@ void IpcClient::connectToHost()
{ {
infoMessage("connecting to service..."); infoMessage("connecting to service...");
m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT); m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT);
if (!m_ReaderStarted) {
m_Reader->start();
m_ReaderStarted = true;
}
} }
void IpcClient::error(QAbstractSocket::SocketError error) void IpcClient::error(QAbstractSocket::SocketError error)

View File

@ -52,4 +52,5 @@ signals:
private: private:
QTcpSocket* m_Socket; QTcpSocket* m_Socket;
IpcReader* m_Reader; IpcReader* m_Reader;
bool m_ReaderStarted;
}; };