summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp120
-rw-r--r--noncore/games/solitaire/opie-solitaire.control2
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)
// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
-// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
- canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
+// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
+ canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
} else {
QPixmap bg;
- bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
+ bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
canvas.setBackgroundPixmap(bg);
@@ -104,2 +104,3 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f)
menu->insertItem(tr("Settings"),settings);
+ settings->setCheckable(TRUE);
@@ -113,43 +114,45 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f)
settings->setItemChecked(snap_id, snapOn);
+
gameType = cfg.readNumEntry( "GameType", -1 );
- drawThree = cfg.readBoolEntry( "DrawThree", TRUE);
+ drawThree = cfg.readBoolEntry( "DrawThree", FALSE);
if ( gameType == 0 ) {
- cardGame = new PatienceCardGame( &canvas, snapOn, this );
- cardGame->setNumberToDraw(drawThree ? 3 : 1);
- setCaption(tr("Patience"));
- setCentralWidget(cardGame);
- cardGame->readConfig( cfg );
- setCardBacks();
+ cardGame = new PatienceCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(drawThree ? 3 : 1);
+
+ setCaption(tr("Patience"));
+ setCentralWidget(cardGame);
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else if ( gameType == 1 ) {
- cardGame = new FreecellCardGame( &canvas, snapOn, this );
- setCaption(tr("Freecell"));
- setCentralWidget(cardGame);
- //cardGame->newGame(); // Until we know how to handle reading freecell config
- cardGame->readConfig( cfg );
- setCardBacks();
+ cardGame = new FreecellCardGame( &canvas, snapOn, this );
+ setCaption(tr("Freecell"));
+ setCentralWidget(cardGame);
+ //cardGame->newGame(); // Until we know how to handle reading freecell config
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else if ( gameType == 2 ) {
- cardGame = new ChicaneCardGame( &canvas, snapOn, this );
- cardGame->setNumberToDraw(1);
- setCaption(tr("Chicane"));
- setCentralWidget(cardGame);
- cardGame->readConfig( cfg );
- setCardBacks();
+ cardGame = new ChicaneCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ setCaption(tr("Chicane"));
+ setCentralWidget(cardGame);
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else if ( gameType == 3 ) {
- cardGame = new HarpCardGame( &canvas, snapOn, this );
- cardGame->setNumberToDraw(1);
- setCaption(tr("Harp"));
- setCentralWidget(cardGame);
- cardGame->readConfig( cfg );
- setCardBacks();
+ cardGame = new HarpCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ setCaption(tr("Harp"));
+ setCentralWidget(cardGame);
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else if ( gameType == 4 ) {
- cardGame = new TeeclubCardGame( &canvas, snapOn, this );
- cardGame->setNumberToDraw(1);
- setCaption(tr("Teeclub"));
- setCentralWidget(cardGame);
- cardGame->readConfig( cfg );
- setCardBacks();
+ cardGame = new TeeclubCardGame( &canvas, snapOn, this );
+ cardGame->setNumberToDraw(1);
+ setCaption(tr("Teeclub"));
+ setCentralWidget(cardGame);
+ cardGame->readConfig( cfg );
+ setCardBacks();
} else {
- // Probably there isn't a config file or it is broken
- // Start a new game
- initPatience();
+ // Probably there isn't a config file or it is broken
+ // Start a new game
+ initPatience();
}
@@ -163,9 +166,10 @@ CanvasCardWindow::~CanvasCardWindow()
if (cardGame) {
- Config cfg("Patience");
- cfg.setGroup( "GlobalSettings" );
- cfg.writeEntry( "GameType", gameType );
- cfg.writeEntry( "SnapOn", snapOn );
- cfg.writeEntry( "DrawThree", drawThree);
- cardGame->writeConfig( cfg );
- delete cardGame;
+ Config cfg("Patience");
+ cfg.setGroup( "GlobalSettings" );
+ cfg.writeEntry( "GameType", gameType );
+ cfg.writeEntry( "SnapOn", snapOn );
+ cfg.writeEntry( "DrawThree", drawThree);
+ cfg.write();
+ cardGame->writeConfig( cfg );
+ delete cardGame;
}
@@ -186,3 +190,3 @@ void CanvasCardWindow::initPatience()
if ( cardGame )
- delete cardGame;
+ delete cardGame;
cardGame = new PatienceCardGame( &canvas, snapOn, this );
@@ -202,3 +206,3 @@ void CanvasCardWindow::initFreecell()
if ( cardGame ) {
- delete cardGame;
+ delete cardGame;
}
@@ -217,3 +221,3 @@ void CanvasCardWindow::initChicane()
if ( cardGame ) {
- delete cardGame;
+ delete cardGame;
}
@@ -232,3 +236,3 @@ void CanvasCardWindow::initHarp()
if ( cardGame ) {
- delete cardGame;
+ delete cardGame;
}
@@ -270,4 +274,9 @@ void CanvasCardWindow::drawnToggle()
{
+ drawThree=!drawThree;
+ Config cfg( "Patience" );
+ cfg.setGroup( "GlobalSettings" );
cardGame->toggleCardsDrawn();
updateDraw();
+ cfg.writeEntry( "DrawThree", drawThree);
+ cfg.write();
}
@@ -275,6 +284,7 @@ void CanvasCardWindow::drawnToggle()
void CanvasCardWindow::updateDraw() {
- if(cardGame->cardsDrawn() == 3)
- settings->changeItem(drawId, tr("Turn One Card"));
- else
- settings->changeItem(drawId, tr("Turn Three Cards"));
+ if(cardGame->cardsDrawn() == 3){
+ settings->changeItem(drawId, tr("Turn One Card"));
+ } else {
+ settings->changeItem(drawId, tr("Turn Three Cards"));
+ }
}
@@ -287,4 +297,4 @@ void CanvasCardWindow::setCardBacks()
for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) {
- if ( (*it)->rtti() == canvasCardId )
- ((CanvasCard *)(*it))->setCardBack( cardBack );
+ if ( (*it)->rtti() == canvasCardId )
+ ((CanvasCard *)(*it))->setCardBack( cardBack );
}
@@ -298,3 +308,3 @@ void CanvasCardWindow::changeCardBacks()
if (cardBack == 5)
- cardBack = 0;
+ cardBack = 0;
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 @@
-Files: bin/patience apps/Games/patience.desktop pics/cards
+Files: bin/patience apps/Games/patience.desktop pics/cards
Priority: optional