-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWarwinner.cpp
More file actions
44 lines (36 loc) · 1.19 KB
/
Copy pathWarwinner.cpp
File metadata and controls
44 lines (36 loc) · 1.19 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
#include "Warwinner.h"
#include "ui_Warwinner.h"
Winner::Winner(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Winner)
{
ui->setupUi(this);
}
Winner::~Winner()
{
delete ui;
}
void Winner::declare(const Player &winner, BattleMarker& battleMarker, bool win)
{
this->show();
if (win) {
ui->label_2->setText("The player" +
QString::number(winner.getID() + 1) +
" Won the Battle and captured the " +
QString::fromStdString(battleMarker.getState().getName())); // show name of winner player
}
else {
ui->label_2->setText("The battle was inconclusive and the state of " +
QString::fromStdString(battleMarker.getState().getName()) + // show name of winner player
" still remains");
}
QEventLoop loop;
connect(ui->pushButton_3, SIGNAL(clicked(bool)), &loop, SLOT(quit())); //signal and slot
loop.exec();
disconnect(ui->pushButton_3, SIGNAL(clicked(bool)), &loop, SLOT(quit())); //signal and slot
this->hide();
}
void Winner::on_btn_save_clicked() /// save button
{
emit save();
}