-rw-r--r-- | noncore/decorations/flat/flat.cpp | 2 | ||||
-rw-r--r-- | noncore/games/bounce/game.cpp | 7 | ||||
-rw-r--r-- | noncore/games/kbill/Game.cc | 0 | ||||
-rw-r--r-- | noncore/games/kbill/Game.h | 2 | ||||
-rw-r--r-- | noncore/games/kbill/field.cpp | 0 | ||||
-rw-r--r-- | noncore/games/kbill/inputbox.cpp | 2 | ||||
-rw-r--r-- | noncore/games/kbill/kbill.h | 2 | ||||
-rw-r--r-- | noncore/games/zsame/ZSameWidget.cpp | 12 |
8 files changed, 15 insertions, 12 deletions
diff --git a/noncore/decorations/flat/flat.cpp b/noncore/decorations/flat/flat.cpp index a2f12be..9a670cc 100644 --- a/noncore/decorations/flat/flat.cpp +++ b/noncore/decorations/flat/flat.cpp | |||
@@ -265,49 +265,49 @@ void FlatDecoration::drawArea( Area a, QPainter *p, const WindowData *wd ) const | |||
265 | case Title: | 265 | case Title: |
266 | if ( r.height() < 2 ) { | 266 | if ( r.height() < 2 ) { |
267 | WindowDecorationInterface::drawArea( a, p, wd ); | 267 | WindowDecorationInterface::drawArea( a, p, wd ); |
268 | } else { | 268 | } else { |
269 | const QColorGroup &cg = wd->palette.active(); | 269 | const QColorGroup &cg = wd->palette.active(); |
270 | QColor c; | 270 | QColor c; |
271 | if ( wd->flags & WindowData::Active ) | 271 | if ( wd->flags & WindowData::Active ) |
272 | c = cg.color(QColorGroup::Highlight); | 272 | c = cg.color(QColorGroup::Highlight); |
273 | else | 273 | else |
274 | c = cg.color(QColorGroup::Background); | 274 | c = cg.color(QColorGroup::Background); |
275 | p->fillRect( QRect(r.x(),r.y()-th,r.width(),th), c ); | 275 | p->fillRect( QRect(r.x(),r.y()-th,r.width(),th), c ); |
276 | } | 276 | } |
277 | break; | 277 | break; |
278 | case TitleText: | 278 | case TitleText: |
279 | p->drawText( r.left()+3+metric(HelpWidth,wd), r.top()-th, | 279 | p->drawText( r.left()+3+metric(HelpWidth,wd), r.top()-th, |
280 | r.width()-metric(HelpWidth,wd)-metric(CloseWidth,wd), th, | 280 | r.width()-metric(HelpWidth,wd)-metric(CloseWidth,wd), th, |
281 | Qt::AlignVCenter, wd->caption ); | 281 | Qt::AlignVCenter, wd->caption ); |
282 | break; | 282 | break; |
283 | default: | 283 | default: |
284 | FlatDecoration::drawArea( a, p, wd ); | 284 | FlatDecoration::drawArea( a, p, wd ); |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int w, int h, QWSButton::State state ) const | 289 | void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const |
290 | { | 290 | { |
291 | QColor c; | 291 | QColor c; |
292 | const QColorGroup &cg = wd->palette.active(); | 292 | const QColorGroup &cg = wd->palette.active(); |
293 | if ( wd->flags & WindowDecorationInterface::WindowData::Active ) | 293 | if ( wd->flags & WindowDecorationInterface::WindowData::Active ) |
294 | c = cg.color(QColorGroup::HighlightedText); | 294 | c = cg.color(QColorGroup::HighlightedText); |
295 | else | 295 | else |
296 | c = cg.color(QColorGroup::Foreground); | 296 | c = cg.color(QColorGroup::Foreground); |
297 | bool r = (state & QWSButton::MouseOver) && (state & QWSButton::Clicked); | 297 | bool r = (state & QWSButton::MouseOver) && (state & QWSButton::Clicked); |
298 | int th = metric(TitleHeight, wd); | 298 | int th = metric(TitleHeight, wd); |
299 | 299 | ||
300 | QString key( "%1-%2-%3-%4" ); | 300 | QString key( "%1-%2-%3-%4" ); |
301 | key = key.arg(b).arg(th).arg(c.name()).arg(r ? "1" : "0"); | 301 | key = key.arg(b).arg(th).arg(c.name()).arg(r ? "1" : "0"); |
302 | QImage *img = buttonCache.find( key ); | 302 | QImage *img = buttonCache.find( key ); |
303 | if ( !img ) { | 303 | if ( !img ) { |
304 | QImage tmp; | 304 | QImage tmp; |
305 | switch ( b ) { | 305 | switch ( b ) { |
306 | case OK: | 306 | case OK: |
307 | tmp = QImage( ok_xpm ); | 307 | tmp = QImage( ok_xpm ); |
308 | break; | 308 | break; |
309 | case Close: | 309 | case Close: |
310 | tmp = QImage( close_xpm ); | 310 | tmp = QImage( close_xpm ); |
311 | break; | 311 | break; |
312 | case Help: | 312 | case Help: |
313 | tmp = QImage( help_xpm ); | 313 | tmp = QImage( help_xpm ); |
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp index bbd3d0b..5ef9f15 100644 --- a/noncore/games/bounce/game.cpp +++ b/noncore/games/bounce/game.cpp | |||
@@ -79,74 +79,74 @@ void Ball::update() | |||
79 | m_animDelay--; | 79 | m_animDelay--; |
80 | if ( m_animDelay<=0 ) | 80 | if ( m_animDelay<=0 ) |
81 | { | 81 | { |
82 | m_animDelay = MS2TICKS(BALL_ANIM_DELAY); | 82 | m_animDelay = MS2TICKS(BALL_ANIM_DELAY); |
83 | int frameNum = frame(); | 83 | int frameNum = frame(); |
84 | frameNum++; | 84 | frameNum++; |
85 | if ( frameNum>=frameCount() ) | 85 | if ( frameNum>=frameCount() ) |
86 | frameNum = 0; | 86 | frameNum = 0; |
87 | setFrame( frameNum ); | 87 | setFrame( frameNum ); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void Ball::advance(int stage) | 91 | void Ball::advance(int stage) |
92 | { | 92 | { |
93 | bool reflectX = false; | 93 | bool reflectX = false; |
94 | bool reflectY = false; | 94 | bool reflectY = false; |
95 | 95 | ||
96 | // check for collisions | 96 | // check for collisions |
97 | if ( collide(xVelocity(), 0) ) reflectX = true; | 97 | if ( collide(xVelocity(), 0) ) reflectX = true; |
98 | if ( collide(0, yVelocity()) ) reflectY = true; | 98 | if ( collide(0, yVelocity()) ) reflectY = true; |
99 | if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true; | 99 | if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true; |
100 | 100 | ||
101 | // emit collision | 101 | // emit collision |
102 | QRect r = boundingRect(); | 102 | QRect r = boundingRect(); |
103 | r.moveBy( xVelocity(), yVelocity() ); | 103 | r.moveBy( static_cast<int>(xVelocity()), static_cast<int>( yVelocity() ) ); |
104 | JezzField* field = (JezzField *)canvas(); | 104 | JezzField* field = (JezzField *)canvas(); |
105 | 105 | ||
106 | int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); | 106 | int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); |
107 | int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); | 107 | int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); |
108 | int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); | 108 | int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); |
109 | int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); | 109 | int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); |
110 | 110 | ||
111 | if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else | 111 | if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else |
112 | if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else | 112 | if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else |
113 | if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else | 113 | if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else |
114 | if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br ); | 114 | if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br ); |
115 | 115 | ||
116 | // apply reflection | 116 | // apply reflection |
117 | if ( reflectX ) setXVelocity( -xVelocity() ); | 117 | if ( reflectX ) setXVelocity( -xVelocity() ); |
118 | if ( reflectY ) setYVelocity( -yVelocity() ); | 118 | if ( reflectY ) setYVelocity( -yVelocity() ); |
119 | 119 | ||
120 | // update field | 120 | // update field |
121 | update(); | 121 | update(); |
122 | QCanvasSprite::advance( stage ); | 122 | QCanvasSprite::advance( stage ); |
123 | } | 123 | } |
124 | 124 | ||
125 | bool Ball::collide( double dx, double dy ) | 125 | bool Ball::collide( double dx, double dy ) |
126 | { | 126 | { |
127 | QRect r = boundingRect(); | 127 | QRect r = boundingRect(); |
128 | r.moveBy( dx, dy ); | 128 | r.moveBy( static_cast<int>( dx ), static_cast<int>( dy ) ); |
129 | JezzField* field = (JezzField *)canvas(); | 129 | JezzField* field = (JezzField *)canvas(); |
130 | 130 | ||
131 | int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); | 131 | int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE ); |
132 | int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); | 132 | int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE ); |
133 | int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); | 133 | int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE ); |
134 | int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); | 134 | int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE ); |
135 | 135 | ||
136 | return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE ); | 136 | return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE ); |
137 | } | 137 | } |
138 | 138 | ||
139 | /*************************************************************************/ | 139 | /*************************************************************************/ |
140 | 140 | ||
141 | Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, QObject *parent, const char *name ) | 141 | Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, QObject *parent, const char *name ) |
142 | : QObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ), | 142 | : QObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ), |
143 | m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true ) | 143 | m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true ) |
144 | { | 144 | { |
145 | // setup position and direction | 145 | // setup position and direction |
146 | m_dx = 0; | 146 | m_dx = 0; |
147 | m_dy = 0; | 147 | m_dy = 0; |
148 | switch ( m_dir ) | 148 | switch ( m_dir ) |
149 | { | 149 | { |
150 | case Up: m_dy = -1; break; | 150 | case Up: m_dy = -1; break; |
151 | case Down: m_dy = 1; break; | 151 | case Down: m_dy = 1; break; |
152 | case Left: m_dx = -1; break; | 152 | case Left: m_dx = -1; break; |
@@ -392,49 +392,50 @@ void JezzGame::display( QString text, int size ) | |||
392 | m_text->hide(); | 392 | m_text->hide(); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
396 | void JezzGame::start() | 396 | void JezzGame::start() |
397 | { | 397 | { |
398 | m_running = true; | 398 | m_running = true; |
399 | } | 399 | } |
400 | 400 | ||
401 | void JezzGame::stop() | 401 | void JezzGame::stop() |
402 | { | 402 | { |
403 | m_running = false; | 403 | m_running = false; |
404 | } | 404 | } |
405 | 405 | ||
406 | 406 | ||
407 | void JezzGame::makeBlack() | 407 | void JezzGame::makeBlack() |
408 | { | 408 | { |
409 | // copy current field into buffer | 409 | // copy current field into buffer |
410 | for ( int y=0; y<FIELD_HEIGHT; y++ ) | 410 | for ( int y=0; y<FIELD_HEIGHT; y++ ) |
411 | for ( int x=0; x<FIELD_WIDTH; x++ ) | 411 | for ( int x=0; x<FIELD_WIDTH; x++ ) |
412 | m_buf[x][y] = m_field->tile( x, y ); | 412 | m_buf[x][y] = m_field->tile( x, y ); |
413 | 413 | ||
414 | // fill areas that contains a ball | 414 | // fill areas that contains a ball |
415 | for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() ) | 415 | for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() ) |
416 | fill( ball->x()/TILE_SIZE, ball->y()/TILE_SIZE ); | 416 | fill( static_cast<int>( ball->x()/TILE_SIZE ), |
417 | static_cast<int>( ball->y()/TILE_SIZE ) ); | ||
417 | 418 | ||
418 | // areas still free can be blacked now | 419 | // areas still free can be blacked now |
419 | for ( int y=0; y<FIELD_HEIGHT; y++ ) | 420 | for ( int y=0; y<FIELD_HEIGHT; y++ ) |
420 | for ( int x=0; x<FIELD_WIDTH; x++ ) | 421 | for ( int x=0; x<FIELD_WIDTH; x++ ) |
421 | { | 422 | { |
422 | if ( m_buf[x][y]==TILE_FREE ) | 423 | if ( m_buf[x][y]==TILE_FREE ) |
423 | m_field->setGameTile( x, y, true ); | 424 | m_field->setGameTile( x, y, true ); |
424 | } | 425 | } |
425 | 426 | ||
426 | m_field->update(); | 427 | m_field->update(); |
427 | m_view->repaint(); | 428 | m_view->repaint(); |
428 | 429 | ||
429 | // count percent value of occupied area | 430 | // count percent value of occupied area |
430 | int p = percent(); | 431 | int p = percent(); |
431 | if ( p!=m_percent ) | 432 | if ( p!=m_percent ) |
432 | { | 433 | { |
433 | m_percent = p; | 434 | m_percent = p; |
434 | emit newPercent( m_percent ); | 435 | emit newPercent( m_percent ); |
435 | } | 436 | } |
436 | } | 437 | } |
437 | 438 | ||
438 | int JezzGame::percent() | 439 | int JezzGame::percent() |
439 | { | 440 | { |
440 | int notFree = 0; | 441 | int notFree = 0; |
diff --git a/noncore/games/kbill/Game.cc b/noncore/games/kbill/Game.cc index 624b50b..4cd5322 100644 --- a/noncore/games/kbill/Game.cc +++ b/noncore/games/kbill/Game.cc | |||
diff --git a/noncore/games/kbill/Game.h b/noncore/games/kbill/Game.h index 4473936..5c9c497 100644 --- a/noncore/games/kbill/Game.h +++ b/noncore/games/kbill/Game.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef GAME_H | 1 | #ifndef GAME_H |
2 | #define GAME_H | 2 | #define GAME_H |
3 | 3 | ||
4 | #include "objects.h" | 4 | #include "objects.h" |
5 | 5 | ||
6 | class Game { | 6 | class Game { |
7 | unsigned state; | 7 | int state; |
8 | int efficiency; | 8 | int efficiency; |
9 | public: | 9 | public: |
10 | unsigned score, level, iteration; | 10 | unsigned score, level, iteration; |
11 | Picture logo; | 11 | Picture logo; |
12 | int grabbed; | 12 | int grabbed; |
13 | 13 | ||
14 | static const unsigned short scrwidth = 240; | 14 | static const unsigned short scrwidth = 240; |
15 | static const unsigned short scrheight = 290; | 15 | static const unsigned short scrheight = 290; |
16 | 16 | ||
17 | static const int PLAYING = 1; | 17 | static const int PLAYING = 1; |
18 | static const int BETWEEN = 2; | 18 | static const int BETWEEN = 2; |
19 | static const int END = 3; | 19 | static const int END = 3; |
20 | static const int WAITING = 4; | 20 | static const int WAITING = 4; |
21 | 21 | ||
22 | static const int DEFAULTC = 0; /* cursors */ | 22 | static const int DEFAULTC = 0; /* cursors */ |
23 | static const int DOWNC = -1; | 23 | static const int DOWNC = -1; |
24 | static const int BUCKETC = -2; | 24 | static const int BUCKETC = -2; |
25 | 25 | ||
26 | static const int ENDGAME = 200; /* dialog window IDs */ | 26 | static const int ENDGAME = 200; /* dialog window IDs */ |
27 | static const int ENTERNAME = 201; | 27 | static const int ENTERNAME = 201; |
28 | static const int HIGHSCORE = 202; | 28 | static const int HIGHSCORE = 202; |
29 | static const int SCORE = 203; | 29 | static const int SCORE = 203; |
30 | 30 | ||
31 | static const int ENDLEVEL = -1; /* Codes for updating score */ | 31 | static const int ENDLEVEL = -1; /* Codes for updating score */ |
diff --git a/noncore/games/kbill/field.cpp b/noncore/games/kbill/field.cpp index a974ab2..0dd8d72 100644 --- a/noncore/games/kbill/field.cpp +++ b/noncore/games/kbill/field.cpp | |||
diff --git a/noncore/games/kbill/inputbox.cpp b/noncore/games/kbill/inputbox.cpp index 5087fbb..7aaebe7 100644 --- a/noncore/games/kbill/inputbox.cpp +++ b/noncore/games/kbill/inputbox.cpp | |||
@@ -1,43 +1,43 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | inputbox.cpp - description | 2 | inputbox.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Sat Jan 1 2000 | 4 | begin : Sat Jan 1 2000 |
5 | copyright : (C) 2000 by Jurrien Loonstra | 5 | copyright : (C) 2000 by Jurrien Loonstra |
6 | email : j.h.loonstra@st.hanze.nl | 6 | email : j.h.loonstra@st.hanze.nl |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "inputbox.h" | 18 | #include "inputbox.h" |
19 | InputBox::InputBox(QWidget *parent, const char *name, const char *caption, const char *text) : QDialog(parent, name, TRUE) { | 19 | InputBox::InputBox(QWidget *parent, const char *name, const char *, const char *) : QDialog(parent, name, TRUE) { |
20 | // setCaption(caption); | 20 | // setCaption(caption); |
21 | // | 21 | // |
22 | // question = new QLabel(this); | 22 | // question = new QLabel(this); |
23 | // question->setText(text); | 23 | // question->setText(text); |
24 | // question->setGeometry(10, 10, 240, 50); | 24 | // question->setGeometry(10, 10, 240, 50); |
25 | // | 25 | // |
26 | // input = new QLineEdit(this); | 26 | // input = new QLineEdit(this); |
27 | // input->setGeometry(10, 60, 240, 30); | 27 | // input->setGeometry(10, 60, 240, 30); |
28 | // input->setFocus(); | 28 | // input->setFocus(); |
29 | // input->setMaxLength(19); | 29 | // input->setMaxLength(19); |
30 | // | 30 | // |
31 | // ok = new QPushButton( "Ok", this ); | 31 | // ok = new QPushButton( "Ok", this ); |
32 | // ok->setGeometry(10, 100, 100,30 ); | 32 | // ok->setGeometry(10, 100, 100,30 ); |
33 | // ok->setDefault(TRUE); | 33 | // ok->setDefault(TRUE); |
34 | // connect( ok, SIGNAL(clicked()), SLOT(accept()) ); | 34 | // connect( ok, SIGNAL(clicked()), SLOT(accept()) ); |
35 | // | 35 | // |
36 | // cancel = new QPushButton( "Cancel", this ); | 36 | // cancel = new QPushButton( "Cancel", this ); |
37 | // cancel->setGeometry(150, 100, 100,30 ); | 37 | // cancel->setGeometry(150, 100, 100,30 ); |
38 | // connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); | 38 | // connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); |
39 | } | 39 | } |
40 | 40 | ||
41 | InputBox::~InputBox(){ | 41 | InputBox::~InputBox(){ |
42 | delete ok; | 42 | delete ok; |
43 | delete cancel; | 43 | delete cancel; |
diff --git a/noncore/games/kbill/kbill.h b/noncore/games/kbill/kbill.h index fbc0c6c..da1a111 100644 --- a/noncore/games/kbill/kbill.h +++ b/noncore/games/kbill/kbill.h | |||
@@ -17,38 +17,40 @@ | |||
17 | 17 | ||
18 | #ifndef KBILL_H | 18 | #ifndef KBILL_H |
19 | #define KBILL_H | 19 | #define KBILL_H |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
26 | 26 | ||
27 | #include "field.h" | 27 | #include "field.h" |
28 | 28 | ||
29 | class KBill : public QMainWindow | 29 | class KBill : public QMainWindow |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | public: | 32 | public: |
33 | KBill(); | 33 | KBill(); |
34 | ~KBill(); | 34 | ~KBill(); |
35 | Field* getField(); | 35 | Field* getField(); |
36 | private: | 36 | private: |
37 | QMenuBar *menu; | 37 | QMenuBar *menu; |
38 | QPopupMenu *file, *help; | 38 | QPopupMenu *file, *help; |
39 | Field *field; | 39 | Field *field; |
40 | int pauseid; | 40 | int pauseid; |
41 | |||
41 | protected slots: | 42 | protected slots: |
42 | void Quit(); | 43 | void Quit(); |
43 | void About(); | 44 | void About(); |
44 | void NewGame(); | 45 | void NewGame(); |
45 | void Pause(); | 46 | void Pause(); |
46 | void WarpTo(); | 47 | void WarpTo(); |
47 | void Story(); | 48 | void Story(); |
48 | void Rules(); | 49 | void Rules(); |
49 | void ViewHighScores(); | 50 | void ViewHighScores(); |
50 | 51 | ||
52 | protected: | ||
51 | friend class UI; | 53 | friend class UI; |
52 | }; | 54 | }; |
53 | 55 | ||
54 | #endif | 56 | #endif |
diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp index 4fab0f6..04ad825 100644 --- a/noncore/games/zsame/ZSameWidget.cpp +++ b/noncore/games/zsame/ZSameWidget.cpp | |||
@@ -88,56 +88,56 @@ ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl ) | |||
88 | desktop_widget(foo); | 88 | desktop_widget(foo); |
89 | stone = new StoneWidget(this,foo[0],foo[1]); | 89 | stone = new StoneWidget(this,foo[0],foo[1]); |
90 | 90 | ||
91 | connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); | 91 | connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); |
92 | 92 | ||
93 | connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); | 93 | connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); |
94 | connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); | 94 | connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); |
95 | connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); | 95 | connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); |
96 | connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); | 96 | connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); |
97 | 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))); |
98 | 98 | ||
99 | connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); | 99 | connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); |
100 | 100 | ||
101 | sizeChanged(); | 101 | sizeChanged(); |
102 | setCentralWidget(stone); | 102 | setCentralWidget(stone); |
103 | 103 | ||
104 | 104 | ||
105 | setScore(0); | 105 | setScore(0); |
106 | } | 106 | } |
107 | 107 | ||
108 | ZSameWidget::~ZSameWidget() { | 108 | ZSameWidget::~ZSameWidget() { |
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | void ZSameWidget::readProperties(Config *conf) { | 112 | void ZSameWidget::readProperties(Config *) { |
113 | /* | 113 | /* |
114 | Q_ASSERT(conf); | 114 | Q_ASSERT(conf); |
115 | stone->readProperties(conf); | 115 | stone->readProperties(conf); |
116 | */ | 116 | */ |
117 | } | 117 | } |
118 | 118 | ||
119 | void ZSameWidget::saveProperties(Config *conf) { | 119 | void ZSameWidget::saveProperties(Config *) { |
120 | /* | 120 | /* |
121 | Q_ASSERT(conf); | 121 | Q_ASSERT(conf); |
122 | stone->saveProperties(conf); | 122 | stone->saveProperties(conf); |
123 | conf->sync(); | 123 | conf->sync(); |
124 | */ | 124 | */ |
125 | } | 125 | } |
126 | 126 | ||
127 | void ZSameWidget::sizeChanged() { | 127 | void ZSameWidget::sizeChanged() { |
128 | //stone->setFixedSize(stone->sizeHint()); | 128 | //stone->setFixedSize(stone->sizeHint()); |
129 | } | 129 | } |
130 | 130 | ||
131 | void ZSameWidget::newGame(unsigned int board,int colors) { | 131 | void ZSameWidget::newGame(unsigned int board,int colors) { |
132 | while (board>=1000000) board-=1000000; | 132 | while (board>=1000000) board-=1000000; |
133 | // kdDebug() << "newgame board " << board << " colors " << colors << endl; | 133 | // kdDebug() << "newgame board " << board << " colors " << colors << endl; |
134 | stone->newGame(board,colors); | 134 | stone->newGame(board,colors); |
135 | setScore(0); | 135 | setScore(0); |
136 | } | 136 | } |
137 | 137 | ||
138 | bool ZSameWidget::confirmAbort() { | 138 | bool ZSameWidget::confirmAbort() { |
139 | return stone->isGameover() || | 139 | return stone->isGameover() || |
140 | stone->isOriginalBoard() || | 140 | stone->isOriginalBoard() || |
141 | (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>"), |
142 | QMessageBox::Yes, | 142 | QMessageBox::Yes, |
143 | QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes ); | 143 | QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes ); |
@@ -168,66 +168,66 @@ void ZSameWidget::m_undo() { | |||
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | void ZSameWidget::m_showhs() { | 171 | void ZSameWidget::m_showhs() { |
172 | /* Q_ASSERT(stone); | 172 | /* Q_ASSERT(stone); |
173 | stone->unmark(); | 173 | stone->unmark(); |
174 | KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); | 174 | KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); |
175 | d.addField(Board, i18n("Board"), "Board"); | 175 | d.addField(Board, i18n("Board"), "Board"); |
176 | d.exec(); | 176 | d.exec(); |
177 | */ | 177 | */ |
178 | } | 178 | } |
179 | 179 | ||
180 | void ZSameWidget::m_quit() { | 180 | void ZSameWidget::m_quit() { |
181 | // Q_ASSERT(stone); | 181 | // Q_ASSERT(stone); |
182 | stone->unmark(); | 182 | stone->unmark(); |
183 | qApp->quit(); | 183 | qApp->quit(); |
184 | // delete this; | 184 | // delete this; |
185 | } | 185 | } |
186 | 186 | ||
187 | void ZSameWidget::m_tglboard() { | 187 | void ZSameWidget::m_tglboard() { |
188 | //kdDebug() << "toggled" << endl; | 188 | //kdDebug() << "toggled" << endl; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | void ZSameWidget::setColors(int colors) { | 192 | void ZSameWidget::setColors(int ) { |
193 | //status->changeItem(i18n("%1 Colors").arg(colors),1); | 193 | //status->changeItem(i18n("%1 Colors").arg(colors),1); |
194 | } | 194 | } |
195 | 195 | ||
196 | void ZSameWidget::setBoard(int board) { | 196 | void ZSameWidget::setBoard(int ) { |
197 | //status->changeItem(i18n("Board: %1").arg(board, 6), 2); | 197 | //status->changeItem(i18n("Board: %1").arg(board, 6), 2); |
198 | } | 198 | } |
199 | 199 | ||
200 | void ZSameWidget::setMarked(int m) { | 200 | void ZSameWidget::setMarked(int ) { |
201 | // status->changeItem(i18n("Marked: %1").arg(m, 6),3); | 201 | // status->changeItem(i18n("Marked: %1").arg(m, 6),3); |
202 | } | 202 | } |
203 | 203 | ||
204 | void ZSameWidget::stonesRemoved(int,int) { | 204 | void ZSameWidget::stonesRemoved(int,int) { |
205 | //KNotifyClient::event("stones removed", | 205 | //KNotifyClient::event("stones removed", |
206 | // i18n("%1 stones removed.").arg(stone->marked())); | 206 | // i18n("%1 stones removed.").arg(stone->marked())); |
207 | } | 207 | } |
208 | 208 | ||
209 | void ZSameWidget::setScore(int score) { | 209 | void ZSameWidget::setScore(int ) { |
210 | // status->changeItem(i18n("Score: %1").arg(score, 6),4); | 210 | // status->changeItem(i18n("Score: %1").arg(score, 6),4); |
211 | // undo->setEnabled(stone->undoPossible()); | 211 | // undo->setEnabled(stone->undoPossible()); |
212 | // restart->setEnabled(!stone->isOriginalBoard()); | 212 | // restart->setEnabled(!stone->isOriginalBoard()); |
213 | } | 213 | } |
214 | 214 | ||
215 | void ZSameWidget::gameover() { | 215 | void ZSameWidget::gameover() { |
216 | // kdDebug() << "GameOver" << endl; | 216 | // kdDebug() << "GameOver" << endl; |
217 | if (stone->hasBonus()) { | 217 | if (stone->hasBonus()) { |
218 | QMessageBox::information(this,i18n("Game won"), | 218 | QMessageBox::information(this,i18n("Game won"), |
219 | i18n("<qt>You even removed the last stone, great job! " | 219 | i18n("<qt>You even removed the last stone, great job! " |
220 | "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())); |
221 | } else { | 221 | } else { |
222 | QMessageBox::information(this,i18n("Game over"), | 222 | QMessageBox::information(this,i18n("Game over"), |
223 | i18n("<qt>There are no more removeable stones. " | 223 | i18n("<qt>There are no more removeable stones. " |
224 | "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())); |
225 | } | 225 | } |
226 | stone->unmark(); | 226 | stone->unmark(); |
227 | } | 227 | } |
228 | 228 | ||
229 | void ZSameWidget::desktop_widget(int *f)const{ | 229 | void ZSameWidget::desktop_widget(int *f)const{ |
230 | 230 | ||
231 | QWidget* wid = QApplication::desktop(); | 231 | QWidget* wid = QApplication::desktop(); |
232 | /* width > height landscape mode */ | 232 | /* width > height landscape mode */ |
233 | if ( wid->width() > wid->height() ) { | 233 | if ( wid->width() > wid->height() ) { |