1 /*
2 * GStreamer
3 * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #include "qglrenderer.h"
22
QGLRenderer(const QString videoLocation,QWidget * parent)23 QGLRenderer::QGLRenderer(const QString videoLocation, QWidget *parent)
24 : QGLWidget(parent),
25 m_gt(winId(), videoLocation)
26 {
27 setAttribute(Qt::WA_NoSystemBackground);
28 setVisible(false);
29 move(20, 10);
30 resize(640, 480);
31
32 QObject::connect(&m_gt, SIGNAL(finished()), this, SLOT(close()));
33 QObject::connect(this, SIGNAL(exposeRequested()), &m_gt, SLOT(exposeRequested()));
34 QObject::connect(this, SIGNAL(closeRequested()), &m_gt, SLOT(stop()), Qt::DirectConnection);
35 QObject::connect(&m_gt, SIGNAL(showRequested()), this, SLOT(show()));
36 m_gt.start();
37 }
38
~QGLRenderer()39 QGLRenderer::~QGLRenderer()
40 {
41 }
42
paintEvent(QPaintEvent * event)43 void QGLRenderer::paintEvent(QPaintEvent* event)
44 {
45 emit exposeRequested();
46 }
47
closeEvent(QCloseEvent * event)48 void QGLRenderer::closeEvent(QCloseEvent* event)
49 {
50 emit closeRequested();
51 m_gt.wait();
52 }
53