-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
47 lines (38 loc) · 1.03 KB
/
mainwindow.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
38
39
40
41
42
43
44
45
46
47
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QFile>
#include "package/packagemessage.h"
#include "package/packageauth.h"
#include "package/packagefilehandler.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Server *serv= new Server(this);
if(serv->start(QHostAddress::Any,1024)){
qDebug()<<"run server";
}
Client *client = new Client(this);
client->connectTo("localhost",1024);
PackageAuth *pkAuth= new PackageAuth();
pkAuth->login="mefest";
client->sendPackage(pkAuth);
PackageFileHandler *fl= new PackageFileHandler();
QFile file("Makefile");
fl->setFile(file);
qDebug()<<fl->hash;
client->sendPackage(fl);
PackageMessage *pkMes= new PackageMessage();
pkMes->setMessage("hi my favorite server");
client->sendPackage(pkMes);
qDebug()<<"connect to localhost";
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::onRecivPackage(Package *package)
{
}