-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.cpp
More file actions
48 lines (44 loc) · 1001 Bytes
/
settings.cpp
File metadata and controls
48 lines (44 loc) · 1001 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
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "settings.h"
#include "ui_settings.h"
Settings::Settings(start* pStart,Color color, QWidget *parent) :
QDialog(parent),
ui(new Ui::Settings),
startPage(pStart)
{
ui->setupUi(this);
if(color == Color::WHITE)
{
ui->whiteRadioButton->setChecked(true);
}
else ui->blackRadioButton->setChecked(true);
}
Settings::~Settings()
{
delete ui;
}
void Settings::on_okButton_clicked()
{
Player* p1 = nullptr;
Player* p2 = nullptr;
if(ui->whiteRadioButton->isChecked())
{
p1 = new Person(Color::WHITE);
}
else if(ui->blackRadioButton->isChecked())
{
p1 = new Person(Color::BLACK);
}
if(ui->botRadioButton->isChecked())
{
if(!ui->whiteRadioButton->isChecked())
{
p2 = new Bot(Color::WHITE);
}
else if(!ui->blackRadioButton->isChecked())
{
p2 = new Bot(Color::BLACK);
}
}
startPage->setPlayers(p1, p2);
this->close();
}