| 1 |
// SPDX-FileCopyrightText: Nheko Contributors |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
import "../" |
| 6 |
import QtQuick |
| 7 |
import QtQuick.Controls |
| 8 |
import QtQuick.Layouts |
| 9 |
import im.nheko |
| 10 |
|
| 11 |
Popup { |
| 12 |
modal: true |
| 13 |
|
| 14 |
anchors.centerIn: parent; |
| 15 |
|
| 16 |
Component.onCompleted: { |
| 17 |
frameRateCombo.currentIndex = frameRateCombo.find(Settings.screenShareFrameRate); |
| 18 |
} |
| 19 |
Component.onDestruction: { |
| 20 |
CallManager.closeScreenShare(); |
| 21 |
} |
| 22 |
|
| 23 |
ColumnLayout { |
| 24 |
Label { |
| 25 |
Layout.topMargin: 16 |
| 26 |
Layout.bottomMargin: 16 |
| 27 |
Layout.leftMargin: 8 |
| 28 |
Layout.rightMargin: 8 |
| 29 |
Layout.alignment: Qt.AlignLeft |
| 30 |
text: qsTr("Share desktop with %1?").arg(room.roomName) |
| 31 |
color: palette.windowText |
| 32 |
} |
| 33 |
|
| 34 |
RowLayout { |
| 35 |
Layout.leftMargin: 8 |
| 36 |
Layout.rightMargin: 8 |
| 37 |
Layout.bottomMargin: 8 |
| 38 |
|
| 39 |
Label { |
| 40 |
Layout.alignment: Qt.AlignLeft |
| 41 |
text: qsTr("Method:") |
| 42 |
color: palette.windowText |
| 43 |
} |
| 44 |
|
| 45 |
ComboBox { |
| 46 |
id: screenshareType |
| 47 |
|
| 48 |
Layout.fillWidth: true |
| 49 |
model: CallManager.screenShareTypeList() |
| 50 |
onCurrentIndexChanged: CallManager.setScreenShareType(currentIndex); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
RowLayout { |
| 55 |
Layout.leftMargin: 8 |
| 56 |
Layout.rightMargin: 8 |
| 57 |
Layout.bottomMargin: 8 |
| 58 |
|
| 59 |
Label { |
| 60 |
Layout.alignment: Qt.AlignLeft |
| 61 |
text: qsTr("Window:") |
| 62 |
color: palette.windowText |
| 63 |
} |
| 64 |
|
| 65 |
ComboBox { |
| 66 |
visible: CallManager.screenShareType == Voip.X11 || CallManager.screenShareType == Voip.D3D11 |
| 67 |
id: windowCombo |
| 68 |
|
| 69 |
Layout.fillWidth: true |
| 70 |
model: CallManager.windowList() |
| 71 |
} |
| 72 |
|
| 73 |
Button { |
| 74 |
visible: CallManager.screenShareType == Voip.XDP |
| 75 |
highlighted: !CallManager.screenShareReady |
| 76 |
text: qsTr("Request screencast") |
| 77 |
onClicked: { |
| 78 |
Settings.screenShareHideCursor = hideCursorCheckBox.checked; |
| 79 |
CallManager.setupScreenShareXDP(); |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
RowLayout { |
| 86 |
Layout.leftMargin: 8 |
| 87 |
Layout.rightMargin: 8 |
| 88 |
Layout.bottomMargin: 8 |
| 89 |
|
| 90 |
Label { |
| 91 |
Layout.alignment: Qt.AlignLeft |
| 92 |
text: qsTr("Frame rate:") |
| 93 |
color: palette.windowText |
| 94 |
} |
| 95 |
|
| 96 |
ComboBox { |
| 97 |
id: frameRateCombo |
| 98 |
|
| 99 |
Layout.fillWidth: true |
| 100 |
model: ["120", "90", "60", "50", "48", "30", "25", "20", "15", "10", "5", "2", "1"] |
| 101 |
} |
| 102 |
|
| 103 |
} |
| 104 |
|
| 105 |
GridLayout { |
| 106 |
columns: 2 |
| 107 |
rowSpacing: 10 |
| 108 |
Layout.margins: 8 |
| 109 |
|
| 110 |
MatrixText { |
| 111 |
text: qsTr("Include your camera picture-in-picture") |
| 112 |
} |
| 113 |
|
| 114 |
ToggleButton { |
| 115 |
id: pipCheckBox |
| 116 |
|
| 117 |
enabled: CallManager.cameras.length > 0 |
| 118 |
checked: CallManager.cameras.length > 0 && Settings.screenSharePiP |
| 119 |
Layout.alignment: Qt.AlignRight |
| 120 |
} |
| 121 |
|
| 122 |
MatrixText { |
| 123 |
text: qsTr("Request remote camera") |
| 124 |
ToolTip.text: qsTr("View your callee's camera like a regular video call") |
| 125 |
ToolTip.visible: hovered |
| 126 |
} |
| 127 |
|
| 128 |
ToggleButton { |
| 129 |
id: remoteVideoCheckBox |
| 130 |
|
| 131 |
Layout.alignment: Qt.AlignRight |
| 132 |
checked: Settings.screenShareRemoteVideo |
| 133 |
ToolTip.text: qsTr("View your callee's camera like a regular video call") |
| 134 |
ToolTip.visible: hovered |
| 135 |
} |
| 136 |
|
| 137 |
MatrixText { |
| 138 |
text: qsTr("Hide mouse cursor") |
| 139 |
} |
| 140 |
|
| 141 |
ToggleButton { |
| 142 |
id: hideCursorCheckBox |
| 143 |
|
| 144 |
Layout.alignment: Qt.AlignRight |
| 145 |
checked: Settings.screenShareHideCursor |
| 146 |
} |
| 147 |
|
| 148 |
} |
| 149 |
|
| 150 |
RowLayout { |
| 151 |
Layout.margins: 8 |
| 152 |
|
| 153 |
Item { |
| 154 |
Layout.fillWidth: true |
| 155 |
} |
| 156 |
|
| 157 |
Button { |
| 158 |
visible: CallManager.screenShareReady |
| 159 |
text: qsTr("Share") |
| 160 |
icon.source: "qrc:/icons/icons/ui/screen-share.svg" |
| 161 |
|
| 162 |
onClicked: { |
| 163 |
Settings.screenShareFrameRate = frameRateCombo.currentText; |
| 164 |
Settings.screenSharePiP = pipCheckBox.checked; |
| 165 |
Settings.screenShareRemoteVideo = remoteVideoCheckBox.checked; |
| 166 |
Settings.screenShareHideCursor = hideCursorCheckBox.checked; |
| 167 |
|
| 168 |
CallManager.sendInvite(room.roomId, Voip.SCREEN, windowCombo.currentIndex); |
| 169 |
close(); |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
Button { |
| 174 |
visible: CallManager.screenShareReady |
| 175 |
text: qsTr("Preview") |
| 176 |
onClicked: { |
| 177 |
CallManager.previewWindow(windowCombo.currentIndex); |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
Button { |
| 182 |
text: qsTr("Cancel") |
| 183 |
onClicked: { |
| 184 |
close(); |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
} |
| 189 |
|
| 190 |
} |
| 191 |
|
| 192 |
background: Rectangle { |
| 193 |
color: palette.window |
| 194 |
border.color: palette.windowText |
| 195 |
} |
| 196 |
|
| 197 |
} |