summaryrefslogtreecommitdiff
path: root/noncore/games/tetrix/qtetrix.cpp
Unidiff
Diffstat (limited to 'noncore/games/tetrix/qtetrix.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/tetrix/qtetrix.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/noncore/games/tetrix/qtetrix.cpp b/noncore/games/tetrix/qtetrix.cpp
index f649894..6d29c3f 100644
--- a/noncore/games/tetrix/qtetrix.cpp
+++ b/noncore/games/tetrix/qtetrix.cpp
@@ -13,30 +13,33 @@
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 "qtetrix.h" 22#include "qtetrix.h"
23 23
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/config.h>
25 26
26#include <qapplication.h> 27#include <qapplication.h>
27#include <qlabel.h> 28#include <qlabel.h>
28#include <qdatetime.h> 29#include <qdatetime.h>
29#include <qlayout.h> 30#include <qlayout.h>
31#include <qstring.h>
30 32
33#include "ohighscoredlg.h"
31 34
32 35
33void drawTetrixButton( QPainter *p, int x, int y, int w, int h, 36void drawTetrixButton( QPainter *p, int x, int y, int w, int h,
34 const QColor *color ) 37 const QColor *color )
35{ 38{
36 QColor fc; 39 QColor fc;
37 if ( color ) { 40 if ( color ) {
38 QPointArray a; 41 QPointArray a;
39 a.setPoints( 3, x,y+h-1, x,y, x+w-1,y ); 42 a.setPoints( 3, x,y+h-1, x,y, x+w-1,y );
40 p->setPen( color->light() ); 43 p->setPen( color->light() );
41 p->drawPolyline( a ); 44 p->drawPolyline( a );
42 a.setPoints( 3, x+1,y+h-1, x+w-1,y+h-1, x+w-1,y+1 ); 45 a.setPoints( 3, x+1,y+h-1, x+w-1,y+h-1, x+w-1,y+1 );
@@ -152,19 +155,23 @@ QTetrix::QTetrix( QWidget *parent, const char *name, WFlags f )
152 connect( board, SIGNAL(updateRemovedSignal(int)), showLines, 155 connect( board, SIGNAL(updateRemovedSignal(int)), showLines,
153 SLOT(setNum(int))); 156 SLOT(setNum(int)));
154 157
155 showScore->setNum( 0 ); 158 showScore->setNum( 0 );
156 showLevel->setNum( 0 ); 159 showLevel->setNum( 0 );
157 showLines->setNum( 0 ); 160 showLines->setNum( 0 );
158 board->revealNextPiece(TRUE); 161 board->revealNextPiece(TRUE);
159 board->setFocusPolicy( StrongFocus ); 162 board->setFocusPolicy( StrongFocus );
160} 163}
161 164
162void QTetrix::gameOver() 165void QTetrix::gameOver()
163{ 166{
167 OHighscore *hs = new OHighscore( showScore->text().toInt() , showLevel->text().toInt() );
168 if ( hs->isNewhighscore )
169 hs->insertData( hs->getName(), showScore->text().toInt() , showLevel->text().toInt() );
170 OHighscoreDialog hscdlg( hs, this, "OHighscoreDialog", true );
171 hscdlg.exec();
164} 172}
165 173
166
167void QTetrix::quit() 174void QTetrix::quit()
168{ 175{
169 close(); 176 close();
170} 177}