qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
netcamview.h
Go to the documentation of this file.
1 /*
2  Copyright © 2014-2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "src/core/toxpk.h"
23 #include <QVector>
24 #include <QWidget>
25 
26 class QHBoxLayout;
27 struct vpx_image;
28 class VideoSource;
29 class QFrame;
30 class MovableWidget;
31 class QVBoxLayout;
32 class VideoSurface;
33 class QPushButton;
34 class QKeyEvent;
35 class QCloseEvent;
36 class QShowEvent;
37 
38 class NetCamView : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
43  NetCamView(ToxPk friendPk, QWidget* parent = nullptr);
44  ~NetCamView();
45 
46  virtual void show(VideoSource* source, const QString& title);
47  virtual void hide();
48 
49  void setSource(VideoSource* s);
50  void setTitle(const QString& title);
51  QSize getSurfaceMinSize();
52 
53 protected:
54  void showEvent(QShowEvent* event);
55  QVBoxLayout* verLayout;
57  QPushButton* enterFullScreenButton = nullptr;
58 
59 signals:
60  void showMessageClicked();
61  void videoCallEnd();
62  void volMuteToggle();
63  void micMuteToggle();
64 
65 public slots:
66  void setShowMessages(bool show, bool notify = false);
67  void updateMuteVolButton(bool isMuted);
68  void updateMuteMicButton(bool isMuted);
69 
70 private slots:
71  void updateRatio();
72 
73 private:
74  void updateFrameSize(QSize size);
75  QPushButton* createButton(const QString& name, const QString& state);
76  void toggleFullScreen();
77  void enterFullScreen();
78  void exitFullScreen();
79  void endVideoCall();
80  void toggleVideoPreview();
81  void toggleButtonState(QPushButton* btn);
82  void updateButtonState(QPushButton* btn, bool active);
83  void keyPressEvent(QKeyEvent *event);
84  void closeEvent(QCloseEvent *event);
88  bool e;
89  QVector<QMetaObject::Connection> connections;
90  QHBoxLayout* buttonLayout = nullptr;
91  QPushButton* toggleMessagesButton = nullptr;
92  QFrame* buttonPanel = nullptr;
93  QPushButton* videoPreviewButton = nullptr;
94  QPushButton* volumeButton = nullptr;
95  QPushButton* microphoneButton = nullptr;
96  QPushButton* endVideoButton = nullptr;
97  QPushButton* exitFullScreenButton = nullptr;
98 };
NetCamView::showEvent
void showEvent(QShowEvent *event)
Definition: netcamview.cpp:198
NetCamView::endVideoButton
QPushButton * endVideoButton
Definition: netcamview.h:96
VideoSource
An abstract source of video frames.
Definition: videosource.h:29
NetCamView::closeEvent
void closeEvent(QCloseEvent *event)
Definition: netcamview.cpp:347
NetCamView::videoCallEnd
void videoCallEnd()
NetCamView::buttonPanel
QFrame * buttonPanel
Definition: netcamview.h:92
NetCamView::exitFullScreenButton
QPushButton * exitFullScreenButton
Definition: netcamview.h:97
NetCamView::hide
virtual void hide()
Definition: netcamview.cpp:175
toxpk.h
NetCamView::microphoneButton
QPushButton * microphoneButton
Definition: netcamview.h:95
NetCamView::toggleButtonState
void toggleButtonState(QPushButton *btn)
Definition: netcamview.cpp:317
NetCamView::show
virtual void show(VideoSource *source, const QString &title)
Definition: netcamview.cpp:166
NetCamView::e
bool e
Definition: netcamview.h:88
NetCamView::exitFullScreen
void exitFullScreen()
Definition: netcamview.cpp:271
NetCamView::micMuteToggle
void micMuteToggle()
NetCamView::~NetCamView
~NetCamView()
Definition: netcamview.cpp:160
NetCamView::endVideoCall
void endVideoCall()
Definition: netcamview.cpp:280
NetCamView::NetCamView
NetCamView(ToxPk friendPk, QWidget *parent=nullptr)
Definition: netcamview.cpp:50
NetCamView::createButton
QPushButton * createButton(const QString &name, const QString &state)
Definition: netcamview.cpp:296
MovableWidget
Definition: movablewidget.h:24
NetCamView::getSurfaceMinSize
QSize getSurfaceMinSize()
Definition: netcamview.cpp:220
NetCamView::toggleMessagesButton
QPushButton * toggleMessagesButton
Definition: netcamview.h:91
ToxPk
This class represents a Tox Public Key, which is a part of Tox ID.
Definition: toxpk.h:26
NetCamView::updateMuteVolButton
void updateMuteVolButton(bool isMuted)
Definition: netcamview.cpp:307
NetCamView::connections
QVector< QMetaObject::Connection > connections
Definition: netcamview.h:89
NetCamView::videoSurface
VideoSurface * videoSurface
Definition: netcamview.h:56
NetCamView::setSource
void setSource(VideoSource *s)
Definition: netcamview.cpp:188
NetCamView::updateRatio
void updateRatio()
Definition: netcamview.cpp:204
NetCamView
Definition: netcamview.h:38
NetCamView::verLayout
QVBoxLayout * verLayout
Definition: netcamview.h:55
NetCamView::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition: netcamview.cpp:339
NetCamView::selfFrame
MovableWidget * selfFrame
Definition: netcamview.h:86
NetCamView::toggleFullScreen
void toggleFullScreen()
Definition: netcamview.cpp:244
NetCamView::enterFullScreenButton
QPushButton * enterFullScreenButton
Definition: netcamview.h:57
NetCamView::volumeButton
QPushButton * volumeButton
Definition: netcamview.h:94
NetCamView::toggleVideoPreview
void toggleVideoPreview()
Definition: netcamview.cpp:286
NetCamView::updateFrameSize
void updateFrameSize(QSize size)
Definition: netcamview.cpp:210
NetCamView::updateButtonState
void updateButtonState(QPushButton *btn, bool active)
Definition: netcamview.cpp:328
NetCamView::setTitle
void setTitle(const QString &title)
Definition: netcamview.cpp:193
NetCamView::enterFullScreen
void enterFullScreen()
Definition: netcamview.cpp:253
NetCamView::videoPreviewButton
QPushButton * videoPreviewButton
Definition: netcamview.h:93
NetCamView::showMessageClicked
void showMessageClicked()
NetCamView::setShowMessages
void setShowMessages(bool show, bool notify=false)
Definition: netcamview.cpp:229
NetCamView::selfVideoSurface
VideoSurface * selfVideoSurface
Definition: netcamview.h:85
NetCamView::buttonLayout
QHBoxLayout * buttonLayout
Definition: netcamview.h:90
NetCamView::updateMuteMicButton
void updateMuteMicButton(bool isMuted)
Definition: netcamview.cpp:312
VideoSurface
Definition: videosurface.h:27
NetCamView::volMuteToggle
void volMuteToggle()
NetCamView::friendPk
ToxPk friendPk
Definition: netcamview.h:87