Commit 2d9bef6a authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsVideo): supports preview

parent 2a507f48
......@@ -1133,6 +1133,13 @@ Server url not configured.</translation>
<translation>VIDEO PREVIEW</translation>
</message>
</context>
<context>
<name>SettingsVideoPreview</name>
<message>
<source>confirm</source>
<translation>OK</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
......
......@@ -1133,6 +1133,13 @@ Url du serveur non configurée.</translation>
<translation>APERÇU DE LA VIDÉO</translation>
</message>
</context>
<context>
<name>SettingsVideoPreview</name>
<message>
<source>confirm</source>
<translation>VALIDER</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
......
......@@ -308,8 +308,8 @@
<file>ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml</file>
<file>ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml</file>
<file>ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml</file>
<file>ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml</file>
<file>ui/modules/Linphone/Styles/Calls/CallsStyle.qml</file>
<file>ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml</file>
<file>ui/modules/Linphone/Styles/Chat/ChatStyle.qml</file>
<file>ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml</file>
<file>ui/modules/Linphone/Styles/Contact/AvatarStyle.qml</file>
......@@ -375,6 +375,8 @@
<file>ui/views/App/Settings/SettingsSipAccounts.js</file>
<file>ui/views/App/Settings/SettingsSipAccounts.qml</file>
<file>ui/views/App/Settings/SettingsUi.qml</file>
<file>ui/views/App/Settings/SettingsVideo.js</file>
<file>ui/views/App/Settings/SettingsVideoPreview.qml</file>
<file>ui/views/App/Settings/SettingsVideo.qml</file>
<file>ui/views/App/Settings/SettingsWindow.qml</file>
<file>ui/views/App/SplashScreen/SplashScreen.qml</file>
......@@ -397,6 +399,7 @@
<file>ui/views/App/Styles/Main/ManageAccountsStyle.qml</file>
<file>ui/views/App/Styles/qmldir</file>
<file>ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml</file>
<file>ui/views/App/Styles/Settings/SettingsVideoPreviewStyle.qml</file>
<file>ui/views/App/Styles/Settings/SettingsWindowStyle.qml</file>
<file>ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml</file>
</qresource>
......
......@@ -278,7 +278,7 @@ void App::registerTypes () {
qmlRegisterType<AssistantModel>("Linphone", 1, 0, "AssistantModel");
qmlRegisterType<Authentication>("Linphone", 1, 0, "Authentication");
qmlRegisterType<Camera>("Linphone", 1, 0, "Camera");
qmlRegisterType<Camera>("Linphone", 1, 0, "CameraPreview");
qmlRegisterType<CameraPreview>("Linphone", 1, 0, "CameraPreview");
qmlRegisterType<ChatModel>("Linphone", 1, 0, "ChatModel");
qmlRegisterType<ChatProxyModel>("Linphone", 1, 0, "ChatProxyModel");
qmlRegisterType<ContactsListProxyModel>("Linphone", 1, 0, "ContactsListProxyModel");
......
......@@ -123,7 +123,11 @@ void CameraRenderer::synchronize (QQuickFramebufferObject *item) {
Camera *camera = qobject_cast<Camera *>(item);
mLinphoneCall = camera->getCall()->getLinphoneCall();
{
CallModel *model = camera->getCall();
mLinphoneCall = model ? model->getLinphoneCall() : nullptr;
}
mIsPreview = camera->mIsPreview;
updateWindowId();
......
......@@ -126,7 +126,17 @@ void CameraPreviewRenderer::updateWindowId () {
// -----------------------------------------------------------------------------
QMutex CameraPreview::mCounterMutex;
int CameraPreview::mCounter = 0;
// -----------------------------------------------------------------------------
CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(parent) {
mCounterMutex.lock();
if (++mCounter == 1)
CoreManager::getInstance()->getCore()->enableVideoPreview(true);
mCounterMutex.unlock();
// The fbo content must be y-mirrored because the ms rendering is y-inverted.
setMirrorVertically(true);
......@@ -142,6 +152,13 @@ CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(pare
mRefreshTimer->start();
}
CameraPreview::~CameraPreview () {
mCounterMutex.lock();
if (--mCounter == 0)
CoreManager::getInstance()->getCore()->enableVideoPreview(false);
mCounterMutex.unlock();
}
QQuickFramebufferObject::Renderer *CameraPreview::createRenderer () const {
return new CameraPreviewRenderer();
}
......@@ -23,6 +23,7 @@
#ifndef CAMERA_PREVIEW_H_
#define CAMERA_PREVIEW_H_
#include <QMutex>
#include <QOpenGLFramebufferObject>
#include <QQuickFramebufferObject>
......@@ -61,12 +62,15 @@ class CameraPreview : public QQuickFramebufferObject {
public:
CameraPreview (QQuickItem *parent = Q_NULLPTR);
~CameraPreview () = default;
~CameraPreview ();
QQuickFramebufferObject::Renderer *createRenderer () const override;
private:
QTimer *mRefreshTimer;
static QMutex mCounterMutex;
static int mCounter;
};
#endif // CAMERA_PREVIEW_H_
......@@ -25,7 +25,6 @@
#include "CoreManager.hpp"
#include <QDebug>
#include <QDir>
#include <QtConcurrent>
#include <QTimer>
......
// =============================================================================
// `SettingsVideo.qml` Logic.
// =============================================================================
function showVideoPreview (account) {
window.attachVirtualWindow(Qt.resolvedUrl('SettingsVideoPreview.qml'))
}
......@@ -6,6 +6,8 @@ import Utils 1.0
import App.Styles 1.0
import 'SettingsVideo.js' as Logic
// =============================================================================
TabContainer {
......@@ -109,7 +111,7 @@ TabContainer {
anchors.right: parent.right
text: qsTr('showCameraPreview')
onClicked: console.log('TODO')
onClicked: Logic.showVideoPreview()
}
// -------------------------------------------------------------------------
......
import QtQuick 2.7
import Common 1.0
import Linphone 1.0
import App.Styles 1.0
// =============================================================================
DialogPlus {
id: dialog
buttons: [
TextButtonB {
text: qsTr('confirm')
onClicked: exit(1)
}
]
centeredButtons: true
height: SettingsVideoPreviewStyle.height
width: SettingsVideoPreviewStyle.width
// ---------------------------------------------------------------------------
CameraPreview {
anchors {
fill: parent
leftMargin: SettingsVideoPreviewStyle.preview.leftMargin
rightMargin: SettingsVideoPreviewStyle.preview.rightMargin
}
}
}
pragma Singleton
import QtQuick 2.7
// =============================================================================
QtObject {
property int height: 480
property int width: 640
property QtObject preview: QtObject {
property int leftMargin: 25
property int rightMargin: 25
}
}
......@@ -24,6 +24,8 @@ singleton MainWindowMenuBarStyle 1.0 Main/MainWindowMenuBarSty
singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml
singleton ManageAccountsStyle 1.0 Main/ManageAccountsStyle.qml
singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
singleton SettingsSipAccountsEditStyle 1.0 Settings/SettingsSipAccountsEditStyle.qml
singleton SettingsVideoPreviewStyle 1.0 Settings/SettingsVideoPreviewStyle.qml
singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml
linphone @ 740eac98
Subproject commit fba1e7ccb12cd83865b736d873bcd8ac28e73920
Subproject commit 740eac982a2f15c93d30499a8972a8c9d5144f4f
mediastreamer2 @ ecc40cd8
Subproject commit dc46e818fe9b621eca3c132dfebbed39f2f232e3
Subproject commit ecc40cd8c874b833cc6ec1a05b59769d7c7c891d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment