1 | /* |
2 | * Copyright (C) 1995 Paul Olav Tvete <paul@troll.no> |
3 | * Copyright (C) 2000-2009 Stephan Kulow <coolo@kde.org> |
4 | * Copyright (C) 2009 Parker Coates <coates@kde.org> |
5 | * |
6 | * License of original code: |
7 | * ------------------------------------------------------------------------- |
8 | * Permission to use, copy, modify, and distribute this software and its |
9 | * documentation for any purpose and without fee is hereby granted, |
10 | * provided that the above copyright notice appear in all copies and that |
11 | * both that copyright notice and this permission notice appear in |
12 | * supporting documentation. |
13 | * |
14 | * This file is provided AS IS with no warranties of any kind. The author |
15 | * shall have no liability with respect to the infringement of copyrights, |
16 | * trade secrets or any patents by this file or any part thereof. In no |
17 | * event will the author be liable for any lost revenue or profits or |
18 | * other special, indirect and consequential damages. |
19 | * ------------------------------------------------------------------------- |
20 | * |
21 | * License of modifications/additions made after 2009-01-01: |
22 | * ------------------------------------------------------------------------- |
23 | * This program is free software; you can redistribute it and/or |
24 | * modify it under the terms of the GNU General Public License as |
25 | * published by the Free Software Foundation; either version 2 of |
26 | * the License, or (at your option) any later version. |
27 | * |
28 | * This program is distributed in the hope that it will be useful, |
29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31 | * GNU General Public License for more details. |
32 | * |
33 | * You should have received a copy of the GNU General Public License |
34 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
35 | * ------------------------------------------------------------------------- |
36 | */ |
37 | |
38 | #ifndef DEALERINFO_H |
39 | #define DEALERINFO_H |
40 | |
41 | class DealerInfoList; |
42 | class DealerScene; |
43 | class Solver; |
44 | |
45 | #include <QtCore/QByteArray> |
46 | #include <QtCore/QList> |
47 | #include <QtCore/QMap> |
48 | #include <QtCore/QString> |
49 | |
50 | |
51 | class DealerInfo |
52 | { |
53 | public: |
54 | enum GameIds |
55 | { |
56 | KlondikeDrawOneId = 0, |
57 | GrandfatherId = 1, |
58 | AcesUpId = 2, |
59 | FreecellId = 3, |
60 | Mod3Id = 5, |
61 | GypsyId = 7, |
62 | FortyAndEightId = 8, |
63 | SimpleSimonId = 9, |
64 | YukonId = 10, |
65 | GrandfathersClockId = 11, |
66 | GolfId = 12, |
67 | KlondikeDrawThreeId = 13, |
68 | SpiderOneSuitId = 14, |
69 | SpiderTwoSuitId = 15, |
70 | SpiderFourSuitId = 16, |
71 | SpiderGeneralId = 17, |
72 | KlondikeGeneralId = 18 |
73 | }; |
74 | |
75 | DealerInfo( const QByteArray & untranslatedBaseName, int baseId ); |
76 | virtual ~DealerInfo(); |
77 | |
78 | QString baseName() const; |
79 | QByteArray untranslatedBaseName() const; |
80 | QString baseIdString() const; |
81 | int baseId() const; |
82 | |
83 | void addSubtype( int id, const QByteArray & untranslatedName ); |
84 | QList<int> subtypeIds() const; |
85 | |
86 | QList<int> distinctIds() const; |
87 | bool providesId( int id ) const; |
88 | QString nameForId( int id ) const; |
89 | |
90 | virtual DealerScene * createGame() const = 0; |
91 | |
92 | protected: |
93 | QByteArray m_baseName; |
94 | QString m_baseIdString; |
95 | int m_baseId; |
96 | |
97 | QMap<int,QByteArray> m_subtypes; |
98 | }; |
99 | |
100 | |
101 | class DealerInfoList |
102 | { |
103 | private: |
104 | friend class DealerInfoListPrivate; |
105 | explicit DealerInfoList(); |
106 | virtual ~DealerInfoList(); |
107 | |
108 | public: |
109 | static DealerInfoList * self(); |
110 | void add( DealerInfo * di ); |
111 | const QList<DealerInfo*> games() const; |
112 | |
113 | private: |
114 | QList<DealerInfo*> m_list; |
115 | }; |
116 | |
117 | #endif |
118 | |