1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

renamed SelfCamView to VideoSurface

This commit is contained in:
krepa098 2014-10-08 16:42:09 +02:00
parent de1445cdd8
commit 88ece1b213
8 changed files with 21 additions and 25 deletions

View File

@ -107,7 +107,6 @@ HEADERS += widget/form/addfriendform.h \
friendlist.h \ friendlist.h \
misc/cdata.h \ misc/cdata.h \
misc/cstring.h \ misc/cstring.h \
widget/selfcamview.h \
widget/camera.h \ widget/camera.h \
widget/netcamview.h \ widget/netcamview.h \
misc/smileypack.h \ misc/smileypack.h \
@ -130,7 +129,8 @@ HEADERS += widget/form/addfriendform.h \
widget/tool/chatactions/actionaction.h \ widget/tool/chatactions/actionaction.h \
widget/maskablepixmapwidget.h \ widget/maskablepixmapwidget.h \
videosource.h \ videosource.h \
cameraworker.h cameraworker.h \
widget/videosurface.h
SOURCES += \ SOURCES += \
widget/form/addfriendform.cpp \ widget/form/addfriendform.cpp \
@ -156,7 +156,6 @@ SOURCES += \
misc/settings.cpp \ misc/settings.cpp \
misc/cdata.cpp \ misc/cdata.cpp \
misc/cstring.cpp \ misc/cstring.cpp \
widget/selfcamview.cpp \
widget/camera.cpp \ widget/camera.cpp \
widget/netcamview.cpp \ widget/netcamview.cpp \
misc/smileypack.cpp \ misc/smileypack.cpp \
@ -177,4 +176,5 @@ SOURCES += \
widget/tool/chatactions/systemmessageaction.cpp \ widget/tool/chatactions/systemmessageaction.cpp \
widget/tool/chatactions/actionaction.cpp \ widget/tool/chatactions/actionaction.cpp \
widget/maskablepixmapwidget.cpp \ widget/maskablepixmapwidget.cpp \
cameraworker.cpp cameraworker.cpp \
widget/videosurface.cpp

View File

@ -19,9 +19,7 @@
#include <QImage> #include <QImage>
#include <QList> #include <QList>
#include <QQueue>
#include <QMutex> #include <QMutex>
#include <QMap>
#include "vpx/vpx_image.h" #include "vpx/vpx_image.h"
#include "opencv2/opencv.hpp" #include "opencv2/opencv.hpp"
#include "videosource.h" #include "videosource.h"

View File

@ -25,7 +25,7 @@ AVForm::AVForm() :
bodyUI->setupUi(this); bodyUI->setupUi(this);
//cam->setVideoMode(cam->getBestVideoMode()); //cam->setVideoMode(cam->getBestVideoMode());
camView = new SelfCamView(Camera::getInstance(), this); camView = new VideoSurface(Camera::getInstance(), this);
bodyUI->CamViewLayout->addWidget(camView); bodyUI->CamViewLayout->addWidget(camView);
} }

View File

@ -18,7 +18,7 @@
#define AVFORM_H #define AVFORM_H
#include "genericsettings.h" #include "genericsettings.h"
#include "widget/selfcamview.h" #include "widget/videosurface.h"
#include <QGroupBox> #include <QGroupBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPushButton> #include <QPushButton>
@ -47,7 +47,7 @@ private slots:
private: private:
Ui::AVSettings *bodyUI; Ui::AVSettings *bodyUI;
SelfCamView* camView; VideoSurface* camView;
}; };
#endif #endif

View File

@ -14,7 +14,7 @@
See the COPYING file for more details. See the COPYING file for more details.
*/ */
#include "selfcamview.h" #include "videosurface.h"
#include "camera.h" #include "camera.h"
#include <QTimer> #include <QTimer>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
@ -22,7 +22,7 @@
#include <QOpenGLShaderProgram> #include <QOpenGLShaderProgram>
#include <QDebug> #include <QDebug>
SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent) VideoSurface::VideoSurface(VideoSource *Source, QWidget* parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
, source(Source) , source(Source)
, pbo(nullptr) , pbo(nullptr)
@ -32,11 +32,10 @@ SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent)
, uploadFrame(false) , uploadFrame(false)
, hasSubscribed(false) , hasSubscribed(false)
{ {
qDebug()<<"NEW VideoSurface:"<<source->resolution();
setFixedSize(source->resolution()); setFixedSize(source->resolution());
} }
SelfCamView::~SelfCamView() VideoSurface::~VideoSurface()
{ {
if (pbo) if (pbo)
delete pbo; delete pbo;
@ -47,36 +46,36 @@ SelfCamView::~SelfCamView()
source->unsubscribe(); source->unsubscribe();
} }
void SelfCamView::hideEvent(QHideEvent *ev) void VideoSurface::hideEvent(QHideEvent *ev)
{ {
if (hasSubscribed) if (hasSubscribed)
{ {
source->unsubscribe(); source->unsubscribe();
hasSubscribed = false; hasSubscribed = false;
disconnect(source, &VideoSource::frameAvailable, this, &SelfCamView::updateGL); disconnect(source, &VideoSource::frameAvailable, this, &VideoSurface::updateGL);
} }
QGLWidget::hideEvent(ev); QGLWidget::hideEvent(ev);
} }
void SelfCamView::showEvent(QShowEvent *ev) void VideoSurface::showEvent(QShowEvent *ev)
{ {
if (!hasSubscribed) if (!hasSubscribed)
{ {
source->subscribe(); source->subscribe();
hasSubscribed = true; hasSubscribed = true;
connect(source, &VideoSource::frameAvailable, this, &SelfCamView::updateGL); connect(source, &VideoSource::frameAvailable, this, &VideoSurface::updateGL);
} }
QGLWidget::showEvent(ev); QGLWidget::showEvent(ev);
} }
void SelfCamView::initializeGL() void VideoSurface::initializeGL()
{ {
} }
void SelfCamView::paintGL() void VideoSurface::paintGL()
{ {
if (!pbo) if (!pbo)
{ {
@ -189,7 +188,7 @@ void SelfCamView::paintGL()
program->release(); program->release();
} }
void SelfCamView::updateGL() void VideoSurface::updateGL()
{ {
uploadFrame = true; uploadFrame = true;
QGLWidget::updateGL(); QGLWidget::updateGL();

View File

@ -24,13 +24,13 @@ class QOpenGLShaderProgram;
class QTimer; class QTimer;
class VideoSource; class VideoSource;
class SelfCamView : public QGLWidget class VideoSurface : public QGLWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
SelfCamView(VideoSource* source, QWidget* parent=0); VideoSurface(VideoSource* source, QWidget* parent=0);
~SelfCamView(); ~VideoSurface();
virtual void hideEvent(QHideEvent* ev); virtual void hideEvent(QHideEvent* ev);
virtual void showEvent(QShowEvent* ev); virtual void showEvent(QShowEvent* ev);

View File

@ -27,7 +27,6 @@
#include "widget/groupwidget.h" #include "widget/groupwidget.h"
#include "widget/form/groupchatform.h" #include "widget/form/groupchatform.h"
#include "misc/style.h" #include "misc/style.h"
#include "selfcamview.h"
#include "widget/friendlistwidget.h" #include "widget/friendlistwidget.h"
#include "camera.h" #include "camera.h"
#include "widget/form/chatform.h" #include "widget/form/chatform.h"

View File

@ -34,7 +34,7 @@ class GenericChatroomWidget;
class Group; class Group;
struct Friend; struct Friend;
class QSplitter; class QSplitter;
class SelfCamView; class VideoSurface;
class QMenu; class QMenu;
class Core; class Core;
class Camera; class Camera;