-rw-r--r-- | noncore/games/solitaire/canvascard.cpp | 51 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascardgame.h | 1 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascardwindow.cpp | 7 |
3 files changed, 26 insertions, 33 deletions
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp index c36da6c..cd298ef 100644 --- a/noncore/games/solitaire/canvascard.cpp +++ b/noncore/games/solitaire/canvascard.cpp | |||
@@ -1,47 +1,47 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "canvascard.h" | 21 | #include "canvascard.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <opie2/oresource.h> |
24 | 24 | ||
25 | #include <qgfx_qws.h> // Needed to get the device's width | 25 | #include <qgfx_qws.h> // Needed to get the device's width |
26 | 26 | ||
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #if defined( QT_QWS_CASSIOPEIA ) | 29 | #if defined( QT_QWS_CASSIOPEIA ) |
30 | #define SLOW_HARDWARE | 30 | #define SLOW_HARDWARE |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | // Seems to be fast enough to me even without Transformations in the library | 33 | // Seems to be fast enough to me even without Transformations in the library |
34 | //#if defined( QT_NO_TRANSFORMATIONS ) && defined( QT_QWS_IPAQ ) | 34 | //#if defined( QT_NO_TRANSFORMATIONS ) && defined( QT_QWS_IPAQ ) |
35 | //#define SLOW_HARDWARE | 35 | //#define SLOW_HARDWARE |
36 | //#endif | 36 | //#endif |
37 | 37 | ||
38 | 38 | ||
39 | QBitmap *Create180RotatedBitmap(QBitmap *srcBitmap) | 39 | QBitmap *Create180RotatedBitmap(QBitmap *srcBitmap) |
40 | { | 40 | { |
41 | #ifdef QT_NO_TRANSFORMATIONS | 41 | #ifdef QT_NO_TRANSFORMATIONS |
42 | int w = srcBitmap->width(); | 42 | int w = srcBitmap->width(); |
43 | int h = srcBitmap->height(); | 43 | int h = srcBitmap->height(); |
44 | QBitmap *dstBitmap = new QBitmap( w, h ); | 44 | QBitmap *dstBitmap = new QBitmap( w, h ); |
45 | // ### this is very poorly implemented and probably could be much faster | 45 | // ### this is very poorly implemented and probably could be much faster |
46 | for (int i = 0; i < w; i++) | 46 | for (int i = 0; i < w; i++) |
47 | for (int j = 0; j < h; j++) | 47 | for (int j = 0; j < h; j++) |
@@ -78,141 +78,136 @@ QPixmap *CreateScaledPixmap(QPixmap *srcPixmap, double scaleX, double scaleY) | |||
78 | } | 78 | } |
79 | return dstPixmap; | 79 | return dstPixmap; |
80 | #else | 80 | #else |
81 | QWMatrix s; | 81 | QWMatrix s; |
82 | s.scale( scaleX, scaleY ); | 82 | s.scale( scaleX, scaleY ); |
83 | return new QPixmap( srcPixmap->xForm( s ) ); | 83 | return new QPixmap( srcPixmap->xForm( s ) ); |
84 | #endif | 84 | #endif |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | // Initialise static member variables to NULL | 88 | // Initialise static member variables to NULL |
89 | QPixmap *CanvasCard::cardsFaces = NULL; | 89 | QPixmap *CanvasCard::cardsFaces = NULL; |
90 | QPixmap *CanvasCard::cardsBacks = NULL; | 90 | QPixmap *CanvasCard::cardsBacks = NULL; |
91 | QBitmap *CanvasCard::cardsChars = NULL; | 91 | QBitmap *CanvasCard::cardsChars = NULL; |
92 | QBitmap *CanvasCard::cardsSuits = NULL; | 92 | QBitmap *CanvasCard::cardsSuits = NULL; |
93 | QBitmap *CanvasCard::cardsCharsUpsideDown = NULL; | 93 | QBitmap *CanvasCard::cardsCharsUpsideDown = NULL; |
94 | QBitmap *CanvasCard::cardsSuitsUpsideDown = NULL; | 94 | QBitmap *CanvasCard::cardsSuitsUpsideDown = NULL; |
95 | 95 | ||
96 | 96 | ||
97 | CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) : | 97 | CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) : |
98 | Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0) | 98 | Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0) |
99 | { | 99 | { |
100 | if ( !cardsFaces ) { | 100 | if ( !cardsFaces ) { |
101 | if ( qt_screen->deviceWidth() < 200 ) { | 101 | if ( qt_screen->deviceWidth() < 200 ) { |
102 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) ); | 102 | cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face_small" ) ); |
103 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); | 103 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) ); |
104 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) ); | 104 | cardsChars = new QBitmap(); |
105 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) ); | 105 | *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars_small" ); |
106 | cardsSuits = new QBitmap(); | ||
107 | *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits_small" ); | ||
106 | } else { | 108 | } else { |
107 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); | 109 | cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face" ) ); |
108 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); | 110 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) ); |
109 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) ); | 111 | cardsChars = new QBitmap(); |
110 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); | 112 | *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars" ); |
113 | cardsSuits = new QBitmap(); | ||
114 | *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits" ); | ||
111 | } | 115 | } |
112 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); | 116 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); |
113 | cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits ); | 117 | cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits ); |
114 | } | 118 | } |
115 | xOff = cardsFaces->width() / 2; | 119 | xOff = cardsFaces->width() / 2; |
116 | yOff = cardsFaces->height() / 2; | 120 | yOff = cardsFaces->height() / 2; |
117 | setSize( cardsFaces->width(), cardsFaces->height() ); | 121 | setSize( cardsFaces->width(), cardsFaces->height() ); |
118 | setPen( NoPen ); | 122 | setPen( NoPen ); |
119 | flipping = FALSE; | 123 | flipping = FALSE; |
120 | } | 124 | } |
121 | 125 | ||
122 | 126 | ||
123 | void CanvasCard::setCardBack(int b) | 127 | void CanvasCard::setCardBack(int b) |
124 | { | 128 | { |
125 | if ( cardBack != b ) { | 129 | if ( cardBack != b ) { |
126 | 130 | ||
127 | cardBack = b; | 131 | cardBack = b; |
128 | 132 | ||
129 | if ( cardsBacks ) | 133 | if ( cardsBacks ) |
130 | delete cardsBacks; | 134 | delete cardsBacks; |
131 | 135 | ||
132 | if ( qt_screen->deviceWidth() < 200 ) { | 136 | if ( qt_screen->deviceWidth() < 200 ) { |
133 | switch (cardBack) { | 137 | switch (cardBack) { |
134 | case 0: | 138 | case 0: |
135 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break; | 139 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) ); break; |
136 | case 1: | 140 | case 1: |
137 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break; | 141 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002_small" ) ); break; |
138 | case 2: | 142 | case 2: |
139 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break; | 143 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003_small" ) ); break; |
140 | case 3: | 144 | case 3: |
141 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break; | 145 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004_small" ) ); break; |
142 | case 4: | 146 | case 4: |
143 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break; | 147 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005_small" ) ); break; |
144 | } | 148 | } |
145 | } else { | 149 | } else { |
146 | switch (cardBack) { | 150 | switch (cardBack) { |
147 | case 0: | 151 | case 0: |
148 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break; | 152 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) ); break; |
149 | case 1: | 153 | case 1: |
150 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break; | 154 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002" ) ); break; |
151 | case 2: | 155 | case 2: |
152 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break; | 156 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003" ) ); break; |
153 | case 3: | 157 | case 3: |
154 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break; | 158 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004" ) ); break; |
155 | case 4: | 159 | case 4: |
156 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break; | 160 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005" ) ); break; |
157 | } | 161 | } |
158 | } | 162 | } |
159 | 163 | ||
160 | if ( !isFacing() ) | 164 | if ( !isFacing() ) |
161 | redraw(); | 165 | redraw(); |
162 | } | 166 | } |
163 | } | 167 | } |
164 | 168 | ||
165 | 169 | ||
166 | void CanvasCard::draw(QPainter &painter) | 170 | void CanvasCard::draw(QPainter &painter) |
167 | { | 171 | { |
168 | int ix = (int)x(), iy = (int)y(); | 172 | int ix = (int)x(), iy = (int)y(); |
169 | 173 | ||
170 | QPainter *p = &painter; | 174 | QPainter *p = &painter; |
171 | QPixmap *unscaledCard = NULL; | 175 | QPixmap *unscaledCard = NULL; |
172 | 176 | ||
173 | if ((scaleX <= 0.98) || (scaleY <= 0.98)) | 177 | if ((scaleX <= 0.98) || (scaleY <= 0.98)) |
174 | { | 178 | { |
175 | p = new QPainter(); | 179 | p = new QPainter(); |
176 | unscaledCard = new QPixmap( cardsFaces->width(), cardsFaces->height() ); | 180 | unscaledCard = new QPixmap( cardsFaces->width(), cardsFaces->height() ); |
177 | p->begin(unscaledCard); | 181 | p->begin(unscaledCard); |
178 | ix = 0; | 182 | ix = 0; |
179 | iy = 0; | 183 | iy = 0; |
180 | } | 184 | } |
181 | 185 | ||
182 | if ( isFacing() ) { | 186 | if ( isFacing() ) { |
183 | 187 | ||
184 | /* | ||
185 | // Now add the joker and card backs to the list of pixmaps | ||
186 | QPixmap *CardsBack = new QPixmap( Resource::loadPixmap( "cards/card_joker.png" ) ); | ||
187 | QPoint *newBackHotspot = new QPoint( 0, 0 ); | ||
188 | pixmaps->append((const QPixmap *)CardsBack); | ||
189 | hotspots->append((const QPoint *)newBackHotspot); | ||
190 | */ | ||
191 | |||
192 | int w = cardsFaces->width(), h = cardsFaces->height(); | 188 | int w = cardsFaces->width(), h = cardsFaces->height(); |
193 | 189 | ||
194 | //p->setBrush( NoBrush ); | ||
195 | p->setBrush( QColor( 0xFF, 0xFF, 0xFF ) ); | 190 | p->setBrush( QColor( 0xFF, 0xFF, 0xFF ) ); |
196 | 191 | ||
197 | if ( isRed() == TRUE ) | 192 | if ( isRed() == TRUE ) |
198 | p->setPen( QColor( 0xFF, 0, 0 ) ); | 193 | p->setPen( QColor( 0xFF, 0, 0 ) ); |
199 | else | 194 | else |
200 | p->setPen( QColor( 0, 0, 0 ) ); | 195 | p->setPen( QColor( 0, 0, 0 ) ); |
201 | 196 | ||
202 | if ( qt_screen->deviceWidth() < 200 ) { | 197 | if ( qt_screen->deviceWidth() < 200 ) { |
203 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | 198 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); |
204 | p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 ); | 199 | p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 ); |
205 | p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 ); | 200 | p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 ); |
206 | p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 ); | 201 | p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 ); |
207 | p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 ); | 202 | p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 ); |
208 | } else { | 203 | } else { |
209 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | 204 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); |
210 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); | 205 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); |
211 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); | 206 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); |
212 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); | 207 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); |
213 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); | 208 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); |
214 | } | 209 | } |
215 | 210 | ||
216 | } else { | 211 | } else { |
217 | 212 | ||
218 | p->drawPixmap( ix, iy, *cardsBacks ); | 213 | p->drawPixmap( ix, iy, *cardsBacks ); |
diff --git a/noncore/games/solitaire/canvascardgame.h b/noncore/games/solitaire/canvascardgame.h index b93cfbf..c559a90 100644 --- a/noncore/games/solitaire/canvascardgame.h +++ b/noncore/games/solitaire/canvascardgame.h | |||
@@ -3,49 +3,48 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef CANVAS_CARD_GAME_H | 20 | #ifndef CANVAS_CARD_GAME_H |
21 | #define CANVAS_CARD_GAME_H | 21 | #define CANVAS_CARD_GAME_H |
22 | 22 | ||
23 | #include "cardgame.h" | 23 | #include "cardgame.h" |
24 | #include "canvasshapes.h" | 24 | #include "canvasshapes.h" |
25 | #include "canvascard.h" | 25 | #include "canvascard.h" |
26 | 26 | ||
27 | #include <qpe/resource.h> | ||
28 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
29 | 28 | ||
30 | #include <qmainwindow.h> | 29 | #include <qmainwindow.h> |
31 | #include <qmenubar.h> | 30 | #include <qmenubar.h> |
32 | #include <qpainter.h> | 31 | #include <qpainter.h> |
33 | 32 | ||
34 | #include <stdlib.h> | 33 | #include <stdlib.h> |
35 | #include <time.h> | 34 | #include <time.h> |
36 | 35 | ||
37 | 36 | ||
38 | class CanvasCardPile; | 37 | class CanvasCardPile; |
39 | 38 | ||
40 | 39 | ||
41 | class CanvasCardGame : public QCanvasView, public CardGame | 40 | class CanvasCardGame : public QCanvasView, public CardGame |
42 | { | 41 | { |
43 | public: | 42 | public: |
44 | CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) : | 43 | CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) : |
45 | QCanvasView( &c, parent, name, f ), | 44 | QCanvasView( &c, parent, name, f ), |
46 | CardGame(0,numOfDecks), | 45 | CardGame(0,numOfDecks), |
47 | moved(FALSE), | 46 | moved(FALSE), |
48 | moving(NULL), | 47 | moving(NULL), |
49 | alphaCardPile( NULL ), | 48 | alphaCardPile( NULL ), |
50 | cardXOff(0), cardYOff(0), | 49 | cardXOff(0), cardYOff(0), |
51 | snapOn(snap), | 50 | snapOn(snap), |
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp index 503bc92..956c5bd 100644 --- a/noncore/games/solitaire/canvascardwindow.cpp +++ b/noncore/games/solitaire/canvascardwindow.cpp | |||
@@ -3,66 +3,65 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "canvascardwindow.h" | 21 | #include "canvascardwindow.h" |
22 | #include "freecellcardgame.h" | 22 | #include "freecellcardgame.h" |
23 | #include "chicanecardgame.h" | 23 | #include "chicanecardgame.h" |
24 | #include "harpcardgame.h" | 24 | #include "harpcardgame.h" |
25 | #include "teeclubcardgame.h" | 25 | #include "teeclubcardgame.h" |
26 | 26 | ||
27 | 27 | #include <opie2/oresource.h> | |
28 | |||
29 | 28 | ||
30 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : | 29 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : |
31 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), | 30 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), |
32 | cardGame(NULL) | 31 | cardGame(NULL) |
33 | { | 32 | { |
34 | setIcon( Resource::loadPixmap( "cards" ) ); | 33 | setIcon( Opie::Core::OResource::loadPixmap( "cards" ) ); |
35 | setCaption(tr("Patience")); | 34 | setCaption(tr("Patience")); |
36 | 35 | ||
37 | // Create Playing Area for Games | 36 | // Create Playing Area for Games |
38 | if ( QPixmap::defaultDepth() < 12 ) { | 37 | if ( QPixmap::defaultDepth() < 12 ) { |
39 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); | 38 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); |
40 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); | 39 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); |
41 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); | 40 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); |
42 | } else { | 41 | } else { |
43 | QPixmap bg; | 42 | QPixmap bg; |
44 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); | 43 | bg.convertFromImage( Opie::Core::OResource::loadImage( "table_pattern" ), ThresholdDither ); |
45 | canvas.setBackgroundPixmap(bg); | 44 | canvas.setBackgroundPixmap(bg); |
46 | } | 45 | } |
47 | 46 | ||
48 | #if defined( QT_QWS_CASSIOPEIA ) | 47 | #if defined( QT_QWS_CASSIOPEIA ) |
49 | canvas.setAdvancePeriod(70); | 48 | canvas.setAdvancePeriod(70); |
50 | #else | 49 | #else |
51 | canvas.setAdvancePeriod(30); | 50 | canvas.setAdvancePeriod(30); |
52 | #endif | 51 | #endif |
53 | 52 | ||
54 | 53 | ||
55 | #ifdef _PATIENCE_USE_ACCELS_ | 54 | #ifdef _PATIENCE_USE_ACCELS_ |
56 | QMenuBar* menu = menuBar(); | 55 | QMenuBar* menu = menuBar(); |
57 | 56 | ||
58 | QPopupMenu* file = new QPopupMenu; | 57 | QPopupMenu* file = new QPopupMenu; |
59 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); | 58 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); |
60 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); | 59 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); |
61 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); | 60 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); |
62 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); | 61 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); |
63 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); | 62 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); |
64 | menu->insertItem(tr("&Game"), file); | 63 | menu->insertItem(tr("&Game"), file); |
65 | 64 | ||
66 | menu->insertSeparator(); | 65 | menu->insertSeparator(); |
67 | 66 | ||
68 | settings = new QPopupMenu; | 67 | settings = new QPopupMenu; |