示例#1
0
void CNetRender::ClientDisconnected()
{
	// get client by signal emitter
	QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
	if(socket)
	{
		int index = GetClientIndexFromSocket(socket);
		WriteLog("NetRender - Client disconnected #" + QString::number(index) + " (" + socket->peerAddress().toString() + ")");
		if(index > -1){
			clients.removeAt(index);
		}
		socket->close();
		socket->deleteLater();
		emit ClientsChanged();
	}
}
示例#2
0
void CNetRender::HandleNewConnection()
{
	while (server->hasPendingConnections())
	{
		WriteLog("NetRender - new client connected");
		// push new socket to list
		sClient client;
		client.socket = server->nextPendingConnection();
		clients.append(client);

		connect(client.socket, SIGNAL(disconnected()), this, SLOT(ClientDisconnected()));
		connect(client.socket, SIGNAL(readyRead()), this, SLOT(ReceiveFromClient()));

		// tell mandelbulber version to client
		sMessage msg;
		msg.command = netRender_VERSION;
		msg.payload.append((char*)&version, sizeof(qint32));
		SendData(client.socket, msg);
		emit ClientsChanged();
	}
}
		SLOT(slotPressedButtonBoundingBoxMoveZPos()));

	// NetRender
	connect(ui->bu_netrender_connect, SIGNAL(clicked()), this, SLOT(slotNetRenderClientConnect()));
	connect(
		ui->bu_netrender_disconnect, SIGNAL(clicked()), this, SLOT(slotNetRenderClientDisconnect()));
	connect(ui->bu_netrender_start_server, SIGNAL(clicked()), this, SLOT(slotNetRenderServerStart()));
	connect(ui->bu_netrender_stop_server, SIGNAL(clicked()), this, SLOT(slotNetRenderServerStop()));
	connect(ui->comboBox_netrender_mode, SIGNAL(currentIndexChanged(int)), this,
		SLOT(slotNetRenderClientServerChange(int)));
	connect(
		ui->group_netrender, SIGNAL(toggled(bool)), this, SLOT(slotCheckBoxDisableNetRender(bool)));
	connect(ui->bu_netrender_connect, SIGNAL(clicked()), this, SLOT(slotNetRenderClientConnect()));
	connect(gNetRender, SIGNAL(NewStatusClient()), this, SLOT(slotNetRenderStatusClientUpdate()));
	connect(gNetRender, SIGNAL(NewStatusServer()), this, SLOT(slotNetRenderStatusServerUpdate()));
	connect(gNetRender, SIGNAL(ClientsChanged()), this, SLOT(slotNetRenderClientListUpdate()));
	connect(gNetRender, SIGNAL(ClientsChanged(int)), this, SLOT(slotNetRenderClientListUpdate(int)));
	connect(gNetRender, SIGNAL(ClientsChanged(int, int)), this,
		SLOT(slotNetRenderClientListUpdate(int, int)));

	connect(ui->checkBox_connect_detail_level_2, SIGNAL(stateChanged(int)), this,
		SIGNAL(stateChangedConnectDetailLevel(int)));

	connect(ui->pushButton_calculate_dist_thresh, SIGNAL(clicked()), this,
		SLOT(slotCalculateDistanceThreshold()));
}

void cDockRenderingEngine::slotNetRenderServerStart() const
{
	SynchronizeInterfaceWindow(ui->group_netrender, gPar, qInterface::read);
	qint32 port = gPar->Get<int>("netrender_server_local_port");