-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingsDialog.cpp
42 lines (31 loc) · 1.25 KB
/
SettingsDialog.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
#include "SettingsDialog.h"
#include "ui_SettingsDialog.h"
#include "GameManager.h"
SettingsDialog::SettingsDialog(QDialog *parent) : QDialog(parent), _ui(new Ui::SettingsDialog)
{
_ui->setupUi(this);
Player* black = sGameManager->GetBlackPlayer();
Player* white = sGameManager->GetWhitePlayer();
_ui->comboBoxBlackDifficulty->setCurrentIndex(black->GetGameDifficulty());
_ui->comboBoxWhiteDifficulty->setCurrentIndex(white->GetGameDifficulty());
_ui->comboBoxBlackPlayerType->setCurrentIndex(black->GetPlayerType());
_ui->comboBoxWhitePlayerType->setCurrentIndex(white->GetPlayerType());
}
SettingsDialog::~SettingsDialog()
{
delete _ui;
}
void SettingsDialog::on_pushButtonApply_clicked()
{
Player* black = sGameManager->GetBlackPlayer();
Player* white = sGameManager->GetWhitePlayer();
black->SetGameDifficulty(GameDifficulty(_ui->comboBoxBlackDifficulty->currentIndex()));
white->SetGameDifficulty(GameDifficulty(_ui->comboBoxWhiteDifficulty->currentIndex()));
black->SetPlayerType(PlayerType(_ui->comboBoxBlackPlayerType->currentIndex()));
white->SetPlayerType(PlayerType(_ui->comboBoxWhitePlayerType->currentIndex()));
accept();
}
void SettingsDialog::on_pushButtonCancel_clicked()
{
reject();
}