1 /*
2     SPDX-FileCopyrightText: 2008 Pino Toscano <pino@kde.org>
3     SPDX-FileCopyrightText: 2012 Guillermo A. Amaral B. <gamaral@kde.org>
4 
5     SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #ifndef _OKULAR_MOVIE_H_
9 #define _OKULAR_MOVIE_H_
10 
11 #include "global.h"
12 #include "okularcore_export.h"
13 
14 #include <QSize>
15 
16 class QImage;
17 
18 namespace Okular
19 {
20 /**
21  * @short Contains information about a movie object.
22  *
23  * @since 0.8 (KDE 4.2)
24  */
25 class OKULARCORE_EXPORT Movie
26 {
27 public:
28     /**
29      * The play mode for playing the movie
30      */
31     enum PlayMode {
32         PlayLimited,   ///< Play a fixed amount of times, closing the movie controls at the end @since 0.24
33         PlayOpen,      ///< Like PlayLimited, but leaving the controls open
34         PlayRepeat,    ///< Play continuously until stopped
35         PlayPalindrome ///< Play forward, then backward, then again forward and so on until stopped
36     };
37 
38     /**
39      * Creates a new movie object with the given external @p fileName.
40      */
41     explicit Movie(const QString &fileName);
42 
43     /**
44      * Creates a new movie object with the given movie data.
45      */
46     explicit Movie(const QString &fileName, const QByteArray &data);
47 
48     /**
49      * Destroys the movie object.
50      */
51     ~Movie();
52 
53     /**
54      * Returns the url of the movie.
55      */
56     QString url() const;
57 
58     /**
59      * Sets the size for the movie.
60      */
61     void setSize(const QSize &aspect); // TODO remove the & when we do a BIC change elsewhere
62 
63     /**
64      * Returns the size of the movie.
65      */
66     QSize size() const;
67 
68     /**
69      * Sets the @p rotation of the movie.
70      */
71     void setRotation(Rotation rotation);
72 
73     /**
74      * Returns the rotation of the movie.
75      */
76     Rotation rotation() const;
77 
78     /**
79      * Sets whether show a bar with movie controls
80      */
81     void setShowControls(bool show);
82 
83     /**
84      * Whether show a bar with movie controls
85      */
86     bool showControls() const;
87 
88     /**
89      * Sets the way the movie should be played
90      */
91     void setPlayMode(PlayMode mode);
92 
93     /**
94      * How to play the movie
95      */
96     PlayMode playMode() const;
97 
98     /**
99      * Sets how many times the movie should be played
100      * @since 0.24
101      */
102     void setPlayRepetitions(double repetitions);
103 
104     /**
105      * How many times to play the movie
106      * @since 0.24
107      */
108     double playRepetitions() const;
109 
110     /**
111      * Sets whether to play the movie automatically
112      */
113     void setAutoPlay(bool autoPlay);
114 
115     /**
116      * Whether to play the movie automatically
117      */
118     bool autoPlay() const;
119 
120     /**
121      * Sets whether to show a poster image.
122      *
123      * @since 4.10
124      */
125     void setShowPosterImage(bool show);
126 
127     /**
128      * Whether to show a poster image.
129      *
130      * @since 4.10
131      */
132     bool showPosterImage() const;
133 
134     /**
135      * Sets the poster image.
136      *
137      * @since 4.10
138      */
139     void setPosterImage(const QImage &image);
140 
141     /**
142      * Returns the poster image.
143      *
144      * @since 4.10
145      */
146     QImage posterImage() const;
147 
148 private:
149     class Private;
150     Private *const d;
151 
152     Q_DISABLE_COPY(Movie)
153 };
154 
155 }
156 
157 #endif
158