~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to .pc/kubuntu_sflphone-fix-akonadi-freeze.patch/kde/src/widgets/videowidget3.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2013-2014 by Savoir-Faire Linux                         *
3
 
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>*
4
 
 *                                                                         *
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.                                   *
9
 
 *                                                                         *
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.                          *
14
 
 *                                                                         *
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"
19
 
 
20
 
//Qt
21
 
#include <QtCore/QDebug>
22
 
#include <QtOpenGL/QGLWidget>
23
 
#include <QtOpenGL/QGLFormat>
24
 
 
25
 
//System
26
 
#include <math.h>
27
 
#include <GL/glu.h>
28
 
 
29
 
//SFLPhone
30
 
#include <lib/videorenderer.h>
31
 
#include <lib/videomodel.h>
32
 
#include "videoscene.h"
33
 
#include "videoglframe.h"
34
 
#include "videotoolbar.h"
35
 
 
36
 
 
37
 
#ifndef GL_MULTISAMPLE
38
 
#define GL_MULTISAMPLE  0x809D
39
 
#endif
40
 
 
41
 
 
42
 
VideoWidget3::VideoWidget3(QWidget *parent) : QGraphicsView(parent)
43
 
{
44
 
   QSizePolicy sp = sizePolicy();
45
 
   sp.setVerticalPolicy  ( QSizePolicy::Preferred );
46
 
   sp.setHorizontalPolicy( QSizePolicy::Preferred );
47
 
   sp.setHeightForWidth  ( true                   );
48
 
   sp.setWidthForHeight  ( true                   );
49
 
   setSizePolicy(sp);
50
 
 
51
 
   setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
52
 
   setVerticalScrollBarPolicy  (Qt::ScrollBarAlwaysOff);
53
 
 
54
 
   m_pWdg = new QGLWidget(QGLFormat(QGL::SampleBuffers/*|QGL::AlphaChannel*/),this);
55
 
   setViewport(m_pWdg);
56
 
   setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
57
 
 
58
 
   m_pScene = new VideoScene();
59
 
   setScene(m_pScene);
60
 
 
61
 
   VideoToolbar* tb = new VideoToolbar(nullptr);
62
 
   tb->setForcedParent(this);
63
 
   tb->show();
64
 
   m_pScene->setToolbar(tb);
65
 
   m_pScene->setSceneRect(0,0,width(),height());
66
 
   tb->resizeToolbar();
67
 
}
68
 
 
69
 
VideoWidget3::~VideoWidget3()
70
 
{
71
 
   
72
 
}
73
 
 
74
 
void VideoWidget3::addRenderer(VideoRenderer* renderer)
75
 
{
76
 
   m_pWdg->makeCurrent();
77
 
   if (renderer) {
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);
82
 
   }
83
 
}
84
 
 
85
 
void VideoWidget3::resizeEvent(QResizeEvent* event)
86
 
{
87
 
   m_pScene->setSceneRect(0,0,event->size().width(),event->size().height());
88
 
}