Commit 906ec740 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsVideo): hide preview when at least on call exists

parent c6cae422
......@@ -51,11 +51,11 @@ CameraPreviewRenderer::CameraPreviewRenderer () {
CameraPreviewRenderer::~CameraPreviewRenderer () {
qInfo() << QStringLiteral("Delete context info:") << mContextInfo;
CoreManager *core = CoreManager::getInstance();
CoreManager *coreManager = CoreManager::getInstance();
core->lockVideoRender();
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(nullptr);
core->unlockVideoRender();
coreManager->lockVideoRender();
coreManager->getCore()->setNativePreviewWindowId(nullptr);
coreManager->unlockVideoRender();
delete mContextInfo;
}
......@@ -66,10 +66,10 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const
format.setInternalTextureFormat(GL_RGBA8);
format.setSamples(4);
CoreManager *core = CoreManager::getInstance();
CoreManager *coreManager = CoreManager::getInstance();
// It's not the same thread as render.
core->lockVideoRender();
coreManager->lockVideoRender();
mContextInfo->width = size.width();
mContextInfo->height = size.height();
......@@ -78,7 +78,7 @@ QOpenGLFramebufferObject *CameraPreviewRenderer::createFramebufferObject (const
updateWindowId();
core->unlockVideoRender();
coreManager->unlockVideoRender();
return new QOpenGLFramebufferObject(size, format);
}
......@@ -88,7 +88,7 @@ void CameraPreviewRenderer::render () {
{
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glClearColor(0.f, 0.f, 0.f, 0.f);
f->glClearColor(0.f, 0.f, 0.f, 1.f);
f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
CoreManager *coreManager = CoreManager::getInstance();
......
......@@ -2,6 +2,20 @@
// `SettingsVideo.qml` Logic.
// =============================================================================
.import Linphone 1.0 as Linphone
// =============================================================================
function showVideoPreview (account) {
window.attachVirtualWindow(Qt.resolvedUrl('SettingsVideoPreview.qml'))
}
function updateVideoPreview () {
var count = Linphone.CallsListModel.rowCount()
if (count === 0) {
showCameraPreview.enabled = true
} else if (count === 1) {
showCameraPreview.enabled = false
window.detachVirtualWindow()
}
}
......@@ -108,10 +108,21 @@ TabContainer {
}
TextButtonB {
id: showCameraPreview
anchors.right: parent.right
enabled: CallsListModel.rowCount() === 0
text: qsTr('showCameraPreview')
onClicked: Logic.showVideoPreview()
Connections {
target: CallsListModel
onRowsInserted: Logic.updateVideoPreview()
onRowsRemoved: Logic.updateVideoPreview()
}
}
// -------------------------------------------------------------------------
......
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