summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/go/gowidget.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index 8567b30..1d38c9f 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -39,5 +39,5 @@
39 39
40static const enum bVal computer_color = BLACK; 40static const enum bVal computer_color = BLACK;
41 41
42static int current_handicap = 1; 42static int current_handicap = 1;
43 43
@@ -53,5 +53,5 @@ static bool smallStones = FALSE;
53 53
54GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : 54GoMainWidget::GoMainWidget( QWidget *parent, const char* name) :
55 QMainWindow( parent, name ) 55 QMainWindow( parent, name )
56{ 56{
57 setToolBarsMovable( FALSE ); 57 setToolBarsMovable( FALSE );
@@ -75,6 +75,6 @@ GoMainWidget::GoMainWidget( QWidget *parent, const char* name) :
75 a->addTo( file ); 75 a->addTo( file );
76 a->addTo( toolbar ); 76 a->addTo( toolbar );
77 77
78 78
79 a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 ); 79 a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 );
80 connect( a, SIGNAL( activated() ), go, SLOT( resign() ) ); 80 connect( a, SIGNAL( activated() ), go, SLOT( resign() ) );
@@ -85,20 +85,20 @@ GoMainWidget::GoMainWidget( QWidget *parent, const char* name) :
85 connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) ); 85 connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) );
86 a->addTo( file ); 86 a->addTo( file );
87 87
88 mb->insertItem( tr( "Game" ), file ); 88 mb->insertItem( tr( "Game" ), file );
89 89
90 QLabel *turnLabel = new QLabel( toolbar ); 90 QLabel *turnLabel = new QLabel( toolbar );
91 turnLabel->setBackgroundMode( PaletteButton ); 91 turnLabel->setBackgroundMode( PaletteButton );
92 connect( go, SIGNAL(showTurn(const QPixmap&)), 92 connect( go, SIGNAL(showTurn(const QPixmap&)),
93 turnLabel, SLOT(setPixmap(const QPixmap&)) ); 93 turnLabel, SLOT(setPixmap(const QPixmap&)) );
94 94
95 95
96 QLabel * scoreLabel = new QLabel( toolbar ); 96 QLabel * scoreLabel = new QLabel( toolbar );
97 scoreLabel->setBackgroundMode( PaletteButton ); 97 scoreLabel->setBackgroundMode( PaletteButton );
98 connect( go, SIGNAL(showScore(const QString&)), 98 connect( go, SIGNAL(showScore(const QString&)),
99 scoreLabel, SLOT(setText(const QString&)) ); 99 scoreLabel, SLOT(setText(const QString&)) );
100 100
101 toolbar->setStretchableWidget( scoreLabel ); 101 toolbar->setStretchableWidget( scoreLabel );
102 102
103 go->readConfig(); 103 go->readConfig();
104} 104}
@@ -118,5 +118,5 @@ GoWidget *GoWidget::self = 0;
118 118
119GoWidget::GoWidget( QWidget *parent, const char* name) : 119GoWidget::GoWidget( QWidget *parent, const char* name) :
120 QWidget( parent, name ) 120 QWidget( parent, name )
121{ 121{
122 if ( self ) 122 if ( self )
@@ -125,8 +125,8 @@ GoWidget::GoWidget( QWidget *parent, const char* name) :
125 twoplayer = FALSE; 125 twoplayer = FALSE;
126 126
127 127
128 d = bx = by = 1; 128 d = bx = by = 1;
129 129
130 QPixmap pix = Resource::loadPixmap( "pine" ); 130 QPixmap pix = Resource::loadPixmap( "go/pine" );
131 goBrush = new QBrush( black, pix ); 131 goBrush = new QBrush( black, pix );
132 /* 132 /*
@@ -205,5 +205,5 @@ void GoWidget::resizeEvent( QResizeEvent * )
205 whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) ); 205 whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) );
206 newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) ); 206 newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) );
207 207
208 smallStones = TRUE; 208 smallStones = TRUE;
209 } else if ( d >= 10 && smallStones ) { 209 } else if ( d >= 10 && smallStones ) {
@@ -239,5 +239,5 @@ void GoWidget::paintEvent( QPaintEvent *e )
239 239
240 int r = whiteStone->width()/2; 240 int r = whiteStone->width()/2;
241 241
242 QPainter p(this); 242 QPainter p(this);
243 p.fillRect( bx - d/2, by - d/2, 19*d, 19*d, *goBrush ); 243 p.fillRect( bx - d/2, by - d/2, 19*d, 19*d, *goBrush );
@@ -250,5 +250,5 @@ void GoWidget::paintEvent( QPaintEvent *e )
250 QColor pine( 255, 186, 89 ); 250 QColor pine( 255, 186, 89 );
251 p.setPen( pine.dark() ); 251 p.setPen( pine.dark() );
252 252
253 for ( i = xMin; i < xMax+1 ; i ++ ) { 253 for ( i = xMin; i < xMax+1 ; i ++ ) {
254 p.drawLine( bx+i*d, by, bx+i*d, by+18*d ); 254 p.drawLine( bx+i*d, by, bx+i*d, by+18*d );
@@ -263,9 +263,9 @@ void GoWidget::paintEvent( QPaintEvent *e )
263 for ( j = 3; j < yMax+1; j+=6 ) 263 for ( j = 3; j < yMax+1; j+=6 )
264 p.drawEllipse( bx+i*d-2, by+j*d-2, 5, 5 ); 264 p.drawEllipse( bx+i*d-2, by+j*d-2, 5, 5 );
265 265
266 266
267 for ( i = xMin; i < xMax+1; i++ ) 267 for ( i = xMin; i < xMax+1; i++ )
268 for ( j = yMin; j < yMax+1; j++ ) { 268 for ( j = yMin; j < yMax+1; j++ ) {
269 if ( board[i][j] == WHITE || 269 if ( board[i][j] == WHITE ||
270 currentPlayer==WHITE && newX == i && newY == j ) 270 currentPlayer==WHITE && newX == i && newY == j )
271 p.drawPixmap( bx+i*d - r, by+j*d - r, *whiteStone ); 271 p.drawPixmap( bx+i*d - r, by+j*d - r, *whiteStone );
@@ -395,5 +395,5 @@ void GoWidget::showStone( int x, int y, enum bVal c )
395 refresh(x,y); 395 refresh(x,y);
396 } 396 }
397 397
398} 398}
399 399
@@ -407,5 +407,5 @@ void GoWidget::mouseReleaseEvent( QMouseEvent * )
407void GoWidget::refresh( int x, int y ) 407void GoWidget::refresh( int x, int y )
408{ 408{
409 update( bx+d*x-d/2-1, by+d*y-d/2-1, d+2, d+2 ); 409 update( bx+d*x-d/2-1, by+d*y-d/2-1, d+2, d+2 );
410} 410}
411 411