equal
deleted
inserted
replaced
39 if(!IPCServer) { |
39 if(!IPCServer) { |
40 IPCServer = new QTcpServer(0); |
40 IPCServer = new QTcpServer(0); |
41 IPCServer->setMaxPendingConnections(1); |
41 IPCServer->setMaxPendingConnections(1); |
42 if (!IPCServer->listen(QHostAddress::LocalHost)) { |
42 if (!IPCServer->listen(QHostAddress::LocalHost)) { |
43 QMessageBox::critical(0, tr("Error"), |
43 QMessageBox::critical(0, tr("Error"), |
44 tr("Unable to start the server: %1.") |
44 tr("Unable to start the server: %1.") |
45 .arg(IPCServer->errorString())); |
45 .arg(IPCServer->errorString())); |
46 exit(0); // FIXME - should be graceful exit here |
46 exit(0); // FIXME - should be graceful exit here |
47 } |
47 } |
48 } |
48 } |
49 ipc_port=IPCServer->serverPort(); |
49 ipc_port=IPCServer->serverPort(); |
50 } |
50 } |
95 } |
95 } |
96 |
96 |
97 void TCPBase::StartProcessError(QProcess::ProcessError error) |
97 void TCPBase::StartProcessError(QProcess::ProcessError error) |
98 { |
98 { |
99 QMessageBox::critical(0, tr("Error"), |
99 QMessageBox::critical(0, tr("Error"), |
100 tr("Unable to run engine: %1 (") |
100 tr("Unable to run engine: %1 (") |
101 .arg(error) + bindir->absolutePath() + "/hwengine)"); |
101 .arg(error) + bindir->absolutePath() + "/hwengine)"); |
102 } |
102 } |
103 |
103 |
104 void TCPBase::tcpServerReady() |
104 void TCPBase::tcpServerReady() |
105 { |
105 { |
106 disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
106 disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
133 { |
133 { |
134 } |
134 } |
135 |
135 |
136 void TCPBase::SendIPC(const QByteArray & buf) |
136 void TCPBase::SendIPC(const QByteArray & buf) |
137 { |
137 { |
138 if (buf.size() > MAXMSGCHARS) return; |
138 if (buf.size() > MAXMSGCHARS) return; |
139 quint8 len = buf.size(); |
139 quint8 len = buf.size(); |
140 RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf); |
140 RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf); |
141 } |
141 } |
142 |
142 |
143 void TCPBase::RawSendIPC(const QByteArray & buf) |
143 void TCPBase::RawSendIPC(const QByteArray & buf) |
144 { |
144 { |
145 if (!IPCSocket) |
145 if (!IPCSocket) |
146 { |
146 { |
147 toSendBuf += buf; |
147 toSendBuf += buf; |
148 } else |
148 } else |
149 { |
149 { |
150 if (toSendBuf.size() > 0) |
150 if (toSendBuf.size() > 0) |
151 { |
151 { |
152 IPCSocket->write(toSendBuf); |
152 IPCSocket->write(toSendBuf); |
153 if(m_isDemoMode) demo.append(toSendBuf); |
153 if(m_isDemoMode) demo.append(toSendBuf); |
154 toSendBuf.clear(); |
154 toSendBuf.clear(); |
155 } |
155 } |
156 if(!buf.isEmpty()) { |
156 if(!buf.isEmpty()) { |
157 IPCSocket->write(buf); |
157 IPCSocket->write(buf); |
158 if(m_isDemoMode) demo.append(buf); |
158 if(m_isDemoMode) demo.append(buf); |
159 } |
159 } |
160 } |
160 } |
161 } |
161 } |