mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-22 06:02:03 +02:00
issue: Maximize and then Restore Select a screen to share
window
Change-Id: I6ef8069de9012e235fe6f8907b9d2bb94a44cd40 GitLab: #634
This commit is contained in:
parent
b34f031251
commit
feb53e6183
4 changed files with 252 additions and 369 deletions
|
@ -44,7 +44,6 @@ Item {
|
||||||
function closeContextMenuAndRelatedWindows() {
|
function closeContextMenuAndRelatedWindows() {
|
||||||
ContactPickerCreation.closeContactPicker()
|
ContactPickerCreation.closeContactPicker()
|
||||||
sipInputPanel.close()
|
sipInputPanel.close()
|
||||||
SelectScreenWindowCreation.destroySelectScreenWindow()
|
|
||||||
ScreenRubberBandCreation.destroyScreenRubberBandWindow()
|
ScreenRubberBandCreation.destroyScreenRubberBandWindow()
|
||||||
PluginHandlerPickerCreation.closePluginHandlerPicker()
|
PluginHandlerPickerCreation.closePluginHandlerPicker()
|
||||||
root.closeClicked()
|
root.closeClicked()
|
||||||
|
@ -125,16 +124,16 @@ Item {
|
||||||
if (Qt.application.screens.length === 1) {
|
if (Qt.application.screens.length === 1) {
|
||||||
AvAdapter.shareEntireScreen(0)
|
AvAdapter.shareEntireScreen(0)
|
||||||
} else {
|
} else {
|
||||||
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
|
SelectScreenWindowCreation.presentSelectScreenWindow(
|
||||||
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, false)
|
appWindow, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openShareWindow() {
|
function openShareWindow() {
|
||||||
AvAdapter.getListWindows()
|
AvAdapter.getListWindows()
|
||||||
if (AvAdapter.windowsNames.length >= 1) {
|
if (AvAdapter.windowsNames.length >= 1) {
|
||||||
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
|
SelectScreenWindowCreation.presentSelectScreenWindow(
|
||||||
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, true)
|
appWindow, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +184,8 @@ Item {
|
||||||
}
|
}
|
||||||
onRecordCallClicked: CallAdapter.recordThisCallToggle()
|
onRecordCallClicked: CallAdapter.recordThisCallToggle()
|
||||||
onOpenSelectionWindow: {
|
onOpenSelectionWindow: {
|
||||||
SelectScreenWindowCreation.createSelectScreenWindowObject(appWindow)
|
SelectScreenWindowCreation.presentSelectScreenWindow(
|
||||||
SelectScreenWindowCreation.showSelectScreenWindow(callPreviewId, windowSelection)
|
appWindow, windowSelection)
|
||||||
}
|
}
|
||||||
onScreenshotButtonHoveredChanged: {
|
onScreenshotButtonHoveredChanged: {
|
||||||
participantsLayer.screenshotButtonHovered = screenshotButtonHovered
|
participantsLayer.screenshotButtonHovered = screenshotButtonHovered
|
||||||
|
|
86
src/app/mainview/components/ScreenSharePreview.qml
Normal file
86
src/app/mainview/components/ScreenSharePreview.qml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Savoir-faire Linux Inc.
|
* Copyright (C) 2020-2023 Savoir-faire Linux Inc.
|
||||||
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
||||||
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
||||||
*
|
* Author: Nicolas Vengeon <Nicolas.vengeon@savoirfairelinux.com>
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
@ -35,372 +36,198 @@ import "../../commoncomponents"
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool window: false
|
minimumHeight: minimumWidth * 3 / 4
|
||||||
|
minimumWidth: componentMinWidth + 2 * marginSize
|
||||||
property int selectedScreenNumber: -1
|
|
||||||
property bool selectAllScreens: false
|
|
||||||
property string currentPreview: ""
|
|
||||||
property var screens: []
|
|
||||||
property real componentMinWidth: 200
|
|
||||||
property real componentWidthDoubleColumn: screenSelectionScrollView.width / 2 -
|
|
||||||
screenSelectionScrollViewFlow.spacing / 2 - JamiTheme.preferredMarginSize
|
|
||||||
property real componentWidthSingleColumn: screenSelectionScrollView.width -
|
|
||||||
2 * JamiTheme.preferredMarginSize
|
|
||||||
|
|
||||||
modality: Qt.ApplicationModal
|
modality: Qt.ApplicationModal
|
||||||
title: window ? JamiStrings.selectWindow : JamiStrings.selectScreen
|
title: showWindows ? JamiStrings.selectWindow : JamiStrings.selectScreen
|
||||||
|
|
||||||
|
onClosing: this.destroy()
|
||||||
|
|
||||||
|
required property bool showWindows
|
||||||
|
|
||||||
|
property var selectedScreenNumber: undefined
|
||||||
|
property bool selectAllScreens: selectedScreenNumber === -1
|
||||||
|
property var listModel: []
|
||||||
|
property real componentMinWidth: 350
|
||||||
|
property real marginSize: JamiTheme.preferredMarginSize
|
||||||
|
property real elementWidth: {
|
||||||
|
var layoutWidth = selectScreenWindowLayout.width
|
||||||
|
var minSize = componentMinWidth + 2 * marginSize
|
||||||
|
var numberElementPerRow = Math.floor(layoutWidth / minSize)
|
||||||
|
if (numberElementPerRow == 1 && layoutWidth > componentMinWidth * 1.5) {
|
||||||
|
numberElementPerRow = 2
|
||||||
|
}
|
||||||
|
if (showWindows)
|
||||||
|
numberElementPerRow = Math.min(listModel.length, numberElementPerRow)
|
||||||
|
else
|
||||||
|
numberElementPerRow = Math.min(listModel.length + 1, numberElementPerRow)
|
||||||
|
var spacingLength = marginSize * (numberElementPerRow + 2)
|
||||||
|
|
||||||
|
return (layoutWidth - spacingLength) / numberElementPerRow
|
||||||
|
}
|
||||||
|
|
||||||
// How many rows the ScrollView should have.
|
|
||||||
function calculateRepeaterModel() {
|
function calculateRepeaterModel() {
|
||||||
screens = []
|
listModel = []
|
||||||
var idx
|
var idx
|
||||||
for (idx in Qt.application.screens) {
|
if (!showWindows) {
|
||||||
screens.push(JamiStrings.screen.arg(idx))
|
for (idx in Qt.application.screens) {
|
||||||
|
listModel.push(JamiStrings.screen.arg(idx))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AvAdapter.getListWindows()
|
||||||
|
for (idx in AvAdapter.windowsNames) {
|
||||||
|
listModel.push(AvAdapter.windowsNames[idx])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AvAdapter.getListWindows()
|
|
||||||
for (idx in AvAdapter.windowsNames) {
|
|
||||||
screens.push(AvAdapter.windowsNames[idx])
|
|
||||||
}
|
|
||||||
|
|
||||||
return screens.length
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible)
|
if (!visible)
|
||||||
return
|
return
|
||||||
if (!active) {
|
if (!active) {
|
||||||
selectedScreenNumber = -1
|
selectedScreenNumber = undefined
|
||||||
selectAllScreens = false
|
|
||||||
}
|
}
|
||||||
screenInfo.model = {}
|
screenSharePreviewRepeater.model = {}
|
||||||
screenInfo2.model = {}
|
|
||||||
calculateRepeaterModel()
|
calculateRepeaterModel()
|
||||||
screenInfo.model = screens.length
|
screenSharePreviewRepeater.model = root.listModel
|
||||||
screenInfo2.model = screens.length
|
|
||||||
windowsText.visible = root.window
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: selectScreenWindowRect
|
id: selectScreenWindowRect
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
color: JamiTheme.backgroundColor
|
color: JamiTheme.backgroundColor
|
||||||
|
|
||||||
ScrollView {
|
ColumnLayout {
|
||||||
id: screenSelectionScrollView
|
id: selectScreenWindowLayout
|
||||||
|
|
||||||
anchors.topMargin: JamiTheme.preferredMarginSize
|
anchors.fill: parent
|
||||||
anchors.horizontalCenter: selectScreenWindowRect.horizontalCenter
|
|
||||||
|
|
||||||
width: selectScreenWindowRect.width
|
Text {
|
||||||
height: selectScreenWindowRect.height -
|
font.pointSize: JamiTheme.menuFontSize
|
||||||
(selectButton.height + JamiTheme.preferredMarginSize * 4)
|
font.bold: true
|
||||||
|
text: showWindows ? JamiStrings.windows : JamiStrings.screens
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
|
color: JamiTheme.textColor
|
||||||
|
Layout.margins: marginSize
|
||||||
|
}
|
||||||
|
|
||||||
clip: true
|
ScrollView {
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
id: screenSelectionScrollView
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
|
||||||
|
|
||||||
Flow {
|
Layout.alignment: Qt.AlignCenter
|
||||||
id: screenSelectionScrollViewFlow
|
Layout.preferredWidth: selectScreenWindowLayout.width
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
anchors.fill: parent
|
clip: true
|
||||||
topPadding: JamiTheme.preferredMarginSize
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
rightPadding: JamiTheme.preferredMarginSize
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
leftPadding: JamiTheme.preferredMarginSize
|
|
||||||
|
|
||||||
spacing: JamiTheme.preferredMarginSize
|
Flow {
|
||||||
|
id: screenSelectionScrollViewFlow
|
||||||
|
|
||||||
Text {
|
// https://bugreports.qt.io/browse/QTBUG-110323
|
||||||
width: screenSelectionScrollView.width
|
width: screenSelectionScrollView.width
|
||||||
height: JamiTheme.preferredFieldHeight
|
height: screenSelectionScrollView.height
|
||||||
|
|
||||||
font.pointSize: JamiTheme.menuFontSize
|
topPadding: marginSize
|
||||||
font.bold: true
|
rightPadding: marginSize
|
||||||
text: JamiStrings.screens
|
leftPadding: marginSize
|
||||||
verticalAlignment: Text.AlignBottom
|
spacing: marginSize
|
||||||
color: JamiTheme.textColor
|
|
||||||
visible: !root.window
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
Loader {
|
||||||
id: screenInfo
|
// Show all screens
|
||||||
|
active: !showWindows &&
|
||||||
|
Qt.application.screens.length > 1 &&
|
||||||
|
Qt.platform.os.toString() !== "windows"
|
||||||
|
sourceComponent: ScreenSharePreview {
|
||||||
|
id: screenSelectionRectAll
|
||||||
|
|
||||||
model: screens ? screens.length : 0
|
elementIndex: -1
|
||||||
|
rectTitle: JamiStrings.allScreens
|
||||||
delegate: Rectangle {
|
rId: AvAdapter.getSharingResource(-1)
|
||||||
id: screenItem
|
|
||||||
|
|
||||||
color: JamiTheme.secondaryBackgroundColor
|
|
||||||
|
|
||||||
width: componentWidthDoubleColumn > componentMinWidth ? componentWidthDoubleColumn : componentWidthSingleColumn
|
|
||||||
height: 3 * width / 4
|
|
||||||
|
|
||||||
border.color: selectedScreenNumber === index ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor
|
|
||||||
visible: !root.window && JamiStrings.selectScreen !== screens[index] && index < Qt.application.screens.length
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: screenName
|
|
||||||
|
|
||||||
anchors.top: screenItem.top
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenItem.horizontalCenter
|
|
||||||
width: parent.width
|
|
||||||
font.pointSize: JamiTheme.textFontSize
|
|
||||||
text: screens[index] ? screens[index] : ""
|
|
||||||
elide: Text.ElideMiddle
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
color: JamiTheme.textColor
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoView {
|
|
||||||
id: screenPreview
|
|
||||||
|
|
||||||
anchors.top: screenName.bottom
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenItem.horizontalCenter
|
|
||||||
height: screenItem.height - 50
|
|
||||||
width: screenItem.width - 50
|
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
VideoDevices.stopDevice(rendererId)
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (visible) {
|
|
||||||
const rId = AvAdapter.getSharingResource(index)
|
|
||||||
if (rId !== "") {
|
|
||||||
rendererId = VideoDevices.startDevice(rId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: screenItem
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
selectAllScreens = false
|
|
||||||
if (selectedScreenNumber == -1
|
|
||||||
|| selectedScreenNumber !== index) {
|
|
||||||
selectedScreenNumber = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: AvAdapter
|
|
||||||
|
|
||||||
function onScreenCaptured(screenNumber, source) {
|
|
||||||
if (screenNumber === -1)
|
|
||||||
screenShotAll.source = JamiQmlUtils.base64StringTitle + source
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: screenSelectionRectAll
|
|
||||||
|
|
||||||
color: JamiTheme.secondaryBackgroundColor
|
|
||||||
|
|
||||||
width: componentWidthDoubleColumn > componentMinWidth ? componentWidthDoubleColumn : componentWidthSingleColumn
|
|
||||||
height: 3 * width / 4
|
|
||||||
|
|
||||||
border.color: selectAllScreens ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor
|
|
||||||
|
|
||||||
visible: !root.window && Qt.application.screens.length > 1 && Qt.platform.os.toString() !== "windows"
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: screenNameAll
|
|
||||||
|
|
||||||
anchors.top: screenSelectionRectAll.top
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenSelectionRectAll.horizontalCenter
|
|
||||||
|
|
||||||
font.pointSize: JamiTheme.textFontSize
|
|
||||||
text: JamiStrings.allScreens
|
|
||||||
color: JamiTheme.textColor
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoView {
|
|
||||||
id: screenShotAll
|
|
||||||
|
|
||||||
anchors.top: screenNameAll.bottom
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenSelectionRectAll.horizontalCenter
|
|
||||||
height: screenSelectionRectAll.height - 50
|
|
||||||
width: screenSelectionRectAll.width - 50
|
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
VideoDevices.stopDevice(rendererId)
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (visible) {
|
|
||||||
const rId = AvAdapter.getSharingResource(-1)
|
|
||||||
if (rId !== "") {
|
|
||||||
rendererId = VideoDevices.startDevice(rId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
Repeater {
|
||||||
anchors.fill: parent
|
id: screenSharePreviewRepeater
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
|
|
||||||
onClicked: {
|
model: listModel.length
|
||||||
selectedScreenNumber = -1
|
|
||||||
selectAllScreens = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
delegate: ScreenSharePreview {
|
||||||
id: windowsText
|
id: screenItem
|
||||||
width: screenSelectionScrollView.width
|
|
||||||
height: JamiTheme.preferredFieldHeight
|
|
||||||
|
|
||||||
font.pointSize: JamiTheme.menuFontSize
|
visible: JamiStrings.selectScreen !== listModel[index] && JamiStrings.selectWindow !== listModel[index]
|
||||||
font.bold: true
|
elementIndex: index
|
||||||
text: JamiStrings.windows
|
rectTitle: listModel[index] ? listModel[index] : ""
|
||||||
verticalAlignment: Text.AlignBottom
|
rId: {
|
||||||
color: JamiTheme.textColor
|
if (showWindows)
|
||||||
visible: root.window
|
return rId = AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[index], AvAdapter.windowsNames[index])
|
||||||
}
|
return rId = AvAdapter.getSharingResource(index)
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: screenInfo2
|
|
||||||
|
|
||||||
model: screens ? screens.length : 0
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
|
||||||
id: screenItem2
|
|
||||||
|
|
||||||
color: JamiTheme.secondaryBackgroundColor
|
|
||||||
|
|
||||||
width: componentWidthDoubleColumn > componentMinWidth ? componentWidthDoubleColumn : componentWidthSingleColumn
|
|
||||||
height: 3 * width / 4
|
|
||||||
|
|
||||||
border.color: selectedScreenNumber === index ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor
|
|
||||||
visible: root.window && JamiStrings.selectScreen !== screens[index] && index >= Qt.application.screens.length
|
|
||||||
&& screenName2.text != JamiStrings.selectWindow
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: screenName2
|
|
||||||
|
|
||||||
anchors.top: screenItem2.top
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenItem2.horizontalCenter
|
|
||||||
width: parent.width
|
|
||||||
font.pointSize: JamiTheme.textFontSize
|
|
||||||
text: screens[index] ? screens[index] : ""
|
|
||||||
elide: Text.ElideMiddle
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
color: JamiTheme.textColor
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoView {
|
|
||||||
id: screenPreview2
|
|
||||||
|
|
||||||
anchors.top: screenName2.bottom
|
|
||||||
anchors.topMargin: 10
|
|
||||||
anchors.horizontalCenter: screenItem2.horizontalCenter
|
|
||||||
anchors.leftMargin: 25
|
|
||||||
anchors.rightMargin: 25
|
|
||||||
height: screenItem2.height - 60
|
|
||||||
width: screenItem2.width - 50
|
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
VideoDevices.stopDevice(rendererId)
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (visible) {
|
|
||||||
const rId = AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[index - Qt.application.screens.length], AvAdapter.windowsNames[index - Qt.application.screens.length])
|
|
||||||
if (rId !== "") {
|
|
||||||
rendererId = VideoDevices.startDevice(rId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: screenItem2
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
selectAllScreens = false
|
|
||||||
if (selectedScreenNumber == -1
|
|
||||||
|| selectedScreenNumber !== index) {
|
|
||||||
selectedScreenNumber = index
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.bottom: selectScreenWindowRect.bottom
|
Layout.margins: marginSize
|
||||||
anchors.bottomMargin: JamiTheme.preferredMarginSize
|
Layout.preferredWidth: selectScreenWindowLayout.width
|
||||||
anchors.horizontalCenter: selectScreenWindowRect.horizontalCenter
|
Layout.preferredHeight: childrenRect.height
|
||||||
|
spacing: marginSize
|
||||||
|
|
||||||
width: parent.width
|
MaterialButton {
|
||||||
height: childrenRect.height
|
id: selectButton
|
||||||
spacing: JamiTheme.preferredMarginSize
|
|
||||||
|
|
||||||
MaterialButton {
|
Layout.maximumWidth: 200
|
||||||
id: selectButton
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.leftMargin: marginSize
|
||||||
|
|
||||||
Layout.maximumWidth: 200
|
enabled: selectedScreenNumber != undefined
|
||||||
Layout.fillWidth: true
|
opacity: enabled ? 1.0 : 0.5
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
|
||||||
|
|
||||||
enabled: selectedScreenNumber != -1 || selectAllScreens
|
color: JamiTheme.buttonTintedBlack
|
||||||
opacity: enabled ? 1.0 : 0.5
|
hoveredColor: JamiTheme.buttonTintedBlackHovered
|
||||||
|
pressedColor: JamiTheme.buttonTintedBlackPressed
|
||||||
|
secondary: true
|
||||||
|
autoAccelerator: true
|
||||||
|
|
||||||
color: JamiTheme.buttonTintedBlack
|
text: showWindows ? JamiStrings.shareWindow : JamiStrings.shareScreen
|
||||||
hoveredColor: JamiTheme.buttonTintedBlackHovered
|
|
||||||
pressedColor: JamiTheme.buttonTintedBlackPressed
|
|
||||||
secondary: true
|
|
||||||
autoAccelerator: true
|
|
||||||
|
|
||||||
text: window ? JamiStrings.shareWindow : JamiStrings.shareScreen
|
onClicked: {
|
||||||
|
if (selectAllScreens)
|
||||||
onClicked: {
|
AvAdapter.shareAllScreens()
|
||||||
if (selectAllScreens)
|
else {
|
||||||
AvAdapter.shareAllScreens()
|
if (!showWindows)
|
||||||
else {
|
AvAdapter.shareEntireScreen(selectedScreenNumber)
|
||||||
if (selectedScreenNumber < Qt.application.screens.length)
|
else {
|
||||||
AvAdapter.shareEntireScreen(selectedScreenNumber)
|
AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber], AvAdapter.windowsNames[selectedScreenNumber - Qt.application.screens.length])
|
||||||
else {
|
}
|
||||||
AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber - Qt.application.screens.length], AvAdapter.windowsNames[selectedScreenNumber - Qt.application.screens.length])
|
}
|
||||||
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.close()
|
|
||||||
|
MaterialButton {
|
||||||
|
id: cancelButton
|
||||||
|
|
||||||
|
Layout.maximumWidth: 200
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.rightMargin: marginSize
|
||||||
|
|
||||||
|
color: JamiTheme.buttonTintedBlack
|
||||||
|
hoveredColor: JamiTheme.buttonTintedBlackHovered
|
||||||
|
pressedColor: JamiTheme.buttonTintedBlackPressed
|
||||||
|
secondary: true
|
||||||
|
autoAccelerator: true
|
||||||
|
|
||||||
|
text: JamiStrings.optionCancel
|
||||||
|
|
||||||
|
onClicked: root.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialButton {
|
|
||||||
id: cancelButton
|
|
||||||
|
|
||||||
Layout.maximumWidth: 200
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.rightMargin: JamiTheme.preferredMarginSize
|
|
||||||
|
|
||||||
color: JamiTheme.buttonTintedBlack
|
|
||||||
hoveredColor: JamiTheme.buttonTintedBlackHovered
|
|
||||||
pressedColor: JamiTheme.buttonTintedBlackPressed
|
|
||||||
secondary: true
|
|
||||||
autoAccelerator: true
|
|
||||||
|
|
||||||
text: JamiStrings.optionCancel
|
|
||||||
|
|
||||||
onClicked: root.close()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,53 +16,24 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Global select screen window component, object variable for creation.
|
function presentSelectScreenWindow(parent, selectWindows) {
|
||||||
var selectScreenWindowComponent
|
var comp = Qt.createComponent(
|
||||||
var selectScreenWindowObject
|
|
||||||
var mainWindow
|
|
||||||
|
|
||||||
function createSelectScreenWindowObject(appWindow) {
|
|
||||||
if (selectScreenWindowObject)
|
|
||||||
return
|
|
||||||
selectScreenWindowComponent = Qt.createComponent(
|
|
||||||
"../components/SelectScreen.qml")
|
"../components/SelectScreen.qml")
|
||||||
mainWindow = appWindow
|
if (comp.status === Component.Ready) {
|
||||||
if (selectScreenWindowComponent.status === Component.Ready)
|
var obj = comp.createObject(parent, {showWindows: selectWindows})
|
||||||
finishCreation()
|
if (obj === null) {
|
||||||
else if (selectScreenWindowComponent.status === Component.Error)
|
// Error Handling.
|
||||||
console.log("Error loading component:",
|
console.log("Error creating select screen object")
|
||||||
selectScreenWindowComponent.errorString())
|
} else {
|
||||||
}
|
var centerX = appWindow.x + appWindow.width / 2
|
||||||
|
var centerY = appWindow.y + appWindow.height / 2
|
||||||
function finishCreation() {
|
obj.width = 0.75 * appWindow.width
|
||||||
selectScreenWindowObject = selectScreenWindowComponent.createObject()
|
obj.height = 0.75 * appWindow.height
|
||||||
if (selectScreenWindowObject === null) {
|
obj.x = centerX - obj.width / 2
|
||||||
// Error Handling.
|
obj.y = centerY - obj.height / 2
|
||||||
console.log("Error creating select screen object")
|
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
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue