Skip to content
Snippets Groups Projects
Commit feb53e61 authored by Nicolas Vengeon's avatar Nicolas Vengeon Committed by Sébastien Blin
Browse files

issue: Maximize and then Restore `Select a screen to share` window

Change-Id: I6ef8069de9012e235fe6f8907b9d2bb94a44cd40
GitLab: #634
parent b34f0312
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,6 @@ Item {
function closeContextMenuAndRelatedWindows() {
ContactPickerCreation.closeContactPicker()
sipInputPanel.close()
SelectScreenWindowCreation.destroySelectScreenWindow()
ScreenRubberBandCreation.destroyScreenRubberBandWindow()
PluginHandlerPickerCreation.closePluginHandlerPicker()
root.closeClicked()
......@@ -125,16 +124,16 @@ Item {
if (Qt.application.screens.length === 1) {
AvAdapter.shareEntireScreen(0)
} else {
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, false)
SelectScreenWindowCreation.presentSelectScreenWindow(
appWindow, false)
}
}
function openShareWindow() {
AvAdapter.getListWindows()
if (AvAdapter.windowsNames.length >= 1) {
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, true)
SelectScreenWindowCreation.presentSelectScreenWindow(
appWindow, true)
}
}
......@@ -185,8 +184,8 @@ Item {
}
onRecordCallClicked: CallAdapter.recordThisCallToggle()
onOpenSelectionWindow: {
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, windowSelection)
SelectScreenWindowCreation.presentSelectScreenWindow(
appWindow, windowSelection)
}
onScreenshotButtonHoveredChanged: {
participantsLayer.screenshotButtonHovered = screenshotButtonHovered
......
/*
* Copyright (C) 2023 Savoir-faire Linux Inc.
* Author: Nicolas Vengeon <Nicolas.vengeon@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/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Adapters 1.1
import net.jami.Models 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
Rectangle {
id: root
color: JamiTheme.secondaryBackgroundColor
border.color: selectedScreenNumber === elementIndex
? JamiTheme.screenSelectionBorderColor
: JamiTheme.tabbarBorderColor
width: elementWidth
height: 3 * width / 4
property var elementIndex
property string rectTitle
property var rId
Text {
id: textTitle
anchors.top: parent.top
anchors.topMargin: marginSize
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 2 * marginSize
font.pointSize: JamiTheme.textFontSize
text: rectTitle
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
color: JamiTheme.textColor
}
VideoView {
anchors.top: textTitle.bottom
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
height: parent.height - 50
width: parent.width - 50
Component.onDestruction: {
VideoDevices.stopDevice(rendererId)
}
Component.onCompleted: {
if (root.rId !== "") {
rendererId = VideoDevices.startDevice(root.rId)
}
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
if (selectedScreenNumber !== root.elementIndex) {
selectedScreenNumber = root.elementIndex
}
}
}
}
This diff is collapsed.
......@@ -16,53 +16,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Global select screen window component, object variable for creation.
var selectScreenWindowComponent
var selectScreenWindowObject
var mainWindow
function createSelectScreenWindowObject(appWindow) {
if (selectScreenWindowObject)
return
selectScreenWindowComponent = Qt.createComponent(
function presentSelectScreenWindow(parent, selectWindows) {
var comp = Qt.createComponent(
"../components/SelectScreen.qml")
mainWindow = appWindow
if (selectScreenWindowComponent.status === Component.Ready)
finishCreation()
else if (selectScreenWindowComponent.status === Component.Error)
console.log("Error loading component:",
selectScreenWindowComponent.errorString())
}
function finishCreation() {
selectScreenWindowObject = selectScreenWindowComponent.createObject()
if (selectScreenWindowObject === null) {
// Error Handling.
console.log("Error creating select screen object")
if (comp.status === Component.Ready) {
var obj = comp.createObject(parent, {showWindows: selectWindows})
if (obj === null) {
// Error Handling.
console.log("Error creating select screen object")
} else {
var centerX = appWindow.x + appWindow.width / 2
var centerY = appWindow.y + appWindow.height / 2
obj.width = 0.75 * appWindow.width
obj.height = 0.75 * appWindow.height
obj.x = centerX - obj.width / 2
obj.y = centerY - obj.height / 2
obj.show()
}
} else if (comp.status === Component.Error) {
console.log("Error loading component:", comp.errorString())
}
// Signal connection.
selectScreenWindowObject.onClosing.connect(destroySelectScreenWindow)
}
function showSelectScreenWindow(previewId, window) {
selectScreenWindowObject.currentPreview = previewId
selectScreenWindowObject.window = window
selectScreenWindowObject.show()
var centerX = mainWindow.x + mainWindow.width / 2
var centerY = mainWindow.y + mainWindow.height / 2
selectScreenWindowObject.width = 0.75 * appWindow.width
selectScreenWindowObject.height = 0.75 * appWindow.height
selectScreenWindowObject.x = centerX - selectScreenWindowObject.width / 2
selectScreenWindowObject.y = centerY - selectScreenWindowObject.height / 2
}
// Destroy and reset selectScreenWindowObject when window is closed.
function destroySelectScreenWindow() {
if(!selectScreenWindowObject)
return
selectScreenWindowObject.destroy()
selectScreenWindowObject = false
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment