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 "qrenderer.h"
22
QRenderer(const QString videoLocation,QWidget * parent,Qt::WindowFlags flags)23 QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WindowFlags flags)
24 : QWidget(parent, flags),
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 QObject::connect(this, SIGNAL(mouseMoved()), &m_gt, SLOT(onMouseMove()));
37 m_gt.start();
38 }
39
~QRenderer()40 QRenderer::~QRenderer()
41 {
42 }
43
paintEvent(QPaintEvent * event)44 void QRenderer::paintEvent(QPaintEvent* event)
45 {
46 emit exposeRequested();
47 }
48
mouseMoveEvent(QMouseEvent * event)49 void QRenderer::mouseMoveEvent(QMouseEvent* event)
50 {
51 emit mouseMoved();
52 }
53
closeEvent(QCloseEvent * event)54 void QRenderer::closeEvent(QCloseEvent* event)
55 {
56 emit closeRequested();
57 m_gt.wait();
58 }
59