nheko/resources/qml/voip/PlaceCall.qml

147 lines
4.0 KiB
QML
Raw Normal View History

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