summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-13 20:51:18 (UTC)
committer zecke <zecke>2004-03-13 20:51:18 (UTC)
commita3304e23c7f8576a4584475ef0cf49d0e588671e (patch) (unidiff)
tree854fa06307ad13c403a5be06caa2c9da305dd9b6
parent8ff0f6a5875346302d62b52621f9e6189d683dd9 (diff)
downloadopie-a3304e23c7f8576a4584475ef0cf49d0e588671e.zip
opie-a3304e23c7f8576a4584475ef0cf49d0e588671e.tar.gz
opie-a3304e23c7f8576a4584475ef0cf49d0e588671e.tar.bz2
convert to Opie2 namespace
most of them are only using namespace Opie::Core in the main remove <qpe/qpetoolbar.h>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/bounce/main.cpp1
-rw-r--r--noncore/games/buzzword/main.cpp1
-rw-r--r--noncore/games/fifteen/main.cpp1
-rw-r--r--noncore/games/go/gowidget.cpp2
-rw-r--r--noncore/games/go/main.cpp1
-rw-r--r--noncore/games/kcheckers/main.cpp1
-rw-r--r--noncore/games/minesweep/main.cpp1
-rw-r--r--noncore/games/parashoot/main.cpp1
-rw-r--r--noncore/games/qasteroids/main.cpp1
-rw-r--r--noncore/games/snake/interface.cpp2
-rw-r--r--noncore/games/snake/main.cpp1
-rw-r--r--noncore/games/solitaire/main.cpp1
-rw-r--r--noncore/games/tetrix/main.cpp1
-rw-r--r--noncore/games/tictac/main.cpp1
-rw-r--r--noncore/games/wordgame/main.cpp1
-rw-r--r--noncore/games/wordgame/wordgame.cpp2
-rw-r--r--noncore/games/zlines/main.cpp1
-rw-r--r--noncore/games/zsame/ZSameWidget.cpp1
18 files changed, 18 insertions, 3 deletions
diff --git a/noncore/games/bounce/main.cpp b/noncore/games/bounce/main.cpp
index eb8d561..bec4a86 100644
--- a/noncore/games/bounce/main.cpp
+++ b/noncore/games/bounce/main.cpp
@@ -1,24 +1,25 @@
1/* 1/*
2 * Copyright (C) 2000 Stefan Schimanski <schimmi@kde.org> 2 * Copyright (C) 2000 Stefan Schimanski <schimmi@kde.org>
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the Free 15 * License along with this program; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19#include "kbounce.h" 19#include "kbounce.h"
20 20
21#include <opie2/oapplicationfactory.h> 21#include <opie2/oapplicationfactory.h>
22 22
23using namespace Opie::Core;
23OPIE_EXPORT_APP( OApplicationFactory<KJezzball> ) 24OPIE_EXPORT_APP( OApplicationFactory<KJezzball> )
24 25
diff --git a/noncore/games/buzzword/main.cpp b/noncore/games/buzzword/main.cpp
index 596cf16..a95e91a 100644
--- a/noncore/games/buzzword/main.cpp
+++ b/noncore/games/buzzword/main.cpp
@@ -1,23 +1,24 @@
1/* 1/*
2 * Copyright (C) 2002 Martin Imobersteg <imm@gmx.ch> 2 * Copyright (C) 2002 Martin Imobersteg <imm@gmx.ch>
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public 5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License,Life or (at your option) any later version. 7 * version 2 of the License,Life or (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the Free 15 * License along with this program; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
20 20
21#include "buzzword.h" 21#include "buzzword.h"
22 22
23using namespace Opie::Core;
23OPIE_EXPORT_APP( OApplicationFactory<BuzzWord> ) 24OPIE_EXPORT_APP( OApplicationFactory<BuzzWord> )
diff --git a/noncore/games/fifteen/main.cpp b/noncore/games/fifteen/main.cpp
index ed74a47..800a270 100644
--- a/noncore/games/fifteen/main.cpp
+++ b/noncore/games/fifteen/main.cpp
@@ -1,23 +1,24 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Holger Freyther. All rights reserved. 2** Copyright (C) 2004 Holger Freyther. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16**********************************************************************/ 16**********************************************************************/
17 17
18#include "fifteen.h" 18#include "fifteen.h"
19 19
20#include <opie2/oapplicationfactory.h> 20#include <opie2/oapplicationfactory.h>
21 21
22using namespace Opie::Core;
22OPIE_EXPORT_APP( OApplicationFactory<FifteenMainWindow> ) 23OPIE_EXPORT_APP( OApplicationFactory<FifteenMainWindow> )
23 24
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index 79820b1..d134540 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -1,219 +1,219 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "gowidget.h" 21#include "gowidget.h"
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25 25
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qpe/qpetoolbar.h> 27#include <qtoolbar.h>
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qaction.h> 29#include <qaction.h>
30#include <qapplication.h> //processEvents() 30#include <qapplication.h> //processEvents()
31#include <qlabel.h> 31#include <qlabel.h>
32 32
33//#include <stdio.h> 33//#include <stdio.h>
34 34
35 35
36static const enum bVal computer_color = BLACK; 36static const enum bVal computer_color = BLACK;
37 37
38static int current_handicap = 1; 38static int current_handicap = 1;
39 39
40static QBrush *goBrush; 40static QBrush *goBrush;
41//static QImage *newBlackStone; 41//static QImage *newBlackStone;
42//static QImage *blackStone; 42//static QImage *blackStone;
43//static QImage *whiteStone; 43//static QImage *whiteStone;
44static QPixmap *newBlackStone; 44static QPixmap *newBlackStone;
45static QPixmap *blackStone; 45static QPixmap *blackStone;
46static QPixmap *whiteStone; 46static QPixmap *whiteStone;
47 47
48static bool smallStones = FALSE; 48static bool smallStones = FALSE;
49 49
50GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) : 50GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) :
51 QMainWindow( parent, name, fl ) 51 QMainWindow( parent, name, fl )
52{ 52{
53 setToolBarsMovable( FALSE ); 53 setToolBarsMovable( FALSE );
54 GoWidget *go = new GoWidget(this); 54 GoWidget *go = new GoWidget(this);
55 55
56 setCentralWidget(go); 56 setCentralWidget(go);
57 toolbar = new QToolBar(this); 57 toolbar = new QToolBar(this);
58 toolbar->setHorizontalStretchable( TRUE ); 58 toolbar->setHorizontalStretchable( TRUE );
59 addToolBar(toolbar); 59 addToolBar(toolbar);
60 60
61 QMenuBar *mb = new QMenuBar( toolbar ); 61 QMenuBar *mb = new QMenuBar( toolbar );
62 mb->setMargin(0); 62 mb->setMargin(0);
63 QPopupMenu *file = new QPopupMenu( this ); 63 QPopupMenu *file = new QPopupMenu( this );
64 64
65 QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 ); 65 QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 );
66 connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) ); 66 connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) );
67 a->addTo( file ); 67 a->addTo( file );
68 68
69 a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 ); 69 a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 );
70 connect( a, SIGNAL( activated() ), go, SLOT( pass() ) ); 70 connect( a, SIGNAL( activated() ), go, SLOT( pass() ) );
71 a->addTo( file ); 71 a->addTo( file );
72 a->addTo( toolbar ); 72 a->addTo( toolbar );
73 73
74 74
75 a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 ); 75 a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 );
76 connect( a, SIGNAL( activated() ), go, SLOT( resign() ) ); 76 connect( a, SIGNAL( activated() ), go, SLOT( resign() ) );
77 a->addTo( file ); 77 a->addTo( file );
78 78
79 a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 ); 79 a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 );
80 a->setToggleAction( TRUE ); 80 a->setToggleAction( TRUE );
81 connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) ); 81 connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) );
82 a->addTo( file ); 82 a->addTo( file );
83 83
84 mb->insertItem( tr( "Game" ), file ); 84 mb->insertItem( tr( "Game" ), file );
85 85
86 QLabel *turnLabel = new QLabel( toolbar ); 86 QLabel *turnLabel = new QLabel( toolbar );
87 turnLabel->setBackgroundMode( PaletteButton ); 87 turnLabel->setBackgroundMode( PaletteButton );
88 connect( go, SIGNAL(showTurn(const QPixmap&)), 88 connect( go, SIGNAL(showTurn(const QPixmap&)),
89 turnLabel, SLOT(setPixmap(const QPixmap&)) ); 89 turnLabel, SLOT(setPixmap(const QPixmap&)) );
90 90
91 91
92 QLabel * scoreLabel = new QLabel( toolbar ); 92 QLabel * scoreLabel = new QLabel( toolbar );
93 scoreLabel->setBackgroundMode( PaletteButton ); 93 scoreLabel->setBackgroundMode( PaletteButton );
94 connect( go, SIGNAL(showScore(const QString&)), 94 connect( go, SIGNAL(showScore(const QString&)),
95 scoreLabel, SLOT(setText(const QString&)) ); 95 scoreLabel, SLOT(setText(const QString&)) );
96 96
97 toolbar->setStretchableWidget( scoreLabel ); 97 toolbar->setStretchableWidget( scoreLabel );
98 98
99 go->readConfig(); 99 go->readConfig();
100} 100}
101 101
102void GoMainWidget::resizeEvent( QResizeEvent * ) 102void GoMainWidget::resizeEvent( QResizeEvent * )
103{ 103{
104 //### this won't work because of the text label... 104 //### this won't work because of the text label...
105 /* 105 /*
106 if ( width() > height() ) 106 if ( width() > height() )
107 moveToolBar( toolbar, Left ); 107 moveToolBar( toolbar, Left );
108 else 108 else
109 moveToolBar( toolbar, Top ); 109 moveToolBar( toolbar, Top );
110 */ 110 */
111} 111}
112 112
113GoWidget *GoWidget::self = 0; 113GoWidget *GoWidget::self = 0;
114 114
115GoWidget::GoWidget( QWidget *parent, const char* name) : 115GoWidget::GoWidget( QWidget *parent, const char* name) :
116 QWidget( parent, name ) 116 QWidget( parent, name )
117{ 117{
118 if ( self ) 118 if ( self )
119 fatal( "Only one Go widget allowed" ); 119 fatal( "Only one Go widget allowed" );
120 self = this; 120 self = this;
121 twoplayer = FALSE; 121 twoplayer = FALSE;
122 122
123 123
124 d = bx = by = 1; 124 d = bx = by = 1;
125 125
126 QPixmap pix = Resource::loadPixmap( "go/pine" ); 126 QPixmap pix = Resource::loadPixmap( "go/pine" );
127 goBrush = new QBrush( black, pix ); 127 goBrush = new QBrush( black, pix );
128 /* 128 /*
129 QString fn = Resource::findPixmap("Go-black"); 129 QString fn = Resource::findPixmap("Go-black");
130 blackStone = new QImage( fn ); 130 blackStone = new QImage( fn );
131 fn = Resource::findPixmap("Go-black-highlight"); 131 fn = Resource::findPixmap("Go-black-highlight");
132 newBlackStone = new QImage( fn ); 132 newBlackStone = new QImage( fn );
133 fn = Resource::findPixmap("Go-white"); 133 fn = Resource::findPixmap("Go-white");
134 whiteStone = new QImage( fn ); 134 whiteStone = new QImage( fn );
135 */ 135 */
136 blackStone = new QPixmap(Resource::loadPixmap( "Go-black" )); 136 blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
137 whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" )); 137 whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
138 newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" )); 138 newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
139 139
140 init(); 140 init();
141} 141}
142 142
143GoWidget::~GoWidget() 143GoWidget::~GoWidget()
144{ 144{
145 writeConfig(); 145 writeConfig();
146} 146}
147 147
148void GoWidget::writeConfig() 148void GoWidget::writeConfig()
149{ 149{
150 Config cfg("Go"); 150 Config cfg("Go");
151 cfg.setGroup("Game"); 151 cfg.setGroup("Game");
152 cfg.writeEntry("TwoPlayer", twoplayer); 152 cfg.writeEntry("TwoPlayer", twoplayer);
153 cfg.writeEntry("CurrentPlayer", currentPlayer); 153 cfg.writeEntry("CurrentPlayer", currentPlayer);
154 cfg.writeEntry("NPassed", nPassed); 154 cfg.writeEntry("NPassed", nPassed);
155 QString b; 155 QString b;
156 for (int i=0; i<19; i++) 156 for (int i=0; i<19; i++)
157 for (int j=0; j<19; j++) 157 for (int j=0; j<19; j++)
158 b += board[i][j] == BLACK ? 'B' : board[i][j] == WHITE ? 'W' : '.'; 158 b += board[i][j] == BLACK ? 'B' : board[i][j] == WHITE ? 'W' : '.';
159 cfg.writeEntry("Board", b); 159 cfg.writeEntry("Board", b);
160 cfg.writeEntry("LastX", lastX); 160 cfg.writeEntry("LastX", lastX);
161 cfg.writeEntry("LastY", lastY); 161 cfg.writeEntry("LastY", lastY);
162 extern int blackPrisoners, whitePrisoners; 162 extern int blackPrisoners, whitePrisoners;
163 cfg.writeEntry("BlackPrisoners", blackPrisoners); 163 cfg.writeEntry("BlackPrisoners", blackPrisoners);
164 cfg.writeEntry("WhitePrisoners", whitePrisoners); 164 cfg.writeEntry("WhitePrisoners", whitePrisoners);
165} 165}
166 166
167void GoWidget::readConfig() 167void GoWidget::readConfig()
168{ 168{
169 init(); 169 init();
170 Config cfg("Go"); 170 Config cfg("Go");
171 cfg.setGroup("Game"); 171 cfg.setGroup("Game");
172 twoplayer = cfg.readBoolEntry("TwoPlayer"); 172 twoplayer = cfg.readBoolEntry("TwoPlayer");
173 currentPlayer = (bVal)cfg.readNumEntry("CurrentPlayer",1); 173 currentPlayer = (bVal)cfg.readNumEntry("CurrentPlayer",1);
174 nPassed = cfg.readNumEntry("NPassed",0); 174 nPassed = cfg.readNumEntry("NPassed",0);
175 QString b = cfg.readEntry("Board"); 175 QString b = cfg.readEntry("Board");
176 if ( b.length() == 19*19 ) 176 if ( b.length() == 19*19 )
177 for (int i=0; i<19; i++) 177 for (int i=0; i<19; i++)
178 for (int j=0; j<19; j++) { 178 for (int j=0; j<19; j++) {
179 QChar ch = b[j+19*i]; 179 QChar ch = b[j+19*i];
180 if ( ch != '.' ) 180 if ( ch != '.' )
181 GoPlaceStone( ch == 'B' ? BLACK : WHITE, i, j ); 181 GoPlaceStone( ch == 'B' ? BLACK : WHITE, i, j );
182 } 182 }
183 lastX = cfg.readNumEntry("LastX"); 183 lastX = cfg.readNumEntry("LastX");
184 lastY = cfg.readNumEntry("LastY"); 184 lastY = cfg.readNumEntry("LastY");
185 extern int blackPrisoners, whitePrisoners; 185 extern int blackPrisoners, whitePrisoners;
186 blackPrisoners = cfg.readNumEntry("BlackPrisoners",0); 186 blackPrisoners = cfg.readNumEntry("BlackPrisoners",0);
187 whitePrisoners = cfg.readNumEntry("WhitePrisoners",0); 187 whitePrisoners = cfg.readNumEntry("WhitePrisoners",0);
188 reportPrisoners(blackPrisoners,whitePrisoners); 188 reportPrisoners(blackPrisoners,whitePrisoners);
189 emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone ); 189 emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone );
190} 190}
191 191
192void GoWidget::resizeEvent( QResizeEvent * ) 192void GoWidget::resizeEvent( QResizeEvent * )
193{ 193{
194 d = QMIN(width(),height())/19; 194 d = QMIN(width(),height())/19;
195 // int r = (d/2-1); 195 // int r = (d/2-1);
196 bx = (width() - 18*d)/2 ; 196 bx = (width() - 18*d)/2 ;
197 by = (height() - 18*d)/2 ; 197 by = (height() - 18*d)/2 ;
198 198
199 if ( d < 10 && !smallStones ) { 199 if ( d < 10 && !smallStones ) {
200 blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) ); 200 blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) );
201 whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) ); 201 whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) );
202 newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) ); 202 newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) );
203 203
204 smallStones = TRUE; 204 smallStones = TRUE;
205 } else if ( d >= 10 && smallStones ) { 205 } else if ( d >= 10 && smallStones ) {
206 blackStone = new QPixmap(Resource::loadPixmap( "Go-black" )); 206 blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
207 whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" )); 207 whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
208 newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" )); 208 newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
209 smallStones = FALSE; 209 smallStones = FALSE;
210 } 210 }
211} 211}
212 212
213void GoWidget::init() 213void GoWidget::init()
214{ 214{
215 lastX = lastY = newX = newY = -1; 215 lastX = lastY = newX = newY = -1;
216 nPassed = 0; 216 nPassed = 0;
217 for ( int i = 0; i < 19; i++ ) 217 for ( int i = 0; i < 19; i++ )
218 for ( int j = 0; j < 19; j++ ) 218 for ( int j = 0; j < 19; j++ )
219 board[i][j]=-1; 219 board[i][j]=-1;
diff --git a/noncore/games/go/main.cpp b/noncore/games/go/main.cpp
index 46817d1..f6bb813 100644
--- a/noncore/games/go/main.cpp
+++ b/noncore/games/go/main.cpp
@@ -1,27 +1,28 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "gowidget.h" 21#include "gowidget.h"
22 22
23 23
24#include <opie2/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<GoMainWidget> ) 27OPIE_EXPORT_APP( OApplicationFactory<GoMainWidget> )
27 28
diff --git a/noncore/games/kcheckers/main.cpp b/noncore/games/kcheckers/main.cpp
index 79b5ac7..8c708e2 100644
--- a/noncore/games/kcheckers/main.cpp
+++ b/noncore/games/kcheckers/main.cpp
@@ -1,9 +1,10 @@
1 1
2 2
3#include "kcheckers.h" 3#include "kcheckers.h"
4 4
5#include <opie2/oapplicationfactory.h> 5#include <opie2/oapplicationfactory.h>
6 6
7using namespace Opie::Core;
7OPIE_EXPORT_APP( OApplicationFactory<KCheckers> ) 8OPIE_EXPORT_APP( OApplicationFactory<KCheckers> )
8 9
9 10
diff --git a/noncore/games/minesweep/main.cpp b/noncore/games/minesweep/main.cpp
index f3070f5..629afbf 100644
--- a/noncore/games/minesweep/main.cpp
+++ b/noncore/games/minesweep/main.cpp
@@ -1,26 +1,27 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "minesweep.h" 21#include "minesweep.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25using namespace Opie::Core;
25OPIE_EXPORT_APP( OApplicationFactory<MineSweep> ) 26OPIE_EXPORT_APP( OApplicationFactory<MineSweep> )
26 27
diff --git a/noncore/games/parashoot/main.cpp b/noncore/games/parashoot/main.cpp
index 81d513d..da21c25 100644
--- a/noncore/games/parashoot/main.cpp
+++ b/noncore/games/parashoot/main.cpp
@@ -1,26 +1,27 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "interface.h" 21#include "interface.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25using namespace Opie::Core;
25OPIE_EXPORT_APP( OApplicationFactory<ParaShoot> ) 26OPIE_EXPORT_APP( OApplicationFactory<ParaShoot> )
26 27
diff --git a/noncore/games/qasteroids/main.cpp b/noncore/games/qasteroids/main.cpp
index 33e4729..6ddb238 100644
--- a/noncore/games/qasteroids/main.cpp
+++ b/noncore/games/qasteroids/main.cpp
@@ -1,26 +1,27 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "toplevel.h" 21#include "toplevel.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<KAstTopLevel> ) 27OPIE_EXPORT_APP( OApplicationFactory<KAstTopLevel> )
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp
index b5fb5bf..9d9550a 100644
--- a/noncore/games/snake/interface.cpp
+++ b/noncore/games/snake/interface.cpp
@@ -1,217 +1,217 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "interface.h" 21#include "interface.h"
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24 24
25#include <qpe/qpetoolbar.h> 25#include <qtoolbar.h>
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27 27
28SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : 28SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) :
29 QMainWindow(parent,name,f), 29 QMainWindow(parent,name,f),
30 canvas(232, 258) 30 canvas(232, 258)
31{ 31{
32 setCaption( tr("Snake") ); 32 setCaption( tr("Snake") );
33 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); 33 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
34 QPixmap bg = Resource::loadPixmap("snake/grass"); 34 QPixmap bg = Resource::loadPixmap("snake/grass");
35 canvas.setBackgroundPixmap(bg); 35 canvas.setBackgroundPixmap(bg);
36 canvas.setUpdatePeriod(100); 36 canvas.setUpdatePeriod(100);
37 snake = 0; 37 snake = 0;
38 38
39 cv = new QCanvasView(&canvas, this); 39 cv = new QCanvasView(&canvas, this);
40 40
41 pauseTimer = new QTimer(this); 41 pauseTimer = new QTimer(this);
42 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); 42 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
43 43
44 setToolBarsMovable( FALSE ); 44 setToolBarsMovable( FALSE );
45 45
46 QToolBar* toolbar = new QToolBar( this); 46 QToolBar* toolbar = new QToolBar( this);
47 toolbar->setHorizontalStretchable( TRUE ); 47 toolbar->setHorizontalStretchable( TRUE );
48 48
49 QPixmap newicon = Resource::loadPixmap("ksnake"); 49 QPixmap newicon = Resource::loadPixmap("ksnake");
50 setIcon(newicon); 50 setIcon(newicon);
51 (void)new QToolButton(newicon, tr("New Game"), 0, 51 (void)new QToolButton(newicon, tr("New Game"), 0,
52 this, SLOT(newGame()), toolbar, "New Game"); 52 this, SLOT(newGame()), toolbar, "New Game");
53 53
54 scorelabel = new QLabel(toolbar); 54 scorelabel = new QLabel(toolbar);
55 showScore(0); 55 showScore(0);
56 scorelabel->setBackgroundMode( PaletteButton ); 56 scorelabel->setBackgroundMode( PaletteButton );
57 scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); 57 scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs );
58 toolbar->setStretchableWidget( scorelabel ); 58 toolbar->setStretchableWidget( scorelabel );
59 59
60 setFocusPolicy(StrongFocus); 60 setFocusPolicy(StrongFocus);
61 61
62 setCentralWidget(cv); 62 setCentralWidget(cv);
63 63
64 QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); 64 QTimer::singleShot( 16, this, SLOT(welcomescreen()) );
65 gamestopped = true; 65 gamestopped = true;
66 waitover = true; 66 waitover = true;
67} 67}
68 68
69SnakeGame::~SnakeGame() 69SnakeGame::~SnakeGame()
70{ 70{
71 delete snake; 71 delete snake;
72} 72}
73 73
74void SnakeGame::resizeEvent(QResizeEvent *) 74void SnakeGame::resizeEvent(QResizeEvent *)
75{ 75{
76 QSize s = centralWidget()->size(); 76 QSize s = centralWidget()->size();
77 int fw = style().defaultFrameWidth(); 77 int fw = style().defaultFrameWidth();
78 canvas.resize( s.width() - fw - 2, s.height() - fw - 2); 78 canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
79} 79}
80 80
81void SnakeGame::welcomescreen() 81void SnakeGame::welcomescreen()
82{ 82{
83 QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); 83 QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas);
84 title->setColor(yellow); 84 title->setColor(yellow);
85 title->setFont( QFont("times", 18, QFont::Bold) ); 85 title->setFont( QFont("times", 18, QFont::Bold) );
86 int w = title->boundingRect().width(); 86 int w = title->boundingRect().width();
87 title->move(canvas.width()/2 -w/2, canvas.height()/2-110); 87 title->move(canvas.width()/2 -w/2, canvas.height()/2-110);
88 title->show(); 88 title->show();
89 QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title")); 89 QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title"));
90 QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); 90 QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas);
91 titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); 91 titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85);
92 titlepic->show(); 92 titlepic->show();
93 QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" 93 QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n"
94 "snake to eat the mouse. You must not\n" 94 "snake to eat the mouse. You must not\n"
95 "crash into the walls, edges or its tail."), 95 "crash into the walls, edges or its tail."),
96 &canvas); 96 &canvas);
97 w = instr->boundingRect().width(); 97 w = instr->boundingRect().width();
98 instr->move(canvas.width()/2-w/2, canvas.height()/2-20); 98 instr->move(canvas.width()/2-w/2, canvas.height()/2-20);
99 instr->setColor(white); 99 instr->setColor(white);
100 instr->show(); 100 instr->show();
101 QCanvasText* cont = new QCanvasText(tr("Press any key to start"), &canvas); 101 QCanvasText* cont = new QCanvasText(tr("Press any key to start"), &canvas);
102 w = cont->boundingRect().width(); 102 w = cont->boundingRect().width();
103 cont->move(canvas.width()/2-w/2, canvas.height()-20); 103 cont->move(canvas.width()/2-w/2, canvas.height()-20);
104 cont->setColor(yellow); 104 cont->setColor(yellow);
105 cont->show(); 105 cont->show();
106 106
107} 107}
108 108
109void SnakeGame::newGame() 109void SnakeGame::newGame()
110{ 110{
111 clear(); 111 clear();
112 snake = new Snake(&canvas); 112 snake = new Snake(&canvas);
113 connect(snake, SIGNAL(dead()), this, SLOT(gameOver()) ); 113 connect(snake, SIGNAL(dead()), this, SLOT(gameOver()) );
114 connect(snake, SIGNAL(targethit()), this, SLOT(levelUp()) ); 114 connect(snake, SIGNAL(targethit()), this, SLOT(levelUp()) );
115 connect(snake, SIGNAL(scorechanged()), this, SLOT(scoreInc()) ); 115 connect(snake, SIGNAL(scorechanged()), this, SLOT(scoreInc()) );
116 connect(this, SIGNAL(moveFaster()), snake, SLOT(increaseSpeed()) ); 116 connect(this, SIGNAL(moveFaster()), snake, SLOT(increaseSpeed()) );
117 last = 0; 117 last = 0;
118 targetamount = 1; 118 targetamount = 1;
119 notargets = 1; 119 notargets = 1;
120 level = 1; 120 level = 1;
121 stage = 1; 121 stage = 1;
122 showScore(0); 122 showScore(0);
123 gamestopped = false; 123 gamestopped = false;
124 waitover = true; 124 waitover = true;
125 int y = canvas.height()-50; 125 int y = canvas.height()-50;
126 (void)new Obstacle(&canvas, 32); 126 (void)new Obstacle(&canvas, 32);
127 (void)new Obstacle(&canvas, y); 127 (void)new Obstacle(&canvas, y);
128 createTargets(); 128 createTargets();
129} 129}
130 130
131 131
132void SnakeGame::showScore(int score) 132void SnakeGame::showScore(int score)
133{ 133{
134 scorelabel->setText(tr(" Score : %1 ").arg(score) ); 134 scorelabel->setText(tr(" Score : %1 ").arg(score) );
135} 135}
136 136
137 137
138void SnakeGame::scoreInc() 138void SnakeGame::scoreInc()
139{ 139{
140 showScore( snake->getScore() ); 140 showScore( snake->getScore() );
141} 141}
142 142
143void SnakeGame::levelUp() 143void SnakeGame::levelUp()
144{ 144{
145 notargets--; 145 notargets--;
146 if (notargets == 0) { 146 if (notargets == 0) {
147 stage++; 147 stage++;
148 if (stage == 3) { 148 if (stage == 3) {
149 level++; 149 level++;
150 emit moveFaster(); 150 emit moveFaster();
151 targetamount++; 151 targetamount++;
152 stage = 0; 152 stage = 0;
153 } 153 }
154 createTargets(); 154 createTargets();
155 } 155 }
156} 156}
157 157
158void SnakeGame::createTargets() 158void SnakeGame::createTargets()
159{ 159{
160 for (int i = 0; i < targetamount; i++) 160 for (int i = 0; i < targetamount; i++)
161 (void)new Target(&canvas); 161 (void)new Target(&canvas);
162 notargets = targetamount; 162 notargets = targetamount;
163} 163}
164 164
165void SnakeGame::clear() 165void SnakeGame::clear()
166{ 166{
167 delete snake; 167 delete snake;
168 snake = 0; 168 snake = 0;
169 QCanvasItemList l = canvas.allItems(); 169 QCanvasItemList l = canvas.allItems();
170 for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { 170 for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
171 delete *it; 171 delete *it;
172 } 172 }
173} 173}
174 174
175void SnakeGame::gameOver() 175void SnakeGame::gameOver()
176{ 176{
177 int score = snake->getScore(); 177 int score = snake->getScore();
178 QString scoreoutput=""; 178 QString scoreoutput="";
179 scoreoutput.setNum(score); 179 scoreoutput.setNum(score);
180 QCanvasText* gameover = new QCanvasText(tr("GAME OVER!\n Your Score: %1").arg( scoreoutput), &canvas); 180 QCanvasText* gameover = new QCanvasText(tr("GAME OVER!\n Your Score: %1").arg( scoreoutput), &canvas);
181 181
182 gameover->setZ(100); 182 gameover->setZ(100);
183 gameover->setColor(yellow); 183 gameover->setColor(yellow);
184 gameover->setFont( QFont("times", 18, QFont::Bold) ); 184 gameover->setFont( QFont("times", 18, QFont::Bold) );
185 int w = gameover->boundingRect().width(); 185 int w = gameover->boundingRect().width();
186 gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50); 186 gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50);
187 gameover->show(); 187 gameover->show();
188 gamestopped = true; 188 gamestopped = true;
189 waitover = false; 189 waitover = false;
190 pauseTimer->start(1500); 190 pauseTimer->start(1500);
191} 191}
192 192
193void SnakeGame::wait() 193void SnakeGame::wait()
194{ 194{
195 waitover = true; 195 waitover = true;
196 pauseTimer->stop(); 196 pauseTimer->stop();
197 QCanvasText* cont = new QCanvasText(tr("Press any key to begin a new game."), 197 QCanvasText* cont = new QCanvasText(tr("Press any key to begin a new game."),
198 &canvas); 198 &canvas);
199 cont->setZ(100); 199 cont->setZ(100);
200 cont->setColor(white); 200 cont->setColor(white);
201 int w = cont->boundingRect().width(); 201 int w = cont->boundingRect().width();
202 cont->move(canvas.width()/2 -w/2, canvas.height()/2); 202 cont->move(canvas.width()/2 -w/2, canvas.height()/2);
203 cont->show(); 203 cont->show();
204} 204}
205 205
206void SnakeGame::keyPressEvent(QKeyEvent* event) 206void SnakeGame::keyPressEvent(QKeyEvent* event)
207{ 207{
208 if (gamestopped) { 208 if (gamestopped) {
209 if (waitover) 209 if (waitover)
210 newGame(); 210 newGame();
211 else 211 else
212 return; 212 return;
213 } 213 }
214 else { 214 else {
215 int newkey = event->key(); 215 int newkey = event->key();
216 snake->go(newkey); 216 snake->go(newkey);
217 } 217 }
diff --git a/noncore/games/snake/main.cpp b/noncore/games/snake/main.cpp
index 44f742f..81eb9ee 100644
--- a/noncore/games/snake/main.cpp
+++ b/noncore/games/snake/main.cpp
@@ -1,28 +1,29 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "interface.h" 21#include "interface.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> ) 27OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> )
27 28
28 29
diff --git a/noncore/games/solitaire/main.cpp b/noncore/games/solitaire/main.cpp
index d4f6673..c8d4040 100644
--- a/noncore/games/solitaire/main.cpp
+++ b/noncore/games/solitaire/main.cpp
@@ -1,25 +1,26 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "canvascardwindow.h" 21#include "canvascardwindow.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25using namespace Opie::Core;
25OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file 26OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file
diff --git a/noncore/games/tetrix/main.cpp b/noncore/games/tetrix/main.cpp
index 147d13d..6194bbf 100644
--- a/noncore/games/tetrix/main.cpp
+++ b/noncore/games/tetrix/main.cpp
@@ -1,27 +1,28 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qtetrix.h" 21#include "qtetrix.h"
22 22
23 23
24#include <opie2/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<QTetrix> ) 27OPIE_EXPORT_APP( OApplicationFactory<QTetrix> )
27 28
diff --git a/noncore/games/tictac/main.cpp b/noncore/games/tictac/main.cpp
index b8193f7..f3df375 100644
--- a/noncore/games/tictac/main.cpp
+++ b/noncore/games/tictac/main.cpp
@@ -1,13 +1,14 @@
1/**************************************************************************** 1/****************************************************************************
2** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 2** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of an example program for Qt. This example 4** This file is part of an example program for Qt. This example
5** program may be used, distributed and modified without limitation. 5** program may be used, distributed and modified without limitation.
6** 6**
7*****************************************************************************/ 7*****************************************************************************/
8 8
9#include "tictac.h" 9#include "tictac.h"
10 10
11#include <opie2/oapplicationfactory.h> 11#include <opie2/oapplicationfactory.h>
12 12
13using namespace Opie::Core;
13OPIE_EXPORT_APP( OApplicationFactory<TicTacToe> ) 14OPIE_EXPORT_APP( OApplicationFactory<TicTacToe> )
diff --git a/noncore/games/wordgame/main.cpp b/noncore/games/wordgame/main.cpp
index 7fd5f50..c388775 100644
--- a/noncore/games/wordgame/main.cpp
+++ b/noncore/games/wordgame/main.cpp
@@ -1,27 +1,28 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "wordgame.h" 21#include "wordgame.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<WordGame> ) 27OPIE_EXPORT_APP( OApplicationFactory<WordGame> )
27 28
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index 43a54f8..a80bd35 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -1,228 +1,228 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21 21
22#include "wordgame.h" 22#include "wordgame.h"
23 23
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28#include <qapplication.h> 28#include <qapplication.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qpe/qpetoolbar.h> 36#include <qtoolbar.h>
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qvbox.h> 38#include <qvbox.h>
39#include <qwidgetstack.h> 39#include <qwidgetstack.h>
40#include <qlayout.h> 40#include <qlayout.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43#include <unistd.h> 43#include <unistd.h>
44#include <pwd.h> 44#include <pwd.h>
45#include <sys/types.h> 45#include <sys/types.h>
46 46
47enum RuleEffects { 47enum RuleEffects {
48 Multiplier=15, 48 Multiplier=15,
49 MultiplyAll=64, 49 MultiplyAll=64,
50 Start=128 50 Start=128
51}; 51};
52 52
53static int tile_smallw = 16; 53static int tile_smallw = 16;
54static int tile_smallh = 16; 54static int tile_smallh = 16;
55static int tile_bigw = 22; 55static int tile_bigw = 22;
56static int tile_bigh = 22; 56static int tile_bigh = 22;
57static int tile_stweak = -2; 57static int tile_stweak = -2;
58static int tile_btweak = -1; 58static int tile_btweak = -1;
59 59
60static const int rack_tiles=7; 60static const int rack_tiles=7;
61 61
62const char* sampleWGR= 62const char* sampleWGR=
63 "wordgame_shapes\n" 63 "wordgame_shapes\n"
64 "15 15\n" 64 "15 15\n"
65 "400001040100004\n" 65 "400001040100004\n"
66 "030000000000030\n" 66 "030000000000030\n"
67 "002002000200200\n" 67 "002002000200200\n"
68 "000300020003000\n" 68 "000300020003000\n"
69 "000020000020000\n" 69 "000020000020000\n"
70 "102001000100201\n" 70 "102001000100201\n"
71 "000000202000000\n" 71 "000000202000000\n"
72 "400200050002004\n" 72 "400200050002004\n"
73 "000000202000000\n" 73 "000000202000000\n"
74 "102001000100201\n" 74 "102001000100201\n"
75 "000020000020000\n" 75 "000020000020000\n"
76 "000300020003000\n" 76 "000300020003000\n"
77 "002002000200200\n" 77 "002002000200200\n"
78 "030000000000030\n" 78 "030000000000030\n"
79 "400001040100004\n" 79 "400001040100004\n"
80 "1 2 3 66 67 194 100 0\n" 80 "1 2 3 66 67 194 100 0\n"
81 "1 j 8\n" 81 "1 j 8\n"
82 "1 q 7\n" 82 "1 q 7\n"
83 "1 x 6\n" 83 "1 x 6\n"
84 "1 z 6\n" 84 "1 z 6\n"
85 "1 w 4\n" 85 "1 w 4\n"
86 "1 k 4\n" 86 "1 k 4\n"
87 "1 v 3\n" 87 "1 v 3\n"
88 "1 f 3\n" 88 "1 f 3\n"
89 "2 y 3\n" 89 "2 y 3\n"
90 "2 h 2\n" 90 "2 h 2\n"
91 "2 b 2\n" 91 "2 b 2\n"
92 "2 m 2\n" 92 "2 m 2\n"
93 "3 p 2\n" 93 "3 p 2\n"
94 "3 g 2\n" 94 "3 g 2\n"
95 "3 u 2\n" 95 "3 u 2\n"
96 "4 d 2\n" 96 "4 d 2\n"
97 "4 c 2\n" 97 "4 c 2\n"
98 "5 l 1\n" 98 "5 l 1\n"
99 "5 o 1\n" 99 "5 o 1\n"
100 "7 t 1\n" 100 "7 t 1\n"
101 "7 n 1\n" 101 "7 n 1\n"
102 "7 a 1\n" 102 "7 a 1\n"
103 "7 r 1\n" 103 "7 r 1\n"
104 "8 s 1\n" 104 "8 s 1\n"
105 "8 i 1\n" 105 "8 i 1\n"
106 "11 e 1\n" 106 "11 e 1\n"
107 "0\n"; 107 "0\n";
108 108
109WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : 109WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) :
110 QMainWindow(parent, name, fl) 110 QMainWindow(parent, name, fl)
111{ 111{
112 if ( qApp->desktop()->width() < 240 ) { 112 if ( qApp->desktop()->width() < 240 ) {
113 tile_smallw = 10; 113 tile_smallw = 10;
114 tile_smallh = 10; 114 tile_smallh = 10;
115 tile_bigw = 16; 115 tile_bigw = 16;
116 tile_bigh = 16; 116 tile_bigh = 16;
117 tile_stweak = 0; 117 tile_stweak = 0;
118 tile_btweak = 0; 118 tile_btweak = 0;
119 } 119 }
120 120
121 setIcon( Resource::loadPixmap( "wordgame/WordGame.png" ) ); 121 setIcon( Resource::loadPixmap( "wordgame/WordGame.png" ) );
122 setCaption( tr("Word Game") ); 122 setCaption( tr("Word Game") );
123 123
124 setToolBarsMovable( FALSE ); 124 setToolBarsMovable( FALSE );
125 vbox = new QVBox(this); 125 vbox = new QVBox(this);
126 126
127 setCentralWidget(vbox); 127 setCentralWidget(vbox);
128 toolbar = new QToolBar(this); 128 toolbar = new QToolBar(this);
129 addToolBar(toolbar, Bottom); 129 addToolBar(toolbar, Bottom);
130 reset = new QToolButton(Resource::loadPixmap("back"), tr("Back"), "", this, SLOT(resetTurn()), toolbar); 130 reset = new QToolButton(Resource::loadPixmap("back"), tr("Back"), "", this, SLOT(resetTurn()), toolbar);
131 done = new QToolButton(Resource::loadPixmap("done"), tr("Done"), "", this, SLOT(endTurn()), toolbar); 131 done = new QToolButton(Resource::loadPixmap("done"), tr("Done"), "", this, SLOT(endTurn()), toolbar);
132 scoreinfo = new ScoreInfo(toolbar); 132 scoreinfo = new ScoreInfo(toolbar);
133 scoreinfo->setFont(QFont("Helvetica",10)); 133 scoreinfo->setFont(QFont("Helvetica",10));
134 new QToolButton(Resource::loadPixmap("finish"), tr("Close"), "", this, SLOT(endGame()), toolbar); 134 new QToolButton(Resource::loadPixmap("finish"), tr("Close"), "", this, SLOT(endGame()), toolbar);
135 toolbar->setStretchableWidget(scoreinfo); 135 toolbar->setStretchableWidget(scoreinfo);
136 136
137 cpu = 0; 137 cpu = 0;
138 board = 0; 138 board = 0;
139 bag = 0; 139 bag = 0;
140 racks = 0; 140 racks = 0;
141 141
142 aiheart = new QTimer(this); 142 aiheart = new QTimer(this);
143 connect(aiheart, SIGNAL(timeout()), this, SLOT(think())); 143 connect(aiheart, SIGNAL(timeout()), this, SLOT(think()));
144 144
145 readConfig(); 145 readConfig();
146} 146}
147 147
148WordGame::~WordGame() 148WordGame::~WordGame()
149{ 149{
150 writeConfig(); 150 writeConfig();
151} 151}
152 152
153void WordGame::writeConfig() 153void WordGame::writeConfig()
154{ 154{
155 Config cfg("WordGame"); 155 Config cfg("WordGame");
156 cfg.setGroup("Game"); 156 cfg.setGroup("Game");
157 cfg.writeEntry("NameList",namelist,';'); 157 cfg.writeEntry("NameList",namelist,';');
158 cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1); 158 cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1);
159 if ( !gameover ) { 159 if ( !gameover ) {
160 cfg.writeEntry("Rules",rules); 160 cfg.writeEntry("Rules",rules);
161 bag->writeConfig(cfg); 161 bag->writeConfig(cfg);
162 board->writeConfig(cfg); 162 board->writeConfig(cfg);
163 scoreinfo->writeConfig(cfg); 163 scoreinfo->writeConfig(cfg);
164 } 164 }
165 for (int p=0; p<nplayers; p++) { 165 for (int p=0; p<nplayers; p++) {
166 cfg.setGroup("Player"+QString::number(p+1)); 166 cfg.setGroup("Player"+QString::number(p+1));
167 if ( gameover ) cfg.clearGroup(); else rack(p)->writeConfig(cfg); 167 if ( gameover ) cfg.clearGroup(); else rack(p)->writeConfig(cfg);
168 } 168 }
169} 169}
170 170
171void WordGame::readConfig() 171void WordGame::readConfig()
172{ 172{
173 Config cfg("WordGame"); 173 Config cfg("WordGame");
174 cfg.setGroup("Game"); 174 cfg.setGroup("Game");
175 int currentplayer = cfg.readNumEntry("CurrentPlayer",0); 175 int currentplayer = cfg.readNumEntry("CurrentPlayer",0);
176 QStringList pnames = cfg.readListEntry("NameList",';'); 176 QStringList pnames = cfg.readListEntry("NameList",';');
177 if ( currentplayer ) { 177 if ( currentplayer ) {
178 gameover = FALSE; 178 gameover = FALSE;
179 rules = cfg.readEntry("Rules"); 179 rules = cfg.readEntry("Rules");
180 if ( rules.find("x-wordgamerules") >= 0 ) { 180 if ( rules.find("x-wordgamerules") >= 0 ) {
181 // rules files moved 181 // rules files moved
182 rules = "Sample.rules"; 182 rules = "Sample.rules";
183 } 183 }
184 if ( loadRules(rules) ) { 184 if ( loadRules(rules) ) {
185 startGame(pnames); 185 startGame(pnames);
186 bag->readConfig(cfg); 186 bag->readConfig(cfg);
187 board->readConfig(cfg); 187 board->readConfig(cfg);
188 scoreinfo->readConfig(cfg); 188 scoreinfo->readConfig(cfg);
189 for (int p=0; p<nplayers; p++) { 189 for (int p=0; p<nplayers; p++) {
190 cfg.setGroup("Player"+QString::number(p+1)); 190 cfg.setGroup("Player"+QString::number(p+1));
191 rack(p)->readConfig(cfg); 191 rack(p)->readConfig(cfg);
192 } 192 }
193 player=currentplayer-1; 193 player=currentplayer-1;
194 readyRack(player); 194 readyRack(player);
195 return; 195 return;
196 } 196 }
197 } 197 }
198 // fall-back 198 // fall-back
199 openGameSelector(pnames); 199 openGameSelector(pnames);
200} 200}
201 201
202void WordGame::openGameSelector(const QStringList& initnames) 202void WordGame::openGameSelector(const QStringList& initnames)
203{ 203{
204 toolbar->hide(); 204 toolbar->hide();
205 gameover = FALSE; 205 gameover = FALSE;
206 206
207 delete board; 207 delete board;
208 board = 0; 208 board = 0;
209 delete racks; 209 delete racks;
210 racks = 0; 210 racks = 0;
211 211
212 delete cpu; 212 delete cpu;
213 cpu = 0; 213 cpu = 0;
214 214
215 newgame = new NewGame(vbox); 215 newgame = new NewGame(vbox);
216 216
217 //Rules rules(this); 217 //Rules rules(this);
218 //connect(game.editrules, SIGNAL(clicked()), &rules, SLOT(editRules())); 218 //connect(game.editrules, SIGNAL(clicked()), &rules, SLOT(editRules()));
219 //connect(&rules, SIGNAL(rulesChanged()), &game, SLOT(updateRuleSets())); 219 //connect(&rules, SIGNAL(rulesChanged()), &game, SLOT(updateRuleSets()));
220 struct passwd* n = getpwuid(getuid()); 220 struct passwd* n = getpwuid(getuid());
221 QString playername = n ? n->pw_name : ""; 221 QString playername = n ? n->pw_name : "";
222 if ( playername.isEmpty() ) { 222 if ( playername.isEmpty() ) {
223 playername = "Player"; 223 playername = "Player";
224 } 224 }
225 newgame->player0->changeItem(playername,0); 225 newgame->player0->changeItem(playername,0);
226 newgame->player1->setCurrentItem(1); 226 newgame->player1->setCurrentItem(1);
227 newgame->updateRuleSets(); 227 newgame->updateRuleSets();
228 newgame->show(); 228 newgame->show();
diff --git a/noncore/games/zlines/main.cpp b/noncore/games/zlines/main.cpp
index d1709e4..8d80bae 100644
--- a/noncore/games/zlines/main.cpp
+++ b/noncore/games/zlines/main.cpp
@@ -1,28 +1,29 @@
1/*************************************************************************** 1/***************************************************************************
2 main.cpp - description 2 main.cpp - description
3 ------------------- 3 -------------------
4 begin : Fri May 19 2000 4 begin : Fri May 19 2000
5 copyright : (C) 2000 by Roman Merzlyakov 5 copyright : (C) 2000 by Roman Merzlyakov
6 email : roman@sbrf.barrt.ru 6 email : roman@sbrf.barrt.ru
7 copyright : (C) 2000 by Roman Razilov 7 copyright : (C) 2000 by Roman Razilov
8 email : Roman.Razilov@gmx.de 8 email : Roman.Razilov@gmx.de
9 ***************************************************************************/ 9 ***************************************************************************/
10 10
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 /* 19 /*
20 * Roman Razilov 2000-05-19 debug dummmy 20 * Roman Razilov 2000-05-19 debug dummmy
21 * Roman Razilov 2000-05-21 qimgio 21 * Roman Razilov 2000-05-21 qimgio
22*/ 22*/
23 23
24#include "klines.h" 24#include "klines.h"
25 25
26#include <opie2/oapplicationfactory.h> 26#include <opie2/oapplicationfactory.h>
27 27
28using namespace Opie::Core;
28OPIE_EXPORT_APP( OApplicationFactory<KLines> ) 29OPIE_EXPORT_APP( OApplicationFactory<KLines> )
diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp
index 3c58c93..4fab0f6 100644
--- a/noncore/games/zsame/ZSameWidget.cpp
+++ b/noncore/games/zsame/ZSameWidget.cpp
@@ -1,234 +1,235 @@
1/* Yo Emacs, this is -*- C++ -*- */ 1/* Yo Emacs, this is -*- C++ -*- */
2/* 2/*
3 * ksame 0.4 - simple Game 3 * ksame 0.4 - simple Game
4 * Copyright (C) 1997,1998 Marcus Kreutzberger 4 * Copyright (C) 1997,1998 Marcus Kreutzberger
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * 19 *
20 */ 20 */
21 21
22#include <stdio.h> 22#include <stdio.h>
23 23
24#include <opie2/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27 27
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qmenubar.h> 29#include <qmenubar.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qaction.h> 31#include <qaction.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33 33
34#include <kapplication.h> 34#include <kapplication.h>
35 35
36#include "ZSameWidget.h" 36#include "ZSameWidget.h"
37 37
38static int default_colors=3; 38static int default_colors=3;
39 39
40#define i18n tr 40#define i18n tr
41 41
42 42
43using namespace Opie::Core;
43OPIE_EXPORT_APP( OApplicationFactory<ZSameWidget> ) 44OPIE_EXPORT_APP( OApplicationFactory<ZSameWidget> )
44 45
45 46
46 47
47ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl ) 48ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl )
48 : QMainWindow( parent, name, fl ) 49 : QMainWindow( parent, name, fl )
49{ 50{
50 setCaption(tr("ZSame")); 51 setCaption(tr("ZSame"));
51 52
52 setToolBarsMovable( false ); 53 setToolBarsMovable( false );
53 QToolBar* con = new QToolBar( this ); 54 QToolBar* con = new QToolBar( this );
54 con->setHorizontalStretchable( true ); 55 con->setHorizontalStretchable( true );
55 QMenuBar* mb = new QMenuBar( con ); 56 QMenuBar* mb = new QMenuBar( con );
56 QToolBar* tb = new QToolBar( this ); 57 QToolBar* tb = new QToolBar( this );
57 58
58 QPopupMenu* fileMenu = new QPopupMenu( this ); 59 QPopupMenu* fileMenu = new QPopupMenu( this );
59 60
60 QAction* a = new QAction(tr("New Game"), Resource::loadIconSet("new") , 61 QAction* a = new QAction(tr("New Game"), Resource::loadIconSet("new") ,
61 QString::null, 0, this, "new_icon"); 62 QString::null, 0, this, "new_icon");
62 a->addTo( fileMenu ); 63 a->addTo( fileMenu );
63 a->addTo( tb ); 64 a->addTo( tb );
64 connect(a, SIGNAL(activated()), this, SLOT(m_new())); 65 connect(a, SIGNAL(activated()), this, SLOT(m_new()));
65 66
66 a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"), 67 a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"),
67 QString::null, 0, this, "restart_board" ); 68 QString::null, 0, this, "restart_board" );
68 a->addTo( fileMenu ); 69 a->addTo( fileMenu );
69 connect( a, SIGNAL(activated()), this, SLOT(m_restart())); 70 connect( a, SIGNAL(activated()), this, SLOT(m_restart()));
70 restart = a; 71 restart = a;
71 72
72 a = new QAction( tr("Undo"), Resource::loadIconSet("undo"), 73 a = new QAction( tr("Undo"), Resource::loadIconSet("undo"),
73 QString::null, 0, this, "undo_action" ); 74 QString::null, 0, this, "undo_action" );
74 a->addTo( fileMenu ); 75 a->addTo( fileMenu );
75 a->addTo( tb ); 76 a->addTo( tb );
76 connect( a, SIGNAL(activated()), this, SLOT(m_undo())); 77 connect( a, SIGNAL(activated()), this, SLOT(m_undo()));
77 78
78 a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"), 79 a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"),
79 QString::null, 0, this, "quit_action"); 80 QString::null, 0, this, "quit_action");
80 a->addTo( fileMenu ); 81 a->addTo( fileMenu );
81 a->addTo( tb ); 82 a->addTo( tb );
82 connect(a, SIGNAL(activated()), this, SLOT(m_quit())); 83 connect(a, SIGNAL(activated()), this, SLOT(m_quit()));
83 84
84 mb->insertItem(tr("Game" ), fileMenu ); 85 mb->insertItem(tr("Game" ), fileMenu );
85 86
86 int foo[2]; 87 int foo[2];
87 desktop_widget(foo); 88 desktop_widget(foo);
88 stone = new StoneWidget(this,foo[0],foo[1]); 89 stone = new StoneWidget(this,foo[0],foo[1]);
89 90
90 connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); 91 connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover()));
91 92
92 connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); 93 connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int)));
93 connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); 94 connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int)));
94 connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); 95 connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int)));
95 connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); 96 connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int)));
96 connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int))); 97 connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int)));
97 98
98 connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); 99 connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged()));
99 100
100 sizeChanged(); 101 sizeChanged();
101 setCentralWidget(stone); 102 setCentralWidget(stone);
102 103
103 104
104 setScore(0); 105 setScore(0);
105} 106}
106 107
107ZSameWidget::~ZSameWidget() { 108ZSameWidget::~ZSameWidget() {
108 109
109} 110}
110 111
111void ZSameWidget::readProperties(Config *conf) { 112void ZSameWidget::readProperties(Config *conf) {
112/* 113/*
113 Q_ASSERT(conf); 114 Q_ASSERT(conf);
114 stone->readProperties(conf); 115 stone->readProperties(conf);
115*/ 116*/
116} 117}
117 118
118void ZSameWidget::saveProperties(Config *conf) { 119void ZSameWidget::saveProperties(Config *conf) {
119/* 120/*
120 Q_ASSERT(conf); 121 Q_ASSERT(conf);
121 stone->saveProperties(conf); 122 stone->saveProperties(conf);
122 conf->sync(); 123 conf->sync();
123*/ 124*/
124} 125}
125 126
126void ZSameWidget::sizeChanged() { 127void ZSameWidget::sizeChanged() {
127 //stone->setFixedSize(stone->sizeHint()); 128 //stone->setFixedSize(stone->sizeHint());
128} 129}
129 130
130void ZSameWidget::newGame(unsigned int board,int colors) { 131void ZSameWidget::newGame(unsigned int board,int colors) {
131 while (board>=1000000) board-=1000000; 132 while (board>=1000000) board-=1000000;
132 // kdDebug() << "newgame board " << board << " colors " << colors << endl; 133 // kdDebug() << "newgame board " << board << " colors " << colors << endl;
133 stone->newGame(board,colors); 134 stone->newGame(board,colors);
134 setScore(0); 135 setScore(0);
135} 136}
136 137
137bool ZSameWidget::confirmAbort() { 138bool ZSameWidget::confirmAbort() {
138 return stone->isGameover() || 139 return stone->isGameover() ||
139 stone->isOriginalBoard() || 140 stone->isOriginalBoard() ||
140 (QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"), 141 (QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"),
141 QMessageBox::Yes, 142 QMessageBox::Yes,
142 QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes ); 143 QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes );
143} 144}
144 145
145void ZSameWidget::m_new() { 146void ZSameWidget::m_new() {
146 if (confirmAbort()) 147 if (confirmAbort())
147 newGame(_random(),default_colors); 148 newGame(_random(),default_colors);
148 149
149} 150}
150 151
151void ZSameWidget::m_restart() { 152void ZSameWidget::m_restart() {
152 if (confirmAbort()) 153 if (confirmAbort())
153 newGame(stone->board(),default_colors); 154 newGame(stone->board(),default_colors);
154} 155}
155 156
156void ZSameWidget::m_load() { 157void ZSameWidget::m_load() {
157// kdDebug() << "menu load not supported" << endl; 158// kdDebug() << "menu load not supported" << endl;
158} 159}
159 160
160void ZSameWidget::m_save() { 161void ZSameWidget::m_save() {
161// kdDebug() << "menu save not supported" << endl; 162// kdDebug() << "menu save not supported" << endl;
162} 163}
163 164
164void ZSameWidget::m_undo() { 165void ZSameWidget::m_undo() {
165 //Q_ASSERT(stone); 166 //Q_ASSERT(stone);
166 stone->undo(); 167 stone->undo();
167} 168}
168 169
169 170
170void ZSameWidget::m_showhs() { 171void ZSameWidget::m_showhs() {
171/* Q_ASSERT(stone); 172/* Q_ASSERT(stone);
172 stone->unmark(); 173 stone->unmark();
173 KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); 174 KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this);
174 d.addField(Board, i18n("Board"), "Board"); 175 d.addField(Board, i18n("Board"), "Board");
175 d.exec(); 176 d.exec();
176*/ 177*/
177} 178}
178 179
179void ZSameWidget::m_quit() { 180void ZSameWidget::m_quit() {
180// Q_ASSERT(stone); 181// Q_ASSERT(stone);
181 stone->unmark(); 182 stone->unmark();
182 qApp->quit(); 183 qApp->quit();
183// delete this; 184// delete this;
184} 185}
185 186
186void ZSameWidget::m_tglboard() { 187void ZSameWidget::m_tglboard() {
187 //kdDebug() << "toggled" << endl; 188 //kdDebug() << "toggled" << endl;
188} 189}
189 190
190 191
191void ZSameWidget::setColors(int colors) { 192void ZSameWidget::setColors(int colors) {
192 //status->changeItem(i18n("%1 Colors").arg(colors),1); 193 //status->changeItem(i18n("%1 Colors").arg(colors),1);
193} 194}
194 195
195void ZSameWidget::setBoard(int board) { 196void ZSameWidget::setBoard(int board) {
196 //status->changeItem(i18n("Board: %1").arg(board, 6), 2); 197 //status->changeItem(i18n("Board: %1").arg(board, 6), 2);
197} 198}
198 199
199void ZSameWidget::setMarked(int m) { 200void ZSameWidget::setMarked(int m) {
200// status->changeItem(i18n("Marked: %1").arg(m, 6),3); 201// status->changeItem(i18n("Marked: %1").arg(m, 6),3);
201} 202}
202 203
203void ZSameWidget::stonesRemoved(int,int) { 204void ZSameWidget::stonesRemoved(int,int) {
204 //KNotifyClient::event("stones removed", 205 //KNotifyClient::event("stones removed",
205 // i18n("%1 stones removed.").arg(stone->marked())); 206 // i18n("%1 stones removed.").arg(stone->marked()));
206} 207}
207 208
208void ZSameWidget::setScore(int score) { 209void ZSameWidget::setScore(int score) {
209// status->changeItem(i18n("Score: %1").arg(score, 6),4); 210// status->changeItem(i18n("Score: %1").arg(score, 6),4);
210// undo->setEnabled(stone->undoPossible()); 211// undo->setEnabled(stone->undoPossible());
211// restart->setEnabled(!stone->isOriginalBoard()); 212// restart->setEnabled(!stone->isOriginalBoard());
212} 213}
213 214
214void ZSameWidget::gameover() { 215void ZSameWidget::gameover() {
215// kdDebug() << "GameOver" << endl; 216// kdDebug() << "GameOver" << endl;
216 if (stone->hasBonus()) { 217 if (stone->hasBonus()) {
217 QMessageBox::information(this,i18n("Game won"), 218 QMessageBox::information(this,i18n("Game won"),
218 i18n("<qt>You even removed the last stone, great job! " 219 i18n("<qt>You even removed the last stone, great job! "
219 "This gave you a score of %1 in total.</qt>").arg(stone->score())); 220 "This gave you a score of %1 in total.</qt>").arg(stone->score()));
220 } else { 221 } else {
221 QMessageBox::information(this,i18n("Game over"), 222 QMessageBox::information(this,i18n("Game over"),
222 i18n("<qt>There are no more removeable stones. " 223 i18n("<qt>There are no more removeable stones. "
223 "You got a score of %1 in total.</qt>").arg(stone->score())); 224 "You got a score of %1 in total.</qt>").arg(stone->score()));
224 } 225 }
225 stone->unmark(); 226 stone->unmark();
226} 227}
227 228
228void ZSameWidget::desktop_widget(int *f)const{ 229void ZSameWidget::desktop_widget(int *f)const{
229 230
230 QWidget* wid = QApplication::desktop(); 231 QWidget* wid = QApplication::desktop();
231 /* width > height landscape mode */ 232 /* width > height landscape mode */
232 if ( wid->width() > wid->height() ) { 233 if ( wid->width() > wid->height() ) {
233 f[0]=15; 234 f[0]=15;
234 f[1]=9; 235 f[1]=9;