File indexing completed on 2024-10-13 03:43:53
0001 /* 0002 SPDX-FileCopyrightText: 2012 Christian Krippendorf <Coding@Christian-Krippendorf.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef MOVELISTANIMATION_H 0008 #define MOVELISTANIMATION_H 0009 0010 // Qt 0011 #include <QTimer> 0012 0013 // KMahjongg 0014 #include "kmtypes.h" 0015 0016 // Forward declarations... 0017 class GameData; 0018 0019 enum class AnimationDirection { Forward, 0020 Backward }; 0021 0022 /** 0023 * A class for a demo animation with the help of selection. 0024 * 0025 * @author Christian Krippendorf */ 0026 class MoveListAnimation : public QTimer 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 explicit MoveListAnimation(QObject * parent = nullptr); 0032 ~MoveListAnimation() override; 0033 0034 /** 0035 * Set the animation speed in milliseconds. 0036 * 0037 * @param animationSpeed The animation speed in milliseconds. */ 0038 void setAnimationSpeed(int animationSpeed); 0039 0040 /** 0041 * Get the animation speed in milliseconds. 0042 * 0043 * @return Get the animation speed in milliseconds. */ 0044 int getAnimationSpeed() const; 0045 0046 /** 0047 * Override of QTimer. 0048 * 0049 * @param gameData The data object to handle with for this animation process. */ 0050 void start(GameData * gameData); 0051 0052 /** 0053 * Override of QTimer. */ 0054 void stop(); 0055 0056 public Q_SLOTS: 0057 0058 Q_SIGNALS: 0059 /** 0060 * Emit to remove the given item. */ 0061 void removeItem(POSITION & stItem); 0062 0063 /** 0064 * Emit to add the given item. */ 0065 void addItem(POSITION & stItem); 0066 0067 private Q_SLOTS: 0068 /** 0069 * The timeout occurred. */ 0070 void timeoutOccurred(); 0071 0072 private: 0073 int m_step; 0074 int m_animationSpeed; 0075 0076 AnimationDirection m_direction; 0077 0078 GameData * m_gameData; 0079 }; 0080 0081 #endif // MOVELISTANIMATION_H