-rw-r--r-- | noncore/games/solitaire/canvascardwindow.cpp | 120 | ||||
-rw-r--r-- | noncore/games/solitaire/opie-solitaire.control | 2 |
2 files changed, 66 insertions, 56 deletions
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp index 450b4db..e836eb2 100644 --- a/noncore/games/solitaire/canvascardwindow.cpp +++ b/noncore/games/solitaire/canvascardwindow.cpp | |||
@@ -43,7 +43,7 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
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); |
@@ -104,2 +104,3 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
104 | menu->insertItem(tr("Settings"),settings); | 104 | menu->insertItem(tr("Settings"),settings); |
105 | settings->setCheckable(TRUE); | ||
105 | 106 | ||
@@ -113,43 +114,45 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
113 | settings->setItemChecked(snap_id, snapOn); | 114 | settings->setItemChecked(snap_id, snapOn); |
115 | |||
114 | gameType = cfg.readNumEntry( "GameType", -1 ); | 116 | gameType = cfg.readNumEntry( "GameType", -1 ); |
115 | drawThree = cfg.readBoolEntry( "DrawThree", TRUE); | 117 | drawThree = cfg.readBoolEntry( "DrawThree", FALSE); |
116 | if ( gameType == 0 ) { | 118 | if ( gameType == 0 ) { |
117 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 119 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
118 | cardGame->setNumberToDraw(drawThree ? 3 : 1); | 120 | cardGame->setNumberToDraw(drawThree ? 3 : 1); |
119 | setCaption(tr("Patience")); | 121 | |
120 | setCentralWidget(cardGame); | 122 | setCaption(tr("Patience")); |
121 | cardGame->readConfig( cfg ); | 123 | setCentralWidget(cardGame); |
122 | setCardBacks(); | 124 | cardGame->readConfig( cfg ); |
125 | setCardBacks(); | ||
123 | } else if ( gameType == 1 ) { | 126 | } else if ( gameType == 1 ) { |
124 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); | 127 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); |
125 | setCaption(tr("Freecell")); | 128 | setCaption(tr("Freecell")); |
126 | setCentralWidget(cardGame); | 129 | setCentralWidget(cardGame); |
127 | //cardGame->newGame(); // Until we know how to handle reading freecell config | 130 | //cardGame->newGame(); // Until we know how to handle reading freecell config |
128 | cardGame->readConfig( cfg ); | 131 | cardGame->readConfig( cfg ); |
129 | setCardBacks(); | 132 | setCardBacks(); |
130 | } else if ( gameType == 2 ) { | 133 | } else if ( gameType == 2 ) { |
131 | cardGame = new ChicaneCardGame( &canvas, snapOn, this ); | 134 | cardGame = new ChicaneCardGame( &canvas, snapOn, this ); |
132 | cardGame->setNumberToDraw(1); | 135 | cardGame->setNumberToDraw(1); |
133 | setCaption(tr("Chicane")); | 136 | setCaption(tr("Chicane")); |
134 | setCentralWidget(cardGame); | 137 | setCentralWidget(cardGame); |
135 | cardGame->readConfig( cfg ); | 138 | cardGame->readConfig( cfg ); |
136 | setCardBacks(); | 139 | setCardBacks(); |
137 | } else if ( gameType == 3 ) { | 140 | } else if ( gameType == 3 ) { |
138 | cardGame = new HarpCardGame( &canvas, snapOn, this ); | 141 | cardGame = new HarpCardGame( &canvas, snapOn, this ); |
139 | cardGame->setNumberToDraw(1); | 142 | cardGame->setNumberToDraw(1); |
140 | setCaption(tr("Harp")); | 143 | setCaption(tr("Harp")); |
141 | setCentralWidget(cardGame); | 144 | setCentralWidget(cardGame); |
142 | cardGame->readConfig( cfg ); | 145 | cardGame->readConfig( cfg ); |
143 | setCardBacks(); | 146 | setCardBacks(); |
144 | } else if ( gameType == 4 ) { | 147 | } else if ( gameType == 4 ) { |
145 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); | 148 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); |
146 | cardGame->setNumberToDraw(1); | 149 | cardGame->setNumberToDraw(1); |
147 | setCaption(tr("Teeclub")); | 150 | setCaption(tr("Teeclub")); |
148 | setCentralWidget(cardGame); | 151 | setCentralWidget(cardGame); |
149 | cardGame->readConfig( cfg ); | 152 | cardGame->readConfig( cfg ); |
150 | setCardBacks(); | 153 | setCardBacks(); |
151 | } else { | 154 | } else { |
152 | // Probably there isn't a config file or it is broken | 155 | // Probably there isn't a config file or it is broken |
153 | // Start a new game | 156 | // Start a new game |
154 | initPatience(); | 157 | initPatience(); |
155 | } | 158 | } |
@@ -163,9 +166,10 @@ CanvasCardWindow::~CanvasCardWindow() | |||
163 | if (cardGame) { | 166 | if (cardGame) { |
164 | Config cfg("Patience"); | 167 | Config cfg("Patience"); |
165 | cfg.setGroup( "GlobalSettings" ); | 168 | cfg.setGroup( "GlobalSettings" ); |
166 | cfg.writeEntry( "GameType", gameType ); | 169 | cfg.writeEntry( "GameType", gameType ); |
167 | cfg.writeEntry( "SnapOn", snapOn ); | 170 | cfg.writeEntry( "SnapOn", snapOn ); |
168 | cfg.writeEntry( "DrawThree", drawThree); | 171 | cfg.writeEntry( "DrawThree", drawThree); |
169 | cardGame->writeConfig( cfg ); | 172 | cfg.write(); |
170 | delete cardGame; | 173 | cardGame->writeConfig( cfg ); |
174 | delete cardGame; | ||
171 | } | 175 | } |
@@ -186,3 +190,3 @@ void CanvasCardWindow::initPatience() | |||
186 | if ( cardGame ) | 190 | if ( cardGame ) |
187 | delete cardGame; | 191 | delete cardGame; |
188 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 192 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
@@ -202,3 +206,3 @@ void CanvasCardWindow::initFreecell() | |||
202 | if ( cardGame ) { | 206 | if ( cardGame ) { |
203 | delete cardGame; | 207 | delete cardGame; |
204 | } | 208 | } |
@@ -217,3 +221,3 @@ void CanvasCardWindow::initChicane() | |||
217 | if ( cardGame ) { | 221 | if ( cardGame ) { |
218 | delete cardGame; | 222 | delete cardGame; |
219 | } | 223 | } |
@@ -232,3 +236,3 @@ void CanvasCardWindow::initHarp() | |||
232 | if ( cardGame ) { | 236 | if ( cardGame ) { |
233 | delete cardGame; | 237 | delete cardGame; |
234 | } | 238 | } |
@@ -270,4 +274,9 @@ void CanvasCardWindow::drawnToggle() | |||
270 | { | 274 | { |
275 | drawThree=!drawThree; | ||
276 | Config cfg( "Patience" ); | ||
277 | cfg.setGroup( "GlobalSettings" ); | ||
271 | cardGame->toggleCardsDrawn(); | 278 | cardGame->toggleCardsDrawn(); |
272 | updateDraw(); | 279 | updateDraw(); |
280 | cfg.writeEntry( "DrawThree", drawThree); | ||
281 | cfg.write(); | ||
273 | } | 282 | } |
@@ -275,6 +284,7 @@ void CanvasCardWindow::drawnToggle() | |||
275 | void CanvasCardWindow::updateDraw() { | 284 | void CanvasCardWindow::updateDraw() { |
276 | if(cardGame->cardsDrawn() == 3) | 285 | if(cardGame->cardsDrawn() == 3){ |
277 | settings->changeItem(drawId, tr("Turn One Card")); | 286 | settings->changeItem(drawId, tr("Turn One Card")); |
278 | else | 287 | } else { |
279 | settings->changeItem(drawId, tr("Turn Three Cards")); | 288 | settings->changeItem(drawId, tr("Turn Three Cards")); |
289 | } | ||
280 | } | 290 | } |
@@ -287,4 +297,4 @@ void CanvasCardWindow::setCardBacks() | |||
287 | for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { | 297 | for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { |
288 | if ( (*it)->rtti() == canvasCardId ) | 298 | if ( (*it)->rtti() == canvasCardId ) |
289 | ((CanvasCard *)(*it))->setCardBack( cardBack ); | 299 | ((CanvasCard *)(*it))->setCardBack( cardBack ); |
290 | } | 300 | } |
@@ -298,3 +308,3 @@ void CanvasCardWindow::changeCardBacks() | |||
298 | if (cardBack == 5) | 308 | if (cardBack == 5) |
299 | cardBack = 0; | 309 | cardBack = 0; |
300 | 310 | ||
diff --git a/noncore/games/solitaire/opie-solitaire.control b/noncore/games/solitaire/opie-solitaire.control index f70fefa..4389360 100644 --- a/noncore/games/solitaire/opie-solitaire.control +++ b/noncore/games/solitaire/opie-solitaire.control | |||
@@ -1,2 +1,2 @@ | |||
1 | Files: bin/patience apps/Games/patience.desktop pics/cards | 1 | Files: bin/patience apps/Games/patience.desktop pics/cards |
2 | Priority: optional | 2 | Priority: optional |