equal
deleted
inserted
replaced
24 |
24 |
25 #include <QImage> |
25 #include <QImage> |
26 |
26 |
27 #include "hwconsts.h" |
27 #include "hwconsts.h" |
28 |
28 |
29 QList<TCPBase*> srvsList; |
29 //QList<TCPBase*> srvsList; |
30 QPointer<QTcpServer> TCPBase::IPCServer(0); |
30 //QPointer<QTcpServer> TCPBase::IPCServer(0); |
31 |
31 |
32 TCPBase::~TCPBase() |
32 TCPBase::~TCPBase() |
33 { |
33 { |
34 } |
34 } |
35 |
35 |
36 TCPBase::TCPBase(bool demoMode) : |
36 TCPBase::TCPBase(bool demoMode) : |
37 m_isDemoMode(demoMode), |
37 m_isDemoMode(demoMode), |
38 IPCSocket(0) |
38 IPCSocket(0), IPCServer(0) |
39 { |
39 { |
40 if(!IPCServer) |
40 if(!IPCServer) |
41 { |
41 { |
42 IPCServer = new QTcpServer(0); |
42 IPCServer = new QTcpServer(0); |
43 IPCServer->setMaxPendingConnections(1); |
43 IPCServer->setMaxPendingConnections(1); |
65 connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); |
65 connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); |
66 connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
66 connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
67 SendToClientFirst(); |
67 SendToClientFirst(); |
68 } |
68 } |
69 |
69 |
70 void TCPBase::RealStart() |
70 void TCPBase::/*Real*/Start() |
71 { |
71 { |
72 connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
72 connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
73 IPCSocket = 0; |
73 IPCSocket = 0; |
74 |
74 |
75 QProcess * process; |
75 QProcess * process; |
86 void TCPBase::ClientDisconnect() |
86 void TCPBase::ClientDisconnect() |
87 { |
87 { |
88 disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
88 disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
89 onClientDisconnect(); |
89 onClientDisconnect(); |
90 |
90 |
91 if(srvsList.size()==1) srvsList.pop_front(); |
91 /* if(srvsList.size()==1) srvsList.pop_front(); |
92 emit isReadyNow(); |
92 emit isReadyNow();*/ |
93 IPCSocket->deleteLater(); |
93 IPCSocket->deleteLater(); |
94 deleteLater(); |
94 deleteLater(); |
95 } |
95 } |
96 |
96 |
97 void TCPBase::ClientRead() |
97 void TCPBase::ClientRead() |
107 QMessageBox::critical(0, tr("Error"), |
107 QMessageBox::critical(0, tr("Error"), |
108 tr("Unable to run engine: %1 (") |
108 tr("Unable to run engine: %1 (") |
109 .arg(error) + bindir->absolutePath() + "/hwengine)"); |
109 .arg(error) + bindir->absolutePath() + "/hwengine)"); |
110 } |
110 } |
111 |
111 |
|
112 /* |
112 void TCPBase::tcpServerReady() |
113 void TCPBase::tcpServerReady() |
113 { |
114 { |
114 disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
115 disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
115 |
116 |
116 RealStart(); |
117 RealStart(); |
117 } |
118 } |
118 |
|
119 void TCPBase::Start() |
119 void TCPBase::Start() |
120 { |
120 { |
121 if(srvsList.isEmpty()) |
121 if(srvsList.isEmpty()) |
122 { |
122 { |
123 srvsList.push_back(this); |
123 srvsList.push_back(this); |
128 srvsList.push_back(this); |
128 srvsList.push_back(this); |
129 return; |
129 return; |
130 } |
130 } |
131 |
131 |
132 RealStart(); |
132 RealStart(); |
133 } |
133 }*/ |
134 |
134 |
135 void TCPBase::onClientRead() |
135 void TCPBase::onClientRead() |
136 { |
136 { |
137 } |
137 } |
138 |
138 |