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