-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWaintingForTirette.cpp
51 lines (42 loc) · 1.65 KB
/
WaintingForTirette.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
48
49
50
51
#include "WaintingForTirette.h"
WaintingForTirette::WaintingForTirette(QWidget *parent) : QWidget(parent) {
this->mainLayout = new QVBoxLayout(this);
this->title = new QLabel("Wainting for tirette", this);
this->title->setStyleSheet("font-size: 30px; color: black;");
this->wating = new QLabel("Waiting", this);
this->wating->setStyleSheet("font-size: 24px; color: black;");
this->mainLayout->addWidget(this->title, 0, Qt::AlignCenter | Qt::AlignTop);
this->mainLayout->addWidget(this->wating, 0, Qt::AlignCenter | Qt::AlignTop);
this->timer = new QTimer(this);
connect(this->timer, &QTimer::timeout, this, [=]() {
this->i = (this->i + 1) % 3;
QString message = "Waiting";
for (int j = 0; j < this->i; j++)
{
message += ".";
}
this->wating->setText(message);
});
this->disarme = new QPushButton("Disarme", this);
this->disarme->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 66px; width: 378px; color: black; font-size: 33px;");
this->disarme->setBaseSize(378, 66);
this->mainLayout->addWidget(this->disarme);
connect(this->disarme, &QPushButton::pressed, this, &WaintingForTirette::disarmePressed);
}
WaintingForTirette::~WaintingForTirette() {
delete this->title;
delete this->wating;
delete this->timer;
delete this->mainLayout;
}
void WaintingForTirette::responseFromTirette(const std::string& response)
{
std::vector<std::string> list = Modelec::split(response, ";");
if (list[3] == "0")
{
emit startGame();
}
}
void WaintingForTirette::startWaiting() const {
this->timer->start(1000);
}