2020-08-03 13:27:42 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 by Savoir-faire Linux
|
|
|
|
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
|
|
|
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtQuick>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use QQuickPaintedItem so that QPainter apis can be used.
|
|
|
|
* Note: Old video pipeline.
|
|
|
|
*/
|
|
|
|
class PreviewRenderer : public QQuickPaintedItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-09-10 17:40:51 -04:00
|
|
|
explicit PreviewRenderer(QQuickItem* parent = 0);
|
2020-08-03 13:27:42 -04:00
|
|
|
~PreviewRenderer();
|
|
|
|
|
|
|
|
protected:
|
2020-09-10 17:40:51 -04:00
|
|
|
void paint(QPainter* painter) override;
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QMetaObject::Connection previewFrameUpdatedConnection_;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VideoCallPreviewRenderer : public PreviewRenderer
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-11-03 17:28:25 -05:00
|
|
|
Q_PROPERTY(qreal previewImageScalingFactor MEMBER previewImageScalingFactor_
|
|
|
|
NOTIFY previewImageScalingFactorChanged)
|
2020-08-03 13:27:42 -04:00
|
|
|
public:
|
2020-09-10 17:40:51 -04:00
|
|
|
explicit VideoCallPreviewRenderer(QQuickItem* parent = 0);
|
2020-08-03 13:27:42 -04:00
|
|
|
virtual ~VideoCallPreviewRenderer();
|
|
|
|
|
|
|
|
signals:
|
2020-11-03 17:28:25 -05:00
|
|
|
void previewImageScalingFactorChanged();
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
private:
|
2020-09-10 17:40:51 -04:00
|
|
|
void paint(QPainter* painter) override final;
|
2020-11-03 17:28:25 -05:00
|
|
|
qreal previewImageScalingFactor_;
|
2020-08-03 13:27:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class PhotoboothPreviewRender : public PreviewRenderer
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-09-10 17:40:51 -04:00
|
|
|
explicit PhotoboothPreviewRender(QQuickItem* parent = 0);
|
2020-08-03 13:27:42 -04:00
|
|
|
virtual ~PhotoboothPreviewRender();
|
|
|
|
|
2020-12-03 13:25:34 -05:00
|
|
|
Q_INVOKABLE QString takePhoto(int size);
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
signals:
|
|
|
|
void hideBooth();
|
|
|
|
|
|
|
|
private:
|
2020-09-10 17:40:51 -04:00
|
|
|
void paint(QPainter* painter) override final;
|
2020-08-03 13:27:42 -04:00
|
|
|
};
|