Logo::Logo(){ setAttribute ( Qt::WA_DeleteOnClose ); setWindowFlags(windowFlags()|Qt::Popup); v=new Phonon::VideoWidget (this); o=new Phonon::MediaObject (this); Phonon::createPath ( o, v ); v->setAspectRatio ( Phonon::VideoWidget::AspectRatio4_3 ); o->enqueue ( Phonon::MediaSource ( "Perpetuum.avi" ) ); connect ( o,SIGNAL ( finished() ),this,SLOT ( repeat() ) ); o->play(); start=new QPushButton ( tr ( "Запустить приложение" ),this ); exit=new QPushButton ( tr ( "Выход" ),this ); connect ( start,SIGNAL ( clicked() ),this,SLOT ( slotStart() ) ); connect ( exit,SIGNAL ( clicked() ),qApp,SLOT ( quit() ) ); QVBoxLayout *l=new QVBoxLayout ( this ); QHBoxLayout *h=new QHBoxLayout; h->addSpacing ( 1 ); h->addWidget ( start ); h->addWidget ( exit ); l->addWidget ( v ); l->addLayout ( h ); setLayout ( l );}void Logo::repeat(){ o->seek ( 0 ); qDebug()<<o->currentTime(); o->play();}void Logo::slotStart(){ }
#include <QApplication>#include <QTextCodec>#include "logo.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); Logo l; l.show(); return app.exec();}