File indexing completed on 2024-04-14 14:31:58

0001 // Copyright (c) 2015 Pino Toscano <pino@kde.org>
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_CARD_H
0018 #define LIBATLANTIC_CARD_H
0019 
0020 #include <QObject>
0021 
0022 #include "libatlantic_export.h"
0023 
0024 class Player;
0025 
0026 class LIBATLANTIC_EXPORT Card : public QObject
0027 {
0028 Q_OBJECT
0029 
0030 public:
0031     Card(int cardId);
0032     virtual ~Card();
0033 
0034     int cardId() const { return m_cardId; }
0035 
0036     void setTitle(const QString &title);
0037     QString title() const { return m_title; }
0038 
0039     void setOwner(Player *player);
0040     Player *owner() const { return m_owner; }
0041     bool isOwned() const { return m_owner != nullptr; }
0042 
0043     void update(bool force = false);
0044 
0045 Q_SIGNALS:
0046     void changed(Card *card);
0047 
0048 private:
0049     bool m_changed;
0050     int m_cardId;
0051     QString m_title;
0052     Player *m_owner;
0053 };
0054 
0055 #endif