Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 by Savoir-faire Linux |
| 3 | * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> |
| 4 | * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free 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 | * This program 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 this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include <QtQuick> |
| 23 | |
| 24 | /* |
| 25 | * Use QQuickPaintedItem so that QPainter apis can be used. |
| 26 | * Note: Old video pipeline. |
| 27 | */ |
| 28 | class PreviewRenderer : public QQuickPaintedItem |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | public: |
| 32 | explicit PreviewRenderer(QQuickItem *parent = 0); |
| 33 | ~PreviewRenderer(); |
| 34 | |
| 35 | protected: |
| 36 | void paint(QPainter *painter) override; |
| 37 | |
| 38 | private: |
| 39 | QMetaObject::Connection previewFrameUpdatedConnection_; |
| 40 | QMetaObject::Connection previewRenderingStopped_; |
| 41 | }; |
| 42 | |
| 43 | class VideoCallPreviewRenderer : public PreviewRenderer |
| 44 | { |
| 45 | Q_OBJECT |
| 46 | public: |
| 47 | explicit VideoCallPreviewRenderer(QQuickItem *parent = 0); |
| 48 | virtual ~VideoCallPreviewRenderer(); |
| 49 | |
| 50 | Q_INVOKABLE qreal getPreviewImageScalingFactor(); |
| 51 | |
| 52 | signals: |
| 53 | void previewImageAvailable(); |
| 54 | |
| 55 | private: |
| 56 | void paint(QPainter *painter) override final; |
| 57 | }; |
| 58 | |
| 59 | class PhotoboothPreviewRender : public PreviewRenderer |
| 60 | { |
| 61 | Q_OBJECT |
| 62 | public: |
| 63 | explicit PhotoboothPreviewRender(QQuickItem *parent = 0); |
| 64 | virtual ~PhotoboothPreviewRender(); |
| 65 | |
| 66 | QImage takePhoto(); |
| 67 | Q_INVOKABLE QString takeCroppedPhotoToBase64(int size); |
| 68 | |
| 69 | signals: |
| 70 | void hideBooth(); |
| 71 | |
| 72 | private: |
| 73 | void paint(QPainter *painter) override final; |
| 74 | }; |