-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.cpp
More file actions
35 lines (30 loc) · 769 Bytes
/
Menu.cpp
File metadata and controls
35 lines (30 loc) · 769 Bytes
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
#include "Menu.h"
#include "qpushbutton.h"
#include "LogUtil.h"
#include "NetworkHandler.h"
#include "Durak.h"
#include "Game.h"
#include "ui_Menu.h"
Menu::Menu(QWidget* parent) : QDialog(parent)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose);
connect(ui.pbConnect, &QPushButton::clicked, this, &Menu::pbConnect_Clicked);
connect(ui.pbStartServer, &QPushButton::clicked, this, &Menu::pbStartServer_Clicked);
connect(ui.pbStart, &QPushButton::clicked, this, &Menu::pbStartGame_Clicked);
}
void Menu::pbConnect_Clicked()
{
connectAsClient(ui.leIp->text().toStdString(), atoi(ui.lePort->text().toStdString().c_str()));
}
void Menu::pbStartServer_Clicked()
{
startServer(5000);
}
void Menu::pbStartGame_Clicked()
{
if (isServer())
{
startGame();
}
}