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 // Qt 42 #include <QByteArray> 43 #include <QList> 44 #include <QMap> 45 #include <QString> 46 47 class DealerInfoList; 48 class DealerScene; 49 50 51 class DealerInfo 52 { 53 public: 54 enum GameIds 55 { 56 KlondikeDrawOneId = 0, 57 GrandfatherId = 1, 58 AcesUpId = 2, 59 FreecellGeneralId = 3, 60 CastleGeneralId = 4, 61 Mod3Id = 5, 62 GypsyId = 7, 63 FortyAndEightId = 8, 64 SimpleSimonId = 9, 65 YukonId = 10, 66 GrandfathersClockId = 11, 67 GolfId = 12, 68 KlondikeDrawThreeId = 13, 69 SpiderOneSuitId = 14, 70 SpiderTwoSuitId = 15, 71 SpiderFourSuitId = 16, 72 SpiderGeneralId = 17, 73 KlondikeGeneralId = 18, 74 BakersDozenGeneralId= 19, 75 BakersDozenId = 20, 76 BakersDozenSpanishId= 21, 77 BakersDozenCastlesId= 22, 78 BakersDozenPortugueseId= 23, 79 BakersDozenCustomId = 24, 80 FreecellId = 30, 81 FreecellBakersId = 31, 82 FreecellEightOffId = 32, 83 FreecellForeId = 33, 84 FreecellSeahavenId = 34, 85 FreecellCustomId = 39, 86 CastleBeleagueredId = 40, 87 CastleCitadelId = 41, 88 CastleExiledKingsId = 42, 89 CastleStreetAlleyId = 43, 90 CastleSiegecraftId = 44, 91 CastleStrongholdId = 45, 92 CastleCustomId = 49 93 }; 94 95 DealerInfo( const QByteArray & untranslatedBaseName, int baseId ); 96 virtual ~DealerInfo(); 97 98 QString baseName() const; 99 QByteArray untranslatedBaseName() const; 100 QString baseIdString() const; 101 int baseId() const; 102 103 void addSubtype( int id, const QByteArray & untranslatedName ); 104 QList<int> subtypeIds() const; 105 106 QList<int> distinctIds() const; 107 bool providesId( int id ) const; 108 QString nameForId( int id ) const; 109 110 virtual DealerScene * createGame() const = 0; 111 112 protected: 113 QByteArray m_baseName; 114 QString m_baseIdString; 115 int m_baseId; 116 117 QMap<int,QByteArray> m_subtypes; 118 }; 119 120 121 class DealerInfoList 122 { 123 private: 124 friend class DealerInfoListPrivate; 125 explicit DealerInfoList(); 126 virtual ~DealerInfoList(); 127 128 public: 129 static DealerInfoList * self(); 130 void add( DealerInfo * di ); 131 const QList<DealerInfo*> games() const; 132 133 private: 134 QList<DealerInfo*> m_list; 135 }; 136 137 #endif 138