Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

rulesdialog.cpp

Go to the documentation of this file.
00001 #include "rulesdialog.h"
00002 
00003 #include <qgroupbox.h>
00004 #include <qlabel.h>
00005 
00006 #include <qpe/qpeapplication.h>
00007 
00008 RulesDialog::RulesDialog(QWidget* parent,const char* name,bool modal,WFlags f)
00009   : QDialog(parent,name,modal,f)
00010 {
00011     setCaption("Rules Configuration");
00012     QLabel* header=new QLabel("<b>Change the game rules here</b>",this);
00013     header->setGeometry(10,10,200,20);
00014 
00015     //
00016     QGroupBox* pieces_out_box=new QGroupBox("Movement",this);
00017     pieces_out_box->setGeometry(10,10,220,120);
00018     
00019     pieces_out=new QCheckBox("Don't care about others",pieces_out_box);
00020     pieces_out->setGeometry(10,20,200,20);
00021     connect(pieces_out,SIGNAL(clicked()),this,SLOT(pieces_out_clicked()));
00022    
00023     QLabel* pieces_out_help=new QLabel("allow movement of the pieses\neven if there are pieces knocked\nout by the opponent",pieces_out_box);
00024     pieces_out_help->setGeometry(10,40,200,60);
00025 
00026     //
00027     QGroupBox* nice_dice_box=new QGroupBox("Dice",this);
00028     nice_dice_box->setGeometry(10,140,220,120);
00029 
00030     nice_dice=new QCheckBox("Big dice for small numbers",nice_dice_box);
00031     nice_dice->setGeometry(10,20,200,20);
00032     connect(nice_dice,SIGNAL(clicked()),this,SLOT(nice_dice_clicked()));
00033 
00034     QLabel* nice_dice_help=new QLabel("allow to rescue pieces with dice\nvalues graeter than the distance\nto the players endzone.",nice_dice_box);
00035     nice_dice_help->setGeometry(10,40,200,60);
00036     
00037     QPEApplication::showDialog( this );
00038 }
00039 
00040 
00041 RulesDialog::~RulesDialog()
00042 {
00043 }
00044 
00045 void RulesDialog::pieces_out_clicked()
00046 {
00047   if(pieces_out->isChecked())
00048     rules.move_with_pieces_out=true;
00049   else
00050     rules.move_with_pieces_out=false;
00051 }
00052 
00053 void RulesDialog::nice_dice_clicked()
00054 {
00055   if(nice_dice->isChecked())
00056     rules.generous_dice=true;
00057   else
00058     rules.generous_dice=false;
00059 }
00060 
00061 void RulesDialog::setRules(const Rules& new_rules)
00062 {
00063   rules=new_rules;
00064   if(rules.move_with_pieces_out)
00065     pieces_out->setChecked(true);
00066   else
00067     pieces_out->setChecked(false);
00068 
00069   if(rules.generous_dice)
00070     nice_dice->setChecked(true);
00071   else
00072     nice_dice->setChecked(false);    
00073 }
00074 
00075 Rules RulesDialog::getRules()
00076 {
00077   return rules;
00078 }
00079 

Generated on Sat Nov 5 16:17:18 2005 for OPIE by  doxygen 1.4.2