TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musictransitionanimationlabel.h
Go to the documentation of this file.
1 #ifndef MUSICTRANSITIONANIMATIONLABEL_H
2 #define MUSICTRANSITIONANIMATIONLABEL_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2026 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QLabel>
23 #include "musicglobaldefine.h"
24 
25 class QPropertyAnimation;
26 namespace QAlgorithm
27 {
28 class ImageRender;
29 }
30 
35 {
36  Q_OBJECT
37 public:
38  enum class Module
39  {
40  FadeEffect,
41  BlindsEffect,
42  CubeEffect,
43  WaterEffect,
44  LeftToRightEffect,
45  TopToBottomEffect,
46  MAX = 6
47  };
48 
52  explicit MusicTransitionAnimationLabel(QWidget *parent = nullptr);
57 
61  inline void setAnimation(bool enable) noexcept { m_animationEnabled = enable; }
65  inline bool animation() const noexcept { return m_animationEnabled; }
66 
70  const QPixmap& renderPixmap() const noexcept;
71 
75  void start();
79  void stop();
80 
84  bool isRunning() const;
85 
86 public Q_SLOTS:
90  void setPixmap(const QPixmap &pix);
91 
92 private Q_SLOTS:
96  void valueChanged(const QVariant &value);
100  void animationFinished();
101 
102 private:
106  virtual void paintEvent(QPaintEvent *event) override final;
107 
108  Module m_type;
109  bool m_isAnimating;
110  int m_currentValue;
111  bool m_animationEnabled;
112  QPixmap m_renderPixmap;
113  QPixmap m_currentPixmap, m_previousPixmap;
114  QPropertyAnimation *m_animation;
115  QAlgorithm::ImageRender *m_imageRender;
116 
117 };
118 
119 #endif // MUSICTRANSITIONANIMATIONLABEL_H
#define TTK_MODULE_EXPORT
The class of the image render.
Definition: imagewrapper.h:35
The namespace of the algorithm.
The class of the label transition animation.
#define const
Definition: zconf.h:233