1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.gui.movie; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.bytearray; 19 import qt.core.iodevice; 20 import qt.core.list; 21 import qt.core.object; 22 import qt.core.rect; 23 import qt.core.size; 24 import qt.core.string; 25 import qt.gui.color; 26 import qt.gui.image; 27 import qt.gui.imagereader; 28 import qt.gui.pixmap; 29 import qt.helpers; 30 31 /+ QT_REQUIRE_CONFIG(movie); 32 33 34 class QByteArray; 35 class QColor; 36 class QIODevice; 37 class QImage; 38 class QPixmap; 39 class QRect; 40 class QSize; +/ 41 42 extern(C++, class) struct QMoviePrivate; 43 class /+ Q_GUI_EXPORT +/ QMovie : QObject 44 { 45 mixin(Q_OBJECT); 46 /+ Q_DECLARE_PRIVATE(QMovie) +/ 47 /+ Q_PROPERTY(int speed READ speed WRITE setSpeed) 48 Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) +/ 49 public: 50 enum MovieState { 51 NotRunning, 52 Paused, 53 Running 54 } 55 /+ Q_ENUM(MovieState) +/ 56 enum CacheMode { 57 CacheNone, 58 CacheAll 59 } 60 /+ Q_ENUM(CacheMode) +/ 61 62 /+ explicit +/this(QObject parent = null); 63 /+ explicit +/this(QIODevice device, ref const(QByteArray) format = globalInitVar!QByteArray, QObject parent = null); 64 /+ explicit +/this(ref const(QString) fileName, ref const(QByteArray) format = globalInitVar!QByteArray, QObject parent = null); 65 ~this(); 66 67 static QList!(QByteArray) supportedFormats(); 68 69 final void setDevice(QIODevice device); 70 final QIODevice device() const; 71 72 final void setFileName(ref const(QString) fileName); 73 final QString fileName() const; 74 75 final void setFormat(ref const(QByteArray) format); 76 final QByteArray format() const; 77 78 final void setBackgroundColor(ref const(QColor) color); 79 final QColor backgroundColor() const; 80 81 final MovieState state() const; 82 83 final QRect frameRect() const; 84 final QImage currentImage() const; 85 final QPixmap currentPixmap() const; 86 87 final bool isValid() const; 88 final QImageReader.ImageReaderError lastError() const; 89 final QString lastErrorString() const; 90 91 final bool jumpToFrame(int frameNumber); 92 final int loopCount() const; 93 final int frameCount() const; 94 final int nextFrameDelay() const; 95 final int currentFrameNumber() const; 96 97 final int speed() const; 98 99 final QSize scaledSize(); 100 final void setScaledSize(ref const(QSize) size); 101 102 final CacheMode cacheMode() const; 103 final void setCacheMode(CacheMode mode); 104 105 /+ Q_SIGNALS +/public: 106 @QSignal final void started(); 107 @QSignal final void resized(ref const(QSize) size); 108 @QSignal final void updated(ref const(QRect) rect); 109 @QSignal final void stateChanged(QMovie.MovieState state); 110 @QSignal final void error(QImageReader.ImageReaderError error); 111 @QSignal final void finished(); 112 @QSignal final void frameChanged(int frameNumber); 113 114 public /+ Q_SLOTS +/: 115 @QSlot final void start(); 116 @QSlot final bool jumpToNextFrame(); 117 @QSlot final void setPaused(bool paused); 118 @QSlot final void stop(); 119 @QSlot final void setSpeed(int percentSpeed); 120 121 private: 122 /+ Q_DISABLE_COPY(QMovie) +/ 123 /+ Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame()) +/ 124 } 125