//слот - новое подключение void MyServer::slotNewConnection(){ socket = server->nextPendingConnection(); connect (socket,SIGNAL(disconnected()),this,SLOT(slotClientDisconnected())); connect(socket,SIGNAL(disconnected()),socket,SLOT(deleteLater())); isClientConnected = true; messageLabel->setText("Client connected"); }
void CentralWidget::slotClientConnectionError(const QString &error) { connectionStatusLabel->setText(tr(connetionStatus[CS_ERROR]) + error); connectButton->setEnabled(true); connError = true; slotClientDisconnected(); }
void CentralWidget::slotClientAbortConnect() { disconnect(connectButton, SIGNAL(clicked()), this, SLOT(slotClientAbortConnect())); slotClientDisconnected(); tcpClient->abort(); }
void CentralWidget::createTcpClient() { tcpClient = new TcpClient(SERVER_NAME, SERVER_PORT, this); connect(tcpClient, SIGNAL(connected()), this, SLOT(slotClientConnected())); connect(tcpClient, SIGNAL(disconnected()), this, SLOT(slotClientDisconnected())); connect(tcpClient, SIGNAL(signalDataReceived(const std::string &)), this, SLOT(slotClientGetData(const std::string &))); connect(tcpClient, SIGNAL(signalError(const QString &)), this, SLOT(slotClientConnectionError(const QString &))); }