author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QMOVIE_H |
|
43 |
#define QMOVIE_H |
|
44 |
||
45 |
#include <QtCore/qobject.h> |
|
46 |
||
47 |
#ifndef QT_NO_MOVIE |
|
48 |
||
49 |
#include <QtCore/qbytearray.h> |
|
50 |
#include <QtCore/qlist.h> |
|
51 |
#include <QtCore/qobject.h> |
|
52 |
#include <QtGui/qimagereader.h> |
|
53 |
||
54 |
#ifdef QT3_SUPPORT |
|
55 |
#include <QtGui/qimage.h> |
|
56 |
#include <QtGui/qpixmap.h> |
|
57 |
#endif |
|
58 |
||
59 |
QT_BEGIN_HEADER |
|
60 |
||
61 |
QT_BEGIN_NAMESPACE |
|
62 |
||
63 |
QT_MODULE(Gui) |
|
64 |
||
65 |
class QByteArray; |
|
66 |
class QColor; |
|
67 |
class QIODevice; |
|
68 |
class QImage; |
|
69 |
class QPixmap; |
|
70 |
class QRect; |
|
71 |
class QSize; |
|
72 |
||
73 |
class QMoviePrivate; |
|
74 |
class Q_GUI_EXPORT QMovie : public QObject |
|
75 |
{ |
|
76 |
Q_OBJECT |
|
77 |
Q_DECLARE_PRIVATE(QMovie) |
|
78 |
Q_ENUMS(MovieState CacheMode) |
|
79 |
Q_PROPERTY(int speed READ speed WRITE setSpeed) |
|
80 |
Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) |
|
81 |
public: |
|
82 |
enum MovieState { |
|
83 |
NotRunning, |
|
84 |
Paused, |
|
85 |
Running |
|
86 |
}; |
|
87 |
enum CacheMode { |
|
88 |
CacheNone, |
|
89 |
CacheAll |
|
90 |
}; |
|
91 |
||
92 |
QMovie(QObject *parent = 0); |
|
93 |
explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0); |
|
94 |
explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0); |
|
95 |
~QMovie(); |
|
96 |
||
97 |
static QList<QByteArray> supportedFormats(); |
|
98 |
||
99 |
void setDevice(QIODevice *device); |
|
100 |
QIODevice *device() const; |
|
101 |
||
102 |
void setFileName(const QString &fileName); |
|
103 |
QString fileName() const; |
|
104 |
||
105 |
void setFormat(const QByteArray &format); |
|
106 |
QByteArray format() const; |
|
107 |
||
108 |
void setBackgroundColor(const QColor &color); |
|
109 |
QColor backgroundColor() const; |
|
110 |
||
111 |
MovieState state() const; |
|
112 |
||
113 |
QRect frameRect() const; |
|
114 |
QImage currentImage() const; |
|
115 |
QPixmap currentPixmap() const; |
|
116 |
||
117 |
bool isValid() const; |
|
118 |
||
119 |
bool jumpToFrame(int frameNumber); |
|
120 |
int loopCount() const; |
|
121 |
int frameCount() const; |
|
122 |
int nextFrameDelay() const; |
|
123 |
int currentFrameNumber() const; |
|
124 |
||
125 |
int speed() const; |
|
126 |
||
127 |
QSize scaledSize(); |
|
128 |
void setScaledSize(const QSize &size); |
|
129 |
||
130 |
CacheMode cacheMode() const; |
|
131 |
void setCacheMode(CacheMode mode); |
|
132 |
||
133 |
CacheMode cacheMode(); // ### Qt 5: remove me |
|
134 |
||
135 |
Q_SIGNALS: |
|
136 |
void started(); |
|
137 |
void resized(const QSize &size); |
|
138 |
void updated(const QRect &rect); |
|
139 |
void stateChanged(QMovie::MovieState state); |
|
140 |
void error(QImageReader::ImageReaderError error); |
|
141 |
void finished(); |
|
142 |
void frameChanged(int frameNumber); |
|
143 |
||
144 |
public Q_SLOTS: |
|
145 |
void start(); |
|
146 |
bool jumpToNextFrame(); |
|
147 |
void setPaused(bool paused); |
|
148 |
void stop(); |
|
149 |
void setSpeed(int percentSpeed); |
|
150 |
||
151 |
private: |
|
152 |
Q_DISABLE_COPY(QMovie) |
|
153 |
Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame()) |
|
154 |
||
155 |
#ifdef QT3_SUPPORT |
|
156 |
public: |
|
157 |
inline QT3_SUPPORT bool isNull() const { return isValid(); } |
|
158 |
inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); } |
|
159 |
inline QT3_SUPPORT bool running() const { return state() == Running; } |
|
160 |
inline QT3_SUPPORT bool paused() const { return state() == Paused; } |
|
161 |
inline QT3_SUPPORT bool finished() const { return state() == NotRunning; } |
|
162 |
inline QT3_SUPPORT void restart() { stop(); start(); } |
|
163 |
inline QT3_SUPPORT QImage frameImage() const { return currentImage(); } |
|
164 |
inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); } |
|
165 |
inline QT3_SUPPORT void step() { jumpToNextFrame(); } |
|
166 |
inline QT3_SUPPORT void pause() { setPaused(true); } |
|
167 |
inline QT3_SUPPORT void unpause() { setPaused(false); } |
|
168 |
#endif |
|
169 |
}; |
|
170 |
||
171 |
QT_END_NAMESPACE |
|
172 |
||
173 |
QT_END_HEADER |
|
174 |
||
175 |
#endif // QT_NO_MOVIE |
|
176 |
||
177 |
#endif // QMOVIE_H |