1/*
2 * Copyright (C) 1995 Paul Olav Tvete <paul@troll.no>
3 * Copyright (C) 2000-2009 Stephan Kulow <coolo@kde.org>
4 *
5 * License of original code:
6 * -------------------------------------------------------------------------
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted,
9 * provided that the above copyright notice appear in all copies and that
10 * both that copyright notice and this permission notice appear in
11 * supporting documentation.
12 *
13 * This file is provided AS IS with no warranties of any kind. The author
14 * shall have no liability with respect to the infringement of copyrights,
15 * trade secrets or any patents by this file or any part thereof. In no
16 * event will the author be liable for any lost revenue or profits or
17 * other special, indirect and consequential damages.
18 * -------------------------------------------------------------------------
19 *
20 * License of modifications/additions made after 2009-01-01:
21 * -------------------------------------------------------------------------
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License as
24 * published by the Free Software Foundation; either version 2 of
25 * the License, or (at your option) any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 * -------------------------------------------------------------------------
35 */
36
37#ifndef KLONDIKE_H
38#define KLONDIKE_H
39
40#include "dealer.h"
41class KlondikePile;
42
43class KSelectAction;
44
45
46class Klondike : public DealerScene
47{
48 Q_OBJECT
49
50public:
51 Klondike( const DealerInfo * di );
52 virtual void initialize();
53 virtual void mapOldId(int id);
54 virtual int oldId() const;
55 QList<QAction*> configActions() const;
56
57protected:
58 virtual void setGameState( const QString & state );
59 virtual QString getGameOptions() const;
60 virtual void setGameOptions( const QString & options );
61 virtual bool checkAdd(const PatPile * pile, const QList<KCard*> & oldCards, const QList<KCard*> & newCards) const;
62 virtual bool checkRemove(const PatPile * pile, const QList<KCard*> & cards) const;
63 virtual void cardsMoved( const QList<KCard*> & cards, KCardPile * oldPile, KCardPile * newPile );
64 virtual void restart( const QList<KCard*> & cards );
65
66protected slots:
67 virtual bool drop();
68 virtual bool newCards();
69
70private slots:
71 void gameTypeChanged();
72
73private:
74 void setEasy( bool easy );
75
76 bool easyRules;
77 bool redealt;
78
79 KSelectAction *options;
80
81 PatPile* talon;
82 PatPile* play[7];
83 PatPile* target[4];
84
85 KlondikePile *pile;
86 KCardDeck::Rank target_tops[4];
87
88 friend class KlondikeSolver;
89};
90
91class KlondikePile : public PatPile
92{
93public:
94 KlondikePile( DealerScene * scene, int index, const QString & objectName = QString() );
95 void setCardsToShow( int numCards );
96 int cardsToShow() const;
97 virtual QList<QPointF> cardPositions() const;
98
99private:
100 int m_cardsToShow;
101};
102
103#endif
104