blob: 408416c2b69f072a6b57e05ffee35ec9080f8589 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
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 */
28class PreviewRenderer : public QQuickPaintedItem
29{
30 Q_OBJECT
31public:
32 explicit PreviewRenderer(QQuickItem *parent = 0);
33 ~PreviewRenderer();
34
35protected:
36 void paint(QPainter *painter) override;
37
38private:
39 QMetaObject::Connection previewFrameUpdatedConnection_;
40 QMetaObject::Connection previewRenderingStopped_;
41};
42
43class VideoCallPreviewRenderer : public PreviewRenderer
44{
45 Q_OBJECT
46public:
47 explicit VideoCallPreviewRenderer(QQuickItem *parent = 0);
48 virtual ~VideoCallPreviewRenderer();
49
50 Q_INVOKABLE qreal getPreviewImageScalingFactor();
51
52signals:
53 void previewImageAvailable();
54
55private:
56 void paint(QPainter *painter) override final;
57};
58
59class PhotoboothPreviewRender : public PreviewRenderer
60{
61 Q_OBJECT
62public:
63 explicit PhotoboothPreviewRender(QQuickItem *parent = 0);
64 virtual ~PhotoboothPreviewRender();
65
66 QImage takePhoto();
67 Q_INVOKABLE QString takeCroppedPhotoToBase64(int size);
68
69signals:
70 void hideBooth();
71
72private:
73 void paint(QPainter *painter) override final;
74};