Skip to content

Commit 0bc9e27

Browse files
committedAug 3, 2016
Working 3 games
1 parent f925fd5 commit 0bc9e27

35 files changed

+2108
-107
lines changed
 

‎CardGame.pro

+26-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,35 @@ TEMPLATE = app
1414

1515
SOURCES += main.cpp\
1616
cardgame.cpp \
17-
card.cpp
17+
card.cpp \
18+
pile.cpp \
19+
rule.cpp \
20+
freecell.cpp \
21+
spider.cpp \
22+
games.cpp \
23+
klondike.cpp \
24+
move.cpp \
25+
helpdialog.cpp \
26+
aboutdialog.cpp \
27+
windialog.cpp
1828

1929
HEADERS += cardgame.h \
20-
card.h
30+
card.h \
31+
pile.h \
32+
rule.h \
33+
freecell.h \
34+
spider.h \
35+
games.h \
36+
klondike.h \
37+
move.h \
38+
helpdialog.h \
39+
aboutdialog.h \
40+
windialog.h
2141

22-
FORMS += cardgame.ui
42+
FORMS += cardgame.ui \
43+
helpdialog.ui \
44+
aboutdialog.ui \
45+
windialog.ui
2346

2447
RESOURCES += \
2548
cardimages.qrc

‎CardGame.pro.user

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 3.6.1, 2016-04-12T17:20:23. -->
3+
<!-- Written by QtCreator 3.6.1, 2016-05-31T17:07:04. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

‎aboutdialog.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "aboutdialog.h"
2+
#include "ui_aboutdialog.h"
3+
4+
AboutDialog::AboutDialog(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::AboutDialog)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
AboutDialog::~AboutDialog()
12+
{
13+
delete ui;
14+
}

‎aboutdialog.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef ABOUTDIALOG_H
2+
#define ABOUTDIALOG_H
3+
4+
#include <QDialog>
5+
6+
namespace Ui {
7+
class AboutDialog;
8+
}
9+
10+
class AboutDialog : public QDialog
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit AboutDialog(QWidget *parent = 0);
16+
~AboutDialog();
17+
18+
private slots:
19+
20+
private:
21+
Ui::AboutDialog *ui;
22+
};
23+
24+
#endif // ABOUTDIALOG_H

‎aboutdialog.ui

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>AboutDialog</class>
4+
<widget class="QDialog" name="AboutDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>476</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<widget class="QDialogButtonBox" name="buttonBox">
17+
<property name="geometry">
18+
<rect>
19+
<x>110</x>
20+
<y>250</y>
21+
<width>341</width>
22+
<height>32</height>
23+
</rect>
24+
</property>
25+
<property name="orientation">
26+
<enum>Qt::Horizontal</enum>
27+
</property>
28+
<property name="standardButtons">
29+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
30+
</property>
31+
</widget>
32+
<widget class="QTextBrowser" name="textBrowser">
33+
<property name="geometry">
34+
<rect>
35+
<x>20</x>
36+
<y>20</y>
37+
<width>441</width>
38+
<height>221</height>
39+
</rect>
40+
</property>
41+
<property name="palette">
42+
<palette>
43+
<active>
44+
<colorrole role="Light">
45+
<brush brushstyle="SolidPattern">
46+
<color alpha="255">
47+
<red>85</red>
48+
<green>255</green>
49+
<blue>255</blue>
50+
</color>
51+
</brush>
52+
</colorrole>
53+
<colorrole role="Base">
54+
<brush brushstyle="SolidPattern">
55+
<color alpha="255">
56+
<red>246</red>
57+
<green>246</green>
58+
<blue>246</blue>
59+
</color>
60+
</brush>
61+
</colorrole>
62+
<colorrole role="NoRole">
63+
<brush brushstyle="SolidPattern">
64+
<color alpha="255">
65+
<red>180</red>
66+
<green>180</green>
67+
<blue>180</blue>
68+
</color>
69+
</brush>
70+
</colorrole>
71+
</active>
72+
<inactive>
73+
<colorrole role="Light">
74+
<brush brushstyle="SolidPattern">
75+
<color alpha="255">
76+
<red>85</red>
77+
<green>255</green>
78+
<blue>255</blue>
79+
</color>
80+
</brush>
81+
</colorrole>
82+
<colorrole role="Base">
83+
<brush brushstyle="SolidPattern">
84+
<color alpha="255">
85+
<red>246</red>
86+
<green>246</green>
87+
<blue>246</blue>
88+
</color>
89+
</brush>
90+
</colorrole>
91+
<colorrole role="NoRole">
92+
<brush brushstyle="SolidPattern">
93+
<color alpha="255">
94+
<red>180</red>
95+
<green>180</green>
96+
<blue>180</blue>
97+
</color>
98+
</brush>
99+
</colorrole>
100+
</inactive>
101+
<disabled>
102+
<colorrole role="Light">
103+
<brush brushstyle="SolidPattern">
104+
<color alpha="255">
105+
<red>85</red>
106+
<green>255</green>
107+
<blue>255</blue>
108+
</color>
109+
</brush>
110+
</colorrole>
111+
<colorrole role="Base">
112+
<brush brushstyle="SolidPattern">
113+
<color alpha="255">
114+
<red>240</red>
115+
<green>240</green>
116+
<blue>240</blue>
117+
</color>
118+
</brush>
119+
</colorrole>
120+
<colorrole role="NoRole">
121+
<brush brushstyle="SolidPattern">
122+
<color alpha="255">
123+
<red>180</red>
124+
<green>180</green>
125+
<blue>180</blue>
126+
</color>
127+
</brush>
128+
</colorrole>
129+
</disabled>
130+
</palette>
131+
</property>
132+
<property name="autoFillBackground">
133+
<bool>false</bool>
134+
</property>
135+
<property name="html">
136+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
137+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
138+
p, li { white-space: pre-wrap; }
139+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
140+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;Solitaire Collection developped for GUI class of California State University, East Bay.&lt;/span&gt;&lt;/p&gt;
141+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
142+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;Author: Monique Ferreira Moledo&lt;/span&gt;&lt;/p&gt;
143+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
144+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;Credits:&lt;/span&gt;&lt;/p&gt;
145+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt; - Contribuitor and consultant: Professor Roger Doering&lt;/span&gt;&lt;/p&gt;
146+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
147+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;1st version - May,2016&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
148+
</property>
149+
</widget>
150+
</widget>
151+
<resources/>
152+
<connections>
153+
<connection>
154+
<sender>buttonBox</sender>
155+
<signal>accepted()</signal>
156+
<receiver>AboutDialog</receiver>
157+
<slot>accept()</slot>
158+
<hints>
159+
<hint type="sourcelabel">
160+
<x>248</x>
161+
<y>254</y>
162+
</hint>
163+
<hint type="destinationlabel">
164+
<x>157</x>
165+
<y>274</y>
166+
</hint>
167+
</hints>
168+
</connection>
169+
<connection>
170+
<sender>buttonBox</sender>
171+
<signal>rejected()</signal>
172+
<receiver>AboutDialog</receiver>
173+
<slot>reject()</slot>
174+
<hints>
175+
<hint type="sourcelabel">
176+
<x>316</x>
177+
<y>260</y>
178+
</hint>
179+
<hint type="destinationlabel">
180+
<x>286</x>
181+
<y>274</y>
182+
</hint>
183+
</hints>
184+
</connection>
185+
</connections>
186+
</ui>

‎again.png

3.79 KB
Loading

‎card.cpp

+307-26
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
#include "card.h"
2+
#include "rule.h"
3+
#include <QMessageBox>
4+
#include <QIcon>
5+
#include "winDialog.h"
26

3-
card::card(int v, QWidget * parent)
7+
card::card(pips p, suits s, int id, int v, QWidget * parent)
48
{
5-
9+
pip = p;
10+
suit = s;
11+
if(s == DIAMONDS || s == HEARTS ){
12+
cardColor = RED;
13+
}else{
14+
cardColor = BLACK;
15+
}
16+
setParent(parent);
17+
value = v;
18+
this->id = id;
19+
on = NULL;
20+
faceup = true;
21+
popUpCard = NULL;
622
}
723

