Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 1 | /*************************************************************************** |
Edric Milaret | 559bda5 | 2015-04-29 17:02:31 -0400 | [diff] [blame] | 2 | * Copyright (C) 2015 by Savoir-Faire Linux * |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 3 | * 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 Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 24 | #include <QMutex> |
| 25 | #include <QPixmap> |
Edric Milaret | 7153eed | 2015-06-03 15:29:03 -0400 | [diff] [blame^] | 26 | #include <QMenu> |
| 27 | |
| 28 | #include "video/renderer.h" |
| 29 | #include "video/previewmanager.h" |
| 30 | #include "video/sourcemodel.h" |
| 31 | #include "callmodel.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 32 | |
| 33 | class VideoWidget : public QWidget |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | public: |
| 37 | explicit VideoWidget(QWidget *parent = 0); |
| 38 | ~VideoWidget(); |
| 39 | void paintEvent(QPaintEvent* evt); |
| 40 | |
| 41 | public slots: |
| 42 | void previewStarted(Video::Renderer* renderer); |
Edric Milaret | 72c406d | 2015-04-28 13:23:54 -0400 | [diff] [blame] | 43 | void previewStopped(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 44 | void frameFromPreview(); |
| 45 | void callInitiated(Call *call, Video::Renderer *renderer); |
| 46 | void frameFromDistant(); |
| 47 | void renderingStopped(); |
| 48 | |
Edric Milaret | 7153eed | 2015-06-03 15:29:03 -0400 | [diff] [blame^] | 49 | |
Edric Milaret | 435cdfc | 2015-06-01 16:15:50 -0400 | [diff] [blame] | 50 | protected slots: |
| 51 | void mouseDoubleClickEvent(QMouseEvent *e); |
Edric Milaret | 7153eed | 2015-06-03 15:29:03 -0400 | [diff] [blame^] | 52 | |
| 53 | private slots: |
| 54 | void showContextMenu(const QPoint &pos); |
| 55 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 56 | private: |
| 57 | Video::Renderer* previewRenderer_; |
| 58 | Video::Renderer* renderer_; |
| 59 | QImage *previewFrame_; |
| 60 | QImage *distantFrame_; |
| 61 | QMutex lock_; |
| 62 | QPixmap *previewPix_; |
Edric Milaret | 435cdfc | 2015-06-01 16:15:50 -0400 | [diff] [blame] | 63 | QWidget *oldParent_; |
| 64 | QSize oldSize_; |
Edric Milaret | a9f937f | 2015-06-01 17:10:34 -0400 | [diff] [blame] | 65 | constexpr static int previewMargin_ = 15; |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | #endif // VIDEOWIDGET_H |