matrixion/resources/qml/voip/PlaceCall.qml

146 lines
3.9 KiB
QML
Raw Normal View History

2020-12-18 20:49:24 +03:00
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import "../"
ApplicationWindow {
flags: Qt.Dialog
modality: Qt.ApplicationModal
palette: colors
width: columnLayout.implicitWidth
height: columnLayout.implicitHeight
MessageDialog {
id: warningDialog
icon: StandardIcon.Warning
}
ColumnLayout {
id: columnLayout
2020-12-19 18:49:13 +03:00
2020-12-18 20:49:24 +03:00
spacing: 16
RowLayout {
Layout.topMargin: 16
Layout.leftMargin: 8
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
2020-12-19 18:49:13 +03:00
text: qsTr("Place a call to ") + TimelineManager.timeline.roomName + "?"
2020-12-21 01:12:42 +03:00
color: windowText
2020-12-18 20:49:24 +03:00
}
Item {
Layout.fillWidth: true
}
}
RowLayout {
2020-12-19 18:49:13 +03:00
id: buttonLayout
2020-12-18 20:49:24 +03:00
Layout.leftMargin: 8
Layout.rightMargin: 8
function validateMic() {
if (CallManager.mics.length == 0) {
2020-12-20 18:33:22 +03:00
warningDialog.text = qsTr("No microphone found.");
2020-12-18 20:49:24 +03:00
warningDialog.open();
return false;
}
return true;
}
Avatar {
width: avatarSize
height: avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName
}
2020-12-20 18:33:22 +03:00
Item {
implicitWidth: cameraCombo.visible ? 16 : 64
}
2020-12-18 20:49:24 +03:00
Button {
text: qsTr("Voice")
icon.source: "qrc:/icons/icons/ui/place-call.png"
onClicked: {
2020-12-19 18:49:13 +03:00
if (buttonLayout.validateMic()) {
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
text: qsTr("Video")
icon.source: "qrc:/icons/icons/ui/video-call.png"
onClicked: {
2020-12-19 18:49:13 +03:00
if (buttonLayout.validateMic()) {
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();
}
}
}
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 {
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.bottomMargin: cameraCombo.visible ? 0 : 16
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
source: "qrc:/icons/icons/ui/microphone-unmute.png"
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
ComboBox {
id: micCombo
Layout.fillWidth: true
model: CallManager.mics
}
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
RowLayout {
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
visible: CallManager.cameras.length > 0
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.bottomMargin: 16
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
source: "qrc:/icons/icons/ui/video-call.png"
}
2020-12-19 18:49:13 +03:00
2020-12-20 18:33:22 +03:00
ComboBox {
id: cameraCombo
Layout.fillWidth: true
model: CallManager.cameras
}
2020-12-19 18:49:13 +03:00
}
}
2020-12-18 20:49:24 +03:00
}
}