8-
/*static definitions
9-
* QIMAge CARD:: faces[53];
10-
* bool initialized = false
11-
* Qpoint mousedownoffset
12-
*
13-
*
14-
*
15-
* initialize(){
16-
* if(initialized) return;
17-
* char suit[] = c,d,h,s
18-
* char pip[]= 123456789abcd
19-
* int n = 0
20-
* qstring fname = ":cards/c1.bmp";
21-
* for s=clubs; s<=spades;s++{
22-
* fname[8] = suit[s];
23-
* for p = ACE, p<= KING, p++{
24-
* fname[9] = pip[p]
25-
* faces[n++] = QImage(fname)}}
26-
* faces[n] = QImage("/cards/zCardBack.bmp");
27-
* */
28-
29-
QImage card::faces[53];
24+
QImage card::faces[54];
3025
bool card::initialized = false;
26+
QPoint card::mouseDownOffset; //initialized on mouse down event
27+
QPoint card::startDragPos;
28+
bool card::buttonDown = false;
29+
QPoint card::popUpPos;
30+
card* card::popUpCard;
31+
3132

3233
void card::Initialize(){
3334
if(initialized){
@@ -36,13 +37,293 @@ void card::Initialize(){
3637
char suit[] = {'c','d', 'h', 's'};
3738
char pip[] = {'1','2','3','4','5','6','7','8','9','a','b','c','d'};
3839
int n =0;
39-
QString fname = ":cards/c1.bmp";
40+
QString fname = ":/cards/c1.bmp";
4041
for(int s = CLUBS; s<= SPADES; s++){
4142
fname[8] = suit[s];
4243
for(int p=ACE; p<=KING; p++){
4344
fname[9] = pip[p];
4445
faces[n++] = QImage(fname);
4546
}
4647
}
47-
faces[n] = QImage("/cards/zCardBack.bmp");
48+
49+
faces[n] = QImage(":/cards/zCardBack.bmp");
50+
faces[n+1] = QImage(":/again.png");
51+
initialized = true;
52+
53+
}
54+
card::~card(){
55+
56+
}
57+
58+
void card::setImage(){
59+
if(initialized){
60+
if(faceup){
61+
QPixmap image = QPixmap::fromImage(faces[value]);
62+
setPixmap(image);
63+
}else{
64+
QPixmap image = QPixmap::fromImage(faces[52]);
65+
setPixmap(image);
66+
}
67+
}
68+
69+
}
70+
71+
bool card::okTodrag(Pile* pile){
72+
Rule* r1 = new RuleAlternateColors;
73+
Rule* r2 = new RuleMinusOne;
74+
return r1->enforce(pile,this) && r2->enforce(pile,this);
75+
}
76+
77+
void card::winCheck(){
78+
bool won = true;
79+
if(piles->value(0)->getType() == FOUNDATION){
80+
for(int i = 0; i<4; i++){
81+
if(piles->value(i+12)->frst()){
82+
if(piles->value(i+12)->frst()->getPip() != KING){
83+
won = false;
84+
break;
85+
}
86+
}else{
87+
won = false;
88+
break;
89+
}
90+
}
91+
}
92+
if(piles->value(0)->getType() == SFOUNDATION){
93+
for(int i = 15; i<23; i++){
94+
if(piles->value(i)->frst()){
95+
if(piles->value(i)->frst()->getPip() != ACE){
96+
won = false;
97+
break;
98+
}
99+
}else{
100+
won = false;
101+
break;
102+
}
103+
}
104+
}
105+
if(piles->value(0)->getType() == KFOUNDATION){
106+
for(int i = 9; i<13; i++){
107+
if(piles->value(i)->frst()){
108+
if(piles->value(i)->frst()->getPip() != KING){
109+
won = false;
110+
break;
111+
}
112+
}else{
113+
won = false;
114+
break;
115+
}
116+
}
117+
}
118+
WinDialog* wDlg = new WinDialog(this);
119+
// QMessageBox msgBox;
120+
// msgBox.setText("<font face=\"fantasy\" size=\"20pt\" color=\"dark green\"> Well done! </font>");
121+
wDlg->setWindowIcon(QIcon(QPixmap::fromImage(QImage(":/win.png"))));
122+
wDlg->setWindowTitle("You won!");
123+
if(won){
124+
wDlg->exec();
125+
history->clear();
126+
}
127+
}
128+
129+
void card::sequenceCheck(Pile* pile){
130+
if(pile->getType() == SFOUNDATION){
131+
RuleKingToAce* r1 = new RuleKingToAce;
132+
card* king = r1->enforce(pile, this);
133+
if(king){
134+
card* c= king;
135+
for(int i = 15; i< 23; i++){
136+
if(!piles->value(i)->frst()){
137+
while(c){
138+
card* aux = c->over;
139+
c->on->take(c);
140+
piles->value(i)->put(c);
141+
c = aux;
142+
}
143+
history->clear();
144+
break;
145+
}
146+
}
147+
}
148+
}
48149
}
150+
151+
void card::refill(){
152+
if(on->getType() == DECK && value == 53){
153+
card* c = piles->value(8)->frst();
154+
while(c){
155+
c->on->take(c);
156+
c->setFaceDown();
157+
c->setImage();
158+
piles->value(7)->put(c);
159+
c = piles->value(8)->frst();
160+
}
161+
history = NULL;
162+
}
163+
}
164+
165+
void card::setPile(Pile* p){
166+
on = p;
167+
}
168+
void card::mouseDoubleClickEvent(QMouseEvent *e){
169+
if ( e->button() == Qt::LeftButton ){
170+
int adjust = 0;
171+
if(on->getType() == FOUNDATION){
172+
adjust = 12;
173+
}else if(on->getType() == KFOUNDATION){
174+
adjust = 9;
175+
}
176+
177+
if(adjust >0 && faceup){
178+
for(int i=0; i<4; i++){
179+
if(piles->value(i+adjust)->oktoDrop(this,piles)){
180+
int cFaceDown = 200;
181+
if(under){
182+
if(!under->faceup){
183+
cFaceDown = under->id;
184+
}
185+
}
186+
Pile* from = on;
187+
QList<int>* cardsMoved = new QList<int>();
188+
cardsMoved->append(id);
189+
this->on->take(this);
190+
piles->value(i+adjust)->put(this);
191+
Move m(from,piles->value(i+adjust),cardsMoved,cFaceDown);
192+
history->push(m);
193+
winCheck();
194+
return;
195+
}
196+
}
197+
198+
}
199+
}
200+
}
201+
202+
void card::mousePressEvent(QMouseEvent* ev){
203+
buttonDown = false;
204+
switch (ev->button()) {
205+
case Qt::LeftButton:
206+
if(on->getType() == DECK && value == 53){
207+
refill();
208+
buttonDown = true;
209+
}else{
210+
if(on->getType() == DEAL){
211+
buttonDown = true;
212+
Pile* clicked = on;
213+
card* c = this;
214+
int i = 0;
215+
while(clicked->frst()){
216+
c=clicked->getCards()[0];
217+
c->setFaceUp();
218+
clicked->take(c);
219+
piles->value(i)->put(c);
220+
i++;
221+
}
222+
history->clear();
223+
return;
224+
}
225+
if(on->getType() == DECK && !faceup){
226+
buttonDown = true;
227+
piles->value(7)->take(this);
228+
this->setFaceUp();
229+
this->setImage();
230+
piles->value(8)->put(this);
231+
Pile* from = piles->value(7);
232+
QList<int>* cardsMoved = new QList<int>();
233+
cardsMoved->append(id);
234+
Move m(from,piles->value(8),cardsMoved,id);
235+
history->push(m);
236+
}
237+
startDragPos = pos();
238+
mouseDownOffset = pos() - ev->globalPos();
239+
//okToDrag = faceup && pile->canBeDragged(this);
240+
}
241+
break;
242+
default:
243+
break;
244+
}
245+
}
246+
247+
248+
void card::mouseMoveEvent(QMouseEvent* ev){
249+
250+
Rule* r1 = new RuleDeacresingAlternating;
251+
Rule* r2 = new RuleDeacresingSameSuit;
252+
253+
if(((on->getType()== FOUNDATION || on->getType()== SPACE || on->getType()== KFOUNDATION) && r1->enforce(this->on,this))
254+
|| (on->getType() == SFOUNDATION && !buttonDown && r2->enforce(this->on,this))
255+
|| (on->getType() == DECK && !buttonDown)
256+
|| (on->getType() == STOCK)){
257+
card* c = this;
258+
popUpCard = this;
259+
int i = 0;
260+
while(c){
261+
QPoint point = ev->globalPos() + mouseDownOffset;
262+
point.setY(point.y()+20*i);
263+
//QPoint move = point - QPoint(pos().x(), pos().y() + 20*i);
264+
c->move(point);
265+
c->raise();
266+
c = c->over;
267+
i++;
268+
}
269+
}
270+
}
271+
272+
273+
void card::mouseReleaseEvent(QMouseEvent* ev){
274+
if(ev->buttons()) return;
275+
if(popUpCard){
276+
int cFaceDown = 200;
277+
if(!faceup){
278+
cFaceDown = id;
279+
}else if(under && !under->faceup){
280+
cFaceDown = under->id;
281+
}
282+
Pile* from = on;
283+
QList<int>* cardsMoved = new QList<int>();
284+
card* c = popUpCard;
285+
QPoint posDroped = ev->globalPos() + mouseDownOffset;
286+
for(int i = 0; i<piles->size();i++){
287+
if(piles->value(i)->getType() != DECK){
288+
if(piles->value(i)->getType() != DEAL){
289+
double px = piles->value(i)->pos.x();
290+
double py = piles->value(i)->pos.y();
291+
double allpileY = py + piles->value(i)->getSize()*20 + 70;
292+
if(posDroped.x() - px < 20 && posDroped.y() < allpileY && posDroped.y() >= py){
293+
if(piles->value(i)!= popUpCard->on){
294+
if(piles->value(i)->oktoDrop(this, piles)){
295+
while(c){
296+
card* aux = c->over;
297+
c->on->take(c);
298+
piles->value(i)->put(c);
299+
cardsMoved->append(c->id);
300+
c = aux;
301+
}
302+
Move m(from,piles->value(i),cardsMoved,cFaceDown);
303+
history->push(m);
304+
sequenceCheck(piles->value(i));
305+
winCheck();
306+
popUpCard = NULL;
307+
return;
308+
}
309+
break;
310+
}
311+
break;
312+
}
313+
}
314+
}
315+
}
316+
int i = 0;
317+
while(c){
318+
card* aux = c->over;
319+
QPoint back(startDragPos.x(),startDragPos.y()+20*i);
320+
c->move(back);
321+
c = aux;
322+
i++;
323+
}
324+
popUpCard = NULL;
325+
return;
326+
}
327+
328+
}
329+

‎card.h

+53-44
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
21
#ifndef CARD_H
32
#define CARD_H
43
#include <QImage>
54
#include <QLabel>
5+
#include <QMouseEvent>
6+
#include "pile.h"
7+
#include "move.h"
8+
#include <QStack>
9+
#include <QList>
10+
#include <QStack>
11+
612
enum cardColors {BLACK, RED};
713
enum pips {ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING};
814
enum suits {CLUBS, DIAMONDS, HEARTS, SPADES };
@@ -11,52 +17,55 @@ class card: public QLabel
1117
{
1218

1319
private:
14-
static QImage faces[53];
20+
static QImage faces[54];
1521
static bool initialized;
16-
int value; //0 to 51
17-
// Card *under
18-
//Card *over;
19-
//Pile *pile;
20-
21-
/*no need in the 1st impl.
22-
* cardColors color;
23-
* pips pips
24-
* suits suit
25-
* bool faceup
26-
* bool moving
27-
* bool oktodrag
28-
*
29-
* bool hasMouseDown
30-
* static QPoint mouseDownOffset //distance to add to mouse pos to mo
31-
* static QPoint startDragPos;
32-
* static QT:MouseButtons button down;
33-
* static QPoint popUppos
34-
* static Card* popupcard
35-
* */
22+
static QPoint mouseDownOffset; //initialized on mouse down event
23+
static QPoint startDragPos;
24+
static bool buttonDown;
25+
static QPoint popUpPos;
26+
static card* popUpCard;
27+
card* over; //card that is over it on the pile
28+
card* under; //card that is under it on the pile
29+
Pile *on;
30+
pips pip;
31+
suits suit;
32+
cardColors cardColor;
33+
34+
35+
int value; //0 to 51 to get the image of the card
36+
int id;
37+
3638
public:
37-
card(int v, QWidget* parent =0);
38-
card(pips p , suits s, QWidget* parent = 0);
39+
card(pips p, suits s, int v, int id, QWidget* parent);
40+
~card();
41+
bool faceup;
42+
QList<Pile*>* piles;
3943
static void Initialize();
40-
/*
41-
* accessors
42-
*
43-
*
44-
* void mousePressEvent(QMOuseEvent * ev);
45-
* void mouseMoveEvent(QMOuseEvent * ev);
46-
* void mouseReleaseEvent(QMOuseEvent * ev);
47-
* void mouseDoubleClickEvent(QMOuseEvent * ev);
48-
*
49-
* */
44+
pips getPip(){return pip;}
45+
suits getSuit(){return suit;}
46+
cardColors getColor(){return cardColor;}
47+
card* getOver(){return over;}
48+
void setOver(card* c){over = c;}
49+
void setUnder(card* c){under = c;}
50+
void setPile(Pile* p);
51+
void setImage();
52+
int getId(){return id;}
53+
void mousePressEvent(QMouseEvent* ev);
54+
void mouseReleaseEvent(QMouseEvent* ev);
55+
void mouseMoveEvent(QMouseEvent* ev);
56+
void mouseDoubleClickEvent(QMouseEvent* ev);
57+
bool okTodrag(Pile* pile); // check if cards can be dragged
58+
void setFaceUp(){faceup = true; setImage();}
59+
void setFaceDown(){faceup = false;}
60+
bool isfaceup(){return faceup;}
61+
void winCheck();
62+
void sequenceCheck(Pile* piles); // for spider, checks if a sequence from Ace to King was made. If yes send it to stock pile
63+
void refill(); //for klondike, when the cards are over on the deck, refill it.
64+
QStack<Move>* history; //record movements
65+
void setHistory(QStack<Move>* h){history = h;}
66+
friend class Pile;
67+
5068
};
5169

52-
//void Shuffle(Card* Deck[], int n);
53-
//choose a random number to pick a card from the deck
54-
//action game triggered
55-
/*
56-
* if(game) delete game;
57-
* resize(600,600)
58-
* setsizepolicy(qsizepolicy(qsizepolicy::minimum,Qsizepolicy::minimum);
59-
* game = nre klondike
60-
*/
61-
//qsrand(t.elapsed());
70+
6271
#endif // CARD_H

‎cardgame.cpp

+110-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,123 @@
11
#include "cardgame.h"
22
#include "ui_cardgame.h"
3+
#include "pile.h"
4+
#include "card.h"
5+
#include "freecell.h"
6+
#include "spider.h"
7+
#include "klondike.h"
8+
#include "helpdialog.h"
9+
#include "aboutdialog.h"
10+
#include <QMessageBox>
11+
#include <QIcon>
312

413
CardGame::CardGame(QWidget *parent) :
514
QMainWindow(parent),
615
ui(new Ui::CardGame)
716
{
817
ui->setupUi(this);
9-
}
18+
QPixmap icon = QPixmap::fromImage(QImage(":/icon.png"));
19+
this->setWindowIcon(QIcon(icon));
20+
this->setWindowTitle("Solitaire");
21+
card::Initialize();
1022

23+
}
1124
CardGame::~CardGame()
1225
{
26+
27+
piles.clear();
1328
delete ui;
1429
}
30+
void CardGame::on_action_Redeal_triggered()
31+
{
32+
if(game){
33+
game->redeal();
34+
}
35+
36+
}
37+
38+
void CardGame::on_action_Freecell_triggered()
39+
{
40+
if(game){
41+
game->clear();
42+
// game->~games();
43+
}
44+
game = new freecell(ui->centralWidget);
45+
game->generateDeck();
46+
game->setUp();
47+
}
48+
49+
void CardGame::on_action_Spider_triggered()
50+
{
51+
if(game){
52+
game->clear();
53+
//game->~games();
54+
}
55+
game = new spider(ui->centralWidget);
56+
game->generateDeck();
57+
game->setUp();
58+
}
59+
60+
void CardGame::on_action_Klondike_triggered()
61+
{
62+
if(game){
63+
game->clear();
64+
// game->~games();
65+
}
66+
game = new klondike(ui->centralWidget);
67+
game->generateDeck();
68+
game->setUp();
69+
}
70+
71+
72+
void CardGame::on_action_About_triggered()
73+
{
74+
AboutDialog *aDialog = new AboutDialog(this);
75+
aDialog->setWindowIcon(QIcon(QPixmap::fromImage(QImage(":/info.png"))));
76+
aDialog->setWindowTitle("About");
77+
aDialog->show();
78+
79+
}
80+
81+
card* CardGame:: getCard(int id, Pile* on){
82+
for(int i = 0; i< on->getSize(); i++){
83+
if(on->getCards()[i]->getId() == id){
84+
return on->getCards()[i];
85+
}
86+
}
87+
return NULL;
88+
}
89+
90+
void CardGame::on_action_Undo_triggered()
91+
{
92+
if(game){
93+
if(game->getMoves()){
94+
if(!game->getMoves()->empty()){
95+
Move m = game->getMoves()->pop();
96+
for(int i=0;i<m.getCards()->size();i++){
97+
int id = m.getCards()->value(i);
98+
card* c = getCard(id,m.getTo());
99+
if(m.getCardFaceDown()!=200){
100+
if(m.getCardFaceDown()!= m.getCards()->value(0)){
101+
card* cFaceDown = getCard(m.getCardFaceDown(),m.getFrom());
102+
cFaceDown->setFaceDown();
103+
cFaceDown->setImage();
104+
}else{
105+
card* cFaceDown = getCard(m.getCardFaceDown(),m.getTo());
106+
cFaceDown->setFaceDown();
107+
cFaceDown->setImage();
108+
}
109+
}
110+
m.getTo()->take(c);
111+
m.getFrom()->put(c);
112+
}
113+
}
114+
}
115+
}
116+
}
117+
118+
void CardGame::on_action_Help_triggered()
119+
{
120+
HelpDialog *hd = new HelpDialog(this);
121+
hd->setWindowTitle("Help");
122+
hd->show();
123+
}

‎cardgame.h

+24
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#define CARDGAME_H
33

44
#include <QMainWindow>
5+
#include "card.h"
6+
#include "games.h"
7+
58

69
namespace Ui {
710
class CardGame;
@@ -13,10 +16,31 @@ class CardGame : public QMainWindow
1316

1417
public:
1518
explicit CardGame(QWidget *parent = 0);
19+
20+
QList<Pile*> piles;
21+
card* getCard(int id, Pile* on);
1622
~CardGame();
1723

24+
25+
private slots:
26+
void on_action_Redeal_triggered();
27+
28+
void on_action_Freecell_triggered();
29+
30+
void on_action_Spider_triggered();
31+
32+
void on_action_Klondike_triggered();
33+
34+
void on_action_About_triggered();
35+
36+
void on_action_Undo_triggered();
37+
38+
void on_action_Help_triggered();
39+
1840
private:
1941
Ui::CardGame *ui;
42+
card* deck[104];
43+
games* game = NULL;
2044
};
2145

2246
#endif // CARDGAME_H

‎cardgame.ui

+40-31
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>652</width>
10-
<height>416</height>
9+
<width>1021</width>
10+
<height>685</height>
1111
</rect>
1212
</property>
1313
<property name="palette">
@@ -80,27 +80,13 @@
8080
<property name="autoFillBackground">
8181
<bool>true</bool>
8282
</property>
83-
<widget class="QWidget" name="centralWidget">
84-
<widget class="card" name="label">
85-
<property name="geometry">
86-
<rect>
87-
<x>50</x>
88-
<y>140</y>
89-
<width>111</width>
90-
<height>151</height>
91-
</rect>
92-
</property>
93-
<property name="text">
94-
<string>TextLabel</string>
95-
</property>
96-
</widget>
97-
</widget>
83+
<widget class="QWidget" name="centralWidget"/>
9884
<widget class="QMenuBar" name="menuBar">
9985
<property name="geometry">
10086
<rect>
10187
<x>0</x>
10288
<y>0</y>
103-
<width>652</width>
89+
<width>1021</width>
10490
<height>26</height>
10591
</rect>
10692
</property>
@@ -112,23 +98,22 @@
11298
<property name="title">
11399
<string>&amp;New</string>
114100
</property>
101+
<addaction name="action_Freecell"/>
102+
<addaction name="action_Spider"/>
115103
<addaction name="action_Klondike"/>
116104
</widget>
117105
<addaction name="menu_New"/>
118106
<addaction name="action_Redeal"/>
119-
</widget>
120-
<widget class="QMenu" name="menuEdit">
121-
<property name="title">
122-
<string>&amp;Edit</string>
123-
</property>
107+
<addaction name="action_Undo"/>
124108
</widget>
125109
<widget class="QMenu" name="menu_Help">
126110
<property name="title">
127111
<string>&amp;Help</string>
128112
</property>
113+
<addaction name="action_Help"/>
114+
<addaction name="action_About"/>
129115
</widget>
130116
<addaction name="menu_Game"/>
131-
<addaction name="menuEdit"/>
132117
<addaction name="menu_Help"/>
133118
</widget>
134119
<widget class="QToolBar" name="mainToolBar">
@@ -144,21 +129,45 @@
144129
<property name="text">
145130
<string>&amp;Redeal</string>
146131
</property>
132+
<property name="shortcut">
133+
<string>Ctrl+R</string>
134+
</property>
135+
</action>
136+
<action name="action_Freecell">
137+
<property name="text">
138+
<string>&amp;Freecell</string>
139+
</property>
140+
</action>
141+
<action name="action_Spider">
142+
<property name="text">
143+
<string>&amp;Spider</string>
144+
</property>
147145
</action>
148146
<action name="action_Klondike">
149147
<property name="text">
150148
<string>&amp;Klondike</string>
151149
</property>
152150
</action>
151+
<action name="action_About">
152+
<property name="text">
153+
<string>&amp;About</string>
154+
</property>
155+
</action>
156+
<action name="action_Undo">
157+
<property name="text">
158+
<string>&amp;Undo</string>
159+
</property>
160+
<property name="shortcut">
161+
<string>Ctrl+Z</string>
162+
</property>
163+
</action>
164+
<action name="action_Help">
165+
<property name="text">
166+
<string>&amp;Help</string>
167+
</property>
168+
</action>
153169
</widget>
154170
<layoutdefault spacing="6" margin="11"/>
155-
<customwidgets>
156-
<customwidget>
157-
<class>card</class>
158-
<extends>QLabel</extends>
159-
<header location="global">card.h</header>
160-
</customwidget>
161-
</customwidgets>
162171
<resources/>
163172
<connections/>
164173
</ui>

‎cardimages.qrc

+59-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
11
<RCC>
2-
<qresource prefix="/"/>
2+
<qresource prefix="/">
3+
<file>cards/c1.bmp</file>
4+
<file>cards/c2.bmp</file>
5+
<file>cards/c3.bmp</file>
6+
<file>cards/c4.bmp</file>
7+
<file>cards/c5.bmp</file>
8+
<file>cards/c6.bmp</file>
9+
<file>cards/c7.bmp</file>
10+
<file>cards/c8.bmp</file>
11+
<file>cards/c9.bmp</file>
12+
<file>cards/ca.bmp</file>
13+
<file>cards/cb.bmp</file>
14+
<file>cards/cc.bmp</file>
15+
<file>cards/cd.bmp</file>
16+
<file>cards/d1.bmp</file>
17+
<file>cards/d2.bmp</file>
18+
<file>cards/d3.bmp</file>
19+
<file>cards/d4.bmp</file>
20+
<file>cards/d5.bmp</file>
21+
<file>cards/d6.bmp</file>
22+
<file>cards/d7.bmp</file>
23+
<file>cards/d8.bmp</file>
24+
<file>cards/d9.bmp</file>
25+
<file>cards/da.bmp</file>
26+
<file>cards/db.bmp</file>
27+
<file>cards/dc.bmp</file>
28+
<file>cards/dd.bmp</file>
29+
<file>cards/h1.bmp</file>
30+
<file>cards/h2.bmp</file>
31+
<file>cards/h3.bmp</file>
32+
<file>cards/h4.bmp</file>
33+
<file>cards/h5.bmp</file>
34+
<file>cards/h6.bmp</file>
35+
<file>cards/h7.bmp</file>
36+
<file>cards/h8.bmp</file>
37+
<file>cards/h9.bmp</file>
38+
<file>cards/ha.bmp</file>
39+
<file>cards/hb.bmp</file>
40+
<file>cards/hc.bmp</file>
41+
<file>cards/hd.bmp</file>
42+
<file>cards/s1.bmp</file>
43+
<file>cards/s2.bmp</file>
44+
<file>cards/s3.bmp</file>
45+
<file>cards/s4.bmp</file>
46+
<file>cards/s5.bmp</file>
47+
<file>cards/s6.bmp</file>
48+
<file>cards/s7.bmp</file>
49+
<file>cards/s8.bmp</file>
50+
<file>cards/s9.bmp</file>
51+
<file>cards/sa.bmp</file>
52+
<file>cards/sb.bmp</file>
53+
<file>cards/sc.bmp</file>
54+
<file>cards/sd.bmp</file>
55+
<file>cards/zCardBack.bmp</file>
56+
<file>icon.png</file>
57+
<file>win.png</file>
58+
<file>again.png</file>
59+
<file>info.png</file>
60+
</qresource>
361
</RCC>

‎freecell.cpp

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#include "freecell.h"
2+
#include <QTime>
3+
#include <QIcon>
4+
#include "pile.h"
5+
#include <QList>
6+
#include "card.h"
7+
8+
freecell::freecell(QWidget *parent):games(parent)
9+
{
10+
// setParent(parent);
11+
}
12+
13+
void freecell::setUp(){
14+
shuffle(deck,1);
15+
piles.append(new Pile(FOUNDATION,QPoint(30,190), parentWidget()));
16+
piles.append(new Pile(FOUNDATION,QPoint(120,190), parentWidget()));
17+
piles.append(new Pile(FOUNDATION,QPoint(210,190), parentWidget()));
18+
piles.append(new Pile(FOUNDATION,QPoint(300,190), parentWidget()));
19+
piles.append(new Pile(FOUNDATION,QPoint(400,190), parentWidget()));
20+
piles.append(new Pile(FOUNDATION,QPoint(490,190), parentWidget()));
21+
piles.append(new Pile(FOUNDATION,QPoint(580,190), parentWidget()));
22+
piles.append(new Pile(FOUNDATION,QPoint(670,190), parentWidget()));
23+
piles.append(new Pile(SPACE,QPoint(30,40), parentWidget()));
24+
piles.append(new Pile(SPACE,QPoint(120,40), parentWidget()));
25+
piles.append(new Pile(SPACE,QPoint(210,40), parentWidget()));
26+
piles.append(new Pile(SPACE,QPoint(300,40), parentWidget()));
27+
piles.append(new Pile(STOCK,QPoint(410,40), parentWidget()));
28+
piles.append(new Pile(STOCK,QPoint(500,40), parentWidget()));
29+
piles.append(new Pile(STOCK,QPoint(590,40), parentWidget()));
30+
piles.append(new Pile(STOCK,QPoint(680,40), parentWidget()));
31+
placeCards1();
32+
}
33+
34+
void freecell::placeCards1(){
35+
36+
for(int i = 0; i<6;i++ ){
37+
piles.value(0)->put(deck[i]);
38+
piles.value(1)->put(deck[i + 6]);
39+
piles.value(2)->put(deck[i + 6*2]);
40+
piles.value(3)->put(deck[i + 6*3]);
41+
piles.value(4)->put(deck[i + 6*4]);
42+
piles.value(5)->put(deck[i + 6*5]);
43+
piles.value(6)->put(deck[i + 6*6]);
44+
piles.value(7)->put(deck[i + 6*7]);
45+
}
46+
piles.value(0)->put(deck[48]);
47+
piles.value(1)->put(deck[49]);
48+
piles.value(2)->put(deck[50]);
49+
piles.value(3)->put(deck[51]);
50+
for(int i = 0; i<52;i++ ){
51+
deck[i]->setImage();
52+
deck[i]->show();
53+
}
54+
55+
}
56+
57+
void freecell::redeal(){
58+
59+
for(int i = 0; i<piles.size(); i++){
60+
piles.value(i)->~Pile();
61+
}
62+
piles.clear();
63+
history.clear();
64+
setUp();
65+
}
66+
67+
void freecell::clear(){
68+
for(int i = 0; i<piles.size(); i++){
69+
piles.value(i)->~Pile();
70+
}
71+
/* for(int i = 0; i<104; i++){
72+
deck[i] = NULL;
73+
}*/
74+
piles.clear();
75+
history.clear();
76+
}

‎freecell.h

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef FREECELL_H
2+
#define FREECELL_H
3+
4+
#include "card.h"
5+
#include "games.h"
6+
7+
class freecell: public games
8+
{
9+
public:
10+
freecell(QWidget *parent);
11+
12+
void placeCards1();
13+
void setUp();
14+
void redeal();
15+
void clear();
16+
};
17+
18+
#endif // FREECELL_H

‎games.cpp

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#include "games.h"
2+
#include <QTime>
3+
#include <QIcon>
4+
#include "pile.h"
5+
#include <QList>
6+
7+
games::games(QWidget* parent)
8+
{
9+
setParent(parent);
10+
}
11+
games::~games(){
12+
for(int i = 0; i<104; i++){
13+
deck[i] = NULL;
14+
}
15+
}
16+
17+
void games::shuffle(card *deck[], int n){
18+
QTime time = QTime::currentTime();
19+
qsrand((uint)time.msec());
20+
for(int i = 0; i<52*n;i++ ){
21+
int r = qrand()%52;
22+
card *temp = deck[i];
23+
deck[i] = deck[r];
24+
deck[r] = temp;
25+
}
26+
}
27+
28+
void games::generateDeck(){
29+
//char* suit[] = {'c','d', 'h', 's'};
30+
pips pip[] = {ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING};
31+
for(int i = 0; i<13;i++ ){
32+
deck[i] = new card(pip[i], CLUBS, i,i,parentWidget());
33+
deck[i]->piles = &piles;
34+
deck[i]->setHistory(&history);
35+
deck[i]->setImage();
36+
deck[i]->show();
37+
}
38+
for(int i = 13; i<26;i++ ){
39+
deck[i] = new card(pip[i-13], DIAMONDS, i,i,parentWidget());
40+
deck[i]->piles = &piles;
41+
deck[i]->setHistory(&history);
42+
deck[i]->setImage();
43+
deck[i]->show();
44+
}
45+
for(int i = 26; i<39;i++ ){
46+
deck[i] = new card( pip[i-26], HEARTS, i,i,parentWidget());
47+
deck[i]->piles = &piles;
48+
deck[i]->setHistory(&history);
49+
deck[i]->setImage();
50+
deck[i]->show();
51+
}
52+
for(int i = 39; i<52 ;i++ ){
53+
deck[i] = new card(pip[i-39], SPADES, i,i,parentWidget());
54+
deck[i]->piles = &piles;
55+
deck[i]->setHistory(&history);
56+
deck[i]->setImage();
57+
deck[i]->show();
58+
}
59+
60+
61+
}
62+
63+
void games::pushMove(Move m){
64+
history.push(m);
65+
}
66+
67+
QStack<Move>* games::getMoves(){
68+
return &history;
69+
}

‎games.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef GAMES_H
2+
#define GAMES_H
3+
#include "card.h"
4+
#include "move.h"
5+
#include <QStack>
6+
7+
class games: public QWidget
8+
{
9+
public:
10+
games(QWidget* parent);
11+
~games();
12+
virtual void generateDeck(); //create cards and set its image
13+
void shuffle(card* deck[], int n); //shuffle the deck
14+
virtual void setUp()=0; //shuffles the deck, create game piles and place the cards
15+
virtual void redeal()=0;//starts again the game with a new deck
16+
virtual void clear()=0;
17+
QList<Pile*> piles;
18+
void pushMove(Move m);
19+
QStack<Move>* getMoves();
20+
21+
protected:
22+
card* deck[104];
23+
QStack<Move> history;
24+
};
25+
26+
#endif // GAMES_H

‎helpdialog.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "helpdialog.h"
2+
#include "ui_helpdialog.h"
3+
4+
HelpDialog::HelpDialog(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::HelpDialog)
7+
{
8+
ui->setupUi(this);
9+
ui->tabWidget->setTabText(0, "Freecell");
10+
ui->tabWidget->setTabText(1, "Klondike");
11+
ui->tabWidget->setTabText(2, "Spider");
12+
}
13+
14+
HelpDialog::~HelpDialog()
15+
{
16+
delete ui;
17+
}

‎helpdialog.h

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef HELPDIALOG_H
2+
#define HELPDIALOG_H
3+
4+
#include <QDialog>
5+
6+
namespace Ui {
7+
class HelpDialog;
8+
}
9+
10+
class HelpDialog : public QDialog
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit HelpDialog(QWidget *parent = 0);
16+
~HelpDialog();
17+
18+
private:
19+
Ui::HelpDialog *ui;
20+
};
21+
22+
#endif // HELPDIALOG_H

