-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenuwindow.cpp
More file actions
47 lines (41 loc) · 1.15 KB
/
menuwindow.cpp
File metadata and controls
47 lines (41 loc) · 1.15 KB
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 "menuwindow.h"
#include <QWidget>
#include <QPushButton>
#include <QApplication>
#include "serveurwidget.h"
#include "server.h"
#include "client.h"
#include "clientwidget.h"
/**
* @brief MenuWindow::MenuWindow
* @param parent
*/
MenuWindow::MenuWindow(QWidget *parent) : QWidget(parent)
{
setFixedSize(1000,500);
vlay = new QVBoxLayout(this);
QBoxLayout *vlay_bouton = new QHBoxLayout();
QPushButton *server_button = new QPushButton("Héberger une partie");
vlay_bouton->addWidget(server_button);
connect(server_button, SIGNAL(clicked()),this, SLOT(preparerServeur()));
QPushButton *client_button = new QPushButton("Rejoindre une partie");
vlay_bouton->addWidget(client_button);
connect(client_button, SIGNAL(clicked()),this, SLOT(preparerClient()));
vlay->addLayout(vlay_bouton);
}
/**
* @brief MenuWindow::preparerServeur
*/
void MenuWindow::preparerServeur()
{
conn = new Server();
vlay->addWidget(new ServeurWidget(this, (Server*) conn));
}
/**
* @brief MenuWindow::preparerClient
*/
void MenuWindow::preparerClient()
{
conn = new Client();
vlay->addWidget(new ClientWidget(this, (Client*) conn));
}