Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QMOVIE_H
00043 #define QMOVIE_H
00044
00045 #include <QtCore/qobject.h>
00046
00047 #ifndef QT_NO_MOVIE
00048
00049 #include <QtCore/qbytearray.h>
00050 #include <QtCore/qlist.h>
00051 #include <QtCore/qobject.h>
00052 #include <QtGui/qimagereader.h>
00053
00054 #ifdef QT3_SUPPORT
00055 #include <QtGui/qimage.h>
00056 #include <QtGui/qpixmap.h>
00057 #endif
00058
00059 QT_BEGIN_HEADER
00060
00061 QT_BEGIN_NAMESPACE
00062
00063 QT_MODULE(Gui)
00064
00065 class QByteArray;
00066 class QColor;
00067 class QIODevice;
00068 class QImage;
00069 class QPixmap;
00070 class QRect;
00071 class QSize;
00072
00073 class QMoviePrivate;
00074 class Q_GUI_EXPORT QMovie : public QObject
00075 {
00076 Q_OBJECT
00077 Q_DECLARE_PRIVATE(QMovie)
00078 Q_ENUMS(MovieState CacheMode)
00079 Q_PROPERTY(int speed READ speed WRITE setSpeed)
00080 Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode)
00081 public:
00082 enum MovieState {
00083 NotRunning,
00084 Paused,
00085 Running
00086 };
00087 enum CacheMode {
00088 CacheNone,
00089 CacheAll
00090 };
00091
00092 QMovie(QObject *parent = 0);
00093 explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0);
00094 explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0);
00095 ~QMovie();
00096
00097 static QList<QByteArray> supportedFormats();
00098
00099 void setDevice(QIODevice *device);
00100 QIODevice *device() const;
00101
00102 void setFileName(const QString &fileName);
00103 QString fileName() const;
00104
00105 void setFormat(const QByteArray &format);
00106 QByteArray format() const;
00107
00108 void setBackgroundColor(const QColor &color);
00109 QColor backgroundColor() const;
00110
00111 MovieState state() const;
00112
00113 QRect frameRect() const;
00114 QImage currentImage() const;
00115 QPixmap currentPixmap() const;
00116
00117 bool isValid() const;
00118
00119 bool jumpToFrame(int frameNumber);
00120 int loopCount() const;
00121 int frameCount() const;
00122 int nextFrameDelay() const;
00123 int currentFrameNumber() const;
00124
00125 int speed() const;
00126
00127 QSize scaledSize();
00128 void setScaledSize(const QSize &size);
00129
00130 CacheMode cacheMode() const;
00131 void setCacheMode(CacheMode mode);
00132
00133 CacheMode cacheMode();
00134
00135 Q_SIGNALS:
00136 void started();
00137 void resized(const QSize &size);
00138 void updated(const QRect &rect);
00139 void stateChanged(QMovie::MovieState state);
00140 void error(QImageReader::ImageReaderError error);
00141 void finished();
00142 void frameChanged(int frameNumber);
00143
00144 public Q_SLOTS:
00145 void start();
00146 bool jumpToNextFrame();
00147 void setPaused(bool paused);
00148 void stop();
00149 void setSpeed(int percentSpeed);
00150
00151 private:
00152 Q_DISABLE_COPY(QMovie)
00153 Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame())
00154
00155 #ifdef QT3_SUPPORT
00156 public:
00157 inline QT3_SUPPORT bool isNull() const { return isValid(); }
00158 inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); }
00159 inline QT3_SUPPORT bool running() const { return state() == Running; }
00160 inline QT3_SUPPORT bool paused() const { return state() == Paused; }
00161 inline QT3_SUPPORT bool finished() const { return state() == NotRunning; }
00162 inline QT3_SUPPORT void restart() { stop(); start(); }
00163 inline QT3_SUPPORT QImage frameImage() const { return currentImage(); }
00164 inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); }
00165 inline QT3_SUPPORT void step() { jumpToNextFrame(); }
00166 inline QT3_SUPPORT void pause() { setPaused(true); }
00167 inline QT3_SUPPORT void unpause() { setPaused(false); }
00168 #endif
00169 };
00170
00171 QT_END_NAMESPACE
00172
00173 QT_END_HEADER
00174
00175 #endif // QT_NO_MOVIE
00176
00177 #endif // QMOVIE_H