‎helpdialog.ui

+237
Large diffs are not rendered by default.

‎icon.png

38.4 KB
Loading

‎info.png

6.62 KB
Loading

‎klondike.cpp

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#include "klondike.h"
2+
#include "pile.h"
3+
#include <QList>
4+
#include "card.h"
5+
6+
klondike::klondike(QWidget* parent): games(parent)
7+
{
8+
9+
}
10+
void klondike::setUp(){
11+
shuffle(deck,1);
12+
piles.append(new Pile(KFOUNDATION,QPoint(60,190), parentWidget()));
13+
piles.append(new Pile(KFOUNDATION,QPoint(170,190), parentWidget()));
14+
piles.append(new Pile(KFOUNDATION,QPoint(280,190), parentWidget()));
15+
piles.append(new Pile(KFOUNDATION,QPoint(390,190), parentWidget()));
16+
piles.append(new Pile(KFOUNDATION,QPoint(500,190), parentWidget()));
17+
piles.append(new Pile(KFOUNDATION,QPoint(610,190), parentWidget()));
18+
piles.append(new Pile(KFOUNDATION,QPoint(720,190), parentWidget()));
19+
20+
piles.append(new Pile(DECK,QPoint(40,40), parentWidget()));
21+
piles.append(new Pile(DECK,QPoint(150,40), parentWidget()));
22+
23+
piles.append(new Pile(STOCK,QPoint(410,40), parentWidget()));
24+
piles.append(new Pile(STOCK,QPoint(500,40), parentWidget()));
25+
piles.append(new Pile(STOCK,QPoint(590,40), parentWidget()));
26+
piles.append(new Pile(STOCK,QPoint(680,40), parentWidget()));
27+
placeCards1();
28+
29+
}
30+
void klondike::placeCards1(){
31+
int t =0;
32+
for(int i=0; i<7; i++){
33+
for(int j=0; j<i+1; j++, t++){
34+
piles.value(i)->put(deck[t]);
35+
if(j!=i){
36+
deck[t]->setFaceDown();
37+
deck[t]->setImage();
38+
}else{
39+
deck[t]->setFaceUp();
40+
deck[t]->setImage();
41+
}
42+
}
43+
}
44+
deck[52] = new card(ACE, DIAMONDS, 52, 53,parentWidget());
45+
deck[52]->piles = &piles;
46+
deck[52]->setImage();
47+
deck[52]->show();
48+
piles.value(7)->put(deck[52]);
49+
for(int i=28; i<52; i++){
50+
piles.value(7)->put(deck[i]);
51+
deck[i]->setFaceDown();
52+
deck[i]->setImage();
53+
}
54+
55+
56+
}
57+
void klondike::redeal(){
58+
for(int i = 0; i<piles.size(); i++){
59+
piles.value(i)->~Pile();
60+
}
61+
piles.clear();
62+
history.clear();
63+
setUp();
64+
}
65+
void klondike::clear(){
66+
for(int i = 0; i<piles.size(); i++){
67+
piles.value(i)->~Pile();
68+
}
69+
/* for(int i = 0; i<104; i++){
70+
deck[i] = NULL;
71+
}*/
72+
piles.clear();
73+
history.clear();
74+
}

