author | waspe <waspe> | 2003-05-16 16:34:55 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-05-16 16:34:55 (UTC) |
commit | 11b6ce5ac500dce757ccdd0a5f5b5ecd7fb866c8 (patch) (unidiff) | |
tree | 3013dbafcb4e1f919e104204d1288f0309da5641 /noncore/games/backgammon | |
parent | 75f1e9815410e75a6f9ae76d8db716c0c315ea45 (diff) | |
download | opie-11b6ce5ac500dce757ccdd0a5f5b5ecd7fb866c8.zip opie-11b6ce5ac500dce757ccdd0a5f5b5ecd7fb866c8.tar.gz opie-11b6ce5ac500dce757ccdd0a5f5b5ecd7fb866c8.tar.bz2 |
*** empty log message ***
-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 131 | ||||
-rw-r--r-- | noncore/games/backgammon/backgammon.h | 30 | ||||
-rw-r--r-- | noncore/games/backgammon/backgammonview.cpp | 8 | ||||
-rw-r--r-- | noncore/games/backgammon/backgammonview.h | 8 | ||||
-rw-r--r-- | noncore/games/backgammon/definition.cpp | 1 | ||||
-rw-r--r-- | noncore/games/backgammon/displaydialog.cpp | 89 | ||||
-rw-r--r-- | noncore/games/backgammon/displaydialog.h | 30 | ||||
-rw-r--r-- | noncore/games/backgammon/moveengine.cpp | 2 | ||||
-rw-r--r-- | noncore/games/backgammon/moveengine.h | 2 | ||||
-rw-r--r-- | noncore/games/backgammon/rulesdialog.h | 1 |
10 files changed, 51 insertions, 251 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index 38ccb49..c40f462 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp | |||
@@ -1,7 +1,6 @@ | |||
1 | #include "backgammon.h" | 1 | #include "backgammon.h" |
2 | 2 | ||
3 | #include "aidialog.h" | 3 | #include "aidialog.h" |
4 | #include "displaydialog.h" | ||
5 | #include "filedialog.h" | 4 | #include "filedialog.h" |
6 | #include "playerdialog.h" | 5 | #include "playerdialog.h" |
7 | #include "rulesdialog.h" | 6 | #include "rulesdialog.h" |
@@ -9,9 +8,11 @@ | |||
9 | 8 | ||
10 | #include <qdatetime.h> | 9 | #include <qdatetime.h> |
11 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | #include <qlayout.h> | ||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qtimer.h> | 14 | #include <qtimer.h> |
15 | #include <qmainwindow.h> | ||
15 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
17 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
@@ -19,30 +20,9 @@ | |||
19 | 20 | ||
20 | #include <stdlib.h> | 21 | #include <stdlib.h> |
21 | 22 | ||
22 | BackGammonView::BackGammonView(QCanvas* canvas,QWidget* parent) | ||
23 | :QCanvasView(canvas,parent) | ||
24 | { | ||
25 | //do nothing | ||
26 | } | ||
27 | |||
28 | |||
29 | |||
30 | BackGammonView::~BackGammonView() | ||
31 | { | ||
32 | //do nothing | ||
33 | } | ||
34 | |||
35 | |||
36 | |||
37 | void BackGammonView::contentsMousePressEvent(QMouseEvent* e) | ||
38 | { | ||
39 | int x=e->x(); | ||
40 | int y=e->y(); | ||
41 | emit mouse(x,y); | ||
42 | } | ||
43 | 23 | ||
44 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | 24 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) |
45 | : QWidget(parent, name, fl) | 25 | : QMainWindow(parent, name, fl) |
46 | { | 26 | { |
47 | if (!name) setName("BackGammon"); | 27 | if (!name) setName("BackGammon"); |
48 | setCaption("Backgammon"); | 28 | setCaption("Backgammon"); |
@@ -96,21 +76,6 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
96 | ai.empty=conf.readNumEntry("empty",2); | 76 | ai.empty=conf.readNumEntry("empty",2); |
97 | move->setAISettings(ai); | 77 | move->setAISettings(ai); |
98 | 78 | ||
99 | //non qte styles are smaller | ||
100 | conf.setGroup("display"); | ||
101 | display.small=conf.readBoolEntry("small",false); | ||
102 | display.warning=conf.readBoolEntry("warning",true); | ||
103 | non_qte=display.small; | ||
104 | if(display.warning) | ||
105 | { | ||
106 | Config test("qpe"); | ||
107 | test.setGroup("Appearance"); | ||
108 | if(test.readEntry("Style")!="QPE") | ||
109 | { | ||
110 | displaySettings(); | ||
111 | } | ||
112 | } | ||
113 | offset=(non_qte) ? 5 : 0; | ||
114 | 79 | ||
115 | //get the theme component names | 80 | //get the theme component names |
116 | Config theme(theme_file,Config::File); | 81 | Config theme(theme_file,Config::File); |
@@ -163,26 +128,21 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
163 | optionmenu->insertSeparator(); | 128 | optionmenu->insertSeparator(); |
164 | optionmenu->insertItem("AI",this,SLOT(modify_AI())); | 129 | optionmenu->insertItem("AI",this,SLOT(modify_AI())); |
165 | optionmenu->insertItem("Rules",this,SLOT(setrules())); | 130 | optionmenu->insertItem("Rules",this,SLOT(setrules())); |
166 | optionmenu->insertItem("Display",this,SLOT(displaySettings())); | ||
167 | menuBar->insertItem("Options",optionmenu); | 131 | menuBar->insertItem("Options",optionmenu); |
168 | 132 | ||
169 | //status bar | 133 | QWidget* mainarea=new QWidget(this); |
170 | message=new QLabel("<b>Backgammon</b>",this); | 134 | setCentralWidget(mainarea); |
171 | message->setGeometry(0,260,237,20); | ||
172 | message->setAlignment(AlignHCenter); | ||
173 | |||
174 | //the main area | 135 | //the main area |
175 | area=new QCanvas(235-2*offset,235-2*offset); | 136 | QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); |
176 | boardview=new BackGammonView(area,this); | 137 | area=new QCanvas(235,235); |
138 | boardview=new BackGammonView(area,mainarea); | ||
139 | boardview->setMaximumHeight(240); | ||
140 | layout->addWidget(boardview); | ||
177 | connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); | 141 | connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); |
178 | if(non_qte) | 142 | //status bar |
179 | { | 143 | message=new QLabel("<b>Backgammon</b>",mainarea); |
180 | boardview->setGeometry(5,20,229,229); | 144 | message->setAlignment(AlignHCenter); |
181 | } | 145 | layout->addWidget(message); |
182 | else | ||
183 | { | ||
184 | boardview->setGeometry(1,20,237,237); | ||
185 | } | ||
186 | 146 | ||
187 | //the marker | 147 | //the marker |
188 | marker_current=new QCanvasRectangle(area); | 148 | marker_current=new QCanvasRectangle(area); |
@@ -248,25 +208,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
248 | { | 208 | { |
249 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); | 209 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); |
250 | diceA1[a]=new CanvasImageItem(dicebgA,area); | 210 | diceA1[a]=new CanvasImageItem(dicebgA,area); |
251 | diceA1[a]->setX(5-offset); | 211 | diceA1[a]->setX(5); |
252 | diceA1[a]->setY(205-2*offset); | 212 | diceA1[a]->setY(205-2); |
253 | diceA1[a]->setZ(1); | 213 | diceA1[a]->setZ(1); |
254 | diceA1[a]->setSize(25,25); | 214 | diceA1[a]->setSize(25,25); |
255 | diceA2[a]=new CanvasImageItem(dicebgA,area); | 215 | diceA2[a]=new CanvasImageItem(dicebgA,area); |
256 | diceA2[a]->setX(35-offset); | 216 | diceA2[a]->setX(35); |
257 | diceA2[a]->setY(205-2*offset); | 217 | diceA2[a]->setY(205-2); |
258 | diceA2[a]->setZ(1); | 218 | diceA2[a]->setZ(1); |
259 | diceA2[a]->setSize(25,25); | 219 | diceA2[a]->setSize(25,25); |
260 | 220 | ||
261 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); | 221 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); |
262 | diceB1[a]=new CanvasImageItem(dicebgB,area); | 222 | diceB1[a]=new CanvasImageItem(dicebgB,area); |
263 | diceB1[a]->setX(175-offset); | 223 | diceB1[a]->setX(175); |
264 | diceB1[a]->setY(205-2*offset); | 224 | diceB1[a]->setY(205-2); |
265 | diceB1[a]->setZ(1); | 225 | diceB1[a]->setZ(1); |
266 | diceB1[a]->setSize(25,25); | 226 | diceB1[a]->setSize(25,25); |
267 | diceB2[a]=new CanvasImageItem(dicebgB,area); | 227 | diceB2[a]=new CanvasImageItem(dicebgB,area); |
268 | diceB2[a]->setX(205-offset); | 228 | diceB2[a]->setX(205); |
269 | diceB2[a]->setY(205-2*offset); | 229 | diceB2[a]->setY(205-2); |
270 | diceB2[a]->setZ(1); | 230 | diceB2[a]->setZ(1); |
271 | diceB2[a]->setSize(25,25); | 231 | diceB2[a]->setSize(25,25); |
272 | 232 | ||
@@ -275,8 +235,8 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
275 | { | 235 | { |
276 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); | 236 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); |
277 | oddsDice[a]=new CanvasImageItem(oddsbg,area); | 237 | oddsDice[a]=new CanvasImageItem(oddsbg,area); |
278 | oddsDice[a]->setX(110-offset); | 238 | oddsDice[a]->setX(110); |
279 | oddsDice[a]->setY(210-2*offset); | 239 | oddsDice[a]->setY(210-2); |
280 | oddsDice[a]->setZ(1); | 240 | oddsDice[a]->setZ(1); |
281 | oddsDice[a]->setSize(15,15); | 241 | oddsDice[a]->setSize(15,15); |
282 | oddsDice[a]->hide(); | 242 | oddsDice[a]->hide(); |
@@ -287,28 +247,20 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
287 | 247 | ||
288 | //set the board | 248 | //set the board |
289 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); | 249 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); |
290 | if(non_qte) | ||
291 | { | ||
292 | boardbg=boardbg.copy(offset,offset,235-2*offset,200-2*offset); | ||
293 | } | ||
294 | board=new CanvasImageItem(boardbg,area); | 250 | board=new CanvasImageItem(boardbg,area); |
295 | board->setX(0); | 251 | board->setX(0); |
296 | board->setY(0); | 252 | board->setY(0); |
297 | board->setZ(0); | 253 | board->setZ(0); |
298 | board->setSize(235-2*offset,200-2*offset); | 254 | board->setSize(235-2,200-2); |
299 | board->show(); | 255 | board->show(); |
300 | 256 | ||
301 | //the table | 257 | //the table |
302 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); | 258 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); |
303 | if(non_qte) | ||
304 | { | ||
305 | tablebg=tablebg.copy(offset,0,235-offset,200); | ||
306 | } | ||
307 | table=new CanvasImageItem(tablebg,area); | 259 | table=new CanvasImageItem(tablebg,area); |
308 | table->setX(0); | 260 | table->setX(0); |
309 | table->setY(200-2*offset); | 261 | table->setY(200-2); |
310 | table->setZ(0); | 262 | table->setZ(0); |
311 | table->setSize(235-2*offset,20); | 263 | table->setSize(235-2,20); |
312 | table->show(); | 264 | table->show(); |
313 | 265 | ||
314 | //the no move marker | 266 | //the no move marker |
@@ -599,24 +551,11 @@ void BackGammon::setrules() | |||
599 | move->setRules(rules); | 551 | move->setRules(rules); |
600 | } | 552 | } |
601 | 553 | ||
602 | void BackGammon::displaySettings() | ||
603 | { | ||
604 | DisplayDialog* displaydialog=new DisplayDialog(this); | ||
605 | displaydialog->setDisplaySettings(display); | ||
606 | if(!displaydialog->exec()) | ||
607 | return; | ||
608 | display=displaydialog->getDisplaySettings(); | ||
609 | Config conf("backgammon"); | ||
610 | conf.setGroup("display"); | ||
611 | conf.writeEntry("small",display.small); | ||
612 | conf.writeEntry("warning",display.warning); | ||
613 | QMessageBox::warning(this,"Backgammon","changed display settings will\nonly take place after game has\nbeen restarted","OK"); | ||
614 | } | ||
615 | 554 | ||
616 | void BackGammon::draw() | 555 | void BackGammon::draw() |
617 | { | 556 | { |
618 | Pieces pieces; | 557 | Pieces pieces; |
619 | move->position(pieces,non_qte); | 558 | move->position(pieces); |
620 | for(int a=0;a<15;a++) | 559 | for(int a=0;a<15;a++) |
621 | { | 560 | { |
622 | if(!pieces.player1[a].side) | 561 | if(!pieces.player1[a].side) |
@@ -669,10 +608,10 @@ void BackGammon::mouse(int x,int y) | |||
669 | 608 | ||
670 | Marker marker; | 609 | Marker marker; |
671 | 610 | ||
672 | move->boardpressed(x,y,marker,non_qte); | 611 | move->boardpressed(x,y,marker); |
673 | if(marker.visible_current) | 612 | if(marker.visible_current) |
674 | { | 613 | { |
675 | marker_current->setX(marker.x_current-offset); | 614 | marker_current->setX(marker.x_current); |
676 | marker_current->setY(marker.y_current); | 615 | marker_current->setY(marker.y_current); |
677 | marker_current->show(); | 616 | marker_current->show(); |
678 | } | 617 | } |
@@ -685,7 +624,7 @@ void BackGammon::mouse(int x,int y) | |||
685 | { | 624 | { |
686 | if(marker.visible_next[a]) | 625 | if(marker.visible_next[a]) |
687 | { | 626 | { |
688 | marker_next[a]->setX(marker.x_next[a]-offset); | 627 | marker_next[a]->setX(marker.x_next[a]); |
689 | marker_next[a]->setY(marker.y_next[a]); | 628 | marker_next[a]->setY(marker.y_next[a]); |
690 | marker_next[a]->show(); | 629 | marker_next[a]->show(); |
691 | } | 630 | } |
@@ -985,17 +924,9 @@ void BackGammon::autoroll_dice2() | |||
985 | void BackGammon::applytheme() | 924 | void BackGammon::applytheme() |
986 | { | 925 | { |
987 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); | 926 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); |
988 | if(non_qte) | ||
989 | { | ||
990 | boardbg=boardbg.copy(offset,offset,235-2*offset,200-2*offset); | ||
991 | } | ||
992 | board->setImage(boardbg); | 927 | board->setImage(boardbg); |
993 | 928 | ||
994 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); | 929 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); |
995 | if(non_qte) | ||
996 | { | ||
997 | tablebg=tablebg.copy(offset,0,235-offset,200); | ||
998 | } | ||
999 | table->setImage(tablebg); | 930 | table->setImage(tablebg); |
1000 | 931 | ||
1001 | QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name)); | 932 | QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name)); |
diff --git a/noncore/games/backgammon/backgammon.h b/noncore/games/backgammon/backgammon.h index 40dbaba..e3276f1 100644 --- a/noncore/games/backgammon/backgammon.h +++ b/noncore/games/backgammon/backgammon.h | |||
@@ -1,39 +1,26 @@ | |||
1 | #ifndef BACKGAMMON_H | 1 | #ifndef BACKGAMMON_H |
2 | #define BACKGAMMON_H | 2 | #define BACKGAMMON_H |
3 | 3 | ||
4 | #include "backgammonview.h" | ||
4 | #include "canvasimageitem.h" | 5 | #include "canvasimageitem.h" |
5 | #include "definition.h" | ||
6 | //#include "rulesdialog.h" | 6 | //#include "rulesdialog.h" |
7 | #include "moveengine.h" | 7 | #include "moveengine.h" |
8 | 8 | ||
9 | #include <qcanvas.h> | 9 | |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | #include <qlineedit.h> | 11 | #include <qmainwindow.h> |
12 | #include <qwidget.h> | 12 | //#include <qwidget.h> |
13 | |||
13 | 14 | ||
14 | 15 | ||
15 | class BackGammonView : public QCanvasView | ||
16 | { | ||
17 | Q_OBJECT | ||
18 | public: | ||
19 | BackGammonView(QCanvas* canvas,QWidget* parent); | ||
20 | ~BackGammonView(); | ||
21 | signals: | ||
22 | void mouse(int,int); | ||
23 | private: | ||
24 | void contentsMousePressEvent(QMouseEvent* e); | ||
25 | }; | ||
26 | 16 | ||
27 | class BackGammon : public QWidget | 17 | class BackGammon : public QMainWindow |
28 | { | 18 | { |
29 | Q_OBJECT | 19 | Q_OBJECT |
30 | private: | 20 | private: |
31 | //GUI | 21 | //GUI |
32 | //is the style not qte ? | ||
33 | bool non_qte; | ||
34 | int offset; | ||
35 | //the "status" bar | 22 | //the "status" bar |
36 | QLineEdit* inputfield; | 23 | QLabel* message; |
37 | //the main drawing area | 24 | //the main drawing area |
38 | QCanvas* area; | 25 | QCanvas* area; |
39 | BackGammonView* boardview; | 26 | BackGammonView* boardview; |
@@ -53,7 +40,7 @@ private: | |||
53 | 40 | ||
54 | QCanvasRectangle* marker_current; | 41 | QCanvasRectangle* marker_current; |
55 | QCanvasRectangle* marker_next[4]; | 42 | QCanvasRectangle* marker_next[4]; |
56 | QLabel* message; | 43 | |
57 | //ENGINE | 44 | //ENGINE |
58 | MoveEngine* move; | 45 | MoveEngine* move; |
59 | //the dice values | 46 | //the dice values |
@@ -113,7 +100,6 @@ private slots: | |||
113 | void deletetheme(); | 100 | void deletetheme(); |
114 | void modify_AI(); | 101 | void modify_AI(); |
115 | void setrules(); | 102 | void setrules(); |
116 | void displaySettings(); | ||
117 | void mouse(int x,int y); | 103 | void mouse(int x,int y); |
118 | void done_dice1(); | 104 | void done_dice1(); |
119 | void done_dice2(); | 105 | void done_dice2(); |
diff --git a/noncore/games/backgammon/backgammonview.cpp b/noncore/games/backgammon/backgammonview.cpp index ecbc12b..6ee8f10 100644 --- a/noncore/games/backgammon/backgammonview.cpp +++ b/noncore/games/backgammon/backgammonview.cpp | |||
@@ -3,15 +3,21 @@ | |||
3 | BackGammonView::BackGammonView(QCanvas* canvas,QWidget* parent) | 3 | BackGammonView::BackGammonView(QCanvas* canvas,QWidget* parent) |
4 | :QCanvasView(canvas,parent) | 4 | :QCanvasView(canvas,parent) |
5 | { | 5 | { |
6 | //do nothing | ||
6 | } | 7 | } |
7 | 8 | ||
9 | |||
10 | |||
8 | BackGammonView::~BackGammonView() | 11 | BackGammonView::~BackGammonView() |
9 | { | 12 | { |
13 | //do nothing | ||
10 | } | 14 | } |
11 | 15 | ||
16 | |||
17 | |||
12 | void BackGammonView::contentsMousePressEvent(QMouseEvent* e) | 18 | void BackGammonView::contentsMousePressEvent(QMouseEvent* e) |
13 | { | 19 | { |
14 | int x=e->x(); | 20 | int x=e->x(); |
15 | int y=e->y(); | 21 | int y=e->y(); |
16 | //emit mousepressed(x,y); | 22 | emit mouse(x,y); |
17 | } \ No newline at end of file | 23 | } \ No newline at end of file |
diff --git a/noncore/games/backgammon/backgammonview.h b/noncore/games/backgammon/backgammonview.h index e50f2b0..52508e2 100644 --- a/noncore/games/backgammon/backgammonview.h +++ b/noncore/games/backgammon/backgammonview.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef BACKGAMMONVIEW_H | 1 | #ifndef BACKGAMMON_VIEW_H |
2 | #define BACKGAMMONVIEW_H | 2 | #define BACKGAMMON_VIEW_H |
3 | 3 | ||
4 | #include <qcanvas.h> | 4 | #include <qcanvas.h> |
5 | 5 | ||
@@ -10,9 +10,9 @@ public: | |||
10 | BackGammonView(QCanvas* canvas,QWidget* parent); | 10 | BackGammonView(QCanvas* canvas,QWidget* parent); |
11 | ~BackGammonView(); | 11 | ~BackGammonView(); |
12 | signals: | 12 | signals: |
13 | //void mousepressed(int,int); | 13 | void mouse(int,int); |
14 | private: | 14 | private: |
15 | void contentsMousePressEvent(QMouseEvent* e); | 15 | void contentsMousePressEvent(QMouseEvent* e); |
16 | }; | 16 | }; |
17 | 17 | ||
18 | #endif //BACKGAMMONVIEW_H \ No newline at end of file | 18 | #endif //BACKGAMMON_VIEW_H \ No newline at end of file |
diff --git a/noncore/games/backgammon/definition.cpp b/noncore/games/backgammon/definition.cpp index 9e0029d..c036319 100644 --- a/noncore/games/backgammon/definition.cpp +++ b/noncore/games/backgammon/definition.cpp | |||
@@ -1,3 +1,2 @@ | |||
1 | #include "definition.h" | 1 | #include "definition.h" |
2 | 2 | ||
3 | static bool debug=false; | ||
diff --git a/noncore/games/backgammon/displaydialog.cpp b/noncore/games/backgammon/displaydialog.cpp deleted file mode 100644 index 8b97545..0000000 --- a/noncore/games/backgammon/displaydialog.cpp +++ b/dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | #include "displaydialog.h" | ||
2 | |||
3 | #include <qgroupbox.h> | ||
4 | #include <qlabel.h> | ||
5 | |||
6 | DisplayDialog::DisplayDialog(QWidget* parent,const char* name,bool modal,WFlags f) | ||
7 | : QDialog(parent,name,modal,f) | ||
8 | { | ||
9 | setCaption("Display Configuration"); | ||
10 | QLabel* header=new QLabel("<b>Change the display settings</b>",this); | ||
11 | header->setGeometry(10,10,200,20); | ||
12 | |||
13 | // | ||
14 | QGroupBox* settings_frame=new QGroupBox("Settings",this); | ||
15 | settings_frame->setGeometry(10,10,220,120); | ||
16 | |||
17 | small_box=new QRadioButton("Big display, e.g. for QPE Style",settings_frame); | ||
18 | small_box->setGeometry(10,20,200,20); | ||
19 | connect(small_box,SIGNAL(clicked()),this,SLOT(small_clicked())); | ||
20 | |||
21 | big_box=new QRadioButton("Small display, e.g. for Windows Style",settings_frame); | ||
22 | big_box->setGeometry(10,50,200,20); | ||
23 | connect(big_box,SIGNAL(clicked()),this,SLOT(big_clicked())); | ||
24 | |||
25 | // | ||
26 | QGroupBox* warning_frame=new QGroupBox("Warning",this); | ||
27 | warning_frame->setGeometry(10,140,220,120); | ||
28 | |||
29 | warning_box=new QCheckBox("show style warning",warning_frame); | ||
30 | warning_box->setGeometry(10,20,200,20); | ||
31 | connect(warning_box,SIGNAL(clicked()),this,SLOT(warning_clicked())); | ||
32 | |||
33 | QLabel* warning_help=new QLabel("show style warning at statup if the system style is not QPE\nif not set to small you may have\nscrollbars on the palying area",warning_frame); | ||
34 | warning_help->setGeometry(10,50,200,60); | ||
35 | |||
36 | showMaximized(); | ||
37 | } | ||
38 | |||
39 | |||
40 | DisplayDialog::~DisplayDialog() | ||
41 | { | ||
42 | } | ||
43 | |||
44 | void DisplayDialog::big_clicked() | ||
45 | { | ||
46 | big_box->setChecked(true); | ||
47 | small_box->setChecked(false); | ||
48 | } | ||
49 | |||
50 | void DisplayDialog::small_clicked() | ||
51 | { | ||
52 | big_box->setChecked(false); | ||
53 | small_box->setChecked(true); | ||
54 | } | ||
55 | |||
56 | void DisplayDialog::warning_clicked() | ||
57 | { | ||
58 | } | ||
59 | |||
60 | void DisplayDialog::setDisplaySettings(const Display& display) | ||
61 | { | ||
62 | if(!display.small) | ||
63 | { | ||
64 | big_box->setChecked(false); | ||
65 | small_box->setChecked(true); | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | big_box->setChecked(true); | ||
70 | small_box->setChecked(false); | ||
71 | } | ||
72 | if(display.warning) | ||
73 | warning_box->setChecked(true); | ||
74 | else | ||
75 | warning_box->setChecked(false); | ||
76 | |||
77 | } | ||
78 | |||
79 | Display DisplayDialog::getDisplaySettings() | ||
80 | { | ||
81 | Display display; | ||
82 | display.small=!small_box->isChecked(); | ||
83 | display.warning=warning_box->isChecked(); | ||
84 | return display; | ||
85 | } | ||
86 | |||
87 | |||
88 | |||
89 | |||
diff --git a/noncore/games/backgammon/displaydialog.h b/noncore/games/backgammon/displaydialog.h deleted file mode 100644 index 26b77f0..0000000 --- a/noncore/games/backgammon/displaydialog.h +++ b/dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #ifndef DISPLAYDLAOG_H | ||
2 | #define DISPLAYDLAOG_H | ||
3 | |||
4 | #include <qcheckbox.h> | ||
5 | #include <qdialog.h> | ||
6 | #include <qradiobutton.h> | ||
7 | |||
8 | #include "definition.h" | ||
9 | |||
10 | |||
11 | class DisplayDialog : public QDialog | ||
12 | { | ||
13 | Q_OBJECT | ||
14 | private: | ||
15 | QRadioButton* small_box; | ||
16 | QRadioButton* big_box; | ||
17 | QCheckBox* warning_box; | ||
18 | public: | ||
19 | DisplayDialog(QWidget* parent=0,const char* name=0,bool modal=TRUE,WFlags f=0); | ||
20 | ~DisplayDialog(); | ||
21 | private slots: | ||
22 | void big_clicked(); | ||
23 | void small_clicked(); | ||
24 | void warning_clicked(); | ||
25 | public: | ||
26 | void setDisplaySettings(const Display& display); | ||
27 | Display getDisplaySettings(); | ||
28 | }; | ||
29 | |||
30 | #endif //DISPLAYDLAOG_H | ||
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp index 8106b3f..009c449 100644 --- a/noncore/games/backgammon/moveengine.cpp +++ b/noncore/games/backgammon/moveengine.cpp | |||
@@ -4,8 +4,6 @@ | |||
4 | 4 | ||
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | 6 | ||
7 | #include <stdlib.h> | ||
8 | |||
9 | MoveEngine::MoveEngine() | 7 | MoveEngine::MoveEngine() |
10 | : QObject() | 8 | : QObject() |
11 | { | 9 | { |
diff --git a/noncore/games/backgammon/moveengine.h b/noncore/games/backgammon/moveengine.h index a2d4a52..4c39a04 100644 --- a/noncore/games/backgammon/moveengine.h +++ b/noncore/games/backgammon/moveengine.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef MOVEENGINE_H | 1 | #ifndef MOVEENGINE_H |
2 | #define MOVEENGINE_H | 2 | #define MOVEENGINE_H |
3 | 3 | ||
4 | #include <qobject.h> | ||
5 | #include "definition.h" | 4 | #include "definition.h" |
5 | #include <qobject.h> | ||
6 | 6 | ||
7 | class MoveEngine : public QObject | 7 | class MoveEngine : public QObject |
8 | { | 8 | { |
diff --git a/noncore/games/backgammon/rulesdialog.h b/noncore/games/backgammon/rulesdialog.h index 9269a0e..f11a28c 100644 --- a/noncore/games/backgammon/rulesdialog.h +++ b/noncore/games/backgammon/rulesdialog.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | #include "definition.h" | 6 | #include "definition.h" |
7 | 7 | ||
8 | |||
9 | class RulesDialog : public QDialog | 8 | class RulesDialog : public QDialog |
10 | { | 9 | { |
11 | Q_OBJECT | 10 | Q_OBJECT |