summaryrefslogtreecommitdiff
path: root/noncore/games/solitaire
Side-by-side diff
Diffstat (limited to 'noncore/games/solitaire') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp15
-rw-r--r--noncore/games/solitaire/canvascardwindow.h1
-rw-r--r--noncore/games/solitaire/carddeck.cpp2
-rw-r--r--noncore/games/solitaire/main.cpp14
-rwxr-xr-xnoncore/games/solitaire/solitaire.pro5
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
@@ -28,79 +28,80 @@
#include <qpe/resource.h>
#include <qmainwindow.h>
#include <qpopupmenu.h>
#include <qstyle.h>
CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
cardGame(NULL)
{
setIcon( Resource::loadPixmap( "cards" ) );
+ setCaption(tr("Patience"));
// Create Playing Area for Games
if ( QPixmap::defaultDepth() < 12 ) {
// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
// 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);
}
#if defined( QT_QWS_CASSIOPEIA )
canvas.setAdvancePeriod(70);
#else
canvas.setAdvancePeriod(30);
#endif
#ifdef _PATIENCE_USE_ACCELS_
QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F);
menu->insertItem(tr("&Game"), file);
-
+
menu->insertSeparator();
settings = new QPopupMenu;
settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2);
snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3);
settings->setCheckable(TRUE);
menu->insertItem(tr("&Settings"),settings);
menu->insertSeparator();
QPopupMenu* help = new QPopupMenu;
help->insertItem(tr("&About"), this, SLOT(help()), Key_F1);
help->setItemChecked(dbf_id, TRUE);
menu->insertItem(tr("&Help"),help);
#else
QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()));
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()));
file->insertItem(tr("Chicane"), this, SLOT(initChicane()));
file->insertItem(tr("Harp"), this, SLOT(initHarp()));
file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()));
menu->insertItem(tr("Play"), file);
-
+
menu->insertSeparator();
settings = new QPopupMenu;
settings->setCheckable(TRUE);
settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks()));
snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle()));
QString m;
drawId = settings->insertItem(tr("Turn one card"), this, SLOT(drawnToggle()));
menu->insertItem(tr("Settings"),settings);
settings->setCheckable(TRUE);
@@ -109,25 +110,25 @@ CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f)
menu->show();
Config cfg( "Patience" );
cfg.setGroup( "GlobalSettings" );
snapOn = cfg.readBoolEntry( "SnapOn", TRUE);
settings->setItemChecked(snap_id, snapOn);
gameType = cfg.readNumEntry( "GameType", -1 );
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();
} 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();
} else if ( gameType == 2 ) {
@@ -177,25 +178,25 @@ CanvasCardWindow::~CanvasCardWindow()
void CanvasCardWindow::resizeEvent(QResizeEvent *)
{
QSize s = centralWidget()->size();
int fw = style().defaultFrameWidth();
canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
}
void CanvasCardWindow::initPatience()
{
- // Create New Game
+ // Create New Game
if ( cardGame )
delete cardGame;
cardGame = new PatienceCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(drawThree ? 3 : 1);
gameType = 0;
setCaption(tr("Patience"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
updateDraw();
}
@@ -244,31 +245,31 @@ void CanvasCardWindow::initHarp()
cardGame->newGame();
setCardBacks();
}
void CanvasCardWindow::initTeeclub()
{
// Create New Game
if ( cardGame ) {
delete cardGame;
}
cardGame = new TeeclubCardGame( &canvas, snapOn, this );
- cardGame->setNumberToDraw(1);
+ cardGame->setNumberToDraw(1);
gameType = 4;
setCaption(tr("Teeclub"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
-}
+}
void CanvasCardWindow::snapToggle()
{
snapOn = !snapOn;
settings->setItemChecked(snap_id, snapOn);
cardGame->toggleSnap();
}
void CanvasCardWindow::drawnToggle()
{
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
@@ -24,24 +24,25 @@
#include <qmainwindow.h>
#include <qcanvas.h>
class CanvasCardGame;
class QPopupMenu;
class CanvasCardWindow : public QMainWindow {
Q_OBJECT
public:
+ static QString appName() { return QString::fromLatin1("patience"); }
CanvasCardWindow(QWidget* parent=0, const char* name=0, WFlags f=0);
virtual ~CanvasCardWindow();
public slots:
void setCardBacks();
void changeCardBacks();
void snapToggle();
void drawnToggle();
private slots:
void initFreecell();
void initPatience();
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
@@ -16,25 +16,25 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <stdlib.h>
#include <time.h>
#include "card.h"
#include "carddeck.h"
CardDeck::CardDeck(int jokers, int numOfDecks) : numberOfJokers(jokers), numberOfDecks(numOfDecks), deckCreated(FALSE)
{
- cards = new (Card *)[getNumberOfCards()];
+ cards = new Card *[getNumberOfCards()];
}
CardDeck::~CardDeck()
{
for (int i = 0; i < getNumberOfCards(); i++)
delete cards[i];
delete cards;
}
void CardDeck::createDeck()
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
@@ -12,25 +12,15 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "canvascardwindow.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
-
- CanvasCardWindow m;
- m.setCaption( CanvasCardWindow::tr("Patience") );
- a.showMainWidget( &m );
-
- return a.exec();
-}
-
+OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file
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,21 +1,20 @@
-TEMPLATE = app
-CONFIG += qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG += qt warn_on release quick-app
HEADERS = canvascard.h canvasshapes.h cardgame.h cardgamelayout.h cardpile.h card.h carddeck.h \
canvascardgame.h freecellcardgame.h chicanecardgame.h harpcardgame.h teeclubcardgame.h \
patiencecardgame.h canvascardwindow.h
SOURCES = canvascard.cpp canvasshapes.cpp cardgame.cpp cardgamelayout.cpp \
cardpile.cpp card.cpp carddeck.cpp canvascardgame.cpp freecellcardgame.cpp \
chicanecardgame.cpp harpcardgame.cpp teeclubcardgame.cpp \
patiencecardgame.cpp canvascardwindow.cpp main.cpp
TARGET = patience
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
+
include ( $(OPIEDIR)/include.pro )