‎klondike.h

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef KLONDIKE_H
2+
#define KLONDIKE_H
3+
#include "card.h"
4+
#include "games.h"
5+
6+
7+
class klondike: public games
8+
{
9+
public:
10+
klondike(QWidget* parent);
11+
void placeCards1();
12+
void setUp();
13+
void redeal();
14+
void clear();
15+
// void generateDeck(int n);
16+
};
17+
18+
#endif // KLONDIKE_H

‎move.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "move.h"
2+
3+
Move::Move(Pile* f, Pile* t, QList<int>* cs, int cardFaceDown):
4+
from(f),
5+
to(t),
6+
cards(cs),
7+
cardFaceDown(cardFaceDown)
8+
{
9+
10+
};
11+
12+
Move::Move(): from(NULL),to(NULL){
13+
};
14+

‎move.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef MOVE_H
2+
#define MOVE_H
3+
#include "pile.h"
4+
#include <QList>
5+
6+
7+
class Move
8+
{
9+
private:
10+
Pile* from;
11+
Pile* to;
12+
QList<int>* cards;
13+
int cardFaceDown;
14+
public:
15+
Move(Pile* f,Pile* t, QList<int>* cs, int cardFaceDown);
16+
Move();
17+
Pile* getFrom(){return from;}
18+
Pile* getTo(){ return to;}
19+
QList<int>* getCards(){ return cards;}
20+
int getCardFaceDown(){return cardFaceDown;}
21+
};
22+
23+
24+
#endif // MOVE_H

