1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICKANIMATEDIMAGE_P_H |
5 | #define QQUICKANIMATEDIMAGE_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <private/qtquickglobal_p.h> |
19 | |
20 | QT_REQUIRE_CONFIG(quick_animatedimage); |
21 | |
22 | #include "qquickimage_p.h" |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QMovie; |
27 | class QQuickAnimatedImagePrivate; |
28 | |
29 | class Q_QUICK_PRIVATE_EXPORT QQuickAnimatedImage : public QQuickImage |
30 | { |
31 | Q_OBJECT |
32 | |
33 | Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged FINAL) |
34 | Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged FINAL) |
35 | Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged FINAL) |
36 | Q_PROPERTY(int frameCount READ frameCount NOTIFY frameCountChanged FINAL) |
37 | Q_PROPERTY(qreal speed READ speed WRITE setSpeed NOTIFY speedChanged REVISION(2, 11) FINAL) |
38 | |
39 | QML_NAMED_ELEMENT(AnimatedImage) |
40 | QML_ADDED_IN_VERSION(2, 0) |
41 | |
42 | public: |
43 | QQuickAnimatedImage(QQuickItem *parent=nullptr); |
44 | ~QQuickAnimatedImage(); |
45 | |
46 | bool isPlaying() const; |
47 | void setPlaying(bool play); |
48 | |
49 | bool isPaused() const; |
50 | void setPaused(bool pause); |
51 | |
52 | int currentFrame() const override; |
53 | void setCurrentFrame(int frame) override; |
54 | |
55 | int frameCount() const override; |
56 | |
57 | qreal speed() const; |
58 | void setSpeed(qreal speed); |
59 | |
60 | // Extends QQuickImage's src property |
61 | void setSource(const QUrl&) override; |
62 | |
63 | Q_SIGNALS: |
64 | void playingChanged(); |
65 | void pausedChanged(); |
66 | void frameChanged(); |
67 | void currentFrameChanged(); |
68 | void frameCountChanged(); |
69 | Q_REVISION(2, 11) void speedChanged(); |
70 | |
71 | private Q_SLOTS: |
72 | void movieUpdate(); |
73 | void movieRequestFinished(); |
74 | void playingStatusChanged(); |
75 | void onCacheChanged(); |
76 | |
77 | protected: |
78 | void load() override; |
79 | void componentComplete() override; |
80 | |
81 | private: |
82 | Q_DISABLE_COPY(QQuickAnimatedImage) |
83 | Q_DECLARE_PRIVATE(QQuickAnimatedImage) |
84 | }; |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | QML_DECLARE_TYPE(QQuickAnimatedImage) |
89 | |
90 | #endif // QQUICKANIMATEDIMAGE_P_H |
91 |