matrixion/resources/qml/voip/CallInviteBar.qml

127 lines
3.8 KiB
QML
Raw Normal View History

2020-12-30 23:03:07 +03:00
import "../"
2020-12-17 19:25:32 +03:00
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
Rectangle {
visible: CallManager.haveCallInvite
color: "#2ECC71"
implicitHeight: visible ? rowLayout.height + 8 : 0
2020-12-20 17:37:22 +03:00
Component {
id: devicesDialog
CallDevices {
}
}
2020-12-30 23:03:07 +03:00
Component {
id: deviceError
DeviceError {
}
}
2020-12-17 19:25:32 +03:00
RowLayout {
id: rowLayout
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 8
Avatar {
width: avatarSize
height: avatarSize
url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: CallManager.callParty
}
Label {
2020-12-19 17:32:20 +03:00
Layout.leftMargin: 8
2020-12-17 19:25:32 +03:00
font.pointSize: fontMetrics.font.pointSize * 1.1
2020-12-19 17:32:20 +03:00
text: CallManager.callParty
2020-12-30 23:03:07 +03:00
color: "#000000"
2020-12-17 19:25:32 +03:00
}
Image {
2020-12-19 17:32:20 +03:00
Layout.leftMargin: 4
2020-12-17 19:25:32 +03:00
Layout.preferredWidth: 24
Layout.preferredHeight: 24
source: CallManager.isVideo ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png"
}
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
2020-12-20 18:14:55 +03:00
text: CallManager.isVideo ? qsTr("Video Call") : qsTr("Voice Call")
2020-12-30 23:03:07 +03:00
color: "#000000"
2020-12-17 19:25:32 +03:00
}
Item {
Layout.fillWidth: true
}
2020-12-20 17:37:22 +03:00
ImageButton {
2020-12-30 23:03:07 +03:00
Layout.rightMargin: 16
width: 20
height: 20
2020-12-20 17:37:22 +03:00
buttonTextColor: "#000000"
image: ":/icons/icons/ui/settings.png"
hoverEnabled: true
ToolTip.visible: hovered
2020-12-20 18:14:55 +03:00
ToolTip.text: qsTr("Devices")
2020-12-20 17:37:22 +03:00
onClicked: {
CallManager.refreshDevices();
2020-12-20 17:37:22 +03:00
var dialog = devicesDialog.createObject(timelineRoot);
2020-12-30 23:03:07 +03:00
dialog.open();
2020-12-20 17:37:22 +03:00
}
}
2020-12-17 19:25:32 +03:00
Button {
2020-12-30 23:03:07 +03:00
Layout.rightMargin: 4
2020-12-17 19:25:32 +03:00
icon.source: CallManager.isVideo ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png"
2021-01-07 01:15:43 +03:00
text: qsTr(" Accept ")
palette: colors
2020-12-30 23:03:07 +03:00
2020-12-17 19:25:32 +03:00
onClicked: {
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-17 19:25:32 +03:00
return;
}
else if (!CallManager.mics.includes(Settings.microphone)) {
2020-12-30 23:03:07 +03:00
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("Unknown microphone: ") + Settings.microphone,
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-17 19:25:32 +03:00
return;
}
if (CallManager.isVideo && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
2020-12-30 23:03:07 +03:00
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("Unknown camera: ") + Settings.camera,
2021-01-07 01:15:43 +03:00
"image": ":/icons/icons/ui/video-call.png"
2020-12-30 23:03:07 +03:00
});
dialog.open();
2020-12-17 19:25:32 +03:00
return;
}
CallManager.acceptInvite();
}
}
Button {
2020-12-30 23:03:07 +03:00
Layout.rightMargin: 16
2020-12-17 19:25:32 +03:00
icon.source: "qrc:/icons/icons/ui/end-call.png"
2021-01-07 01:15:43 +03:00
text: qsTr(" Decline ")
palette: colors
2020-12-30 23:03:07 +03:00
2020-12-17 19:25:32 +03:00
onClicked: {
CallManager.hangUp();
}
}
}
}