‎pile.cpp

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
2+
#include "card.h"
3+
#include "rule.h"
4+
5+
Pile::Pile(pileType pt, QPoint position, QWidget* parent)
6+
{
7+
setParent(parent);
8+
pos = position;
9+
size = 0;
10+
tp = pt;
11+
first = NULL;
12+
13+
14+
setFrameShape(Box);
15+
setLineWidth(2);
16+
resize(71,96);
17+
move(pos);
18+
//palette().setColor(BACKGROUND_ROLE,BLACK);
19+
show();
20+
21+
}
22+
23+
Pile::~Pile()
24+
{
25+
for(int i = 0; i < size; i++){
26+
cards[i]->clear();
27+
}
28+
first = NULL;
29+
size = 0;
30+
31+
}
32+
card* Pile::frst(){
33+
return first;
34+
}
35+
36+
bool Pile::oktoDrop(card*c, QList<Pile*>* piles){
37+
if(tp == SPACE && (size > 0 || c->getOver())){
38+
return false;
39+
}
40+
if(tp == STOCK && !c->getOver()){
41+
Rule* r1 = new RulePlusOne;
42+
Rule* r2 = new RuleIsAce;
43+
return r1->enforce(this,c) || r2->enforce(this,c);
44+
}else if(tp == STOCK && c->getOver()){
45+
return false;
46+
}
47+
if(tp == FOUNDATION){
48+
Rule* r1 = new RuleAlternateColors;
49+
Rule* r2 = new RuleMinusOne;
50+
RuleMaxCards* r3 = new RuleMaxCards;
51+
return r1->enforce(this,c) && r2->enforce(this,c) && r3->enforce(piles,c);
52+
}
53+
if(tp == SFOUNDATION){
54+
Rule* r1 = new RuleAlternateColors;
55+
Rule* r2 = new RuleMinusOne;
56+
Rule* r3 = new RuleSameSuit;
57+
return (r1->enforce(this,c) && r2->enforce(this,c)) ||
58+
(r3->enforce(this,c) && r2->enforce(this,c));
59+
}
60+
if(tp == KFOUNDATION){
61+
Rule* r1 = new RuleAlternateColors;
62+
Rule* r2 = new RuleMinusOne;
63+
Rule* r3 = new RuleJustKing;
64+
return r1->enforce(this,c) && r2->enforce(this,c)&& r3->enforce(this,c);
65+
}
66+
return true;
67+
68+
}
69+
70+
void Pile::put(card* c){
71+
if(size == 0){
72+
cards[size] = c;
73+
c->setUnder(NULL);
74+
size++;
75+
first = c;
76+
c->setPile(this);
77+
c->setOver(NULL);
78+
c->move(pos);
79+
c->raise();
80+
}else{
81+
cards[size] = c;
82+
cards[size-1]->setOver(c);
83+
c->setUnder(cards[size-1]);
84+
size++;
85+
first = c;
86+
c->setPile(this);
87+
c->setOver(NULL);
88+
c->move(QPoint(pos.x(),pos.y()+20*(size-1)));
89+
if(tp == STOCK){
90+
c->move(pos);
91+
}
92+
if(tp == DEAL){
93+
c->move(pos);
94+
}
95+
if(tp == DECK){
96+
c->move(pos);
97+
}
98+
c->raise();
99+
resize(71,96);
100+
}
101+
}
102+
103+
void Pile::take(card* c){
104+
if(size == 1){
105+
if(cards[0]->getId() == c->getId()){
106+
cards[0] = NULL;
107+
size--;
108+
first = NULL;
109+
}
110+
}else{
111+
for(int i = 0; i <size; i++){
112+
if(cards[i]){
113+
if(cards[i]->getId() == c->getId()){
114+
for(int j = i; j<size-1; j++){
115+
cards[j] = cards[j+1];
116+
}
117+
//cards[i] = NULL;
118+
size--;
119+
first = cards[size-1];
120+
first->setOver(NULL);
121+
if(!first->isfaceup() && getType()!=DECK){
122+
first->setFaceUp();
123+
first->setImage();
124+
}
125+
}
126+
}
127+
128+
}
129+
}
130+
}

