From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/movies-example.html | 168 +++++++++++++++++++++---------------------- 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'doc/html/movies-example.html') 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; }

-The Movies example displays MNG and animated GIF files using the TQMovie and -TQLabel classes. +The Movies example displays MNG and animated GIF files using the TQMovie and +TQLabel classes.

The movies will only read an animated GIF if GIF reading was enabled when TQt was built.


Main: @@ -48,25 +48,25 @@ The Movies example displays MNG and animated GIF files using the qapplication.h> -#include <qfiledialog.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qpainter.h> -#include <qmessagebox.h> -#include <qmovie.h> -#include <qvbox.h> +#include <ntqapplication.h> +#include <ntqfiledialog.h> +#include <ntqpushbutton.h> +#include <ntqlabel.h> +#include <ntqpainter.h> +#include <ntqmessagebox.h> +#include <ntqmovie.h> +#include <ntqvbox.h> -class MovieScreen : public TQFrame { +class MovieScreen : public TQFrame { Q_OBJECT - TQMovie movie; - TQString filename; - TQSize sh; + TQMovie movie; + TQString filename; + TQSize sh; public: MovieScreen(const char* fname, TQMovie m, TQWidget* p=0, const char* name=0, WFlags f=0) : - TQFrame(p, name, f), + TQFrame(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. - movie.setBackgroundColor(backgroundColor()); + movie.setBackgroundColor(backgroundColor()); setBackgroundMode(NoBackground); // Get the movie to tell use when interesting things happen. - movie.connectUpdate(this, SLOT(movieUpdated(const TQRect&))); - movie.connectResize(this, SLOT(movieResized(const TQSize&))); - movie.connectStatus(this, SLOT(movieStatus(int))); + movie.connectUpdate(this, SLOT(movieUpdated(const TQRect&))); + movie.connectResize(this, SLOT(movieResized(const TQSize&))); + movie.connectStatus(this, SLOT(movieStatus(int))); setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding)); } - TQSize sizeHint() const + TQSize sizeHint() const { return sh; } @@ -99,25 +99,25 @@ protected: void drawContents(TQPainter* p) { // Get the current movie frame. - TQPixmap pm = movie.framePixmap(); + TQPixmap pm = movie.framePixmap(); // Get the area we have to draw in. - TQRect r = contentsRect(); + TQRect r = contentsRect(); - if ( !pm.isNull() ) { + if ( !pm.isNull() ) { // Only rescale is we need to - it can take CPU! - if ( r.size() != pm.size() ) { - TQWMatrix m; - m.scale((double)r.width()/pm.width(), - (double)r.height()/pm.height()); - pm = pm.xForm(m); + if ( r.size() != pm.size() ) { + TQWMatrix m; + m.scale((double)r.width()/pm.width(), + (double)r.height()/pm.height()); + pm = pm.xForm(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. // - p->drawPixmap(r.x(), r.y(), pm); + p->drawPixmap(r.x(), r.y(), pm); } @@ -125,11 +125,11 @@ protected: const char* message = 0; - if (movie.paused()) { + if (movie.paused()) { message = "PAUSED"; - } else if (movie.finished()) { + } else if (movie.finished()) { message = "THE END"; - } else if (movie.steps() > 0) { + } else if (movie.steps() > 0) { message = "FF >>"; } @@ -137,20 +137,20 @@ protected: // Find a good font size... p->setFont(TQFont("Helvetica", 24)); - TQFontMetrics fm = p->fontMetrics(); - if ( fm.width(message) > r.width()-10 ) + TQFontMetrics fm = p->fontMetrics(); + if ( fm.width(message) > r.width()-10 ) p->setFont(TQFont("Helvetica", 18)); fm = p->fontMetrics(); - if ( fm.width(message) > r.width()-10 ) + if ( fm.width(message) > r.width()-10 ) p->setFont(TQFont("Helvetica", 14)); fm = p->fontMetrics(); - if ( fm.width(message) > r.width()-10 ) + if ( fm.width(message) > r.width()-10 ) p->setFont(TQFont("Helvetica", 12)); fm = p->fontMetrics(); - if ( fm.width(message) > r.width()-10 ) + if ( fm.width(message) > r.width()-10 ) p->setFont(TQFont("Helvetica", 10)); // "Shadow" effect. @@ -164,60 +164,60 @@ protected: public slots: void restart() { - movie.restart(); + movie.restart(); repaint(); } void togglePause() { - if ( movie.paused() ) - movie.unpause(); + if ( movie.paused() ) + movie.unpause(); else - movie.pause(); + movie.pause(); repaint(); } void step() { - movie.step(); + movie.step(); repaint(); } void step10() { - movie.step(10); + movie.step(10); repaint(); } private slots: - void movieUpdated(const TQRect& area) + void movieUpdated(const TQRect& area) { if (!isVisible()) show(); // The given area of the movie has changed. - TQRect r = contentsRect(); + TQRect r = contentsRect(); - if ( r.size() != movie.framePixmap().size() ) { + if ( r.size() != movie.framePixmap().size() ) { // Need to scale - redraw whole frame. repaint( r ); } else { // Only redraw the changed area of the frame - repaint( area.x()+r.x(), area.y()+r.x(), - area.width(), area.height() ); + repaint( area.x()+r.x(), area.y()+r.x(), + area.width(), area.height() ); } } - void movieResized(const TQSize& size) + void movieResized(const TQSize& size) { // The movie changed size, probably from its initial zero size. int fw = frameWidth(); - sh = TQSize( size.width() + fw*2, size.height() + fw*2 ); - updateGeometry(); - if ( parentWidget() && parentWidget()->isHidden() ) - parentWidget()->show(); + sh = TQSize( size.width() + fw*2, size.height() + fw*2 ); + updateGeometry(); + if ( parentWidget() && parentWidget()->isHidden() ) + parentWidget()->show(); } void movieStatus(int status) @@ -225,46 +225,46 @@ private slots: // The movie has sent us a status message. if (status < 0) { - TQString msg; - msg.sprintf("Could not play movie \"%s\"", (const char*)filename); - TQMessageBox::warning(this, "movies", msg); - parentWidget()->close(); + TQString msg; + msg.sprintf("Could not play movie \"%s\"", (const char*)filename); + TQMessageBox::warning(this, "movies", msg); + parentWidget()->close(); } else if (status == TQMovie::Paused || status == TQMovie::EndOfMovie) { - repaint(); // Ensure status text is displayed + repaint(); // Ensure status text is displayed } } }; -class MoviePlayer : public TQVBox { +class MoviePlayer : public TQVBox { MovieScreen* movie; public: MoviePlayer(const char* fname, TQMovie m, TQWidget* p=0, const char* name=0, WFlags f=0) : - TQVBox(p,name,f) + TQVBox(p,name,f) { movie = new MovieScreen(fname, m, this); - TQHBox* hb = new TQHBox(this); - TQPushButton* btn; - btn = new TQPushButton("<<", hb); - connect(btn, SIGNAL(clicked()), movie, SLOT(restart())); - btn = new TQPushButton("||", hb); - connect(btn, SIGNAL(clicked()), movie, SLOT(togglePause())); - btn = new TQPushButton(">|", hb); - connect(btn, SIGNAL(clicked()), movie, SLOT(step())); - btn = new TQPushButton(">>|", hb); - connect(btn, SIGNAL(clicked()), movie, SLOT(step10())); + TQHBox* hb = new TQHBox(this); + TQPushButton* btn; + btn = new TQPushButton("<<", hb); + connect(btn, SIGNAL(clicked()), movie, SLOT(restart())); + btn = new TQPushButton("||", hb); + connect(btn, SIGNAL(clicked()), movie, SLOT(togglePause())); + btn = new TQPushButton(">|", hb); + connect(btn, SIGNAL(clicked()), movie, SLOT(step())); + btn = new TQPushButton(">>|", hb); + connect(btn, SIGNAL(clicked()), movie, SLOT(step10())); } }; // A TQFileDialog that chooses movies. // -class MovieStarter: public TQFileDialog { +class MovieStarter: public TQFileDialog { Q_OBJECT public: MovieStarter(const char *dir); public slots: - void startMovie(const TQString& filename); + void startMovie(const TQString& 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: MovieStarter::MovieStarter(const char *dir) - : TQFileDialog(dir, "*.gif *.mng") + : TQFileDialog(dir, "*.gif *.mng") { //behave as in getOpenFilename - setMode( ExistingFile ); + setMode( ExistingFile ); // When a file is selected, show it as a movie. - connect(this, SIGNAL(fileSelected(const TQString&)), - this, SLOT(startMovie(const TQString&))); + connect(this, SIGNAL(fileSelected(const TQString&)), + this, SLOT(startMovie(const TQString&))); } -void MovieStarter::startMovie(const TQString& filename) +void MovieStarter::startMovie(const TQString& filename) { if ( filename ) // Start a new movie - have it delete when closed. (new MoviePlayer( filename, TQMovie(filename), 0, 0, WDestructiveClose))->show(); } -void MovieStarter::done( int r ) +void MovieStarter::done( int r ) { if (r != Accepted) - qApp->quit(); // end on Cancel - setResult( r ); + qApp->quit(); // end on Cancel + setResult( r ); // And don't hide. } @@ -301,7 +301,7 @@ void MovieStarter::startMovie(const TQ int main(int argc, char **argv) { - TQApplication a(argc, argv); + TQApplication 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::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); + TQObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); } else { // "GUI" mode - open a chooser for movies // MovieStarter* fd = new MovieStarter("."); - fd->show(); + fd->show(); } // Go! - return a.exec(); + return a.exec(); } #include "main.moc" -- cgit v1.2.1