nheko/resources/qml/voip/PlaceCall.qml

139 lines
3.7 KiB
QML
Raw Normal View History

2020-12-18 18:49:24 +01: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 16:49:13 +01:00
2020-12-18 18:49:24 +01:00
spacing: 16
RowLayout {
Layout.topMargin: 16
Layout.leftMargin: 8
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
2020-12-19 16:49:13 +01:00
text: qsTr("Place a call to ") + TimelineManager.timeline.roomName + "?"
2020-12-18 18:49:24 +01:00
}
Item {
Layout.fillWidth: true
}
}
RowLayout {
2020-12-19 16:49:13 +01:00
id: buttonLayout
2020-12-18 18:49:24 +01:00
Layout.leftMargin: 8
Layout.rightMargin: 8
spacing: 16
function validateMic() {
if (CallManager.mics.length == 0) {
warningDialog.text = "No microphone found.";
warningDialog.open();
return false;
}
return true;
}
Avatar {
width: avatarSize
height: avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName
}
Button {
text: qsTr("Voice")
icon.source: "qrc:/icons/icons/ui/place-call.png"
onClicked: {
2020-12-19 16:49:13 +01:00
if (buttonLayout.validateMic()) {
Settings.microphone = micCombo.currentText
2020-12-18 18:49:24 +01: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 16:49:13 +01:00
if (buttonLayout.validateMic()) {
Settings.microphone = micCombo.currentText
Settings.camera = cameraCombo.currentText
2020-12-18 18:49:24 +01:00
CallManager.sendInvite(TimelineManager.timeline.roomId(), true);
close();
}
}
}
Button {
palette: colors
text: qsTr("Cancel")
onClicked: {
close();
}
}
}
2020-12-19 16:49:13 +01:00
RowLayout {
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.bottomMargin: cameraCombo.visible ? 0 : 16
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
source: "qrc:/icons/icons/ui/microphone-unmute.png"
}
ComboBox {
id: micCombo
Layout.fillWidth: true
model: CallManager.mics
}
}
RowLayout {
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"
}
ComboBox {
id: cameraCombo
Layout.fillWidth: true
model: CallManager.cameras
}
}
2020-12-18 18:49:24 +01:00
}
}