author | mickeyl <mickeyl> | 2003-03-10 09:47:06 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-10 09:47:06 (UTC) |
commit | 4860161d8761e1b8fa4d1c30572b24f62fba6abe (patch) (unidiff) | |
tree | abe36a533b985446aa4d24e46706988b44f756e3 | |
parent | d060371ab634347a63960c7599212d9556eef7a0 (diff) | |
download | opie-4860161d8761e1b8fa4d1c30572b24f62fba6abe.zip opie-4860161d8761e1b8fa4d1c30572b24f62fba6abe.tar.gz opie-4860161d8761e1b8fa4d1c30572b24f62fba6abe.tar.bz2 |
move chess to unsupported
-rw-r--r-- | noncore/games/chess/.cvsignore | 5 | ||||
-rw-r--r-- | noncore/games/chess/boardview.cw | 23 | ||||
-rw-r--r-- | noncore/games/chess/chess.cpp | 360 | ||||
-rw-r--r-- | noncore/games/chess/chess.db | 2 | ||||
-rw-r--r-- | noncore/games/chess/chess.h | 128 | ||||
-rw-r--r-- | noncore/games/chess/chess.pro | 35 | ||||
-rw-r--r-- | noncore/games/chess/config.in | 4 | ||||
-rw-r--r-- | noncore/games/chess/main.cpp | 51 | ||||
-rw-r--r-- | noncore/games/chess/mainwindow.ui | 220 | ||||
-rw-r--r-- | noncore/games/chess/opie-chess.control | 9 | ||||
-rw-r--r-- | noncore/games/chess/pieces.png | bin | 5696 -> 0 bytes | |||
-rw-r--r-- | noncore/games/chess/simple-l.png | bin | 16143 -> 0 bytes | |||
-rw-r--r-- | packages | 2 |
13 files changed, 1 insertions, 838 deletions
diff --git a/noncore/games/chess/.cvsignore b/noncore/games/chess/.cvsignore deleted file mode 100644 index 2806415..0000000 --- a/noncore/games/chess/.cvsignore +++ b/dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | Makefile | ||
2 | Makefile.in | ||
3 | mainwindow.cpp | ||
4 | mainwindow.h | ||
5 | moc* | ||
diff --git a/noncore/games/chess/boardview.cw b/noncore/games/chess/boardview.cw deleted file mode 100644 index 020af96..0000000 --- a/noncore/games/chess/boardview.cw +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | <!DOCTYPE CW><CW> | ||
2 | <customwidgets> | ||
3 | <customwidget> | ||
4 | <class>BoardView</class> | ||
5 | <header location="global">/home/luke/depot/qpe/chess/chess.h</header> | ||
6 | <sizehint> | ||
7 | <width>-1</width> | ||
8 | <height>-1</height> | ||
9 | </sizehint> | ||
10 | <container>0</container> | ||
11 | <sizepolicy> | ||
12 | <hordata>5</hordata> | ||
13 | <verdata>5</verdata> | ||
14 | </sizepolicy> | ||
15 | <pixmap> | ||
16 | <data format="XPM.GZ" length="4605">789c6dd7d96ee33a1206e0fb7e8aa0ebae31a863c9966d613017d9e3ecce9e0ce6a228c94b6c67f192d83998771f9af517e10493b4daf89a25b258a428f75f7fb61e2ecfb6fefcf56b3697f9b0d82a0632ddfa532e2693d5bffff3afbf7ffd4ed3adf027d94a7fffe3d76ff7b9556c9dbfbe5401ef9bf8d8c464136f9b186ee27513cf9bd8dec47c13d30d74bfb52c3d28cdd322a9058fd6aee7f5a29e047f697bbd96b483573fe2173ffc82fbdbb87fb0762389fdcdd6ee859fe0716ccfd7e6def7fed8c5f1d5c5f77c58c2788959ea70230dfd3982dba9de7f6ff9693b757ee4dbb7f9a3fdf5473d7aea464dfb23fa3e3fdafe319f3d75a3a1edbc0fb7913f9991df8b19f7977081f1ae83c5da89cd8dd0bf34601bffceaced14facfd22c53f36db484f95570a9e3398ed6f1c27ec8c4e239877378d79c85bd4f477089f117d1219ee666c4d7d4cd04fddd98d1de5ebb995abc3ca863fb04467eb26746fc398c7ce5c0aced7c1dade3bfc2983f5766acf7be19f59f466b3d4b752bc1fd9a9f58ffd28311cf6d33f2b9323735ff17752bc17855b4f697c119f2cbcd884fe15cd757d6c711b5ea2dd48766708efd959871ffb319f53c86ad1e67d1fafc89ba9d60bcaf68edffca8ce7ab8033c4b7a2b57e3bc1ae95b7eac1db70091fa9db895a6e61ab472b3af4277730e6cb5d33e69bc3781e6865c6f31ce6d3f6f9b75c881738d3f5e2b119ed27708ef655b4aedf0d6cf5fc50e709f27d84510fb930e3f94a615bdf6bb3f627f7b0cd47f3f5f36d877a5103b67af6cddace23759e20fe00b6e77da016acb77370a6e71df5cc18bf1fadfb610c0bcef304ae6aeab619ef83f57b92f286e5c3cfd1a1de3c803378095bbd9bea98cf305af7430b16d47319adf53f34637daee00af9f7d52ed57c692f5acf7fbdbfc8f3bc113c834be43b35a37d185d84feeed482fd47e77086fdbf0b57d81f75b54b311f8ad6f95e9a319f1adc44fed3689ddf132c589f8e59e385a3b5fdcc8cf1bb30d697a2311eea53a07e1cce7b6948a2f52007676ad956bb14e7e53e6cebb382adff67339eb7a5dac6930f33ce87266cf5388dd6f50ccf83f87a8baed77bb4aed78edaa5c877085738ff3fcdd89f13b58d4f68b7f1e5d48cfd589a118ff10bd49b9ea235fe12aef0fc55669c6fe17c718d42701ececcfafea2118cfb3935e3bcf98cd6f18ecc785fbd99f1beabab4bab77c38cef2b613d5c5908ced357b8c2799aa9637c12ade32dcc787fedc04d7c1fb935e33c7b8cd6f509df578aac10acef02aef0bc76ccbade7caeb6fb656ec6fe1c98f1fc5ec2a82f9f9931bf5ab4e67b0263bf70d80f455956e8efc6acf9d185ba4a51bfb119e779789f97be7f9d1fbda9637b19adf73b33e21fe026ea7162c6f31ad6a7acaad4e9fe1fc1d6be1badf53b36a39e4fb0e5771f1dda257c7fa89a668a76657013b6f509eb5bf99f225bbb3b5fff32b1b0e3c25fffefb3d4288de78a7bdce7010ffdf5cca38dabef7fc73ce1177fcf6b8c77fcc6ef3cf56d6f3ce3392ff8833f79c92bfee26ddef1f1bbbcc785c6f3be8f3be0433ef2b11d3ee6133ee5333ee70bbee42e5ff135dff02ddff13d5388179fc5d4f7f4c08ffcc4354e38e53a3738f39f4d6e719b73ce898958d7a7c74312725450491537a9477d1ad0909e69e4e39b34a609bdf01dbdb2d6abf0fd3ff8e8377aa729cd684e8b704de8833e69e97f57f4e5fbdf8efd3fd30eed724a7bb44f733ff6fa3ae0aebf6be5a30f7d2f473ebe8378f1f1c77442a77416fb3ea70bba0c77f47c465dbaa2eb6ffddfd0adefddfabea37b7aa0477aa21a25beff25a5a17fcbff994a4ea88ebe1b9451d3d734a116b529f7d15df1cbefe71bfbe753ba145af72d224e7ca5f84c4aa9bc7b7edca5f4bfe72f03df3ea485f83b652463bf0a19d765e2df012febfcb9f53d7f79f5f16ff22e5399c95c16f2219f7ec512ffe9eb232bf9fa96ff48b67ddb8eecca9eef719fbb72208772b45ee175fda523c7dff2efcb899cfad57a973339478de672219721ba2b573fea3fe61db9f6792eb9292c37722b77d4926558dbaecfa62ff73eff4eec7fc2d7f2208f612dfde5ef3c44e493cfa523354924953af22fa5e1f7f7adaf9dff4f9d5fcb25aeae7468202d1fdd96dcb123ddcfe179d9f3fbef3a5c95131abbf54fc1fe0deb3771e9a32bd7e35e7cbefc4e757d377043f78c6be4af71f87be25edcab7b73ef6eaaf16eb67e92dddc2ddc87fbf4ff6e9f9ffe73e93f57eecb6dfb081ff7fbbffffcf53f54dd2532</data> | ||
17 | </pixmap> | ||
18 | <slot access="public">newGame()</slot> | ||
19 | <slot access="public">swapSides()</slot> | ||
20 | <slot access="public">setTheme(QString)</slot> | ||
21 | </customwidget> | ||
22 | </customwidgets> | ||
23 | </CW> | ||
diff --git a/noncore/games/chess/chess.cpp b/noncore/games/chess/chess.cpp deleted file mode 100644 index 29c96bb..0000000 --- a/noncore/games/chess/chess.cpp +++ b/dev/null | |||
@@ -1,360 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | |||
22 | // human is not offered a promotion yet | ||
23 | |||
24 | #include <stdlib.h> | ||
25 | |||
26 | #include <qcanvas.h> | ||
27 | #include <qmainwindow.h> | ||
28 | #include <qlist.h> | ||
29 | #include <qimage.h> | ||
30 | #include <qpainter.h> | ||
31 | #include <qmessagebox.h> | ||
32 | #include <qregexp.h> | ||
33 | |||
34 | #include <qpe/config.h> | ||
35 | #include <qpe/resource.h> | ||
36 | |||
37 | #include "chess.h" | ||
38 | |||
39 | #define CHESS_DEBUG | ||
40 | |||
41 | int pieceSize = 40; | ||
42 | static QVector < QImage > imgList; | ||
43 | int timeMoves, timeTime; | ||
44 | |||
45 | int BoardView::convertToRank(int r) | ||
46 | { | ||
47 | r = r / pieceSize; | ||
48 | if (humanSide == sideWhite) | ||
49 | r = 8 - r; | ||
50 | else | ||
51 | r++; | ||
52 | return r; | ||
53 | } | ||
54 | |||
55 | char BoardView::convertToFile(int f) | ||
56 | { | ||
57 | f = f / pieceSize; | ||
58 | if (humanSide == sideWhite) | ||
59 | return f + 'a'; | ||
60 | else | ||
61 | return 'h' - f; | ||
62 | } | ||
63 | |||
64 | int BoardView::convertFromFile(char f) | ||
65 | { | ||
66 | if (humanSide == sideWhite) | ||
67 | f = f - 'a'; | ||
68 | else | ||
69 | f = 'h' - f; | ||
70 | return f * pieceSize; | ||
71 | } | ||
72 | |||
73 | int BoardView::convertFromRank(int r) | ||
74 | { | ||
75 | if (humanSide == sideWhite) | ||
76 | r = 8 - r; | ||
77 | else | ||
78 | r--; | ||
79 | return r * pieceSize; | ||
80 | } | ||
81 | |||
82 | // Pieces | ||
83 | Piece::Piece(QCanvas * canvas, int t):QCanvasRectangle(canvas) | ||
84 | { | ||
85 | type = t; | ||
86 | setSize(pieceSize, pieceSize); | ||
87 | show(); | ||
88 | } | ||
89 | |||
90 | Piece *BoardView::newPiece(int t, char f, int r) | ||
91 | { | ||
92 | Piece *tmpPiece = new Piece(canvas(), t); | ||
93 | tmpPiece->move(convertFromFile(f), convertFromRank(r)); | ||
94 | list.append(tmpPiece); | ||
95 | return tmpPiece; | ||
96 | } | ||
97 | |||
98 | void BoardView::deletePiece(Piece * p) | ||
99 | { | ||
100 | list.remove(p); | ||
101 | canvas()->update(); | ||
102 | } | ||
103 | |||
104 | void Piece::drawShape(QPainter & p) | ||
105 | { | ||
106 | p.drawImage(int (x()), int (y()), *(imgList[type])); | ||
107 | } | ||
108 | |||
109 | void BoardView::buildImages(QImage theme) | ||
110 | { | ||
111 | imgList.resize(12); | ||
112 | int x; | ||
113 | int y = 0; | ||
114 | |||
115 | for (int j = 0; j < 2; j++) { | ||
116 | x = 0; | ||
117 | for (int i = 0; i < 6; i++) { | ||
118 | imgList.insert(i + (j * 6), | ||
119 | new QImage(theme. | ||
120 | copy(x, y, pieceSize, pieceSize))); | ||
121 | x += pieceSize; | ||
122 | } | ||
123 | y += pieceSize; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | void BoardView::readStdout() | ||
128 | { | ||
129 | QString input( crafty->readStdout() ); | ||
130 | #ifdef CHESS_DEBUG | ||
131 | qDebug("received this string from crafty->\n%s\n", input.latin1()); | ||
132 | #endif | ||
133 | |||
134 | int startPosition = input.find("setboard"); | ||
135 | if (startPosition != -1) | ||
136 | decodePosition(input.remove(0, startPosition + 9)); | ||
137 | |||
138 | if (input.contains("Black mates")) { | ||
139 | playingGame = FALSE; | ||
140 | emit(showMessage("Black mates")); | ||
141 | } else if (input.contains("White mates")) { | ||
142 | playingGame = FALSE; | ||
143 | emit(showMessage("White mates")); | ||
144 | } else if (input.contains(" resigns")) { | ||
145 | playingGame = FALSE; | ||
146 | emit(showMessage("Computer resigns")); | ||
147 | } else if (input.contains("Draw")) { | ||
148 | playingGame = FALSE; | ||
149 | emit(showMessage("Draw")); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | // this is pretty close to getting done right | ||
154 | // maybe dont use sprites and just draw a picture | ||
155 | // there'll be lots of drawing done anyway | ||
156 | // eg creating pictures for the webpages, | ||
157 | // and presenting options for promotions | ||
158 | void BoardView::decodePosition(const QString & t) | ||
159 | { | ||
160 | qDebug("decode copped %s \n", t.latin1()); | ||
161 | |||
162 | int count = 0; | ||
163 | int stringPos = 0; | ||
164 | for (int file = 0; file < 8; file++) { | ||
165 | for (int rank = 0; rank < 8; rank++) { | ||
166 | if (count) | ||
167 | count--; | ||
168 | else { | ||
169 | if (t.at(stringPos).isNumber()) | ||
170 | count = t.at(stringPos).digitValue(); | ||
171 | else { | ||
172 | newPiece(t.at(stringPos).latin1(), 'a' + file, | ||
173 | rank + 1); | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | void BoardView::undo() | ||
181 | { | ||
182 | crafty->writeToStdin("undo\n"); | ||
183 | crafty->writeToStdin("savepos\nclock\n"); | ||
184 | } | ||
185 | |||
186 | void BoardView::emitErrorMessage() | ||
187 | { | ||
188 | if (activeSide != humanSide) | ||
189 | emit(showMessage("Not your move")); | ||
190 | else | ||
191 | emit(showMessage("You are not playing a game")); | ||
192 | } | ||
193 | |||
194 | void BoardView::annotateGame() | ||
195 | { | ||
196 | crafty-> | ||
197 | writeToStdin | ||
198 | ("savegame game.save\nannotateh game.save bw 0 1.0 1\n"); | ||
199 | emit(showMessage("Annotating game")); | ||
200 | } | ||
201 | |||
202 | Piece *BoardView::findPiece(char f, int r) | ||
203 | { | ||
204 | QListIterator < Piece > it(list); | ||
205 | Piece *tmpPiece; | ||
206 | for (; it.current(); ++it) { | ||
207 | tmpPiece = it.current(); | ||
208 | if (convertToRank(tmpPiece->x()) == r | ||
209 | && convertToFile(tmpPiece->y()) == f) | ||
210 | return tmpPiece; | ||
211 | } | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | void BoardView::newGame() | ||
216 | { | ||
217 | activeSide = sideWhite; | ||
218 | emit(showMessage("New game")); | ||
219 | crafty->writeToStdin("new\n"); | ||
220 | crafty->writeToStdin("savepos\n"); | ||
221 | crafty->writeToStdin("time " + | ||
222 | QString::number(timeMoves) + | ||
223 | "/" + QString::number(timeTime) + "\n"); | ||
224 | activeSide = sideWhite; | ||
225 | if (humanSide == sideBlack) | ||
226 | crafty->writeToStdin("go\n"); | ||
227 | } | ||
228 | |||
229 | void BoardView::setTheme(QString filename) | ||
230 | { | ||
231 | QImage theme = Resource::loadImage(QString("chess/") + filename); | ||
232 | pieceSize = theme.height() / 2; | ||
233 | setFrameStyle(QFrame::Plain); | ||
234 | setFixedSize(8 * pieceSize, 8 * pieceSize); | ||
235 | canvas()->setBackgroundColor(Qt::red); | ||
236 | canvas()->resize(8 * pieceSize, 8 * pieceSize); | ||
237 | whiteSquare = theme.copy(6 * pieceSize, 0, pieceSize, pieceSize); | ||
238 | activeWhiteSquare = theme.copy(7 * pieceSize, 0, pieceSize, pieceSize); | ||
239 | blackSquare = | ||
240 | theme.copy(6 * pieceSize, pieceSize, pieceSize, pieceSize); | ||
241 | activeBlackSquare = | ||
242 | theme.copy(7 * pieceSize, pieceSize, pieceSize, pieceSize); | ||
243 | buildImages(theme); | ||
244 | drawBackgroundImage(QPoint(-1, -1)); | ||
245 | } | ||
246 | |||
247 | |||
248 | // sets the bg to the default background image for the current theme | ||
249 | // also resposible for drawing the "active" marker | ||
250 | void BoardView::drawBackgroundImage(QPoint activeSquare) | ||
251 | { | ||
252 | bg = QPixmap(8 * pieceSize, 8 * pieceSize); | ||
253 | QPainter p(&bg); | ||
254 | bool col = FALSE; | ||
255 | for (int i = 0; i < 8; i++) { | ||
256 | for (int j = 0; j < 8; j++) { | ||
257 | QPoint point(i * pieceSize, j * pieceSize); | ||
258 | if (col) { | ||
259 | if (point.x() == activeSquare.x() | ||
260 | && point.y() == activeSquare.y()) | ||
261 | p.drawImage(point, activeBlackSquare); | ||
262 | else | ||
263 | p.drawImage(point, blackSquare); | ||
264 | col = FALSE; | ||
265 | } else { | ||
266 | if (point.x() == activeSquare.x() | ||
267 | && point.y() == activeSquare.y()) | ||
268 | p.drawImage(point, activeWhiteSquare); | ||
269 | else | ||
270 | p.drawImage(point, whiteSquare); | ||
271 | col = TRUE; | ||
272 | } | ||
273 | } | ||
274 | col = !col; | ||
275 | } | ||
276 | canvas()->setBackgroundPixmap(bg); | ||
277 | canvas()->update(); | ||
278 | } | ||
279 | |||
280 | |||
281 | // Board view widget | ||
282 | void BoardView::contentsMousePressEvent(QMouseEvent * e) | ||
283 | { | ||
284 | QCanvasItemList cList = canvas()->collisions(e->pos()); | ||
285 | if (activeSide == humanSide && playingGame) { | ||
286 | if (!activePiece) { | ||
287 | if (cList.count()) { | ||
288 | activePiece = (Piece *) (*(cList.at(0))); | ||
289 | drawBackgroundImage(QPoint | ||
290 | (activePiece->x(), activePiece->y())); | ||
291 | } | ||
292 | } else { | ||
293 | if (!(activePiece == (Piece *) (*(cList.at(0))))) { | ||
294 | char fromFile = convertToFile(activePiece->x()); | ||
295 | int fromRank = convertToRank(activePiece->y()); | ||
296 | char toFile = convertToFile(e->pos().x()); | ||
297 | int toRank = convertToRank(e->pos().y()); | ||
298 | QString moveS; | ||
299 | moveS.append(fromFile); | ||
300 | moveS.append(moveS.number(fromRank)); | ||
301 | moveS.append(toFile); | ||
302 | moveS.append(moveS.number(toRank)); | ||
303 | if ((activePiece->type == wPawn | ||
304 | && fromRank == 7 && toRank == 8) | ||
305 | || (activePiece->type == bPawn | ||
306 | && fromRank == 2 && toRank == 1)) { | ||
307 | // offer a promotion | ||
308 | emit(showMessage | ||
309 | ("you are meant to be offered a promotion here")); | ||
310 | char promoteTo = wQueen;// doesnt matter for now | ||
311 | moveS.append(promoteTo); | ||
312 | moveS.append("\n"); | ||
313 | crafty->writeToStdin(moveS.latin1()); | ||
314 | } | ||
315 | } | ||
316 | activePiece = 0; | ||
317 | drawBackgroundImage(QPoint(-1, -1)); | ||
318 | } | ||
319 | } | ||
320 | |||
321 | else { | ||
322 | emitErrorMessage(); | ||
323 | } | ||
324 | } | ||
325 | |||
326 | void BoardView::swapSides() | ||
327 | { | ||
328 | if (activeSide == humanSide && playingGame) { | ||
329 | humanSide = !humanSide; | ||
330 | crafty->writeToStdin("savepos\ngo\n"); | ||
331 | } else | ||
332 | emitErrorMessage(); | ||
333 | } | ||
334 | |||
335 | BoardView::BoardView(QCanvas *c, QWidget *w, const char *name) | ||
336 | : QCanvasView(c, w, name) { | ||
337 | humanSide = sideWhite; | ||
338 | activeSide = sideWhite; | ||
339 | playingGame = TRUE; | ||
340 | activePiece = 0; | ||
341 | list.setAutoDelete(TRUE); | ||
342 | setCanvas(new QCanvas()); | ||
343 | Config conf("Chess", Config::User); | ||
344 | conf.setGroup("Theme"); | ||
345 | QString theme = conf.readEntry("imagefile", "simple-28"); | ||
346 | setTheme(theme); | ||
347 | crafty = new CraftyProcess(this); | ||
348 | crafty->addArgument("crafty"); | ||
349 | if (!crafty->start()) { | ||
350 | QMessageBox::critical(0, | ||
351 | tr("Could not find crafty chess engine"), | ||
352 | tr("Quit")); | ||
353 | exit(-1); | ||
354 | } | ||
355 | |||
356 | connect(crafty, SIGNAL(readyReadStdout()), this, SLOT(readStdout())); | ||
357 | connect(crafty, SIGNAL(processExited()), this, SLOT(craftyDied())); | ||
358 | // crafty->writeToStdin("xboard\nics\nkibitz=2\n"); | ||
359 | newGame(); | ||
360 | } | ||
diff --git a/noncore/games/chess/chess.db b/noncore/games/chess/chess.db deleted file mode 100644 index b520b30..0000000 --- a/noncore/games/chess/chess.db +++ b/dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | <!DOCTYPE DB><DB version="1.0"> | ||
2 | </DB> | ||
diff --git a/noncore/games/chess/chess.h b/noncore/games/chess/chess.h deleted file mode 100644 index 067b2f8..0000000 --- a/noncore/games/chess/chess.h +++ b/dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | ** $Id$ | ||
20 | ** | ||
21 | **********************************************************************/ | ||
22 | #ifndef CHESS_H | ||
23 | #define CHESS_H | ||
24 | |||
25 | #include <qwidget.h> | ||
26 | #include <qcanvas.h> | ||
27 | #include <qmainwindow.h> | ||
28 | #include <qpixmap.h> | ||
29 | #include <qimage.h> | ||
30 | #include <qstack.h> | ||
31 | #include <qvector.h> | ||
32 | #include <qpe/process.h> | ||
33 | |||
34 | #define wPawn 'P' | ||
35 | #definewKnight 'N' | ||
36 | #define wBishop 'B' | ||
37 | #define wRook 'R' | ||
38 | #define wQueen 'Q' | ||
39 | #define wKing 'K' | ||
40 | #define bPawn 'p' | ||
41 | #define bKnight 'n' | ||
42 | #define bBishop 'b' | ||
43 | #define bRook 'r' | ||
44 | #define bQueen 'q' | ||
45 | #define bKing 'k' | ||
46 | #define NONE N | ||
47 | |||
48 | #define sideWhite 0 | ||
49 | #define sideBlack 1 | ||
50 | |||
51 | |||
52 | class Piece:public QCanvasRectangle { | ||
53 | public: | ||
54 | Piece(QCanvas *, int); | ||
55 | ~Piece() { | ||
56 | }; | ||
57 | |||
58 | char type; | ||
59 | |||
60 | protected: | ||
61 | void drawShape(QPainter &); | ||
62 | }; | ||
63 | |||
64 | |||
65 | class CraftyProcess : public Process { | ||
66 | public: | ||
67 | CraftyProcess(QObject *parent) : Process( parent ) { qDebug("CraftyProcess functions not implemented"); } | ||
68 | ~CraftyProcess() { } | ||
69 | bool start() { qDebug("CraftyProcess functions not implemented"); return FALSE; } | ||
70 | const char *readStdout() { qDebug("CraftyProcess functions not implemented"); return "Blah"; } | ||
71 | void writeToStdin(const char *) { qDebug("CraftyProcess functions not implemented"); } | ||
72 | }; | ||
73 | |||
74 | |||
75 | class BoardView:public QCanvasView { | ||
76 | Q_OBJECT public: | ||
77 | BoardView(QCanvas *, QWidget *, const char *); | ||
78 | ~BoardView() { | ||
79 | }; | ||
80 | |||
81 | protected: | ||
82 | void contentsMousePressEvent(QMouseEvent *); | ||
83 | |||
84 | signals: | ||
85 | void showMessage(const QString &); | ||
86 | |||
87 | public slots:void readStdout(); | ||
88 | void craftyDied() { | ||
89 | qFatal("Crafty died unexpectedly\n"); | ||
90 | }; | ||
91 | void newGame(); | ||
92 | void setTheme(QString); | ||
93 | void swapSides(); | ||
94 | void undo(); | ||
95 | void annotateGame(); | ||
96 | |||
97 | private: | ||
98 | CraftyProcess * crafty; | ||
99 | QList < Piece > list; | ||
100 | Piece *activePiece; | ||
101 | |||
102 | void revertLastMove(); | ||
103 | void emitErrorMessage(); | ||
104 | void drawBackgroundImage(QPoint activeSquare); | ||
105 | |||
106 | void buildImages(QImage); | ||
107 | |||
108 | char convertToFile(int); | ||
109 | int convertToRank(int); | ||
110 | int convertFromFile(char); | ||
111 | int convertFromRank(int); | ||
112 | |||
113 | void decodePosition(const QString & t); | ||
114 | |||
115 | Piece *findPiece(char f, int r); | ||
116 | Piece *newPiece(int, char, int); | ||
117 | void deletePiece(Piece *); | ||
118 | |||
119 | int pieceSize; | ||
120 | QPixmap bg; | ||
121 | QImage whiteSquare, blackSquare, activeWhiteSquare, activeBlackSquare; | ||
122 | |||
123 | bool humanSide; | ||
124 | bool activeSide; | ||
125 | bool playingGame; | ||
126 | }; | ||
127 | |||
128 | #endif | ||
diff --git a/noncore/games/chess/chess.pro b/noncore/games/chess/chess.pro deleted file mode 100644 index 4c9604f..0000000 --- a/noncore/games/chess/chess.pro +++ b/dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | SOURCES+= chess.cpp main.cpp | ||
2 | HEADERS+= chess.h | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | TARGET = chess | ||
5 | DEPENDPATH+= $(OPIEDIR)/include | ||
6 | INTERFACES = mainwindow.ui | ||
7 | IMAGES= images/new.png images/repeat.png images/txt.png images/back.png | ||
8 | TEMPLATE=app | ||
9 | CONFIG+= qt warn_on release | ||
10 | INCLUDEPATH += $(OPIEDIR)/include | ||
11 | LIBS+= -lqpe | ||
12 | DBFILE= chess.db | ||
13 | LANGUAGE= C++ | ||
14 | CPP_ALWAYS_CREATE_SOURCE= TRUE | ||
15 | |||
16 | TRANSLATIONS = ../../../i18n/de/chess.ts \ | ||
17 | ../../../i18n/da/chess.ts \ | ||
18 | ../../../i18n/xx/chess.ts \ | ||
19 | ../../../i18n/en/chess.ts \ | ||
20 | ../../../i18n/es/chess.ts \ | ||
21 | ../../../i18n/fr/chess.ts \ | ||
22 | ../../../i18n/hu/chess.ts \ | ||
23 | ../../../i18n/ja/chess.ts \ | ||
24 | ../../../i18n/ko/chess.ts \ | ||
25 | ../../../i18n/no/chess.ts \ | ||
26 | ../../../i18n/pl/chess.ts \ | ||
27 | ../../../i18n/pt/chess.ts \ | ||
28 | ../../../i18n/pt_BR/chess.ts \ | ||
29 | ../../../i18n/sl/chess.ts \ | ||
30 | ../../../i18n/zh_CN/chess.ts \ | ||
31 | ../../../i18n/zh_TW/chess.ts | ||
32 | |||
33 | |||
34 | |||
35 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/games/chess/config.in b/noncore/games/chess/config.in deleted file mode 100644 index 6d49f3e..0000000 --- a/noncore/games/chess/config.in +++ b/dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | config CHESS | ||
2 | boolean "chess" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
diff --git a/noncore/games/chess/main.cpp b/noncore/games/chess/main.cpp deleted file mode 100644 index a56913f..0000000 --- a/noncore/games/chess/main.cpp +++ b/dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | ** $Id$ | ||
20 | ** | ||
21 | **********************************************************************/ | ||
22 | #include <qpe/qpeapplication.h> | ||
23 | #include <qpe/qpetoolbar.h> | ||
24 | #include <qmainwindow.h> | ||
25 | #include <qcanvas.h> | ||
26 | #include "chess.h" | ||
27 | |||
28 | |||
29 | class CanvasMainWindow : public QMainWindow { | ||
30 | public: | ||
31 | CanvasMainWindow(QWidget* parent=0, const char* name=0, WFlags f=0) | ||
32 | : QMainWindow(parent,name,f), canvas(232, 258) { | ||
33 | view = new BoardView(&canvas, this, 0); | ||
34 | setToolBarsMovable( FALSE ); | ||
35 | QPEToolBar* toolbar = new QPEToolBar(this); | ||
36 | toolbar->setHorizontalStretchable( TRUE ); | ||
37 | } | ||
38 | |||
39 | private: | ||
40 | QCanvas canvas; | ||
41 | BoardView *view; | ||
42 | }; | ||
43 | |||
44 | |||
45 | int main( int argc, char **argv ) { | ||
46 | QPEApplication a(argc,argv); | ||
47 | CanvasMainWindow *mw = new CanvasMainWindow(); | ||
48 | a.showMainWidget( mw ); | ||
49 | return a.exec(); | ||
50 | } | ||
51 | |||
diff --git a/noncore/games/chess/mainwindow.ui b/noncore/games/chess/mainwindow.ui deleted file mode 100644 index dc3ae0f..0000000 --- a/noncore/games/chess/mainwindow.ui +++ b/dev/null | |||
@@ -1,220 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI version="3.0" stdsetdef="1"> | ||
2 | <class>MainWindow</class> | ||
3 | <widget class="QMainWindow"> | ||
4 | <property name="name"> | ||
5 | <cstring>MainWindow</cstring> | ||
6 | </property> | ||
7 | <property name="geometry"> | ||
8 | <rect> | ||
9 | <x>0</x> | ||
10 | <y>0</y> | ||
11 | <width>256</width> | ||
12 | <height>338</height> | ||
13 | </rect> | ||
14 | </property> | ||
15 | <property name="caption"> | ||
16 | <string>Chess</string> | ||
17 | </property> | ||
18 | <widget class="QLabel"> | ||
19 | <property name="name"> | ||
20 | <cstring>TextLabel1</cstring> | ||
21 | </property> | ||
22 | <property name="geometry"> | ||
23 | <rect> | ||
24 | <x>10</x> | ||
25 | <y>236</y> | ||
26 | <width>221</width> | ||
27 | <height>31</height> | ||
28 | </rect> | ||
29 | </property> | ||
30 | <property name="text"> | ||
31 | <string>TextLabel1</string> | ||
32 | </property> | ||
33 | </widget> | ||
34 | <widget class="BoardView"> | ||
35 | <property name="name"> | ||
36 | <cstring>ChessBoard</cstring> | ||
37 | </property> | ||
38 | <property name="geometry"> | ||
39 | <rect> | ||
40 | <x>10</x> | ||
41 | <y>10</y> | ||
42 | <width>224</width> | ||
43 | <height>224</height> | ||
44 | </rect> | ||
45 | </property> | ||
46 | <property name="sizePolicy"> | ||
47 | <sizepolicy> | ||
48 | <hsizetype>1</hsizetype> | ||
49 | <vsizetype>1</vsizetype> | ||
50 | <horstretch>0</horstretch> | ||
51 | <verstretch>0</verstretch> | ||
52 | </sizepolicy> | ||
53 | </property> | ||
54 | <property name="minimumSize"> | ||
55 | <size> | ||
56 | <width>224</width> | ||
57 | <height>224</height> | ||
58 | </size> | ||
59 | </property> | ||
60 | </widget> | ||
61 | </widget> | ||
62 | <menubar> | ||
63 | <property name="name"> | ||
64 | <cstring>menubar</cstring> | ||
65 | </property> | ||
66 | <item text="Game" name="PopupMenu_2"> | ||
67 | <action name="newGame"/> | ||
68 | <action name="annotateGame"/> | ||
69 | </item> | ||
70 | <item text="Position" name="PopupMenu_3"> | ||
71 | <action name="swapSides"/> | ||
72 | <action name="undo"/> | ||
73 | </item> | ||
74 | </menubar> | ||
75 | <toolbars> | ||
76 | </toolbars> | ||
77 | <customwidgets> | ||
78 | <customwidget> | ||
79 | <class>BoardView</class> | ||
80 | <header location="global">/home/luke/depot/qpe/chess/chess.h</header> | ||
81 | <sizehint> | ||
82 | <width>-1</width> | ||
83 | <height>-1</height> | ||
84 | </sizehint> | ||
85 | <container>0</container> | ||
86 | <sizepolicy> | ||
87 | <hordata>5</hordata> | ||
88 | <verdata>5</verdata> | ||
89 | <horstretch>0</horstretch> | ||
90 | <verstretch>0</verstretch> | ||
91 | </sizepolicy> | ||
92 | <pixmap>image0</pixmap> | ||
93 | <signal>showMessage(const QString&)</signal> | ||
94 | <slot access="public" specifier="">newGame()</slot> | ||
95 | <slot access="public" specifier="">swapSides()</slot> | ||
96 | <slot access="public" specifier="">setTheme(QString)</slot> | ||
97 | <slot access="public" specifier="">undo()</slot> | ||
98 | <slot access="public" specifier="">annotateGame()</slot> | ||
99 | </customwidget> | ||
100 | </customwidgets> | ||
101 | <actions> | ||
102 | <actiongroup> | ||
103 | <property name="name"> | ||
104 | <cstring>gameActions</cstring> | ||
105 | </property> | ||
106 | <property name="text"> | ||
107 | <string>ActionGroup</string> | ||
108 | </property> | ||
109 | <property name="usesDropDown"> | ||
110 | <bool>false</bool> | ||
111 | </property> | ||
112 | <action> | ||
113 | <property name="name"> | ||
114 | <cstring>newGame</cstring> | ||
115 | </property> | ||
116 | <property name="iconSet"> | ||
117 | <iconset>new.png</iconset> | ||
118 | </property> | ||
119 | <property name="text"> | ||
120 | <string>New Game</string> | ||
121 | </property> | ||
122 | <property name="menuText"> | ||
123 | <string>New Game</string> | ||
124 | </property> | ||
125 | <property name="toolTip"> | ||
126 | <string>New Game</string> | ||
127 | </property> | ||
128 | </action> | ||
129 | <action> | ||
130 | <property name="name"> | ||
131 | <cstring>swapSides</cstring> | ||
132 | </property> | ||
133 | <property name="iconSet"> | ||
134 | <iconset>repeat.png</iconset> | ||
135 | </property> | ||
136 | <property name="text"> | ||
137 | <string>Swap sides</string> | ||
138 | </property> | ||
139 | <property name="toolTip"> | ||
140 | <string>Swap sides</string> | ||
141 | </property> | ||
142 | </action> | ||
143 | <action> | ||
144 | <property name="name"> | ||
145 | <cstring>annotateGame</cstring> | ||
146 | </property> | ||
147 | <property name="iconSet"> | ||
148 | <iconset>txt.png</iconset> | ||
149 | </property> | ||
150 | <property name="text"> | ||
151 | <string>Annotate game</string> | ||
152 | </property> | ||
153 | <property name="toolTip"> | ||
154 | <string>Annotate game</string> | ||
155 | </property> | ||
156 | </action> | ||
157 | <action> | ||
158 | <property name="name"> | ||
159 | <cstring>undo</cstring> | ||
160 | </property> | ||
161 | <property name="iconSet"> | ||
162 | <iconset>back.png</iconset> | ||
163 | </property> | ||
164 | <property name="text"> | ||
165 | <string>Undo move</string> | ||
166 | </property> | ||
167 | <property name="toolTip"> | ||
168 | <string>Undo move</string> | ||
169 | </property> | ||
170 | </action> | ||
171 | <action> | ||
172 | <property name="name"> | ||
173 | <cstring>saveGame</cstring> | ||
174 | </property> | ||
175 | <property name="text"> | ||
176 | <string>Action</string> | ||
177 | </property> | ||
178 | </action> | ||
179 | </actiongroup> | ||
180 | </actions> | ||
181 | <images> | ||
182 | <image name="image0"> | ||
183 | <data format="XPM.GZ" length="3456">789ce5d35d5313491406e07b7e458abea3b68e99cfccd4d65ee0079ac8a720a2d65ef474cf2424229004152dffbba7cf795941182a59bcd8aa6548524fbafb9d9ed3278fd63a47bb5b9db5472bb3b99d1fbb8e1bd96967cd5f9c9c5cbefffbaf6f2bab49dce1ff5eaf13affeb1b24aa6e33aa62b7f620fa7b01517ec423c850bb571b0c3f8bbe0a8db7591ae1fa9c3257e0aa7b0ac8f0ab6aeefc305bc073b783d38ee462ed6f5953a5ce20d38859f894b7629de820bb519c20ee3af829328764924be50275d7806a76a732c2ed9ba7e08176a33811d2cf548a3c4a59a97a9d3aedad4708af153b1655bf14bb880bfc00e3e0fcee2ac9be9f926629b65998eefc21e3e0acee3cce73affb33acfe037ff58e737629b97f026ece128b897e4be9788bfaa7b119cc319fc445cb12bf1215caa8d813d2cfd59243d5fe8faaeb82ab242d7d770097f803d2ce751a66554a6e28f70a636d24fa5633b191fc325fc1cf6f049b04d6d6435ef139cc16fc5ce5aabf3b7e11ade09ae525b573a7f5f5dc5f00bb1aff2ca8b07b0559b315c63fc20d86555ed32f15ced62f812ce61e95fe7d99a67610b3770ada65eb0e776f1bafe4c5cb36bf16bd8c245709dd7719d8b5371cddfc8b821d8aa290e6e78b4d1f9a5ba89e1c7e2a6b14d13bc37879b2bdf7f91b9fffadf65d8df90519123ffc08c9a1a1ad2a86d3ff767d0318d69421fe8843ed229a72c9d4167742ef79ed28ce69c7471f713b567d027beef675ea733bfd0257da5f5bb52da32e8313de18ca7f48c67add30657f539bde07df597c818d04bdae41a84593557654a5bb44d3bb44b7bbfeea53563c2ab467c1a61569f77123e5fd13e1d704a7533a535e3351dd21b3afa65dfeb9cf09677f86ec19a7679e64cea71f3daa788ebb45846cccf93dcaae1942bbb793be38e339ff2b34f28e5f7ab6f4e29e33a8c68f3f6dd5a320cdf29a7deb58c824aeeb31d434b64f48de1351b5736b6fd17d192e1a9321577d5cfe73e5c32c31ac79db16dfccf3e30f55219533e8b53634c73bd3bcc90e285332cf7f21177f51977d9f046775d2e9e6146fc8bbdabcab816c89872270f1e98e1f909c6b4c5cf7f71f5e2f7637e9fe9e742f5e8d3399feb3e0dcc9877744083f613693d174b23befbcc4ccc84b2f0fa1719d7d37c783d28a3b58affd18cef7faefc007d894af5</data> | ||
184 | </image> | ||
185 | </images> | ||
186 | <connections> | ||
187 | <connection> | ||
188 | <sender>newGame</sender> | ||
189 | <signal>activated()</signal> | ||
190 | <receiver>ChessBoard</receiver> | ||
191 | <slot>newGame()</slot> | ||
192 | </connection> | ||
193 | <connection> | ||
194 | <sender>swapSides</sender> | ||
195 | <signal>activated()</signal> | ||
196 | <receiver>ChessBoard</receiver> | ||
197 | <slot>swapSides()</slot> | ||
198 | </connection> | ||
199 | <connection> | ||
200 | <sender>annotateGame</sender> | ||
201 | <signal>activated()</signal> | ||
202 | <receiver>ChessBoard</receiver> | ||
203 | <slot>annotateGame()</slot> | ||
204 | </connection> | ||
205 | <connection> | ||
206 | <sender>undo</sender> | ||
207 | <signal>activated()</signal> | ||
208 | <receiver>ChessBoard</receiver> | ||
209 | <slot>undo()</slot> | ||
210 | </connection> | ||
211 | <connection> | ||
212 | <sender>ChessBoard</sender> | ||
213 | <signal>showMessage(const QString&)</signal> | ||
214 | <receiver>TextLabel1</receiver> | ||
215 | <slot>setText(const QString&)</slot> | ||
216 | </connection> | ||
217 | </connections> | ||
218 | <pixmapinproject/> | ||
219 | <layoutdefaults spacing="6" margin="11"/> | ||
220 | </UI> | ||
diff --git a/noncore/games/chess/opie-chess.control b/noncore/games/chess/opie-chess.control deleted file mode 100644 index e3fe203..0000000 --- a/noncore/games/chess/opie-chess.control +++ b/dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | Files: bin/chess apps/Games/chess.desktop pics/chess | ||
2 | Priority: optional | ||
3 | Section: opie/games | ||
4 | Maintainer: Luke Graham <luke@trolltech.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION | ||
7 | Depends: opie-base | ||
8 | Description: Crafty GUI | ||
9 | A GUI for the crafty chess engine | ||
diff --git a/noncore/games/chess/pieces.png b/noncore/games/chess/pieces.png deleted file mode 100644 index 4baeb4a..0000000 --- a/noncore/games/chess/pieces.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/noncore/games/chess/simple-l.png b/noncore/games/chess/simple-l.png deleted file mode 100644 index 908e2e1..0000000 --- a/noncore/games/chess/simple-l.png +++ b/dev/null | |||
Binary files differ | |||
@@ -3,5 +3,5 @@ CONFIG_BINARY noncore/tools/calc2/binary binary.pro | |||
3 | CONFIG_CALC2 noncore/tools/calc2calc2.pro | 3 | CONFIG_CALC2 noncore/tools/calc2calc2.pro |
4 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro | 4 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro |
5 | CONFIG_CHESS noncore/games/chesschess.pro | 5 | CONFIG_CHESS noncore/unsupported/chesschess.pro |
6 | CONFIG_CONVERTER noncore/unsupported/opiemail/converterconverter.pro | 6 | CONFIG_CONVERTER noncore/unsupported/opiemail/converterconverter.pro |
7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro | 7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro |