blob: 0a0b459635def10854cd9a579eacc6357162a2eb [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Edric Milaret559bda52015-04-29 17:02:31 -04002 * Copyright (C) 2015 by Savoir-Faire Linux *
Edric Milaret627500d2015-03-27 16:41:40 -04003 * Author: Edric Ladent Milaret <edric.ladent-milaret@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
19#ifndef VIDEOWIDGET_H
20#define VIDEOWIDGET_H
21
22#include <QWidget>
23#include <QPainter>
Edric Milaret627500d2015-03-27 16:41:40 -040024#include <QMutex>
25#include <QPixmap>
Edric Milaret7153eed2015-06-03 15:29:03 -040026#include <QMenu>
27
28#include "video/renderer.h"
29#include "video/previewmanager.h"
30#include "video/sourcemodel.h"
31#include "callmodel.h"
Edric Milaret627500d2015-03-27 16:41:40 -040032
33class VideoWidget : public QWidget
34{
35 Q_OBJECT
36public:
37 explicit VideoWidget(QWidget *parent = 0);
38 ~VideoWidget();
39 void paintEvent(QPaintEvent* evt);
40
41public slots:
42 void previewStarted(Video::Renderer* renderer);
Edric Milaret72c406d2015-04-28 13:23:54 -040043 void previewStopped();
Edric Milaret627500d2015-03-27 16:41:40 -040044 void frameFromPreview();
45 void callInitiated(Call *call, Video::Renderer *renderer);
46 void frameFromDistant();
47 void renderingStopped();
48
Edric Milaret7153eed2015-06-03 15:29:03 -040049
Edric Milaret435cdfc2015-06-01 16:15:50 -040050protected slots:
51 void mouseDoubleClickEvent(QMouseEvent *e);
Edric Milaret7153eed2015-06-03 15:29:03 -040052
53private slots:
54 void showContextMenu(const QPoint &pos);
55
Edric Milaret627500d2015-03-27 16:41:40 -040056private:
57 Video::Renderer* previewRenderer_;
58 Video::Renderer* renderer_;
59 QImage *previewFrame_;
60 QImage *distantFrame_;
61 QMutex lock_;
62 QPixmap *previewPix_;
Edric Milaret435cdfc2015-06-01 16:15:50 -040063 QWidget *oldParent_;
64 QSize oldSize_;
Edric Milareta9f937f2015-06-01 17:10:34 -040065 constexpr static int previewMargin_ = 15;
Edric Milaret627500d2015-03-27 16:41:40 -040066};
67
68#endif // VIDEOWIDGET_H