summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/backgammon.cpp
Unidiff
Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 06523f1..755ed10 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -57,97 +57,97 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
57 conf.setGroup("general"); 57 conf.setGroup("general");
58 theme_name=conf.readEntry("theme","default"); 58 theme_name=conf.readEntry("theme","default");
59 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; 59 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
60 60
61 //the rules 61 //the rules
62 conf.setGroup("rules"); 62 conf.setGroup("rules");
63 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); 63 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
64 rules.generous_dice=conf.readBoolEntry("nice_dice",false); 64 rules.generous_dice=conf.readBoolEntry("nice_dice",false);
65 65
66 move->setRules(rules); 66 move->setRules(rules);
67 67
68 //get the AI settings 68 //get the AI settings
69 AISettings ai; 69 AISettings ai;
70 conf.setGroup("ai"); 70 conf.setGroup("ai");
71 ai.rescue=conf.readNumEntry("rescue",6); 71 ai.rescue=conf.readNumEntry("rescue",6);
72 ai.eliminate=conf.readNumEntry("eliminate",4); 72 ai.eliminate=conf.readNumEntry("eliminate",4);
73 ai.expose=conf.readNumEntry("expose",1); 73 ai.expose=conf.readNumEntry("expose",1);
74 ai.protect=conf.readNumEntry("protect",5); 74 ai.protect=conf.readNumEntry("protect",5);
75 ai.safe=conf.readNumEntry("safe",3); 75 ai.safe=conf.readNumEntry("safe",3);
76 ai.empty=conf.readNumEntry("empty",2); 76 ai.empty=conf.readNumEntry("empty",2);
77 move->setAISettings(ai); 77 move->setAISettings(ai);
78 78
79 79
80 //get the theme component names 80 //get the theme component names
81 Config theme(theme_file,Config::File); 81 Config theme(theme_file,Config::File);
82 if(!theme.isValid()) 82 if(!theme.isValid())
83 { 83 {
84 qDebug("theme file does not exist"); 84 qDebug("theme file does not exist");
85 theme.setGroup("theme"); 85 theme.setGroup("theme");
86 theme.writeEntry("board","casino_board_1"); 86 theme.writeEntry("board","casino_board_1");
87 theme.writeEntry("pieces1","casino_pieces_blue"); 87 theme.writeEntry("pieces1","casino_pieces_blue");
88 theme.writeEntry("pieces2","casino_pieces_white"); 88 theme.writeEntry("pieces2","casino_pieces_white");
89 theme.writeEntry("dice1","casino_dice"); 89 theme.writeEntry("dice1","casino_dice");
90 theme.writeEntry("dice2","casino_dice"); 90 theme.writeEntry("dice2","casino_dice");
91 theme.writeEntry("table","casino_table_green"); 91 theme.writeEntry("table","casino_table_green");
92 theme.writeEntry("odds","casino_odds"); 92 theme.writeEntry("odds","casino_odds");
93 } 93 }
94 theme.setGroup("theme"); 94 theme.setGroup("theme");
95 board_name=theme.readEntry("board","casino_board_1"); 95 board_name=theme.readEntry("board","casino_board_1");
96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); 97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
98 diceA_name=theme.readEntry("dice1","casino_dice"); 98 diceA_name=theme.readEntry("dice1","casino_dice");
99 diceB_name=theme.readEntry("dice2","casino_dice"); 99 diceB_name=theme.readEntry("dice2","casino_dice");
100 table_name=theme.readEntry("table","casino_table_green"); 100 table_name=theme.readEntry("table","casino_table_green");
101 odds_name=theme.readEntry("odds","casino_odds"); 101 odds_name=theme.readEntry("odds","casino_odds");
102 102
103 103
104 //the menu 104 //the menu
105 QPEMenuBar* menuBar = new QPEMenuBar(this); 105 QMenuBar* menuBar = new QMenuBar(this);
106 106
107 QPopupMenu* gamemenu= new QPopupMenu(this); 107 QPopupMenu* gamemenu= new QPopupMenu(this);
108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame())); 108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
109 gamemenu->insertSeparator(); 109 gamemenu->insertSeparator();
110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame())); 110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame())); 111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
112 gamemenu->insertSeparator(); 112 gamemenu->insertSeparator();
113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame())); 113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
114 menuBar->insertItem(tr( "Game" ),gamemenu); 114 menuBar->insertItem(tr( "Game" ),gamemenu);
115 115
116 QPopupMenu* thememenu= new QPopupMenu(this); 116 QPopupMenu* thememenu= new QPopupMenu(this);
117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme())); 117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
118 thememenu->insertSeparator(); 118 thememenu->insertSeparator();
119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme())); 119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme())); 120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
121 thememenu->insertSeparator(); 121 thememenu->insertSeparator();
122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault())); 122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme())); 123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
124 menuBar->insertItem(tr( "Theme" ),thememenu); 124 menuBar->insertItem(tr( "Theme" ),thememenu);
125 125
126 QPopupMenu* optionmenu=new QPopupMenu(this); 126 QPopupMenu* optionmenu=new QPopupMenu(this);
127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect())); 127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
128 optionmenu->insertSeparator(); 128 optionmenu->insertSeparator();
129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI())); 129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules())); 130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
131 menuBar->insertItem(tr( "Options"),optionmenu); 131 menuBar->insertItem(tr( "Options"),optionmenu);
132 132
133 QWidget* mainarea=new QWidget(this); 133 QWidget* mainarea=new QWidget(this);
134 setCentralWidget(mainarea); 134 setCentralWidget(mainarea);
135 //the main area 135 //the main area
136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); 136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
137 area=new QCanvas(235,235); 137 area=new QCanvas(235,235);
138 boardview=new BackGammonView(area,mainarea); 138 boardview=new BackGammonView(area,mainarea);
139 boardview->setMaximumHeight(240); 139 boardview->setMaximumHeight(240);
140 layout->addWidget(boardview); 140 layout->addWidget(boardview);
141 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); 141 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
142 //status bar 142 //status bar
143 message=new QLabel("<b>Backgammon</b>",mainarea); 143 message=new QLabel("<b>Backgammon</b>",mainarea);
144 message->setAlignment(AlignHCenter); 144 message->setAlignment(AlignHCenter);
145 layout->addWidget(message); 145 layout->addWidget(message);
146 146
147 //the marker 147 //the marker
148 marker_current=new QCanvasRectangle(area); 148 marker_current=new QCanvasRectangle(area);
149 marker_current->setBrush(QColor(0,0,255)); 149 marker_current->setBrush(QColor(0,0,255));
150 marker_current->setSize(15,5); 150 marker_current->setSize(15,5);
151 marker_current->setZ(1); 151 marker_current->setZ(1);
152 152
153 for(a=0;a<4;a++) 153 for(a=0;a<4;a++)