‎pile.h

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef PILE_H
2+
#define PILE_H
3+
#include <QWidget>
4+
#include <QLabel>
5+
6+
7+
class card;
8+
9+
enum pileType{KFOUNDATION, SFOUNDATION, FOUNDATION, SPACE, STOCK, DEAL,DECK};
10+
11+
class Pile: public QLabel
12+
{
13+
14+
private:
15+
card* cards[53];
16+
int size;
17+
card* first;
18+
pileType tp;
19+
20+
public:
21+
QPoint pos;
22+
pileType getType(){return tp;}
23+
card** getCards(){return cards;}
24+
Pile(pileType pt, QPoint position, QWidget* parent);
25+
~Pile();
26+
void put(card* card);
27+
card* frst(); //returns the first card on the pile
28+
card* last(){return cards[0];} //returns the card last in the pile;
29+
int getSize(){return size;} //return number of cards in the pile
30+
void take(card* c); // takes a card from the pile
31+
bool oktoDrop(card* c, QList<Pile*>* piles); //checks if those cards can be dropped in this pile
32+
33+
};
34+
#endif // PILE_H

‎rule.cpp

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#include "rule.h"
2+
#include "pile.h"
3+
#include "card.h"
4+
#include "math.h"
5+
6+
7+
bool RuleAlternateColors::enforce(Pile *pile, card *card){
8+
if(pile->frst()){
9+
if(pile->frst()->getColor() != card->getColor()){
10+
return true;
11+
}else{
12+
return false;
13+
}
14+
}
15+
return true;
16+
}
17+
18+
bool RuleSameSuit::enforce(Pile *pile, card *card){
19+
if(pile->frst()){
20+
if(pile->frst()->getSuit() == card->getSuit()){
21+
return true;
22+
}else{
23+
return false;
24+
}
25+
}
26+
return true;
27+
}
28+
bool RuleJustKing::enforce(Pile *pile, card *card){
29+
if(!pile->frst()){
30+
if(card->getPip() == KING){
31+
return true;
32+
}else{
33+
return false;
34+
}
35+
}
36+
return true;
37+
}
38+
39+
bool RuleMaxCards::enforce(QList<Pile*>* piles, card* cd){
40+
int nToMove = 0;
41+
card* c = cd;
42+
while(c){
43+
nToMove++;
44+
c = c->getOver();
45+
}
46+
int nFreeCol = 0;
47+
for(int i =0; i<16; i++){
48+
if(piles->value(i)->getType() == FOUNDATION){
49+
if(!piles->value(i)->frst()){
50+
nFreeCol++;
51+
}
52+
}
53+
}
54+
int nFreeCell = 0;
55+
for(int i =0; i<16; i++){
56+
if(piles->value(i)->getType() == SPACE){
57+
if(!piles->value(i)->frst()){
58+
nFreeCell++;
59+
}
60+
}
61+
}
62+
return nToMove <= ((1 + nFreeCell) * (pow(2,nFreeCol)));
63+
}
64+
65+
bool RuleIsAce::enforce(Pile *pile, card* card){
66+
if(!pile->frst()){
67+
if(card->getPip() == ACE){
68+
return true;
69+
}else{
70+
return false;
71+
}
72+
}
73+
return false;
74+
}
75+
bool RuleMinusOne::enforce(Pile *pile, card *card){
76+
if(pile->frst()){
77+
if(pile->frst()->getPip() - card->getPip() == 1){
78+
return true;
79+
}else{
80+
return false;
81+
}
82+
}
83+
return true;
84+
85+
}
86+
87+
bool RulePlusOne::enforce(Pile *pile, card *card){
88+
if(pile->frst()){
89+
if((card->getSuit() == pile->frst()->getSuit()) && card->getPip() - pile->frst()->getPip() == 1){
90+
return true;
91+
}else{
92+
return false;
93+
}
94+
}else{
95+
return false;
96+
}
97+
}
98+
99+
bool RuleDeacresingAlternating::enforce(Pile*pile,card*card){
100+
bool ok = true;
101+
//card is the first card to be dragged
102+
while(ok && card->getOver()){
103+
ok = (card->getPip() - card->getOver()->getPip() == 1) &&
104+
(card->getColor() != card->getOver()->getColor());
105+
card = card->getOver();
106+
}
107+
return ok;
108+
};
109+
110+
bool RuleDeacresingSameSuit::enforce(Pile*pile, card* card){
111+
bool ok = true;
112+
//card is the first card to be dragged
113+
while(ok && card->getOver()){
114+
ok = (card->getPip() - card->getOver()->getPip() == 1) &&
115+
(card->getSuit() == card->getOver()->getSuit());
116+
card = card->getOver();
117+
}
118+
return ok;
119+
};
120+
121+
card* RuleKingToAce::enforce(Pile*pile, card* cd){
122+
bool ok = true;
123+
card* king = NULL;
124+
cd = pile->last();
125+
while(cd && cd->getOver()){
126+
if(cd->getPip() == KING && cd->isfaceup()){
127+
ok = true;
128+
king = cd;
129+
while(ok && cd->getOver()){
130+
if( (cd->getPip() - cd->getOver()->getPip() == 1) &&
131+
(cd->getSuit() == cd->getOver()->getSuit())){
132+
cd = cd->getOver();
133+
}else{
134+
ok = false;
135+
}
136+
}
137+
}
138+
if(ok && cd->getPip() == ACE){
139+
return king;
140+
}
141+
cd = cd->getOver();
142+
}
143+
return NULL;
144+
145+
};

