-rw-r--r-- | noncore/games/solitaire/canvascardwindow.cpp | 15 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascardwindow.h | 1 | ||||
-rw-r--r-- | noncore/games/solitaire/carddeck.cpp | 2 | ||||
-rw-r--r-- | noncore/games/solitaire/main.cpp | 14 | ||||
-rwxr-xr-x | noncore/games/solitaire/solitaire.pro | 5 |
5 files changed, 14 insertions, 23 deletions
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp index dec5591..c12344a 100644 --- a/noncore/games/solitaire/canvascardwindow.cpp +++ b/noncore/games/solitaire/canvascardwindow.cpp | |||
@@ -34,21 +34,22 @@ | |||
34 | 34 | ||
35 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : | 35 | CanvasCardWindow::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 | setCaption(tr("Patience")); | ||
40 | 41 | ||
41 | // Create Playing Area for Games | 42 | // Create Playing Area for Games |
42 | if ( QPixmap::defaultDepth() < 12 ) { | 43 | if ( QPixmap::defaultDepth() < 12 ) { |
43 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); | 44 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); |
44 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); | 45 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); |
45 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); | 46 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); |
46 | } else { | 47 | } else { |
47 | QPixmap bg; | 48 | QPixmap bg; |
48 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); | 49 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); |
49 | canvas.setBackgroundPixmap(bg); | 50 | canvas.setBackgroundPixmap(bg); |
50 | } | 51 | } |
51 | 52 | ||
52 | #if defined( QT_QWS_CASSIOPEIA ) | 53 | #if defined( QT_QWS_CASSIOPEIA ) |
53 | canvas.setAdvancePeriod(70); | 54 | canvas.setAdvancePeriod(70); |
54 | #else | 55 | #else |
@@ -63,13 +64,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
63 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); | 64 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); |
64 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); | 65 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); |
65 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); | 66 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); |
66 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); | 67 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); |
67 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); | 68 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); |
68 | menu->insertItem(tr("&Game"), file); | 69 | menu->insertItem(tr("&Game"), file); |
69 | 70 | ||
70 | menu->insertSeparator(); | 71 | menu->insertSeparator(); |
71 | 72 | ||
72 | settings = new QPopupMenu; | 73 | settings = new QPopupMenu; |
73 | settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); | 74 | 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); | 75 | snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); |
75 | settings->setCheckable(TRUE); | 76 | settings->setCheckable(TRUE); |
@@ -88,13 +89,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
88 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); | 89 | file->insertItem(tr("Patience"), this, SLOT(initPatience())); |
89 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); | 90 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell())); |
90 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); | 91 | file->insertItem(tr("Chicane"), this, SLOT(initChicane())); |
91 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); | 92 | file->insertItem(tr("Harp"), this, SLOT(initHarp())); |
92 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); | 93 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub())); |
93 | menu->insertItem(tr("Play"), file); | 94 | menu->insertItem(tr("Play"), file); |
94 | 95 | ||
95 | menu->insertSeparator(); | 96 | menu->insertSeparator(); |
96 | 97 | ||
97 | settings = new QPopupMenu; | 98 | settings = new QPopupMenu; |
98 | settings->setCheckable(TRUE); | 99 | settings->setCheckable(TRUE); |
99 | settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks())); | 100 | settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks())); |
100 | snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle())); | 101 | snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle())); |
@@ -115,13 +116,13 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) | |||
115 | 116 | ||
116 | gameType = cfg.readNumEntry( "GameType", -1 ); | 117 | gameType = cfg.readNumEntry( "GameType", -1 ); |
117 | drawThree = cfg.readBoolEntry( "DrawThree", FALSE); | 118 | drawThree = cfg.readBoolEntry( "DrawThree", FALSE); |
118 | if ( gameType == 0 ) { | 119 | if ( gameType == 0 ) { |
119 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 120 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
120 | cardGame->setNumberToDraw(drawThree ? 3 : 1); | 121 | cardGame->setNumberToDraw(drawThree ? 3 : 1); |
121 | 122 | ||
122 | setCaption(tr("Patience")); | 123 | setCaption(tr("Patience")); |
123 | setCentralWidget(cardGame); | 124 | setCentralWidget(cardGame); |
124 | cardGame->readConfig( cfg ); | 125 | cardGame->readConfig( cfg ); |
125 | setCardBacks(); | 126 | setCardBacks(); |
126 | } else if ( gameType == 1 ) { | 127 | } else if ( gameType == 1 ) { |
127 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); | 128 | cardGame = new FreecellCardGame( &canvas, snapOn, this ); |
@@ -183,13 +184,13 @@ void CanvasCardWindow::resizeEvent(QResizeEvent *) | |||
183 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); | 184 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void CanvasCardWindow::initPatience() | 188 | void CanvasCardWindow::initPatience() |
188 | { | 189 | { |
189 | // Create New Game | 190 | // Create New Game |
190 | if ( cardGame ) | 191 | if ( cardGame ) |
191 | delete cardGame; | 192 | delete cardGame; |
192 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); | 193 | cardGame = new PatienceCardGame( &canvas, snapOn, this ); |
193 | cardGame->setNumberToDraw(drawThree ? 3 : 1); | 194 | cardGame->setNumberToDraw(drawThree ? 3 : 1); |
194 | gameType = 0; | 195 | gameType = 0; |
195 | setCaption(tr("Patience")); | 196 | setCaption(tr("Patience")); |
@@ -250,19 +251,19 @@ void CanvasCardWindow::initTeeclub() | |||
250 | { | 251 | { |
251 | // Create New Game | 252 | // Create New Game |
252 | if ( cardGame ) { | 253 | if ( cardGame ) { |
253 | delete cardGame; | 254 | delete cardGame; |
254 | } | 255 | } |
255 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); | 256 | cardGame = new TeeclubCardGame( &canvas, snapOn, this ); |
256 | cardGame->setNumberToDraw(1); | 257 | cardGame->setNumberToDraw(1); |
257 | gameType = 4; | 258 | gameType = 4; |
258 | setCaption(tr("Teeclub")); | 259 | setCaption(tr("Teeclub")); |
259 | setCentralWidget(cardGame); | 260 | setCentralWidget(cardGame); |
260 | cardGame->newGame(); | 261 | cardGame->newGame(); |
261 | setCardBacks(); | 262 | setCardBacks(); |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | void CanvasCardWindow::snapToggle() | 266 | void CanvasCardWindow::snapToggle() |
266 | { | 267 | { |
267 | snapOn = !snapOn; | 268 | snapOn = !snapOn; |
268 | settings->setItemChecked(snap_id, snapOn); | 269 | settings->setItemChecked(snap_id, snapOn); |
diff --git a/noncore/games/solitaire/canvascardwindow.h b/noncore/games/solitaire/canvascardwindow.h index eddb184..abd6af6 100644 --- a/noncore/games/solitaire/canvascardwindow.h +++ b/noncore/games/solitaire/canvascardwindow.h | |||
@@ -30,12 +30,13 @@ class QPopupMenu; | |||
30 | 30 | ||
31 | 31 | ||
32 | class CanvasCardWindow : public QMainWindow { | 32 | class CanvasCardWindow : public QMainWindow { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | 34 | ||
35 | public: | 35 | public: |
36 | static QString appName() { return QString::fromLatin1("patience"); } | ||
36 | CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0); | 37 | CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0); |
37 | virtual ~CanvasCardWindow(); | 38 | virtual ~CanvasCardWindow(); |
38 | 39 | ||
39 | public slots: | 40 | public slots: |
40 | void setCardBacks(); | 41 | void setCardBacks(); |
41 | void changeCardBacks(); | 42 | void changeCardBacks(); |
diff --git a/noncore/games/solitaire/carddeck.cpp b/noncore/games/solitaire/carddeck.cpp index a2d0076..b130131 100644 --- a/noncore/games/solitaire/carddeck.cpp +++ b/noncore/games/solitaire/carddeck.cpp | |||
@@ -22,13 +22,13 @@ | |||
22 | #include "card.h" | 22 | #include "card.h" |
23 | #include "carddeck.h" | 23 | #include "carddeck.h" |
24 | 24 | ||
25 | 25 | ||
26 | CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE) | 26 | CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE) |
27 | { | 27 | { |
28 | cards = new (Card *)[getNumberOfCards()]; | 28 | cards = new Card *[getNumberOfCards()]; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | CardDeck::~CardDeck() | 32 | CardDeck::~CardDeck() |
33 | { | 33 | { |
34 | for (int i = 0; i < getNumberOfCards(); i++) | 34 | for (int i = 0; i < getNumberOfCards(); i++) |
diff --git a/noncore/games/solitaire/main.cpp b/noncore/games/solitaire/main.cpp index f81aa3c..bd3cf8b 100644 --- a/noncore/games/solitaire/main.cpp +++ b/noncore/games/solitaire/main.cpp | |||
@@ -18,19 +18,9 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "canvascardwindow.h" | 21 | #include "canvascardwindow.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | 26 | OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file | |
26 | int main( int argc, char ** argv ) | ||
27 | { | ||
28 | QPEApplication a( argc, argv ); | ||
29 | |||
30 | CanvasCardWindow m; | ||
31 | m.setCaption( CanvasCardWindow::tr("Patience") ); | ||
32 | a.showMainWidget( &m ); | ||
33 | |||
34 | return a.exec(); | ||
35 | } | ||
36 | |||
diff --git a/noncore/games/solitaire/solitaire.pro b/noncore/games/solitaire/solitaire.pro index 1ac62c3..b1b8bda 100755 --- a/noncore/games/solitaire/solitaire.pro +++ b/noncore/games/solitaire/solitaire.pro | |||
@@ -1,10 +1,8 @@ | |||
1 | TEMPLATE = app | ||
2 | 1 | ||
3 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release quick-app |
4 | DESTDIR = $(OPIEDIR)/bin | ||
5 | 3 | ||
6 | HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h \ | 4 | HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h \ |
7 | canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h teeclubcardgame.h \ | 5 | canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h teeclubcardgame.h \ |
8 | patiencecardgame.h canvascardwindow.h | 6 | patiencecardgame.h canvascardwindow.h |
9 | 7 | ||
10 | SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ | 8 | SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ |
@@ -15,7 +13,8 @@ SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \ | |||
15 | TARGET = patience | 13 | TARGET = patience |
16 | 14 | ||
17 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
18 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
19 | LIBS += -lqpe | 17 | LIBS += -lqpe |
20 | 18 | ||
19 | |||
21 | include ( $(OPIEDIR)/include.pro ) | 20 | include ( $(OPIEDIR)/include.pro ) |