File indexing completed on 2024-06-09 04:03:33

0001 /*
0002  *  Copyright (C) 2010 Parker Coates <coates@kde.org>
0003  *
0004  *  This program is free software; you can redistribute it and/or
0005  *  modify it under the terms of the GNU General Public License as
0006  *  published by the Free Software Foundation; either version 2 of
0007  *  the License, or (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  *
0017  */
0018 
0019 #ifndef KCARD_P_H
0020 #define KCARD_P_H
0021 
0022 #include "kcard.h"
0023 // Qt
0024 #include <QAbstractAnimation>
0025 
0026 class KAbstractCardDeck;
0027 class KCardPile;
0028 
0029 class QPropertyAnimation;
0030 
0031 class KCardAnimation : public QAbstractAnimation
0032 {
0033 public:
0034     KCardAnimation(KCardPrivate *d, int duration, QPointF pos, qreal rotation, bool faceUp);
0035     int duration() const override;
0036     void updateCurrentTime(int msec) override;
0037 
0038 private:
0039     KCardPrivate *d;
0040 
0041     int m_duration;
0042 
0043     qreal m_x0;
0044     qreal m_y0;
0045     qreal m_rotation0;
0046     qreal m_flippedness0;
0047 
0048     qreal m_xDelta;
0049     qreal m_yDelta;
0050     qreal m_rotationDelta;
0051     qreal m_flippednessDelta;
0052 
0053     qreal m_flipProgressFactor;
0054 };
0055 
0056 class KCardPrivate : public QObject
0057 {
0058     Q_OBJECT
0059 
0060     Q_PROPERTY(qreal highlightedness READ highlightedness WRITE setHighlightedness)
0061 
0062 public:
0063     explicit KCardPrivate(KCard *card);
0064 
0065     void setFlippedness(qreal flippedness);
0066     qreal flippedness() const;
0067 
0068     void setHighlightedness(qreal highlightedness);
0069     qreal highlightedness() const;
0070 
0071     bool faceUp;
0072     bool highlighted;
0073     quint32 id;
0074 
0075     qreal destZ;
0076     qreal flipValue;
0077     qreal highlightValue;
0078 
0079     KCard *q;
0080     KAbstractCardDeck *deck;
0081     KCardPile *pile;
0082 
0083     QPixmap frontPixmap;
0084     QPixmap backPixmap;
0085 
0086     KCardAnimation *animation;
0087     QPropertyAnimation *fadeAnimation;
0088 };
0089 
0090 #endif