summaryrefslogtreecommitdiff
path: root/noncore/games
Unidiff
Diffstat (limited to 'noncore/games') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp2
-rw-r--r--noncore/games/fifteen/fifteen.cpp2
-rw-r--r--noncore/games/go/gowidget.cpp2
-rw-r--r--noncore/games/minesweep/minesweep.cpp2
-rw-r--r--noncore/games/solitaire/canvascardgame.h2
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 06523f1..755ed10 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -57,97 +57,97 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
57 conf.setGroup("general"); 57 conf.setGroup("general");
58 theme_name=conf.readEntry("theme","default"); 58 theme_name=conf.readEntry("theme","default");
59 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; 59 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
60 60
61 //the rules 61 //the rules
62 conf.setGroup("rules"); 62 conf.setGroup("rules");
63 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); 63 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
64 rules.generous_dice=conf.readBoolEntry("nice_dice",false); 64 rules.generous_dice=conf.readBoolEntry("nice_dice",false);
65 65
66 move->setRules(rules); 66 move->setRules(rules);
67 67
68 //get the AI settings 68 //get the AI settings
69 AISettings ai; 69 AISettings ai;
70 conf.setGroup("ai"); 70 conf.setGroup("ai");
71 ai.rescue=conf.readNumEntry("rescue",6); 71 ai.rescue=conf.readNumEntry("rescue",6);
72 ai.eliminate=conf.readNumEntry("eliminate",4); 72 ai.eliminate=conf.readNumEntry("eliminate",4);
73 ai.expose=conf.readNumEntry("expose",1); 73 ai.expose=conf.readNumEntry("expose",1);
74 ai.protect=conf.readNumEntry("protect",5); 74 ai.protect=conf.readNumEntry("protect",5);
75 ai.safe=conf.readNumEntry("safe",3); 75 ai.safe=conf.readNumEntry("safe",3);
76 ai.empty=conf.readNumEntry("empty",2); 76 ai.empty=conf.readNumEntry("empty",2);
77 move->setAISettings(ai); 77 move->setAISettings(ai);
78 78
79 79
80 //get the theme component names 80 //get the theme component names
81 Config theme(theme_file,Config::File); 81 Config theme(theme_file,Config::File);
82 if(!theme.isValid()) 82 if(!theme.isValid())
83 { 83 {
84 qDebug("theme file does not exist"); 84 qDebug("theme file does not exist");
85 theme.setGroup("theme"); 85 theme.setGroup("theme");
86 theme.writeEntry("board","casino_board_1"); 86 theme.writeEntry("board","casino_board_1");
87 theme.writeEntry("pieces1","casino_pieces_blue"); 87 theme.writeEntry("pieces1","casino_pieces_blue");
88 theme.writeEntry("pieces2","casino_pieces_white"); 88 theme.writeEntry("pieces2","casino_pieces_white");
89 theme.writeEntry("dice1","casino_dice"); 89 theme.writeEntry("dice1","casino_dice");
90 theme.writeEntry("dice2","casino_dice"); 90 theme.writeEntry("dice2","casino_dice");
91 theme.writeEntry("table","casino_table_green"); 91 theme.writeEntry("table","casino_table_green");
92 theme.writeEntry("odds","casino_odds"); 92 theme.writeEntry("odds","casino_odds");
93 } 93 }
94 theme.setGroup("theme"); 94 theme.setGroup("theme");
95 board_name=theme.readEntry("board","casino_board_1"); 95 board_name=theme.readEntry("board","casino_board_1");
96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); 97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
98 diceA_name=theme.readEntry("dice1","casino_dice"); 98 diceA_name=theme.readEntry("dice1","casino_dice");
99 diceB_name=theme.readEntry("dice2","casino_dice"); 99 diceB_name=theme.readEntry("dice2","casino_dice");
100 table_name=theme.readEntry("table","casino_table_green"); 100 table_name=theme.readEntry("table","casino_table_green");
101 odds_name=theme.readEntry("odds","casino_odds"); 101 odds_name=theme.readEntry("odds","casino_odds");
102 102
103 103
104 //the menu 104 //the menu
105 QPEMenuBar* menuBar = new QPEMenuBar(this); 105 QMenuBar* menuBar = new QMenuBar(this);
106 106
107 QPopupMenu* gamemenu= new QPopupMenu(this); 107 QPopupMenu* gamemenu= new QPopupMenu(this);
108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame())); 108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
109 gamemenu->insertSeparator(); 109 gamemenu->insertSeparator();
110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame())); 110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame())); 111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
112 gamemenu->insertSeparator(); 112 gamemenu->insertSeparator();
113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame())); 113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
114 menuBar->insertItem(tr( "Game" ),gamemenu); 114 menuBar->insertItem(tr( "Game" ),gamemenu);
115 115
116 QPopupMenu* thememenu= new QPopupMenu(this); 116 QPopupMenu* thememenu= new QPopupMenu(this);
117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme())); 117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
118 thememenu->insertSeparator(); 118 thememenu->insertSeparator();
119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme())); 119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme())); 120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
121 thememenu->insertSeparator(); 121 thememenu->insertSeparator();
122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault())); 122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme())); 123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
124 menuBar->insertItem(tr( "Theme" ),thememenu); 124 menuBar->insertItem(tr( "Theme" ),thememenu);
125 125
126 QPopupMenu* optionmenu=new QPopupMenu(this); 126 QPopupMenu* optionmenu=new QPopupMenu(this);
127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect())); 127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
128 optionmenu->insertSeparator(); 128 optionmenu->insertSeparator();
129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI())); 129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules())); 130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
131 menuBar->insertItem(tr( "Options"),optionmenu); 131 menuBar->insertItem(tr( "Options"),optionmenu);
132 132
133 QWidget* mainarea=new QWidget(this); 133 QWidget* mainarea=new QWidget(this);
134 setCentralWidget(mainarea); 134 setCentralWidget(mainarea);
135 //the main area 135 //the main area
136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); 136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
137 area=new QCanvas(235,235); 137 area=new QCanvas(235,235);
138 boardview=new BackGammonView(area,mainarea); 138 boardview=new BackGammonView(area,mainarea);
139 boardview->setMaximumHeight(240); 139 boardview->setMaximumHeight(240);
140 layout->addWidget(boardview); 140 layout->addWidget(boardview);
141 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); 141 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
142 //status bar 142 //status bar
143 message=new QLabel("<b>Backgammon</b>",mainarea); 143 message=new QLabel("<b>Backgammon</b>",mainarea);
144 message->setAlignment(AlignHCenter); 144 message->setAlignment(AlignHCenter);
145 layout->addWidget(message); 145 layout->addWidget(message);
146 146
147 //the marker 147 //the marker
148 marker_current=new QCanvasRectangle(area); 148 marker_current=new QCanvasRectangle(area);
149 marker_current->setBrush(QColor(0,0,255)); 149 marker_current->setBrush(QColor(0,0,255));
150 marker_current->setSize(15,5); 150 marker_current->setSize(15,5);
151 marker_current->setZ(1); 151 marker_current->setZ(1);
152 152
153 for(a=0;a<4;a++) 153 for(a=0;a<4;a++)
diff --git a/noncore/games/fifteen/fifteen.cpp b/noncore/games/fifteen/fifteen.cpp
index 293cd65..212f7b1 100644
--- a/noncore/games/fifteen/fifteen.cpp
+++ b/noncore/games/fifteen/fifteen.cpp
@@ -7,97 +7,97 @@
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 "fifteen.h" 21#include "fifteen.h"
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25 25
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qaction.h> 27#include <qaction.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qpe/qpetoolbar.h> 32#include <qpe/qpetoolbar.h>
33#include <qpe/qpemenubar.h> 33#include <qpe/qpemenubar.h>
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <qapplication.h> 35#include <qapplication.h>
36 36
37#include <stdlib.h> 37#include <stdlib.h>
38#include <time.h> 38#include <time.h>
39 39
40FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name) 40FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name)
41 : QMainWindow( parent, name ) 41 : QMainWindow( parent, name )
42{ 42{
43 // random seed 43 // random seed
44 srand(time(0)); 44 srand(time(0));
45 45
46 setToolBarsMovable( FALSE ); 46 setToolBarsMovable( FALSE );
47 QVBox *vbox = new QVBox( this ); 47 QVBox *vbox = new QVBox( this );
48 PiecesTable *table = new PiecesTable( vbox ); 48 PiecesTable *table = new PiecesTable( vbox );
49 setCentralWidget(vbox); 49 setCentralWidget(vbox);
50 50
51 QPEToolBar *toolbar = new QPEToolBar(this); 51 QPEToolBar *toolbar = new QPEToolBar(this);
52 toolbar->setHorizontalStretchable( TRUE ); 52 toolbar->setHorizontalStretchable( TRUE );
53 addToolBar(toolbar); 53 addToolBar(toolbar);
54 54
55 QPEMenuBar *menubar = new QPEMenuBar( toolbar ); 55 QMenuBar *menubar = new QMenuBar( toolbar );
56 menubar->setMargin(0); 56 menubar->setMargin(0);
57 57
58 QPopupMenu *game = new QPopupMenu( this ); 58 QPopupMenu *game = new QPopupMenu( this );
59 59
60 QWidget *spacer = new QWidget( toolbar ); 60 QWidget *spacer = new QWidget( toolbar );
61 spacer->setBackgroundMode( PaletteButton ); 61 spacer->setBackgroundMode( PaletteButton );
62 toolbar->setStretchableWidget( spacer ); 62 toolbar->setStretchableWidget( spacer );
63 63
64 QAction *a = new QAction( tr( "Randomize" ), Resource::loadPixmap( "new" ), 64 QAction *a = new QAction( tr( "Randomize" ), Resource::loadPixmap( "new" ),
65 QString::null, 0, this, 0 ); 65 QString::null, 0, this, 0 );
66 connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) ); 66 connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
67 a->addTo( game ); 67 a->addTo( game );
68 a->addTo( toolbar ); 68 a->addTo( toolbar );
69 69
70 a = new QAction( tr( "Solve" ), Resource::loadPixmap( "repeat" ), 70 a = new QAction( tr( "Solve" ), Resource::loadPixmap( "repeat" ),
71 QString::null, 0, this, 0 ); 71 QString::null, 0, this, 0 );
72 connect( a, SIGNAL( activated() ), table, SLOT( slotReset() ) ); 72 connect( a, SIGNAL( activated() ), table, SLOT( slotReset() ) );
73 a->addTo( game ); 73 a->addTo( game );
74 a->addTo( toolbar ); 74 a->addTo( toolbar );
75 75
76 menubar->insertItem( tr( "Game" ), game ); 76 menubar->insertItem( tr( "Game" ), game );
77} 77}
78 78
79PiecesTable::PiecesTable(QWidget* parent, const char* name ) 79PiecesTable::PiecesTable(QWidget* parent, const char* name )
80 : QTableView(parent, name), _menu(0), _randomized(false) 80 : QTableView(parent, name), _menu(0), _randomized(false)
81{ 81{
82 // setup table view 82 // setup table view
83 setFrameStyle(StyledPanel | Sunken); 83 setFrameStyle(StyledPanel | Sunken);
84 setBackgroundMode(NoBackground); 84 setBackgroundMode(NoBackground);
85 setMouseTracking(true); 85 setMouseTracking(true);
86 86
87 setNumRows(4); 87 setNumRows(4);
88 setNumCols(4); 88 setNumCols(4);
89 89
90 // init arrays 90 // init arrays
91 initMap(); 91 initMap();
92 readConfig(); 92 readConfig();
93 initColors(); 93 initColors();
94 94
95 // set font 95 // set font
96 QFont f = font(); 96 QFont f = font();
97 f.setPixelSize(18); 97 f.setPixelSize(18);
98 f.setBold( TRUE ); 98 f.setBold( TRUE );
99 setFont(f); 99 setFont(f);
100} 100}
101 101
102PiecesTable::~PiecesTable() 102PiecesTable::~PiecesTable()
103{ 103{
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index 1d38c9f..476f7ce1 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -17,97 +17,97 @@
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 <qpixmap.h> 27#include <qpixmap.h>
28#include <qpe/qpetoolbar.h> 28#include <qpe/qpetoolbar.h>
29#include <qpe/qpemenubar.h> 29#include <qpe/qpemenubar.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qaction.h> 31#include <qaction.h>
32#include <qapplication.h> //processEvents() 32#include <qapplication.h> //processEvents()
33#include <qlabel.h> 33#include <qlabel.h>
34 34
35//#include <stdio.h> 35//#include <stdio.h>
36 36
37#include "amigo.h" 37#include "amigo.h"
38#include "goplayutils.h" 38#include "goplayutils.h"
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
44static QBrush *goBrush; 44static QBrush *goBrush;
45//static QImage *newBlackStone; 45//static QImage *newBlackStone;
46//static QImage *blackStone; 46//static QImage *blackStone;
47//static QImage *whiteStone; 47//static QImage *whiteStone;
48static QPixmap *newBlackStone; 48static QPixmap *newBlackStone;
49static QPixmap *blackStone; 49static QPixmap *blackStone;
50static QPixmap *whiteStone; 50static QPixmap *whiteStone;
51 51
52static bool smallStones = FALSE; 52static 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 );
58 GoWidget *go = new GoWidget(this); 58 GoWidget *go = new GoWidget(this);
59 59
60 setCentralWidget(go); 60 setCentralWidget(go);
61 toolbar = new QPEToolBar(this); 61 toolbar = new QPEToolBar(this);
62 toolbar->setHorizontalStretchable( TRUE ); 62 toolbar->setHorizontalStretchable( TRUE );
63 addToolBar(toolbar); 63 addToolBar(toolbar);
64 64
65 QPEMenuBar *mb = new QPEMenuBar( toolbar ); 65 QMenuBar *mb = new QMenuBar( toolbar );
66 mb->setMargin(0); 66 mb->setMargin(0);
67 QPopupMenu *file = new QPopupMenu( this ); 67 QPopupMenu *file = new QPopupMenu( this );
68 68
69 QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 ); 69 QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 );
70 connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) ); 70 connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) );
71 a->addTo( file ); 71 a->addTo( file );
72 72
73 a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 ); 73 a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 );
74 connect( a, SIGNAL( activated() ), go, SLOT( pass() ) ); 74 connect( a, SIGNAL( activated() ), go, SLOT( pass() ) );
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() ) );
81 a->addTo( file ); 81 a->addTo( file );
82 82
83 a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 ); 83 a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 );
84 a->setToggleAction( TRUE ); 84 a->setToggleAction( TRUE );
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}
105 105
106void GoMainWidget::resizeEvent( QResizeEvent * ) 106void GoMainWidget::resizeEvent( QResizeEvent * )
107{ 107{
108 //### this won't work because of the text label... 108 //### this won't work because of the text label...
109 /* 109 /*
110 if ( width() > height() ) 110 if ( width() > height() )
111 moveToolBar( toolbar, Left ); 111 moveToolBar( toolbar, Left );
112 else 112 else
113 moveToolBar( toolbar, Top ); 113 moveToolBar( toolbar, Top );
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index c84fe53..814070b 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -201,97 +201,97 @@ void ResultIndicator::center()
201 pp.y() + w->height()/ 2 - s.height()/2 ); 201 pp.y() + w->height()/ 2 - s.height()/2 );
202 202
203 setGeometry( QRect(pp, s) ); 203 setGeometry( QRect(pp, s) );
204 204
205} 205}
206 206
207void ResultIndicator::timerEvent( QTimerEvent *te ) 207void ResultIndicator::timerEvent( QTimerEvent *te )
208{ 208{
209 if ( te->timerId() != timerId ) 209 if ( te->timerId() != timerId )
210 return; 210 return;
211 killTimer( timerId ); 211 killTimer( timerId );
212 if ( twoStage ) { 212 if ( twoStage ) {
213 center(); 213 center();
214 twoStage = FALSE; 214 twoStage = FALSE;
215 timerId = startTimer( 1000 ); 215 timerId = startTimer( 1000 );
216 } else { 216 } else {
217 delete this; 217 delete this;
218 } 218 }
219} 219}
220 220
221 221
222class MineFrame : public QFrame 222class MineFrame : public QFrame
223{ 223{
224public: 224public:
225 MineFrame( QWidget *parent, const char *name = 0 ) 225 MineFrame( QWidget *parent, const char *name = 0 )
226 :QFrame( parent, name ) {} 226 :QFrame( parent, name ) {}
227 void setField( MineField *f ) { field = f; } 227 void setField( MineField *f ) { field = f; }
228protected: 228protected:
229 void resizeEvent( QResizeEvent *e ) { 229 void resizeEvent( QResizeEvent *e ) {
230 field->setAvailableRect( contentsRect()); 230 field->setAvailableRect( contentsRect());
231 QFrame::resizeEvent(e); 231 QFrame::resizeEvent(e);
232 } 232 }
233private: 233private:
234 MineField *field; 234 MineField *field;
235}; 235};
236 236
237 237
238 238
239MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) 239MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
240: QMainWindow( parent, name, f ) 240: QMainWindow( parent, name, f )
241{ 241{
242 srand(::time(0)); 242 srand(::time(0));
243 setCaption( tr("Mine Hunt") ); 243 setCaption( tr("Mine Hunt") );
244 setIcon( Resource::loadPixmap( "minesweep_icon" ) ); 244 setIcon( Resource::loadPixmap( "minesweep_icon" ) );
245 245
246 QPEToolBar *toolBar = new QPEToolBar( this ); 246 QPEToolBar *toolBar = new QPEToolBar( this );
247 toolBar->setHorizontalStretchable( TRUE ); 247 toolBar->setHorizontalStretchable( TRUE );
248 248
249 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 249 QMenuBar *menuBar = new QMenuBar( toolBar );
250 250
251 QPopupMenu *gameMenu = new QPopupMenu( this ); 251 QPopupMenu *gameMenu = new QPopupMenu( this );
252 gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); 252 gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
253 gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); 253 gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) );
254 gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); 254 gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
255 255
256 menuBar->insertItem( tr("Game"), gameMenu ); 256 menuBar->insertItem( tr("Game"), gameMenu );
257 257
258 guessLCD = new QLCDNumber( toolBar ); 258 guessLCD = new QLCDNumber( toolBar );
259 toolBar->setStretchableWidget( guessLCD ); 259 toolBar->setStretchableWidget( guessLCD );
260 260
261 QPalette lcdPal( red ); 261 QPalette lcdPal( red );
262 lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); 262 lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() );
263 lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); 263 lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() );
264 264
265// guessLCD->setPalette( lcdPal ); 265// guessLCD->setPalette( lcdPal );
266 guessLCD->setSegmentStyle( QLCDNumber::Flat ); 266 guessLCD->setSegmentStyle( QLCDNumber::Flat );
267 guessLCD->setFrameStyle( QFrame::NoFrame ); 267 guessLCD->setFrameStyle( QFrame::NoFrame );
268 guessLCD->setNumDigits( 2 ); 268 guessLCD->setNumDigits( 2 );
269 guessLCD->setBackgroundMode( PaletteButton ); 269 guessLCD->setBackgroundMode( PaletteButton );
270 newGameButton = new QPushButton( toolBar ); 270 newGameButton = new QPushButton( toolBar );
271 newGameButton->setPixmap( QPixmap( pix_new ) ); 271 newGameButton->setPixmap( QPixmap( pix_new ) );
272 newGameButton->setFocusPolicy(QWidget::NoFocus); 272 newGameButton->setFocusPolicy(QWidget::NoFocus);
273 connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); 273 connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) );
274 274
275 timeLCD = new QLCDNumber( toolBar ); 275 timeLCD = new QLCDNumber( toolBar );
276// timeLCD->setPalette( lcdPal ); 276// timeLCD->setPalette( lcdPal );
277 timeLCD->setSegmentStyle( QLCDNumber::Flat ); 277 timeLCD->setSegmentStyle( QLCDNumber::Flat );
278 timeLCD->setFrameStyle( QFrame::NoFrame ); 278 timeLCD->setFrameStyle( QFrame::NoFrame );
279 timeLCD->setNumDigits( 5 ); // "mm:ss" 279 timeLCD->setNumDigits( 5 ); // "mm:ss"
280 timeLCD->setBackgroundMode( PaletteButton ); 280 timeLCD->setBackgroundMode( PaletteButton );
281 281
282 setToolBarsMovable ( FALSE ); 282 setToolBarsMovable ( FALSE );
283 283
284 addToolBar( toolBar ); 284 addToolBar( toolBar );
285 285
286 MineFrame *mainframe = new MineFrame( this ); 286 MineFrame *mainframe = new MineFrame( this );
287 mainframe->setFrameShape( QFrame::Box ); 287 mainframe->setFrameShape( QFrame::Box );
288 mainframe->setFrameShadow( QFrame::Raised ); 288 mainframe->setFrameShadow( QFrame::Raised );
289 289
290 mainframe->setLineWidth(2); 290 mainframe->setLineWidth(2);
291 291
292 field = new MineField( mainframe ); 292 field = new MineField( mainframe );
293 mainframe->setField( field ); 293 mainframe->setField( field );
294 QFont fnt = field->font(); 294 QFont fnt = field->font();
295 fnt.setBold( TRUE ); 295 fnt.setBold( TRUE );
296 field->setFont( QFont( fnt ) ); 296 field->setFont( QFont( fnt ) );
297 field->setFocus(); 297 field->setFocus();
diff --git a/noncore/games/solitaire/canvascardgame.h b/noncore/games/solitaire/canvascardgame.h
index d159de6..b93cfbf 100644
--- a/noncore/games/solitaire/canvascardgame.h
+++ b/noncore/games/solitaire/canvascardgame.h
@@ -1,79 +1,79 @@
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#ifndef CANVAS_CARD_GAME_H 20#ifndef CANVAS_CARD_GAME_H
21#define CANVAS_CARD_GAME_H 21#define CANVAS_CARD_GAME_H
22 22
23#include "cardgame.h" 23#include "cardgame.h"
24#include "canvasshapes.h" 24#include "canvasshapes.h"
25#include "canvascard.h" 25#include "canvascard.h"
26 26
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30#include <qmainwindow.h> 30#include <qmainwindow.h>
31#include <qpe/qpemenubar.h> 31#include <qmenubar.h>
32#include <qpainter.h> 32#include <qpainter.h>
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <time.h> 35#include <time.h>
36 36
37 37
38class CanvasCardPile; 38class CanvasCardPile;
39 39
40 40
41class CanvasCardGame : public QCanvasView, public CardGame 41class CanvasCardGame : public QCanvasView, public CardGame
42{ 42{
43public: 43public:
44 CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) : 44 CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) :
45 QCanvasView( &c, parent, name, f ), 45 QCanvasView( &c, parent, name, f ),
46 CardGame(0,numOfDecks), 46 CardGame(0,numOfDecks),
47 moved(FALSE), 47 moved(FALSE),
48 moving(NULL), 48 moving(NULL),
49 alphaCardPile( NULL ), 49 alphaCardPile( NULL ),
50 cardXOff(0), cardYOff(0), 50 cardXOff(0), cardYOff(0),
51 snapOn(snap), 51 snapOn(snap),
52 numberToDraw(1) { } 52 numberToDraw(1) { }
53 53
54 virtual ~CanvasCardGame(); 54 virtual ~CanvasCardGame();
55 55
56 virtual Card *newCard( eValue v, eSuit s, bool f ) { 56 virtual Card *newCard( eValue v, eSuit s, bool f ) {
57 return new CanvasCard( v, s, f, canvas() ); 57 return new CanvasCard( v, s, f, canvas() );
58 } 58 }
59 59
60 virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); } 60 virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); }
61 virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); } 61 virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); }
62 62
63 virtual void gameWon(); 63 virtual void gameWon();
64 virtual bool haveWeWon() { return FALSE; } 64 virtual bool haveWeWon() { return FALSE; }
65 65
66 virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; } 66 virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; }
67 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); } 67 virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
68 68
69 void cancelMoving() { moving = NULL; } 69 void cancelMoving() { moving = NULL; }
70 void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; } 70 void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; }
71 void toggleCardsDrawn() { numberToDraw = (numberToDraw == 1) ? 3 : 1; } 71 void toggleCardsDrawn() { numberToDraw = (numberToDraw == 1) ? 3 : 1; }
72 int cardsDrawn() { return numberToDraw; } 72 int cardsDrawn() { return numberToDraw; }
73 void setNumberToDraw(int numToDraw) { this->numberToDraw = numToDraw; } 73 void setNumberToDraw(int numToDraw) { this->numberToDraw = numToDraw; }
74 74
75 void readPile( Config& cfg, CardPile *pile, QString name, int& highestZ ); 75 void readPile( Config& cfg, CardPile *pile, QString name, int& highestZ );
76 76
77protected: 77protected:
78 void contentsMousePressEvent(QMouseEvent *e); 78 void contentsMousePressEvent(QMouseEvent *e);
79 void contentsMouseReleaseEvent(QMouseEvent *e); 79 void contentsMouseReleaseEvent(QMouseEvent *e);
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp
index 317a02d..dec5591 100644
--- a/noncore/games/solitaire/canvascardwindow.cpp
+++ b/noncore/games/solitaire/canvascardwindow.cpp
@@ -12,97 +12,97 @@
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#include "patiencecardgame.h" 22#include "patiencecardgame.h"
23#include "freecellcardgame.h" 23#include "freecellcardgame.h"
24#include "chicanecardgame.h" 24#include "chicanecardgame.h"
25#include "harpcardgame.h" 25#include "harpcardgame.h"
26#include "teeclubcardgame.h" 26#include "teeclubcardgame.h"
27 27
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29 29
30#include <qmainwindow.h> 30#include <qmainwindow.h>
31#include <qpopupmenu.h> 31#include <qpopupmenu.h>
32#include <qstyle.h> 32#include <qstyle.h>
33 33
34 34
35CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : 35CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
36 QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), 36 QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
37 cardGame(NULL) 37 cardGame(NULL)
38{ 38{
39 setIcon( Resource::loadPixmap( "cards" ) ); 39 setIcon( Resource::loadPixmap( "cards" ) );
40 40
41 // Create Playing Area for Games 41 // Create Playing Area for Games
42 if ( QPixmap::defaultDepth() < 12 ) { 42 if ( QPixmap::defaultDepth() < 12 ) {
43// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); 43// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
44// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); 44// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
45 canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); 45 canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
46 } else { 46 } else {
47 QPixmap bg; 47 QPixmap bg;
48 bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); 48 bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
49 canvas.setBackgroundPixmap(bg); 49 canvas.setBackgroundPixmap(bg);
50 } 50 }
51 51
52#if defined( QT_QWS_CASSIOPEIA ) 52#if defined( QT_QWS_CASSIOPEIA )
53 canvas.setAdvancePeriod(70); 53 canvas.setAdvancePeriod(70);
54#else 54#else
55 canvas.setAdvancePeriod(30); 55 canvas.setAdvancePeriod(30);
56#endif 56#endif
57 57
58 58
59#ifdef _PATIENCE_USE_ACCELS_ 59#ifdef _PATIENCE_USE_ACCELS_
60 QPEMenuBar* menu = menuBar(); 60 QMenuBar* menu = menuBar();
61 61
62 QPopupMenu* file = new QPopupMenu; 62 QPopupMenu* file = new QPopupMenu;
63 file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); 63 file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
64 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); 64 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
65 file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); 65 file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
66 file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); 66 file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
67 file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); 67 file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F);
68 menu->insertItem(tr("&Game"), file); 68 menu->insertItem(tr("&Game"), file);
69 69
70 menu->insertSeparator(); 70 menu->insertSeparator();
71 71
72 settings = new QPopupMenu; 72 settings = new QPopupMenu;
73 settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); 73 settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2);
74 snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); 74 snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3);
75 settings->setCheckable(TRUE); 75 settings->setCheckable(TRUE);
76 menu->insertItem(tr("&Settings"),settings); 76 menu->insertItem(tr("&Settings"),settings);
77 77
78 menu->insertSeparator(); 78 menu->insertSeparator();
79 79
80 QPopupMenu* help = new QPopupMenu; 80 QPopupMenu* help = new QPopupMenu;
81 help->insertItem(tr("&About"), this, SLOT(help()), Key_F1); 81 help->insertItem(tr("&About"), this, SLOT(help()), Key_F1);
82 help->setItemChecked(dbf_id, TRUE); 82 help->setItemChecked(dbf_id, TRUE);
83 menu->insertItem(tr("&Help"),help); 83 menu->insertItem(tr("&Help"),help);
84#else 84#else
85 QMenuBar* menu = menuBar(); 85 QMenuBar* menu = menuBar();
86 86
87 QPopupMenu* file = new QPopupMenu; 87 QPopupMenu* file = new QPopupMenu;
88 file->insertItem(tr("Patience"), this, SLOT(initPatience())); 88 file->insertItem(tr("Patience"), this, SLOT(initPatience()));
89 file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); 89 file->insertItem(tr("Freecell"), this, SLOT(initFreecell()));
90 file->insertItem(tr("Chicane"), this, SLOT(initChicane())); 90 file->insertItem(tr("Chicane"), this, SLOT(initChicane()));
91 file->insertItem(tr("Harp"), this, SLOT(initHarp())); 91 file->insertItem(tr("Harp"), this, SLOT(initHarp()));
92 file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); 92 file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()));
93 menu->insertItem(tr("Play"), file); 93 menu->insertItem(tr("Play"), file);
94 94
95 menu->insertSeparator(); 95 menu->insertSeparator();
96 96
97 settings = new QPopupMenu; 97 settings = new QPopupMenu;
98 settings->setCheckable(TRUE); 98 settings->setCheckable(TRUE);
99 settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks())); 99 settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks()));
100 snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle())); 100 snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle()));
101 QString m; 101 QString m;
102 102
103 drawId = settings->insertItem(tr("Turn one card"), this, SLOT(drawnToggle())); 103 drawId = settings->insertItem(tr("Turn one card"), this, SLOT(drawnToggle()));
104 menu->insertItem(tr("Settings"),settings); 104 menu->insertItem(tr("Settings"),settings);
105 settings->setCheckable(TRUE); 105 settings->setCheckable(TRUE);
106 106
107#endif 107#endif
108 108