int PeerManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: newConnection((*reinterpret_cast< Connection*(*)>(_a[1]))); break; case 1: sendBroadcastDatagram(); break; case 2: readBroadcastDatagram(); break; default: ; } _id -= 3; } return _id; }
PeerManager::PeerManager (Client *client) : QObject (client) { this->client = client; updateAddresses(); f_serverPort = 0; m_serverPort = 0; broadcastSocket.bind (QHostAddress::Any, broadcastPort, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); broadcastTimer.setInterval (BroadcastInterval); connect (&broadcastSocket, SIGNAL (readyRead()), this, SLOT (readBroadcastDatagram())); connect ( &broadcastTimer, SIGNAL (timeout()), this, SLOT (sendBroadcastDatagram())); }
PeerManager::PeerManager(QString userName, Client *client) : QObject(client) { this->client = client; this->username = userName.toUtf8(); if (username.isEmpty()) username = "******"; updateAddresses(); serverPort = 0; broadcastSocket.bind(QHostAddress::AnyIPv4, broadcastPort, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); connect(&broadcastSocket, SIGNAL(readyRead()), this, SLOT(readBroadcastDatagram())); broadcastTimer.setInterval(BroadcastInterval); connect(&broadcastTimer, SIGNAL(timeout()), this, SLOT(sendBroadcastDatagram())); }