matrixion/resources/qml/voip/PlaceCall.qml

156 lines
4.2 KiB
QML
Raw Normal View History

2020-12-30 23:03:07 +03:00
import "../"
import QtQuick 2.9
2020-12-18 20:49:24 +03:00
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
2020-12-30 23:03:07 +03:00
Popup {
modal: true
anchors.centerIn: parent
2021-01-07 01:15:43 +03:00
palette: colors
2020-12-18 20:49:24 +03:00
2020-12-30 23:03:07 +03:00
Component {
id: deviceError
2021-01-12 01:51:39 +03:00
2020-12-30 23:03:07 +03:00
DeviceError {
}
2021-01-12 01:51:39 +03:00
2020-12-18 20:49:24 +03:00
}
ColumnLayout {
id: columnLayout
2020-12-19 18:49:13 +03:00
2020-12-18 20:49:24 +03:00
spacing: 16
RowLayout {
2020-12-30 23:03:07 +03:00
Layout.topMargin: 8
2020-12-18 20:49:24 +03:00
Layout.leftMargin: 8
Label {
2020-12-19 18:49:13 +03:00
text: qsTr("Place a call to ") + TimelineManager.timeline.roomName + "?"
2020-12-21 01:19:24 +03:00
color: colors.windowText
2020-12-18 20:49:24 +03:00
}
Item {
Layout.fillWidth: true
}
2021-01-12 01:51:39 +03:00
2020-12-18 20:49:24 +03:00
}
RowLayout {
2020-12-19 18:49:13 +03:00
id: buttonLayout
2020-12-18 20:49:24 +03:00
function validateMic() {
if (CallManager.mics.length == 0) {
2020-12-30 23:03:07 +03:00
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("No microphone found."),
2021-01-07 01:15:43 +03:00
"image": ":/icons/icons/ui/place-call.png"
2020-12-30 23:03:07 +03:00
});
dialog.open();
2020-12-18 20:49:24 +03:00
return false;
}
return true;
}
2021-01-12 01:51:39 +03:00
Layout.leftMargin: 8
Layout.rightMargin: 8
2020-12-18 20:49:24 +03:00
Avatar {
2020-12-30 23:03:07 +03:00
Layout.rightMargin: cameraCombo.visible ? 16 : 64
2020-12-18 20:49:24 +03:00
width: avatarSize
height: avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName
2021-01-12 04:02:39 +03:00
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
2020-12-18 20:49:24 +03:00
}
Button {
2021-01-07 01:15:43 +03:00
text: qsTr(" Voice ")
2020-12-18 20:49:24 +03:00
icon.source: "qrc:/icons/icons/ui/place-call.png"
onClicked: {
2020-12-19 18:49:13 +03:00
if (buttonLayout.validateMic()) {
2021-01-12 01:51:39 +03:00
Settings.microphone = micCombo.currentText;
2020-12-18 20:49:24 +03:00
CallManager.sendInvite(TimelineManager.timeline.roomId(), false);
close();
}
}
}
Button {
visible: CallManager.cameras.length > 0
2021-01-07 01:15:43 +03:00
text: qsTr(" Video ")
2020-12-18 20:49:24 +03:00
icon.source: "qrc:/icons/icons/ui/video-call.png"
onClicked: {
2020-12-19 18:49:13 +03:00
if (buttonLayout.validateMic()) {
2021-01-12 01:51:39 +03:00
Settings.microphone = micCombo.currentText;
Settings.camera = cameraCombo.currentText;
2020-12-18 20:49:24 +03:00
CallManager.sendInvite(TimelineManager.timeline.roomId(), true);
close();
}
}
}
Button {
text: qsTr("Cancel")
onClicked: {
close();
}
}
2021-01-12 01:51:39 +03:00
2020-12-18 20:49:24 +03:00
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
ColumnLayout {
spacing: 8
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
RowLayout {
Layout.leftMargin: 8
Layout.rightMargin: 8
2020-12-30 23:03:07 +03:00
Layout.bottomMargin: cameraCombo.visible ? 0 : 8
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
2021-01-07 01:15:43 +03:00
source: "image://colorimage/:/icons/icons/ui/microphone-unmute.png?" + colors.windowText
2020-12-20 18:33:22 +03:00
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
ComboBox {
id: micCombo
2021-01-12 01:51:39 +03:00
2020-12-20 18:33:22 +03:00
Layout.fillWidth: true
model: CallManager.mics
}
2021-01-12 01:51:39 +03:00
2020-12-20 18:33:22 +03:00
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
RowLayout {
visible: CallManager.cameras.length > 0
Layout.leftMargin: 8
Layout.rightMargin: 8
2020-12-30 23:03:07 +03:00
Layout.bottomMargin: 8
2020-12-20 18:33:22 +03:00
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
2021-01-07 01:15:43 +03:00
source: "image://colorimage/:/icons/icons/ui/video-call.png?" + colors.windowText
2020-12-20 18:33:22 +03:00
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
ComboBox {
id: cameraCombo
2021-01-12 01:51:39 +03:00
2020-12-20 18:33:22 +03:00
Layout.fillWidth: true
model: CallManager.cameras
}
2021-01-12 01:51:39 +03:00
2020-12-19 18:49:13 +03:00
}
2021-01-12 01:51:39 +03:00
2020-12-19 18:49:13 +03:00
}
2021-01-12 01:51:39 +03:00
2020-12-18 20:49:24 +03:00
}
2021-01-12 01:51:39 +03:00
background: Rectangle {
color: colors.window
border.color: colors.windowText
}
2020-12-18 20:49:24 +03:00
}