‎rule.h

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifndef RULE_H
2+
#define RULE_H
3+
class Pile;
4+
class card;
5+
#include <QList>
6+
7+
class Rule
8+
{
9+
public:
10+
virtual bool enforce(Pile* pile, card* card)=0;
11+
};
12+
13+
class RuleAlternateColors:public Rule{
14+
bool enforce(Pile* pile, card* card);
15+
};
16+
class RuleMinusOne:public Rule{
17+
bool enforce(Pile* pile, card* card);
18+
};
19+
class RuleDeacresingAlternating:public Rule{
20+
bool enforce(Pile* pile, card* card);
21+
};
22+
class RulePlusOne:public Rule{
23+
bool enforce(Pile* pile, card* card);
24+
};
25+
class RuleIsAce:public Rule{
26+
bool enforce(Pile* pile, card* card);
27+
};
28+
class RuleMaxCards{
29+
public:
30+
bool enforce(QList<Pile*>* piles, card* card);
31+
};
32+
33+
class RuleDeacresingSameSuit:public Rule{
34+
public:
35+
bool enforce(Pile* pile, card* card);
36+
};
37+
class RuleKingToAce{
38+
public:
39+
card* enforce(Pile* pile, card* card);
40+
};
41+
42+
class RuleSameSuit:public Rule{
43+
public:
44+
bool enforce(Pile* pile, card* card);
45+
};
46+
class RuleJustKing:public Rule{
47+
public:
48+
bool enforce(Pile* pile, card* card);
49+
};
50+
#endif // RULE_H

