diff options
author | trilene <trilene@runbox.com> | 2020-12-17 11:25:32 -0500 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-01-07 14:04:21 +0100 |
commit | 7124024977ccb237547b88b6a96a50ac6838c354 (patch) | |
tree | f5a6ca7b69444413b3c806667e72584d40e36689 /resources/qml | |
parent | Move call-related properties to CallManager (diff) | |
download | nheko-7124024977ccb237547b88b6a96a50ac6838c354.tar.xz |
Make call invites less intrusive
Diffstat (limited to 'resources/qml')
-rw-r--r-- | resources/qml/TimelineView.qml | 9 | ||||
-rw-r--r-- | resources/qml/voip/ActiveCallBar.qml (renamed from resources/qml/ActiveCallBar.qml) | 16 | ||||
-rw-r--r-- | resources/qml/voip/CallInviteBar.qml | 95 | ||||
-rw-r--r-- | resources/qml/voip/VideoCall.qml (renamed from resources/qml/VideoCall.qml) | 0 |
4 files changed, 111 insertions, 9 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index c71eb89f..3e134b35 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -1,6 +1,7 @@ import "./delegates" import "./device-verification" import "./emoji" +import "./voip" import QtGraphicalEffects 1.0 import QtQuick 2.9 import QtQuick.Controls 2.3 @@ -210,7 +211,7 @@ Page { } Loader { - source: CallManager.isOnVideoCall ? "VideoCall.qml" : "" + source: CallManager.isOnCall && CallManager.isVideo ? "voip/VideoCall.qml" : "" onLoaded: TimelineManager.setVideoCallItem() } @@ -223,6 +224,12 @@ Page { } + CallInviteBar { + id: callInviteBar + Layout.fillWidth: true + z: 3 + } + ActiveCallBar { Layout.fillWidth: true z: 3 diff --git a/resources/qml/ActiveCallBar.qml b/resources/qml/voip/ActiveCallBar.qml index 57b0877c..9efdb325 100644 --- a/resources/qml/ActiveCallBar.qml +++ b/resources/qml/voip/ActiveCallBar.qml @@ -2,18 +2,18 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 import im.nheko 1.0 +import "../" Rectangle { - id: activeCallBar visible: CallManager.isOnCall - color: "#2ECC71" + color: callInviteBar.color implicitHeight: visible ? rowLayout.height + 8 : 0 MouseArea { anchors.fill: parent onClicked: { - if (CallManager.isOnVideoCall) + if (CallManager.isVideo) stackLayout.currentIndex = stackLayout.currentIndex ? 0 : 1; } @@ -31,18 +31,18 @@ Rectangle { width: avatarSize height: avatarSize url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: CallManager.callPartyName + displayName: CallManager.callParty } Label { font.pointSize: fontMetrics.font.pointSize * 1.1 - text: " " + CallManager.callPartyName + " " + text: " " + CallManager.callParty + " " } Image { Layout.preferredWidth: 24 Layout.preferredHeight: 24 - source: CallManager.isOnVideoCall ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png" + source: CallManager.isVideo ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png" } Label { @@ -99,7 +99,7 @@ Rectangle { PropertyChanges { target: stackLayout - currentIndex: CallManager.isOnVideoCall ? 1 : 0 + currentIndex: CallManager.isVideo ? 1 : 0 } }, @@ -148,7 +148,7 @@ Rectangle { } ImageButton { - visible: CallManager.isOnVideoCall + visible: CallManager.isVideo width: 24 height: 24 buttonTextColor: "#000000" diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml new file mode 100644 index 00000000..6d4d2ac0 --- /dev/null +++ b/resources/qml/voip/CallInviteBar.qml @@ -0,0 +1,95 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import QtQuick.Dialogs 1.3 +import QtQuick.Layouts 1.2 +import im.nheko 1.0 +import "../" + +Rectangle { + + visible: CallManager.haveCallInvite + color: "#2ECC71" + implicitHeight: visible ? rowLayout.height + 8 : 0 + + MessageDialog { + id: warningDialog + icon: StandardIcon.Warning + } + + 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 { + font.pointSize: fontMetrics.font.pointSize * 1.1 + text: " " + CallManager.callParty + " " + } + + Image { + 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 + text: CallManager.isVideo ? "Video Call" : "Voice Call" + } + + Item { + Layout.fillWidth: true + } + + Button { + icon.source: CallManager.isVideo ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png" + palette: colors + text: qsTr("Accept") + onClicked: { + if (CallManager.mics.length == 0) { + warningDialog.text = "No microphone found."; + warningDialog.open(); + return; + } + else if (!CallManager.mics.includes(Settings.microphone)) { + warningDialog.text = "Unknown microphone: " + Settings.microphone; + warningDialog.open(); + return; + } + if (CallManager.isVideo && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) { + warningDialog.text = "Unknown camera: " + Settings.camera; + warningDialog.open(); + return; + } + CallManager.acceptInvite(); + } + } + + Item { + implicitWidth: 8 + } + + Button { + icon.source: "qrc:/icons/icons/ui/end-call.png" + palette: colors + text: qsTr("Decline") + onClicked: { + CallManager.hangUp(); + } + } + + Item { + implicitWidth: 16 + } + } +} diff --git a/resources/qml/VideoCall.qml b/resources/qml/voip/VideoCall.qml index 14408b6e..14408b6e 100644 --- a/resources/qml/VideoCall.qml +++ b/resources/qml/voip/VideoCall.qml |