From 88ece1b213417e884d69243f3e4100925c25c182 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Wed, 8 Oct 2014 16:42:09 +0200 Subject: [PATCH] renamed SelfCamView to VideoSurface --- qtox.pro | 8 ++++---- widget/camera.h | 2 -- widget/form/settings/avform.cpp | 2 +- widget/form/settings/avform.h | 4 ++-- widget/{selfcamview.cpp => videosurface.cpp} | 21 ++++++++++---------- widget/{selfcamview.h => videosurface.h} | 6 +++--- widget/widget.cpp | 1 - widget/widget.h | 2 +- 8 files changed, 21 insertions(+), 25 deletions(-) rename widget/{selfcamview.cpp => videosurface.cpp} (88%) rename widget/{selfcamview.h => videosurface.h} (87%) diff --git a/qtox.pro b/qtox.pro index aadec52f6..9c0070db9 100644 --- a/qtox.pro +++ b/qtox.pro @@ -107,7 +107,6 @@ HEADERS += widget/form/addfriendform.h \ friendlist.h \ misc/cdata.h \ misc/cstring.h \ - widget/selfcamview.h \ widget/camera.h \ widget/netcamview.h \ misc/smileypack.h \ @@ -130,7 +129,8 @@ HEADERS += widget/form/addfriendform.h \ widget/tool/chatactions/actionaction.h \ widget/maskablepixmapwidget.h \ videosource.h \ - cameraworker.h + cameraworker.h \ + widget/videosurface.h SOURCES += \ widget/form/addfriendform.cpp \ @@ -156,7 +156,6 @@ SOURCES += \ misc/settings.cpp \ misc/cdata.cpp \ misc/cstring.cpp \ - widget/selfcamview.cpp \ widget/camera.cpp \ widget/netcamview.cpp \ misc/smileypack.cpp \ @@ -177,4 +176,5 @@ SOURCES += \ widget/tool/chatactions/systemmessageaction.cpp \ widget/tool/chatactions/actionaction.cpp \ widget/maskablepixmapwidget.cpp \ - cameraworker.cpp + cameraworker.cpp \ + widget/videosurface.cpp diff --git a/widget/camera.h b/widget/camera.h index c26420953..dcb8b7b75 100644 --- a/widget/camera.h +++ b/widget/camera.h @@ -19,9 +19,7 @@ #include #include -#include #include -#include #include "vpx/vpx_image.h" #include "opencv2/opencv.hpp" #include "videosource.h" diff --git a/widget/form/settings/avform.cpp b/widget/form/settings/avform.cpp index e8f4a0c71..4745bac2c 100644 --- a/widget/form/settings/avform.cpp +++ b/widget/form/settings/avform.cpp @@ -25,7 +25,7 @@ AVForm::AVForm() : bodyUI->setupUi(this); //cam->setVideoMode(cam->getBestVideoMode()); - camView = new SelfCamView(Camera::getInstance(), this); + camView = new VideoSurface(Camera::getInstance(), this); bodyUI->CamViewLayout->addWidget(camView); } diff --git a/widget/form/settings/avform.h b/widget/form/settings/avform.h index 03f4f4208..978506418 100644 --- a/widget/form/settings/avform.h +++ b/widget/form/settings/avform.h @@ -18,7 +18,7 @@ #define AVFORM_H #include "genericsettings.h" -#include "widget/selfcamview.h" +#include "widget/videosurface.h" #include #include #include @@ -47,7 +47,7 @@ private slots: private: Ui::AVSettings *bodyUI; - SelfCamView* camView; + VideoSurface* camView; }; #endif diff --git a/widget/selfcamview.cpp b/widget/videosurface.cpp similarity index 88% rename from widget/selfcamview.cpp rename to widget/videosurface.cpp index 71f63664e..bd49b49c0 100644 --- a/widget/selfcamview.cpp +++ b/widget/videosurface.cpp @@ -14,7 +14,7 @@ See the COPYING file for more details. */ -#include "selfcamview.h" +#include "videosurface.h" #include "camera.h" #include #include @@ -22,7 +22,7 @@ #include #include -SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent) +VideoSurface::VideoSurface(VideoSource *Source, QWidget* parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) , source(Source) , pbo(nullptr) @@ -32,11 +32,10 @@ SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent) , uploadFrame(false) , hasSubscribed(false) { - qDebug()<<"NEW VideoSurface:"<resolution(); setFixedSize(source->resolution()); } -SelfCamView::~SelfCamView() +VideoSurface::~VideoSurface() { if (pbo) delete pbo; @@ -47,36 +46,36 @@ SelfCamView::~SelfCamView() source->unsubscribe(); } -void SelfCamView::hideEvent(QHideEvent *ev) +void VideoSurface::hideEvent(QHideEvent *ev) { if (hasSubscribed) { source->unsubscribe(); hasSubscribed = false; - disconnect(source, &VideoSource::frameAvailable, this, &SelfCamView::updateGL); + disconnect(source, &VideoSource::frameAvailable, this, &VideoSurface::updateGL); } QGLWidget::hideEvent(ev); } -void SelfCamView::showEvent(QShowEvent *ev) +void VideoSurface::showEvent(QShowEvent *ev) { if (!hasSubscribed) { source->subscribe(); hasSubscribed = true; - connect(source, &VideoSource::frameAvailable, this, &SelfCamView::updateGL); + connect(source, &VideoSource::frameAvailable, this, &VideoSurface::updateGL); } QGLWidget::showEvent(ev); } -void SelfCamView::initializeGL() +void VideoSurface::initializeGL() { } -void SelfCamView::paintGL() +void VideoSurface::paintGL() { if (!pbo) { @@ -189,7 +188,7 @@ void SelfCamView::paintGL() program->release(); } -void SelfCamView::updateGL() +void VideoSurface::updateGL() { uploadFrame = true; QGLWidget::updateGL(); diff --git a/widget/selfcamview.h b/widget/videosurface.h similarity index 87% rename from widget/selfcamview.h rename to widget/videosurface.h index 8c3be62df..7de304682 100644 --- a/widget/selfcamview.h +++ b/widget/videosurface.h @@ -24,13 +24,13 @@ class QOpenGLShaderProgram; class QTimer; class VideoSource; -class SelfCamView : public QGLWidget +class VideoSurface : public QGLWidget { Q_OBJECT public: - SelfCamView(VideoSource* source, QWidget* parent=0); - ~SelfCamView(); + VideoSurface(VideoSource* source, QWidget* parent=0); + ~VideoSurface(); virtual void hideEvent(QHideEvent* ev); virtual void showEvent(QShowEvent* ev); diff --git a/widget/widget.cpp b/widget/widget.cpp index b81537c0c..d678c285c 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -27,7 +27,6 @@ #include "widget/groupwidget.h" #include "widget/form/groupchatform.h" #include "misc/style.h" -#include "selfcamview.h" #include "widget/friendlistwidget.h" #include "camera.h" #include "widget/form/chatform.h" diff --git a/widget/widget.h b/widget/widget.h index 8373c1d0b..5caf4256f 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -34,7 +34,7 @@ class GenericChatroomWidget; class Group; struct Friend; class QSplitter; -class SelfCamView; +class VideoSurface; class QMenu; class Core; class Camera;