NetworkManager::NetworkManager(Game *game, QObject *parent)
    :QObject(parent), game(game), tcpClient()
{
    connect(&tcpClient, SIGNAL(reading(QByteArray)), this, SLOT(applyFrame(QByteArray)));
    connect(&tcpClient, SIGNAL(connecting()), this, SLOT(connected()));
    connect(&tcpClient, SIGNAL(disconnecting()), this, SLOT(disconnected()));
}
Esempio n. 2
0
bool BaseClient::linkConnector(BaseConnector *c)
{
    bool ok = true;
    ok &= (bool)connect(c, SIGNAL(connecting()),                this, SLOT(UIConnectingState()));
    ok &= (bool)connect(c, SIGNAL(connected()),                 this, SLOT(UIConnectedState()));
    ok &= (bool)connect(c, SIGNAL(disconnecting()),             this, SLOT(UIDisconnectingState()));
    ok &= (bool)connect(c, SIGNAL(disconnected()),              this, SLOT(UIDisconnectedState()));
    ok &= (bool)connect(c, SIGNAL(outMessage(QString)),         this, SLOT(outMessage(QString)));
    ok &= (bool)connect(c, SIGNAL(newFrame(uint)),              this, SLOT(newFrame(uint)));
    ok &= (bool)connect(c, SIGNAL(newFrame(uint)),              this, SLOT(addCount()));
    ok &= (bool)connect(c, SIGNAL(updateSubject(SubjectData*)), this, SLOT(update(SubjectData*)));
    return ok;
}
Esempio n. 3
0
int
get_char_raw (ID cepid)
{
	if (connected) {
		if (rcv_off >= rcv_len) {
			rcv_off = 0;
			if (tcp_rel_buf(TCP_CEPID, rcv_len) != E_OK) {
				disconnecting();
				return EOF;
				}
			if ((rcv_len = tcp_rcv_buf(TCP_CEPID, (VP*)&rcv_buff, TMO_FEVR)) == 0) {
				disconnecting();
				return EOF;
				}
			else if (rcv_len < 0) {
				disconnecting();
				return EOF;
				}
			}
		return rcv_buff[rcv_off ++];
		}
	else
		return EOF;
	}
Esempio n. 4
0
// Disconnection primitive.
bool qjackctlConnect::disconnectPortsEx (
	qjackctlPortItem *pOPort, qjackctlPortItem *pIPort )
{
	if (pOPort->findConnectPtr(pIPort) == NULL)
		return false;

	emit disconnecting(pOPort, pIPort);

	if (!disconnectPorts(pOPort, pIPort))
		return false;

	pOPort->removeConnect(pIPort);
	pIPort->removeConnect(pOPort);
	return true;
}
Esempio n. 5
0
int ClientThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QThread::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: error((*reinterpret_cast< QTcpSocket::SocketError(*)>(_a[1]))); break;
        case 1: msgRecived((*reinterpret_cast< ClientThread*(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 2: disconnecting((*reinterpret_cast< ClientThread*(*)>(_a[1]))); break;
        case 3: sendDisconnecting(); break;
        case 4: readFromSock(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Esempio n. 6
0
void ClientThread::sendDisconnecting(){
    connected = false;
    emit disconnecting(this);
}