1
/***************************************************************************
2
* Copyright (C) 2013-2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>*
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 3 of the License, or *
8
* (at your option) any later version. *
10
* This program 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 *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17
**************************************************************************/
18
#include "videowidget3.h"
21
#include <QtCore/QDebug>
22
#include <QtOpenGL/QGLWidget>
23
#include <QtOpenGL/QGLFormat>
30
#include <lib/videorenderer.h>
31
#include <lib/videomodel.h>
32
#include "videoscene.h"
33
#include "videoglframe.h"
34
#include "videotoolbar.h"
37
#ifndef GL_MULTISAMPLE
38
#define GL_MULTISAMPLE 0x809D
42
VideoWidget3::VideoWidget3(QWidget *parent) : QGraphicsView(parent)
44
QSizePolicy sp = sizePolicy();
45
sp.setVerticalPolicy ( QSizePolicy::Preferred );
46
sp.setHorizontalPolicy( QSizePolicy::Preferred );
47
sp.setHeightForWidth ( true );
48
sp.setWidthForHeight ( true );
51
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
52
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
54
m_pWdg = new QGLWidget(QGLFormat(QGL::SampleBuffers/*|QGL::AlphaChannel*/),this);
56
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
58
m_pScene = new VideoScene();
61
VideoToolbar* tb = new VideoToolbar(nullptr);
62
tb->setForcedParent(this);
64
m_pScene->setToolbar(tb);
65
m_pScene->setSceneRect(0,0,width(),height());
69
VideoWidget3::~VideoWidget3()
74
void VideoWidget3::addRenderer(VideoRenderer* renderer)
76
m_pWdg->makeCurrent();
78
VideoGLFrame* frm = new VideoGLFrame(m_pWdg);
79
frm->setRenderer(renderer);
80
connect(frm,SIGNAL(changed()),m_pScene,SLOT(frameChanged()));
81
m_pScene->addFrame(frm);
85
void VideoWidget3::resizeEvent(QResizeEvent* event)
87
m_pScene->setSceneRect(0,0,event->size().width(),event->size().height());