summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/rulesdialog.cpp
Unidiff
Diffstat (limited to 'noncore/games/backgammon/rulesdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/backgammon/rulesdialog.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/noncore/games/backgammon/rulesdialog.cpp b/noncore/games/backgammon/rulesdialog.cpp
new file mode 100644
index 0000000..85c3db3
--- a/dev/null
+++ b/noncore/games/backgammon/rulesdialog.cpp
@@ -0,0 +1,77 @@
1#include "rulesdialog.h"
2
3#include <qgroupbox.h>
4#include <qlabel.h>
5
6RulesDialog::RulesDialog(QWidget* parent,const char* name,bool modal,WFlags f)
7 : QDialog(parent,name,modal,f)
8{
9 setCaption("Rules Configuration");
10 QLabel* header=new QLabel("<b>Change the game rules here</b>",this);
11 header->setGeometry(10,10,200,20);
12
13 //
14 QGroupBox* pieces_out_box=new QGroupBox("Movement",this);
15 pieces_out_box->setGeometry(10,10,220,120);
16
17 pieces_out=new QCheckBox("Don't care about others",pieces_out_box);
18 pieces_out->setGeometry(10,20,200,20);
19 connect(pieces_out,SIGNAL(clicked()),this,SLOT(pieces_out_clicked()));
20
21 QLabel* pieces_out_help=new QLabel("allow movement of the pieses\neven if there are pieces knocked\nout by the opponent",pieces_out_box);
22 pieces_out_help->setGeometry(10,40,200,60);
23
24 //
25 QGroupBox* nice_dice_box=new QGroupBox("Dice",this);
26 nice_dice_box->setGeometry(10,140,220,120);
27
28 nice_dice=new QCheckBox("Big dice for small numbers",nice_dice_box);
29 nice_dice->setGeometry(10,20,200,20);
30 connect(nice_dice,SIGNAL(clicked()),this,SLOT(nice_dice_clicked()));
31
32 QLabel* nice_dice_help=new QLabel("allow to rescue pieces with dice\nvalues graeter than the distance\nto the players endzone.",nice_dice_box);
33 nice_dice_help->setGeometry(10,40,200,60);
34
35 showMaximized();
36}
37
38
39RulesDialog::~RulesDialog()
40{
41}
42
43void RulesDialog::pieces_out_clicked()
44{
45 if(pieces_out->isChecked())
46 rules.move_with_pieces_out=true;
47 else
48 rules.move_with_pieces_out=false;
49}
50
51void RulesDialog::nice_dice_clicked()
52{
53 if(nice_dice->isChecked())
54 rules.generous_dice=true;
55 else
56 rules.generous_dice=false;
57}
58
59void RulesDialog::setRules(const Rules& new_rules)
60{
61 rules=new_rules;
62 if(rules.move_with_pieces_out)
63 pieces_out->setChecked(true);
64 else
65 pieces_out->setChecked(false);
66
67 if(rules.generous_dice)
68 nice_dice->setChecked(true);
69 else
70 nice_dice->setChecked(false);
71}
72
73Rules RulesDialog::getRules()
74{
75 return rules;
76}
77