Diffstat (limited to 'noncore/games/solitaire/canvascardwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/solitaire/canvascardwindow.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp index e1c021e..450b4db 100644 --- a/noncore/games/solitaire/canvascardwindow.cpp +++ b/noncore/games/solitaire/canvascardwindow.cpp | |||
@@ -20,12 +20,13 @@ | |||
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 | 27 | ||
27 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
28 | 29 | ||
29 | #include <qmainwindow.h> | 30 | #include <qmainwindow.h> |
30 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
31 | #include <qstyle.h> | 32 | #include <qstyle.h> |
@@ -60,12 +61,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
60 | 61 | ||
61 | QPopupMenu* file = new QPopupMenu; | 62 | QPopupMenu* file = new QPopupMenu; |
62 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); | 63 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); |
63 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); | 64 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); |
64 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); | 65 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); |
65 | 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); | ||
66 | menu->insertItem(tr("&Game"), file); | 68 | menu->insertItem(tr("&Game"), file); |
67 | 69 | ||
68 | menu->insertSeparator(); | 70 | menu->insertSeparator(); |
69 | 71 | ||
70 | settings = new QPopupMenu; | 72 | settings = new QPopupMenu; |
71 | settings->insertItem(tr("&Change Card Backs"), this, SLOT(changeCardBacks()), Key_F2); | 73 | settings->insertItem(tr("&Change Card Backs"), this, SLOT(changeCardBacks()), Key_F2); |
@@ -84,12 +86,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
84 | 86 | ||
85 | QPopupMenu* file = new QPopupMenu; | 87 | QPopupMenu* file = new QPopupMenu; |
86 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); | 88 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); |
87 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); | 89 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); |
88 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); | 90 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); |
89 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); | 91 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); |
92 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); | ||
90 | menu->insertItem(tr("Play"), file); | 93 | menu->insertItem(tr("Play"), file); |
91 | 94 | ||
92 | menu->insertSeparator(); | 95 | menu->insertSeparator(); |
93 | 96 | ||
94 | settings = new QPopupMenu; | 97 | settings = new QPopupMenu; |
95 | settings->setCheckable(TRUE); | 98 | settings->setCheckable(TRUE); |
@@ -126,21 +129,26 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
126 | setCardBacks(); | 129 | setCardBacks(); |
127 | } else if ( gameType == 2 ) { | 130 | } else if ( gameType == 2 ) { |
128 | cardGame = new ChicaneCardGame( &canvas, snapOn, this ); | 131 | cardGame = new ChicaneCardGame( &canvas, snapOn, this ); |
129 | cardGame->setNumberToDraw(1); | 132 | cardGame->setNumberToDraw(1); |
130 | setCaption(tr("Chicane")); | 133 | setCaption(tr("Chicane")); |
131 | setCentralWidget(cardGame); | 134 | setCentralWidget(cardGame); |
132 | //cardGame->newGame(); // Until we know how to handle reading freecell config | ||
133 | cardGame->readConfig( cfg ); | 135 | cardGame->readConfig( cfg ); |
134 | setCardBacks(); | 136 | setCardBacks(); |
135 | } else if ( gameType == 3 ) { | 137 | } else if ( gameType == 3 ) { |
136 | cardGame = new HarpCardGame( &canvas, snapOn, this ); | 138 | cardGame = new HarpCardGame( &canvas, snapOn, this ); |
137 | cardGame->setNumberToDraw(1); | 139 | cardGame->setNumberToDraw(1); |
138 | setCaption(tr("Harp")); | 140 | setCaption(tr("Harp")); |
139 | setCentralWidget(cardGame); | 141 | setCentralWidget(cardGame); |
140 | //cardGame->newGame(); // Until we know how to handle reading freecell config | 142 | cardGame->readConfig( cfg ); |
143 | setCardBacks(); | ||
144 | } else if ( gameType == 4 ) { | ||
145 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); | ||
146 | cardGame->setNumberToDraw(1); | ||
147 | setCaption(tr("Teeclub")); | ||
148 | setCentralWidget(cardGame); | ||
141 | cardGame->readConfig( cfg ); | 149 | cardGame->readConfig( cfg ); |
142 | setCardBacks(); | 150 | setCardBacks(); |
143 | } else { | 151 | } else { |
144 | // Probably there isn't a config file or it is broken | 152 | // Probably there isn't a config file or it is broken |
145 | // Start a new game | 153 | // Start a new game |
146 | initPatience(); | 154 | initPatience(); |
@@ -231,12 +239,28 @@ void CanvasCardWindow::initHarp() | |||
231 | setCentralWidget(cardGame); | 239 | setCentralWidget(cardGame); |
232 | cardGame->newGame(); | 240 | cardGame->newGame(); |
233 | setCardBacks(); | 241 | setCardBacks(); |
234 | } | 242 | } |
235 | 243 | ||
236 | 244 | ||
245 | void CanvasCardWindow::initTeeclub() | ||
246 | { | ||
247 | // Create New Game | ||
248 | if ( cardGame ) { | ||
249 | delete cardGame; | ||
250 | } | ||
251 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); | ||
252 | cardGame->setNumberToDraw(1); | ||
253 | gameType = 4; | ||
254 | setCaption(tr("Teeclub")); | ||
255 | setCentralWidget(cardGame); | ||
256 | cardGame->newGame(); | ||
257 | setCardBacks(); | ||
258 | } | ||
259 | |||
260 | |||
237 | void CanvasCardWindow::snapToggle() | 261 | void CanvasCardWindow::snapToggle() |
238 | { | 262 | { |
239 | snapOn = !snapOn; | 263 | snapOn = !snapOn; |
240 | settings->setItemChecked(snap_id, snapOn); | 264 | settings->setItemChecked(snap_id, snapOn); |
241 | cardGame->toggleSnap(); | 265 | cardGame->toggleSnap(); |
242 | } | 266 | } |