@@ -34,6 +34,7 SpwTcpPacketServer::SpwTcpPacketServer(Q | |||||
34 | connect(this->ui->startServeQpb,SIGNAL(clicked(bool)),SLOT(toggleServer())); |
|
34 | connect(this->ui->startServeQpb,SIGNAL(clicked(bool)),SLOT(toggleServer())); | |
35 | updateHostIP(); |
|
35 | updateHostIP(); | |
36 | this->ui->PortLineEdit->setText("2200"); |
|
36 | this->ui->PortLineEdit->setText("2200"); | |
|
37 | connect(this->p_server,SIGNAL(newConnection()),this,SLOT(newConnection())); | |||
37 | } |
|
38 | } | |
38 |
|
39 | |||
39 | SpwTcpPacketServer::~SpwTcpPacketServer() |
|
40 | SpwTcpPacketServer::~SpwTcpPacketServer() | |
@@ -105,9 +106,15 void SpwTcpPacketServer::setServerPort(q | |||||
105 | this->ui->PortLineEdit->setText(QString("%1").arg(port)); |
|
106 | this->ui->PortLineEdit->setText(QString("%1").arg(port)); | |
106 | } |
|
107 | } | |
107 |
|
108 | |||
|
109 | void SpwTcpPacketServer::setServerSetIP(QString ip) | |||
|
110 | { | |||
|
111 | this->ui->IPLineEdit->setText(ip); | |||
|
112 | } | |||
|
113 | ||||
108 | void SpwTcpPacketServer::newConnection() |
|
114 | void SpwTcpPacketServer::newConnection() | |
109 | { |
|
115 | { | |
110 | this->connectedClients.append(this->p_server->nextPendingConnection()); |
|
116 | this->connectedClients.append(this->p_server->nextPendingConnection()); | |
|
117 | this->ui->listWidget->addItem(this->connectedClients.last()->peerAddress().toString()); | |||
111 | } |
|
118 | } | |
112 |
|
119 | |||
113 | void SpwTcpPacketServer::updateHostIP() |
|
120 | void SpwTcpPacketServer::updateHostIP() |
@@ -48,6 +48,7 public slots: | |||||
48 | void connectServer(); |
|
48 | void connectServer(); | |
49 | void disconnectServer(); |
|
49 | void disconnectServer(); | |
50 | void setServerPort(qint32 port); |
|
50 | void setServerPort(qint32 port); | |
|
51 | void setServerSetIP(QString ip); | |||
51 | void newConnection(); |
|
52 | void newConnection(); | |
52 | private: |
|
53 | private: | |
53 | void updateHostIP(); |
|
54 | void updateHostIP(); |
@@ -49,6 +49,7 spwplugin::spwplugin(QWidget *parent):so | |||||
49 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerConnect()),this->tcpServer,SLOT(connectServer())); |
|
49 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerConnect()),this->tcpServer,SLOT(connectServer())); | |
50 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerDisconnect()),this->tcpServer,SLOT(disconnectServer())); |
|
50 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerDisconnect()),this->tcpServer,SLOT(disconnectServer())); | |
51 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerSetPort(qint32)),this->tcpServer,SLOT(setServerPort(qint32))); |
|
51 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerSetPort(qint32)),this->tcpServer,SLOT(setServerPort(qint32))); | |
|
52 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(TCPServerSetIP(QString)),this->tcpServer,SLOT(setServerSetIP(QString))); | |||
52 | } |
|
53 | } | |
53 |
|
54 | |||
54 |
|
55 |
@@ -22,6 +22,7 signals: | |||||
22 | void TCPServerConnect(); |
|
22 | void TCPServerConnect(); | |
23 | void TCPServerDisconnect(); |
|
23 | void TCPServerDisconnect(); | |
24 | void TCPServerSetPort(qint32 port); |
|
24 | void TCPServerSetPort(qint32 port); | |
|
25 | void TCPServerSetIP(QString ip); | |||
25 | public slots: |
|
26 | public slots: | |
26 |
|
27 | |||
27 | }; |
|
28 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now