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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#include "playerdialog.h"
#include <qgroupbox.h>
PlayerDialog::PlayerDialog(QWidget* parent,const char* name,bool modal,WFlags f)
:QDialog(parent,name,modal,f)
{
auto2=false;
auto2=true;
setCaption("Player Settings");
QGroupBox* player1_box=new QGroupBox("Player 1",this);
player1_box->setGeometry(10,30,220,60);
manual_button1=new QRadioButton("Human",player1_box);
connect(manual_button1,SIGNAL(clicked()),this,SLOT(button_manual1()));
manual_button1->setGeometry(10,20,100,20);
auto_button1=new QRadioButton("Computer",player1_box);
connect(auto_button1,SIGNAL(clicked()),this,SLOT(button_auto1()));
auto_button1->setGeometry(110,20,100,20);
button1_state(auto1);
QGroupBox* player2_box=new QGroupBox("Player 2",this);
player2_box->setGeometry(10,150,220,60);
manual_button2=new QRadioButton("Human",player2_box);
connect(manual_button2,SIGNAL(clicked()),this,SLOT(button_manual2()));
manual_button2->setGeometry(10,20,100,20);
auto_button2=new QRadioButton("Computer",player2_box);
connect(auto_button2,SIGNAL(clicked()),this,SLOT(button_auto2()));
auto_button2->setGeometry(110,20,100,20);
button2_state(auto2);
showMaximized();
}
PlayerDialog::~PlayerDialog()
{}
void PlayerDialog::button_manual1()
{
auto1=false;
button1_state(auto1);
}
void PlayerDialog::button_auto1()
{
auto1=true;
button1_state(auto1);
}
void PlayerDialog::button_manual2()
{
auto2=false;
button2_state(auto2);
}
void PlayerDialog::button_auto2()
{
auto2=true;
button2_state(auto2);
}
void PlayerDialog::button1_state(bool computer)
{
if(computer)
{
manual_button1->setChecked(false);
auto_button1->setChecked(true);
}
else
{
manual_button1->setChecked(true);
auto_button1->setChecked(false);
}
}
void PlayerDialog::button2_state(bool computer)
{
if(computer)
{
manual_button2->setChecked(false);
auto_button2->setChecked(true);
}
else
{
manual_button2->setChecked(true);
auto_button2->setChecked(false);
}
}
void PlayerDialog::setAuto1(bool newstate)
{
auto1=newstate;
button1_state(auto1);
}
bool PlayerDialog::getAuto1()
{
return auto1;
}
void PlayerDialog::setAuto2(bool newstate)
{
auto2=newstate;
button2_state(auto2);
}
bool PlayerDialog::getAuto2()
{
return auto2;
}
|