-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectform.cpp
37 lines (33 loc) · 905 Bytes
/
connectform.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "connectform.h"
#include "ui_connectform.h"
#include "network.h"
#include <QMessageBox>
connectForm::connectForm(QWidget *parent, Client *c, MainWindow *w) :
QWidget(parent),
ui(new Ui::connectForm)
{
ui->setupUi(this);
client = c;
window = w;
}
connectForm::~connectForm()
{
delete ui;
}
void connectForm::on_buttonConnect_clicked()
{
int n;
client->set_username(ui->inputUname->text());
client->set_port(ui->inputPort->text());
client->set_hostname(ui->inputIP->text());
if((n = client->connect_to_server()) == -1)
{
// perror("connect");
}
// QMessageBox::critical(0, QString("Client"), QString("Connected"));
QObject::connect(&readThread, SIGNAL(messageRecieved(QString)), window, SLOT(dataRecieved(QString)));
readThread.setSocket(client->get_sock());
readThread.start();
client->set_connect();
hide();
}