‎spider.cpp

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#include "spider.h"
2+
#include "pile.h"
3+
#include <QList>
4+
#include "card.h"
5+
6+
spider::spider(QWidget* parent): games(parent)
7+
{
8+
//setParent(parent);
9+
}
10+
void spider::setUp(){
11+
shuffle(deck,2);
12+
//this->parentWidget()->resize(1000,900);
13+
piles.append(new Pile(SFOUNDATION,QPoint(30,40), parentWidget()));
14+
piles.append(new Pile(SFOUNDATION,QPoint(120,40), parentWidget()));
15+
piles.append(new Pile(SFOUNDATION,QPoint(210,40), parentWidget()));
16+
piles.append(new Pile(SFOUNDATION,QPoint(300,40), parentWidget()));
17+
piles.append(new Pile(SFOUNDATION,QPoint(390,40), parentWidget()));
18+
piles.append(new Pile(SFOUNDATION,QPoint(480,40), parentWidget()));
19+
piles.append(new Pile(SFOUNDATION,QPoint(570,40), parentWidget()));
20+
piles.append(new Pile(SFOUNDATION,QPoint(660,40), parentWidget()));
21+
piles.append(new Pile(SFOUNDATION,QPoint(750,40), parentWidget()));
22+
piles.append(new Pile(SFOUNDATION,QPoint(840,40), parentWidget()));
23+
24+
piles.append(new Pile(DEAL,QPoint(720,500), parentWidget()));
25+
piles.append(new Pile(DEAL,QPoint(740,500), parentWidget()));
26+
piles.append(new Pile(DEAL,QPoint(760,500), parentWidget()));
27+
piles.append(new Pile(DEAL,QPoint(780,500), parentWidget()));
28+
piles.append(new Pile(DEAL,QPoint(800,500), parentWidget()));
29+
piles.append(new Pile(STOCK,QPoint(30,500), parentWidget()));
30+
piles.append(new Pile(STOCK,QPoint(50,500), parentWidget()));
31+
piles.append(new Pile(STOCK,QPoint(70,500), parentWidget()));
32+
piles.append(new Pile(STOCK,QPoint(90,500), parentWidget()));
33+
piles.append(new Pile(STOCK,QPoint(110,500), parentWidget()));
34+
piles.append(new Pile(STOCK,QPoint(130,500), parentWidget()));
35+
piles.append(new Pile(STOCK,QPoint(150,500), parentWidget()));
36+
piles.append(new Pile(STOCK,QPoint(170,500), parentWidget()));
37+
placeCards1();
38+
39+
}
40+
void spider::placeCards1(){
41+
for(int i = 0; i<104;i++ ){
42+
deck[i]->setFaceDown();
43+
deck[i]->setImage();
44+
deck[i]->show();
45+
}
46+
for(int i = 4; i<10;i++ ){
47+
deck[4 + 5*i]->setFaceUp();
48+
deck[4 + 5*i]->setImage();
49+
deck[4 + 5*i]->show();
50+
}
51+
for(int i = 0; i<4;i++ ){
52+
deck[50 + i]->setFaceUp();
53+
deck[50+i]->setImage();
54+
deck[50+i]->show();
55+
}
56+
for(int i = 0; i<5;i++ ){
57+
piles.value(0)->put(deck[i]);
58+
piles.value(1)->put(deck[i + 5]);
59+
piles.value(2)->put(deck[i + 5*2]);
60+
piles.value(3)->put(deck[i + 5*3]);
61+
piles.value(4)->put(deck[i + 5*4]);
62+
piles.value(5)->put(deck[i + 5*5]);
63+
piles.value(6)->put(deck[i + 5*6]);
64+
piles.value(7)->put(deck[i + 5*7]);
65+
piles.value(8)->put(deck[i + 5*8]);
66+
piles.value(9)->put(deck[i + 5*9]);
67+
}
68+
piles.value(0)->put(deck[50]);
69+
piles.value(1)->put(deck[51]);
70+
piles.value(2)->put(deck[52]);
71+
piles.value(3)->put(deck[53]);
72+
for(int i = 0; i<5;i++ ){
73+
for(int j = 0; j<10; j++){
74+
piles.value(i+10)->put(deck[j + 54 + i*10]);
75+
deck[j + 54 + i*10]->setFaceDown();
76+
}
77+
78+
}
79+
80+
81+
}
82+
void spider::redeal(){
83+
84+
for(int i = 0; i<piles.size(); i++){
85+
piles.value(i)->~Pile();
86+
}
87+
piles.clear();
88+
history.clear();
89+
setUp();
90+
}
91+
void spider::generateDeck(){
92+
93+
//char* suit[] = {'c','d', 'h', 's'};
94+
pips pip[] = {ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING};
95+
96+
for(int i = 0; i<13;i++ ){
97+
deck[i] = new card(pip[i], CLUBS, i,i,parentWidget());
98+
deck[i]->piles = &piles;
99+
deck[i]->setHistory(&history);
100+
//deck[i]->setImage();
101+
//deck[i]->show();
102+
}
103+
104+
for(int i = 13; i<26;i++ ){
105+
deck[i] = new card(pip[i-13], CLUBS, i,i-13,parentWidget());
106+
deck[i]->piles = &piles;
107+
deck[i]->setHistory(&history);
108+
// deck[i]->setImage();
109+
// deck[i]->show();
110+
}
111+
for(int i = 26; i<39;i++ ){
112+
deck[i] = new card(pip[i-26], CLUBS, i,i-26,parentWidget());
113+
deck[i]->piles = &piles;
114+
deck[i]->setHistory(&history);
115+
//deck[i]->setImage();
116+
//deck[i]->show();
117+
}
118+
119+
for(int i = 39; i<52;i++ ){
120+
121+
deck[i] = new card(pip[i-39], CLUBS, i,i-39,parentWidget());
122+
deck[i]->piles = &piles;
123+
deck[i]->setHistory(&history);
124+
// deck[i]->setImage();
125+
//deck[i]->show();
126+
}
127+
for(int i = 52; i<65;i++ ){
128+
deck[i] = new card(pip[i-52], CLUBS, i,i-52,parentWidget());
129+
deck[i]->piles = &piles;
130+
deck[i]->setHistory(&history);
131+
// deck[i]->setImage();
132+
// deck[i]->show();
133+
}
134+
135+
for(int i = 65; i<78;i++ ){
136+
137+
deck[i] = new card(pip[i-65], CLUBS, i,i-65,parentWidget());
138+
deck[i]->piles = &piles;
139+
deck[i]->setHistory(&history);
140+
// deck[i]->setImage();
141+
//deck[i]->show();
142+
}
143+
for(int i = 78; i<91;i++ ){
144+
deck[i] = new card(pip[i-78], CLUBS, i,i-78,parentWidget());
145+
deck[i]->piles = &piles;
146+
deck[i]->setHistory(&history);
147+
// deck[i]->setImage();
148+
// deck[i]->show();
149+
}
150+
151+
for(int i = 91; i<104;i++ ){
152+
153+
deck[i] = new card(pip[i-91], CLUBS, i,i-91,parentWidget());
154+
deck[i]->piles = &piles;
155+
deck[i]->setHistory(&history);
156+
// deck[i]->setImage();
157+
//deck[i]->show();
158+
}
159+
160+
161+
}
162+
163+
void spider::clear(){
164+
for(int i = 0; i<piles.size(); i++){
165+
piles.value(i)->~Pile();
166+
}
167+
/* for(int i = 0; i<104; i++){
168+
deck[i] = NULL;
169+
}*/
170+
piles.clear();
171+
history.clear();
172+
}

‎spider.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef SPIDER_H
2+
#define SPIDER_H
3+
#include "card.h"
4+
#include "games.h"
5+
6+
class spider: public games
7+
{
8+
public:
9+
spider(QWidget* parent);
10+
void placeCards1();
11+
void setUp();
12+
void redeal();
13+
void generateDeck();
14+
void clear();
15+
};
16+
17+
#endif // SPIDER_H

‎win.png

23 KB
Loading

‎windialog.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "windialog.h"
2+
#include "ui_windialog.h"
3+
4+
WinDialog::WinDialog(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::WinDialog)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
WinDialog::~WinDialog()
12+
{
13+
delete ui;
14+
}

‎windialog.h

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef WINDIALOG_H
2+
#define WINDIALOG_H
3+
4+
#include <QDialog>
5+
6+
namespace Ui {
7+
class WinDialog;
8+
}
9+
10+
class WinDialog : public QDialog
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit WinDialog(QWidget *parent = 0);
16+
~WinDialog();
17+
18+
private:
19+
Ui::WinDialog *ui;
20+
};
21+
22+
#endif // WINDIALOG_H

‎windialog.ui

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>WinDialog</class>
4+
<widget class="QDialog" name="WinDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>338</width>
10+
<height>215</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<widget class="QDialogButtonBox" name="buttonBox">
17+
<property name="geometry">
18+
<rect>
19+
<x>-20</x>
20+
<y>160</y>
21+
<width>341</width>
22+
<height>32</height>
23+
</rect>
24+
</property>
25+
<property name="orientation">
26+
<enum>Qt::Horizontal</enum>
27+
</property>
28+
<property name="standardButtons">
29+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
30+
</property>
31+
</widget>
32+
<widget class="QTextBrowser" name="textBrowser">
33+
<property name="geometry">
34+
<rect>
35+
<x>50</x>
36+
<y>10</y>
37+
<width>251</width>
38+
<height>131</height>
39+
</rect>
40+
</property>
41+
<property name="html">
42+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
43+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
44+
p, li { white-space: pre-wrap; }
45+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
46+
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:22pt; font-weight:600; color:#005500;&quot;&gt;Well Done!!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
47+
</property>
48+
</widget>
49+
</widget>
50+
<resources/>
51+
<connections>
52+
<connection>
53+
<sender>buttonBox</sender>
54+
<signal>accepted()</signal>
55+
<receiver>WinDialog</receiver>
56+
<slot>accept()</slot>
57+
<hints>
58+
<hint type="sourcelabel">
59+
<x>248</x>
60+
<y>254</y>
61+
</hint>
62+
<hint type="destinationlabel">
63+
<x>157</x>
64+
<y>274</y>
65+
</hint>
66+
</hints>
67+
</connection>
68+
<connection>
69+
<sender>buttonBox</sender>
70+
<signal>rejected()</signal>
71+
<receiver>WinDialog</receiver>
72+
<slot>reject()</slot>
73+
<hints>
74+
<hint type="sourcelabel">
75+
<x>316</x>
76+
<y>260</y>
77+
</hint>
78+
<hint type="destinationlabel">
79+
<x>286</x>
80+
<y>274</y>
81+
</hint>
82+
</hints>
83+
</connection>
84+
</connections>
85+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.