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.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 51020a0..bdb1c78 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,48 +1,52 @@
1#include "backgammon.h" 1#include "backgammon.h"
2
3#include "aidialog.h" 2#include "aidialog.h"
4#include "filedialog.h" 3#include "filedialog.h"
5#include "playerdialog.h" 4#include "playerdialog.h"
6#include "rulesdialog.h" 5#include "rulesdialog.h"
7#include "themedialog.h" 6#include "themedialog.h"
8 7
8/* OPIE */
9#include <opie2/odebug.h>
10#include <qpe/qpeapplication.h>
11#include <qpe/config.h>
12#include <qpe/resource.h>
13using namespace Opie::Core;
14
15/* QT */
9#include <qfile.h> 16#include <qfile.h>
10#include <qlayout.h> 17#include <qlayout.h>
11#include <qmessagebox.h> 18#include <qmessagebox.h>
12#include <qtimer.h> 19#include <qtimer.h>
13#include <qpe/qpeapplication.h>
14#include <qpe/config.h>
15#include <qmenubar.h> 20#include <qmenubar.h>
16#include <qpe/resource.h>
17 21
18#include <stdlib.h> 22#include <stdlib.h>
19 23
20 24
21BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) 25BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
22 : QMainWindow(parent, name, fl) 26 : QMainWindow(parent, name, fl)
23{ 27{
24 if (!name) setName("BackGammon"); 28 if (!name) setName("BackGammon");
25 setCaption(tr( "Backgammon") ); 29 setCaption(tr( "Backgammon") );
26 setIcon( Resource::loadPixmap( "backgammon" ) ); 30 setIcon( Resource::loadPixmap( "backgammon" ) );
27 //general counter varaible 31 //general counter varaible
28 int a=0; 32 int a=0;
29 //the game engine 33 //the game engine
30 move=new MoveEngine(); 34 move=new MoveEngine();
31 35
32 //load the default theme 36 //load the default theme
33 Config conf("backgammon"); 37 Config conf("backgammon");
34 if(!conf.isValid()) 38 if(!conf.isValid())
35 { 39 {
36 qDebug("config file does not exist"); 40 odebug << "config file does not exist" << oendl;
37 conf.setGroup("general"); 41 conf.setGroup("general");
38 conf.writeEntry("theme","default"); 42 conf.writeEntry("theme","default");
39 conf.setGroup("rules"); 43 conf.setGroup("rules");
40 conf.writeEntry("move_with_pieces_out",false); 44 conf.writeEntry("move_with_pieces_out",false);
41 conf.writeEntry("nice_dice",false); 45 conf.writeEntry("nice_dice",false);
42 conf.setGroup("display"); 46 conf.setGroup("display");
43 conf.writeEntry("small",false); 47 conf.writeEntry("small",false);
44 conf.writeEntry("warning",true); 48 conf.writeEntry("warning",true);
45 conf.setGroup("ai"); 49 conf.setGroup("ai");
46 conf.writeEntry("rescue",6); 50 conf.writeEntry("rescue",6);
47 conf.writeEntry("eliminate",4); 51 conf.writeEntry("eliminate",4);
48 conf.writeEntry("expose",1); 52 conf.writeEntry("expose",1);
@@ -69,25 +73,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
69 ai.eliminate=conf.readNumEntry("eliminate",4); 73 ai.eliminate=conf.readNumEntry("eliminate",4);
70 ai.expose=conf.readNumEntry("expose",1); 74 ai.expose=conf.readNumEntry("expose",1);
71 ai.protect=conf.readNumEntry("protect",5); 75 ai.protect=conf.readNumEntry("protect",5);
72 ai.safe=conf.readNumEntry("safe",3); 76 ai.safe=conf.readNumEntry("safe",3);
73 ai.empty=conf.readNumEntry("empty",2); 77 ai.empty=conf.readNumEntry("empty",2);
74 move->setAISettings(ai); 78 move->setAISettings(ai);
75 79
76 80
77 //get the theme component names 81 //get the theme component names
78 Config theme(theme_file,Config::File); 82 Config theme(theme_file,Config::File);
79 if(!theme.isValid()) 83 if(!theme.isValid())
80 { 84 {
81 qDebug("theme file does not exist"); 85 odebug << "theme file does not exist" << oendl;
82 theme.setGroup("theme"); 86 theme.setGroup("theme");
83 theme.writeEntry("board","casino_board_1"); 87 theme.writeEntry("board","casino_board_1");
84 theme.writeEntry("pieces1","casino_pieces_blue"); 88 theme.writeEntry("pieces1","casino_pieces_blue");
85 theme.writeEntry("pieces2","casino_pieces_white"); 89 theme.writeEntry("pieces2","casino_pieces_white");
86 theme.writeEntry("dice1","casino_dice"); 90 theme.writeEntry("dice1","casino_dice");
87 theme.writeEntry("dice2","casino_dice"); 91 theme.writeEntry("dice2","casino_dice");
88 theme.writeEntry("table","casino_table_green"); 92 theme.writeEntry("table","casino_table_green");
89 theme.writeEntry("odds","casino_odds"); 93 theme.writeEntry("odds","casino_odds");
90 } 94 }
91 theme.setGroup("theme"); 95 theme.setGroup("theme");
92 board_name=theme.readEntry("board","casino_board_1"); 96 board_name=theme.readEntry("board","casino_board_1");
93 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 97 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");