File indexing completed on 2024-04-21 15:08:00
0001 // Copyright (c) 2003 Rob Kaper <cap@capsi.com> 0002 // 0003 // This library is free software; you can redistribute it and/or 0004 // modify it under the terms of the GNU Lesser General Public 0005 // License version 2.1 as published by the Free Software Foundation. 0006 // 0007 // This library is distributed in the hope that it will be useful, 0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0010 // Lesser General Public License for more details. 0011 // 0012 // You should have received a copy of the GNU Lesser General Public License 0013 // along with this library; see the file COPYING.LIB. If not, write to 0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0015 // Boston, MA 02110-1301, USA. 0016 0017 #ifndef LIBATLANTIC_GAME_H 0018 #define LIBATLANTIC_GAME_H 0019 0020 #include <QObject> 0021 0022 #include "libatlantic_export.h" 0023 0024 class Player; 0025 class ConfigOption; 0026 0027 class LIBATLANTIC_EXPORT Game : public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 Game(int gameId); 0033 ~Game(); 0034 0035 int id() const; 0036 void setCanBeJoined(bool canBeJoined); 0037 bool canBeJoined() const; 0038 void setDescription(const QString &description); 0039 QString description() const; 0040 void setName(const QString &name); 0041 QString name() const; 0042 void setType(const QString &type); 0043 QString type() const; 0044 int players() const; 0045 void setPlayers(int players); 0046 Player *master() const; 0047 void setMaster(Player *master); 0048 void setCanBeWatched(bool canBeWatched); 0049 bool canBeWatched() const; 0050 0051 QList<ConfigOption *> configOptions() const; 0052 void addConfigOption(ConfigOption *configOption); 0053 void removeConfigOption(ConfigOption *configOption); 0054 ConfigOption *findConfigOption(int configId) const; 0055 ConfigOption *findConfigOption(const QString &name) const; 0056 0057 void update(bool force = false); 0058 0059 Q_SIGNALS: 0060 void changed(Game *game); 0061 void createGUI(ConfigOption *configOption); 0062 void removeGUI(ConfigOption *configOption); 0063 0064 private: 0065 bool m_changed; 0066 bool m_canBeJoined; 0067 bool m_canBeWatched; 0068 QString m_description, m_name, m_type; 0069 int m_id, m_players; 0070 Player *m_master; 0071 QList<ConfigOption *> m_configOptions; 0072 }; 0073 0074 #endif