diff options
Diffstat (limited to 'doc/html/movies-example.html')
-rw-r--r-- | doc/html/movies-example.html | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/doc/html/movies-example.html b/doc/html/movies-example.html index d607e6ac2..7c2544239 100644 --- a/doc/html/movies-example.html +++ b/doc/html/movies-example.html @@ -33,8 +33,8 @@ body { background: #ffffff; color: black; } <p> -The Movies example displays MNG and animated GIF files using the <a href="qmovie.html">TQMovie</a> and -<a href="qlabel.html">TQLabel</a> classes. +The Movies example displays MNG and animated GIF files using the <a href="ntqmovie.html">TQMovie</a> and +<a href="ntqlabel.html">TQLabel</a> classes. <p> The movies will only read an animated GIF if GIF reading was enabled when TQt was built. <p> <hr> <p> Main: @@ -48,25 +48,25 @@ The Movies example displays MNG and animated GIF files using the <a href="qmovie ** *****************************************************************************/ -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qfiledialog-h.html">qfiledialog.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qmovie-h.html">qmovie.h</a>> -#include <<a href="qvbox-h.html">qvbox.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qfiledialog-h.html">ntqfiledialog.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qmovie-h.html">ntqmovie.h</a>> +#include <<a href="qvbox-h.html">ntqvbox.h</a>> -class MovieScreen : public <a href="qframe.html">TQFrame</a> { +class MovieScreen : public <a href="ntqframe.html">TQFrame</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> - <a href="qmovie.html">TQMovie</a> movie; - <a href="qstring.html">TQString</a> filename; - <a href="qsize.html">TQSize</a> sh; + <a href="ntqmovie.html">TQMovie</a> movie; + <a href="ntqstring.html">TQString</a> filename; + <a href="ntqsize.html">TQSize</a> sh; public: MovieScreen(const char* fname, TQMovie m, TQWidget* p=0, const char* name=0, WFlags f=0) : - <a href="qframe.html">TQFrame</a>(p, name, f), + <a href="ntqframe.html">TQFrame</a>(p, name, f), sh(100,100) { setCaption(fname); @@ -77,18 +77,18 @@ public: setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken); // No background needed, since we draw on the whole widget. -<a name="x523"></a> movie.<a href="qwidget.html#setBackgroundColor">setBackgroundColor</a>(backgroundColor()); +<a name="x523"></a> movie.<a href="ntqwidget.html#setBackgroundColor">setBackgroundColor</a>(backgroundColor()); setBackgroundMode(NoBackground); // Get the movie to tell use when interesting things happen. -<a name="x500"></a> movie.<a href="qmovie.html#connectUpdate">connectUpdate</a>(this, SLOT(movieUpdated(const <a href="qrect.html">TQRect</a>&))); -<a name="x498"></a> movie.<a href="qmovie.html#connectResize">connectResize</a>(this, SLOT(movieResized(const <a href="qsize.html">TQSize</a>&))); -<a name="x499"></a> movie.<a href="qmovie.html#connectStatus">connectStatus</a>(this, SLOT(movieStatus(int))); +<a name="x500"></a> movie.<a href="ntqmovie.html#connectUpdate">connectUpdate</a>(this, SLOT(movieUpdated(const <a href="ntqrect.html">TQRect</a>&))); +<a name="x498"></a> movie.<a href="ntqmovie.html#connectResize">connectResize</a>(this, SLOT(movieResized(const <a href="ntqsize.html">TQSize</a>&))); +<a name="x499"></a> movie.<a href="ntqmovie.html#connectStatus">connectStatus</a>(this, SLOT(movieStatus(int))); setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding)); } - <a href="qsize.html">TQSize</a> sizeHint() const + <a href="ntqsize.html">TQSize</a> sizeHint() const { return sh; } @@ -99,25 +99,25 @@ protected: void drawContents(TQPainter* p) { // Get the current movie frame. -<a name="x502"></a> <a href="qpixmap.html">TQPixmap</a> pm = movie.<a href="qmovie.html#framePixmap">framePixmap</a>(); +<a name="x502"></a> <a href="ntqpixmap.html">TQPixmap</a> pm = movie.<a href="ntqmovie.html#framePixmap">framePixmap</a>(); // Get the area we have to draw in. - <a href="qrect.html">TQRect</a> r = contentsRect(); + <a href="ntqrect.html">TQRect</a> r = contentsRect(); -<a name="x511"></a> if ( !pm.<a href="qpixmap.html#isNull">isNull</a>() ) { +<a name="x511"></a> if ( !pm.<a href="ntqpixmap.html#isNull">isNull</a>() ) { // Only rescale is we need to - it can take CPU! -<a name="x516"></a><a name="x512"></a> if ( r.<a href="qrect.html#size">size</a>() != pm.<a href="qpixmap.html#size">size</a>() ) { - <a href="qwmatrix.html">TQWMatrix</a> m; -<a name="x524"></a><a name="x517"></a><a name="x513"></a> m.<a href="qwmatrix.html#scale">scale</a>((double)r.<a href="qrect.html#width">width</a>()/pm.<a href="qpixmap.html#width">width</a>(), -<a name="x515"></a><a name="x510"></a> (double)r.<a href="qrect.html#height">height</a>()/pm.<a href="qpixmap.html#height">height</a>()); -<a name="x514"></a> pm = pm.<a href="qpixmap.html#xForm">xForm</a>(m); +<a name="x516"></a><a name="x512"></a> if ( r.<a href="ntqrect.html#size">size</a>() != pm.<a href="ntqpixmap.html#size">size</a>() ) { + <a href="ntqwmatrix.html">TQWMatrix</a> m; +<a name="x524"></a><a name="x517"></a><a name="x513"></a> m.<a href="ntqwmatrix.html#scale">scale</a>((double)r.<a href="ntqrect.html#width">width</a>()/pm.<a href="ntqpixmap.html#width">width</a>(), +<a name="x515"></a><a name="x510"></a> (double)r.<a href="ntqrect.html#height">height</a>()/pm.<a href="ntqpixmap.html#height">height</a>()); +<a name="x514"></a> pm = pm.<a href="ntqpixmap.html#xForm">xForm</a>(m); } // Draw the [possibly scaled] frame. movieUpdated() below calls // repaint with only the changed area, so clipping will ensure we // only do the minimum amount of rendering. // -<a name="x519"></a><a name="x518"></a> p->drawPixmap(r.<a href="qrect.html#x">x</a>(), r.<a href="qrect.html#y">y</a>(), pm); +<a name="x519"></a><a name="x518"></a> p->drawPixmap(r.<a href="ntqrect.html#x">x</a>(), r.<a href="ntqrect.html#y">y</a>(), pm); } @@ -125,11 +125,11 @@ protected: const char* message = 0; -<a name="x504"></a> if (movie.<a href="qmovie.html#paused">paused</a>()) { +<a name="x504"></a> if (movie.<a href="ntqmovie.html#paused">paused</a>()) { message = "PAUSED"; -<a name="x501"></a> } else if (movie.<a href="qmovie.html#finished">finished</a>()) { +<a name="x501"></a> } else if (movie.<a href="ntqmovie.html#finished">finished</a>()) { message = "THE END"; -<a name="x507"></a> } else if (movie.<a href="qmovie.html#steps">steps</a>() > 0) { +<a name="x507"></a> } else if (movie.<a href="ntqmovie.html#steps">steps</a>() > 0) { message = "FF >>"; } @@ -137,20 +137,20 @@ protected: // Find a good font size... p->setFont(TQFont("Helvetica", 24)); - <a href="qfontmetrics.html">TQFontMetrics</a> fm = p->fontMetrics(); -<a name="x496"></a> if ( fm.<a href="qfontmetrics.html#width">width</a>(message) > r.<a href="qrect.html#width">width</a>()-10 ) + <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = p->fontMetrics(); +<a name="x496"></a> if ( fm.<a href="ntqfontmetrics.html#width">width</a>(message) > r.<a href="ntqrect.html#width">width</a>()-10 ) p->setFont(TQFont("Helvetica", 18)); fm = p->fontMetrics(); - if ( fm.<a href="qfontmetrics.html#width">width</a>(message) > r.<a href="qrect.html#width">width</a>()-10 ) + if ( fm.<a href="ntqfontmetrics.html#width">width</a>(message) > r.<a href="ntqrect.html#width">width</a>()-10 ) p->setFont(TQFont("Helvetica", 14)); fm = p->fontMetrics(); - if ( fm.<a href="qfontmetrics.html#width">width</a>(message) > r.<a href="qrect.html#width">width</a>()-10 ) + if ( fm.<a href="ntqfontmetrics.html#width">width</a>(message) > r.<a href="ntqrect.html#width">width</a>()-10 ) p->setFont(TQFont("Helvetica", 12)); fm = p->fontMetrics(); - if ( fm.<a href="qfontmetrics.html#width">width</a>(message) > r.<a href="qrect.html#width">width</a>()-10 ) + if ( fm.<a href="ntqfontmetrics.html#width">width</a>(message) > r.<a href="ntqrect.html#width">width</a>()-10 ) p->setFont(TQFont("Helvetica", 10)); // "Shadow" effect. @@ -164,60 +164,60 @@ protected: public slots: void restart() { -<a name="x505"></a> movie.<a href="qmovie.html#restart">restart</a>(); +<a name="x505"></a> movie.<a href="ntqmovie.html#restart">restart</a>(); repaint(); } void togglePause() { - if ( movie.<a href="qmovie.html#paused">paused</a>() ) -<a name="x508"></a> movie.<a href="qmovie.html#unpause">unpause</a>(); + if ( movie.<a href="ntqmovie.html#paused">paused</a>() ) +<a name="x508"></a> movie.<a href="ntqmovie.html#unpause">unpause</a>(); else -<a name="x503"></a> movie.<a href="qmovie.html#pause">pause</a>(); +<a name="x503"></a> movie.<a href="ntqmovie.html#pause">pause</a>(); repaint(); } void step() { -<a name="x506"></a> movie.<a href="qmovie.html#step">step</a>(); +<a name="x506"></a> movie.<a href="ntqmovie.html#step">step</a>(); repaint(); } void step10() { - movie.<a href="qmovie.html#step">step</a>(10); + movie.<a href="ntqmovie.html#step">step</a>(10); repaint(); } private slots: - void movieUpdated(const <a href="qrect.html">TQRect</a>& area) + void movieUpdated(const <a href="ntqrect.html">TQRect</a>& area) { if (!isVisible()) show(); // The given area of the movie has changed. - <a href="qrect.html">TQRect</a> r = contentsRect(); + <a href="ntqrect.html">TQRect</a> r = contentsRect(); - if ( r.<a href="qrect.html#size">size</a>() != movie.<a href="qmovie.html#framePixmap">framePixmap</a>().size() ) { + if ( r.<a href="ntqrect.html#size">size</a>() != movie.<a href="ntqmovie.html#framePixmap">framePixmap</a>().size() ) { // Need to scale - redraw whole frame. repaint( r ); } else { // Only redraw the changed area of the frame - repaint( area.<a href="qrect.html#x">x</a>()+r.<a href="qrect.html#x">x</a>(), area.<a href="qrect.html#y">y</a>()+r.<a href="qrect.html#x">x</a>(), - area.<a href="qrect.html#width">width</a>(), area.<a href="qrect.html#height">height</a>() ); + repaint( area.<a href="ntqrect.html#x">x</a>()+r.<a href="ntqrect.html#x">x</a>(), area.<a href="ntqrect.html#y">y</a>()+r.<a href="ntqrect.html#x">x</a>(), + area.<a href="ntqrect.html#width">width</a>(), area.<a href="ntqrect.html#height">height</a>() ); } } - void movieResized(const <a href="qsize.html">TQSize</a>& size) + void movieResized(const <a href="ntqsize.html">TQSize</a>& size) { // The movie changed size, probably from its initial zero size. int fw = frameWidth(); -<a name="x521"></a><a name="x520"></a> sh = TQSize( size.<a href="qsize.html#width">width</a>() + fw*2, size.<a href="qsize.html#height">height</a>() + fw*2 ); - <a href="qwidget.html#updateGeometry">updateGeometry</a>(); - if ( <a href="qwidget.html#parentWidget">parentWidget</a>() && parentWidget()->isHidden() ) - <a href="qwidget.html#parentWidget">parentWidget</a>()->show(); +<a name="x521"></a><a name="x520"></a> sh = TQSize( size.<a href="ntqsize.html#width">width</a>() + fw*2, size.<a href="ntqsize.html#height">height</a>() + fw*2 ); + <a href="ntqwidget.html#updateGeometry">updateGeometry</a>(); + if ( <a href="ntqwidget.html#parentWidget">parentWidget</a>() && parentWidget()->isHidden() ) + <a href="ntqwidget.html#parentWidget">parentWidget</a>()->show(); } void movieStatus(int status) @@ -225,46 +225,46 @@ private slots: // The movie has sent us a status message. if (status < 0) { - <a href="qstring.html">TQString</a> msg; - msg.<a href="qstring.html#sprintf">sprintf</a>("Could not play movie \"%s\"", (const char*)filename); - TQMessageBox::<a href="qmessagebox.html#warning">warning</a>(this, "movies", msg); - <a href="qwidget.html#parentWidget">parentWidget</a>()->close(); + <a href="ntqstring.html">TQString</a> msg; + msg.<a href="ntqstring.html#sprintf">sprintf</a>("Could not play movie \"%s\"", (const char*)filename); + TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>(this, "movies", msg); + <a href="ntqwidget.html#parentWidget">parentWidget</a>()->close(); } else if (status == TQMovie::Paused || status == TQMovie::EndOfMovie) { - <a href="qwidget.html#repaint">repaint</a>(); // Ensure status text is displayed + <a href="ntqwidget.html#repaint">repaint</a>(); // Ensure status text is displayed } } }; -class MoviePlayer : public <a href="qvbox.html">TQVBox</a> { +class MoviePlayer : public <a href="ntqvbox.html">TQVBox</a> { MovieScreen* movie; public: MoviePlayer(const char* fname, TQMovie m, TQWidget* p=0, const char* name=0, WFlags f=0) : - <a href="qvbox.html">TQVBox</a>(p,name,f) + <a href="ntqvbox.html">TQVBox</a>(p,name,f) { movie = new MovieScreen(fname, m, this); - <a href="qhbox.html">TQHBox</a>* hb = new <a href="qhbox.html">TQHBox</a>(this); - <a href="qpushbutton.html">TQPushButton</a>* btn; - btn = new <a href="qpushbutton.html">TQPushButton</a>("<<", hb); - <a href="qobject.html#connect">connect</a>(btn, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), movie, SLOT(<a href="qmovie.html#restart">restart</a>())); - btn = new <a href="qpushbutton.html">TQPushButton</a>("||", hb); - <a href="qobject.html#connect">connect</a>(btn, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), movie, SLOT(togglePause())); - btn = new <a href="qpushbutton.html">TQPushButton</a>(">|", hb); - <a href="qobject.html#connect">connect</a>(btn, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), movie, SLOT(<a href="qmovie.html#step">step</a>())); - btn = new <a href="qpushbutton.html">TQPushButton</a>(">>|", hb); - <a href="qobject.html#connect">connect</a>(btn, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), movie, SLOT(step10())); + <a href="ntqhbox.html">TQHBox</a>* hb = new <a href="ntqhbox.html">TQHBox</a>(this); + <a href="ntqpushbutton.html">TQPushButton</a>* btn; + btn = new <a href="ntqpushbutton.html">TQPushButton</a>("<<", hb); + <a href="ntqobject.html#connect">connect</a>(btn, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), movie, SLOT(<a href="ntqmovie.html#restart">restart</a>())); + btn = new <a href="ntqpushbutton.html">TQPushButton</a>("||", hb); + <a href="ntqobject.html#connect">connect</a>(btn, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), movie, SLOT(togglePause())); + btn = new <a href="ntqpushbutton.html">TQPushButton</a>(">|", hb); + <a href="ntqobject.html#connect">connect</a>(btn, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), movie, SLOT(<a href="ntqmovie.html#step">step</a>())); + btn = new <a href="ntqpushbutton.html">TQPushButton</a>(">>|", hb); + <a href="ntqobject.html#connect">connect</a>(btn, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), movie, SLOT(step10())); } }; // A TQFileDialog that chooses movies. // -class MovieStarter: public <a href="qfiledialog.html">TQFileDialog</a> { +class MovieStarter: public <a href="ntqfiledialog.html">TQFileDialog</a> { Q_OBJECT public: MovieStarter(const char *dir); public slots: - void startMovie(const <a href="qstring.html">TQString</a>& filename); + void startMovie(const <a href="ntqstring.html">TQString</a>& filename); // TQDialog's method - normally closes the file dialog. // We want it left open, and we want Cancel to quit everything. void done( int r ); @@ -272,28 +272,28 @@ public slots: <a name="f258"></a>MovieStarter::MovieStarter(const char *dir) - : <a href="qfiledialog.html">TQFileDialog</a>(dir, "*.gif *.mng") + : <a href="ntqfiledialog.html">TQFileDialog</a>(dir, "*.gif *.mng") { //behave as in getOpenFilename - <a href="qfiledialog.html#setMode">setMode</a>( ExistingFile ); + <a href="ntqfiledialog.html#setMode">setMode</a>( ExistingFile ); // When a file is selected, show it as a movie. - <a href="qobject.html#connect">connect</a>(this, SIGNAL(<a href="qfiledialog.html#fileSelected">fileSelected</a>(const <a href="qstring.html">TQString</a>&)), - this, SLOT(startMovie(const <a href="qstring.html">TQString</a>&))); + <a href="ntqobject.html#connect">connect</a>(this, SIGNAL(<a href="ntqfiledialog.html#fileSelected">fileSelected</a>(const <a href="ntqstring.html">TQString</a>&)), + this, SLOT(startMovie(const <a href="ntqstring.html">TQString</a>&))); } -void <a name="f259"></a>MovieStarter::startMovie(const <a href="qstring.html">TQString</a>& filename) +void <a name="f259"></a>MovieStarter::startMovie(const <a href="ntqstring.html">TQString</a>& filename) { if ( filename ) // Start a new movie - have it delete when closed. (new MoviePlayer( filename, TQMovie(filename), 0, 0, WDestructiveClose))->show(); } -<a name="x495"></a>void MovieStarter::<a href="qdialog.html#done">done</a>( int r ) +<a name="x495"></a>void MovieStarter::<a href="ntqdialog.html#done">done</a>( int r ) { if (r != Accepted) - qApp-><a href="qapplication.html#quit">quit</a>(); // end on Cancel - <a href="qdialog.html#setResult">setResult</a>( r ); + qApp-><a href="ntqapplication.html#quit">quit</a>(); // end on Cancel + <a href="ntqdialog.html#setResult">setResult</a>( r ); // And don't hide. } @@ -301,7 +301,7 @@ void <a name="f259"></a>MovieStarter::startMovie(const <a href="qstring.html">TQ int main(int argc, char **argv) { - <a href="qapplication.html">TQApplication</a> a(argc, argv); + <a href="ntqapplication.html">TQApplication</a> a(argc, argv); if (argc > 1) { // Commandline mode - show movies given on the command line @@ -317,16 +317,16 @@ int main(int argc, char **argv) (void)new MovieScreen(argv[arg], TQMovie(argv[arg]), 0, 0, TQt::WDestructiveClose); } - TQObject::<a href="qobject.html#connect">connect</a>(qApp, SIGNAL(<a href="qapplication.html#lastWindowClosed">lastWindowClosed</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>())); + TQObject::<a href="ntqobject.html#connect">connect</a>(qApp, SIGNAL(<a href="ntqapplication.html#lastWindowClosed">lastWindowClosed</a>()), qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>())); } else { // "GUI" mode - open a chooser for movies // MovieStarter* fd = new MovieStarter("."); -<a name="x494"></a> fd-><a href="qdialog.html#show">show</a>(); +<a name="x494"></a> fd-><a href="ntqdialog.html#show">show</a>(); } // Go! - return a.<a href="qapplication.html#exec">exec</a>(); + return a.<a href="ntqapplication.html#exec">exec</a>(); } #include "main.moc" |