Add device combos to PlaceCall dialog

This commit is contained in:
trilene 2020-12-19 10:49:13 -05:00 committed by Nicolas Werner
parent d315d02ee6
commit 055c6f7248

View file

@ -19,8 +19,8 @@ ApplicationWindow {
} }
ColumnLayout { ColumnLayout {
id: columnLayout id: columnLayout
spacing: 16 spacing: 16
RowLayout { RowLayout {
@ -30,7 +30,7 @@ ApplicationWindow {
Label { Label {
font.pointSize: fontMetrics.font.pointSize * 1.1 font.pointSize: fontMetrics.font.pointSize * 1.1
text: "Place a call to " + TimelineManager.timeline.roomName + "?" text: qsTr("Place a call to ") + TimelineManager.timeline.roomName + "?"
} }
Item { Item {
@ -39,11 +39,10 @@ ApplicationWindow {
} }
RowLayout { RowLayout {
id: buttonLayout
id: rowLayout
Layout.leftMargin: 8 Layout.leftMargin: 8
Layout.rightMargin: 8 Layout.rightMargin: 8
Layout.bottomMargin: 16
spacing: 16 spacing: 16
function validateMic() { function validateMic() {
@ -52,11 +51,6 @@ ApplicationWindow {
warningDialog.open(); warningDialog.open();
return false; return false;
} }
else if (!CallManager.mics.includes(Settings.microphone)) {
warningDialog.text = "Unknown microphone: " + Settings.microphone;
warningDialog.open();
return false;
}
return true; return true;
} }
@ -71,7 +65,8 @@ ApplicationWindow {
text: qsTr("Voice") text: qsTr("Voice")
icon.source: "qrc:/icons/icons/ui/place-call.png" icon.source: "qrc:/icons/icons/ui/place-call.png"
onClicked: { onClicked: {
if (rowLayout.validateMic()) { if (buttonLayout.validateMic()) {
Settings.microphone = micCombo.currentText
CallManager.sendInvite(TimelineManager.timeline.roomId(), false); CallManager.sendInvite(TimelineManager.timeline.roomId(), false);
close(); close();
} }
@ -83,12 +78,9 @@ ApplicationWindow {
text: qsTr("Video") text: qsTr("Video")
icon.source: "qrc:/icons/icons/ui/video-call.png" icon.source: "qrc:/icons/icons/ui/video-call.png"
onClicked: { onClicked: {
if (rowLayout.validateMic()) { if (buttonLayout.validateMic()) {
if (!CallManager.cameras.includes(Settings.camera)) { Settings.microphone = micCombo.currentText
warningDialog.text = "Unknown camera: " + Settings.camera; Settings.camera = cameraCombo.currentText
warningDialog.open();
return;
}
CallManager.sendInvite(TimelineManager.timeline.roomId(), true); CallManager.sendInvite(TimelineManager.timeline.roomId(), true);
close(); close();
} }
@ -103,5 +95,44 @@ ApplicationWindow {
} }
} }
} }
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
}
}
} }
} }