Implement voice & video calls
This commit is contained in:
86
src/qml/Component/Call/CallPageButton.qml
Normal file
86
src/qml/Component/Call/CallPageButton.qml
Normal file
@@ -0,0 +1,86 @@
|
||||
// SPDX-FileCopyrightText: 2022 Carson Black <uhhadd@gmail.com>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.7 as QQC2
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
QQC2.AbstractButton {
|
||||
id: control
|
||||
|
||||
property int temprament: CallPageButton.Neutral
|
||||
property bool shimmering: false
|
||||
|
||||
enum Temprament {
|
||||
Neutral,
|
||||
Constructive,
|
||||
Destructive
|
||||
}
|
||||
|
||||
padding: Kirigami.Units.largeSpacing
|
||||
contentItem: ColumnLayout {
|
||||
QQC2.Control {
|
||||
padding: Kirigami.Units.gridUnit
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Button
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
contentItem: Kirigami.Icon {
|
||||
implicitHeight: Kirigami.Units.iconSizes.medium
|
||||
implicitWidth: Kirigami.Units.iconSizes.medium
|
||||
source: control.icon.name
|
||||
}
|
||||
background: Rectangle {
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Button
|
||||
|
||||
ShimmerGradient {
|
||||
id: shimmerGradient
|
||||
color: {
|
||||
switch (control.temprament) {
|
||||
case CallPageButton.Neutral:
|
||||
return Kirigami.Theme.textColor
|
||||
case CallPageButton.Constructive:
|
||||
return Kirigami.Theme.positiveTextColor
|
||||
case CallPageButton.Destructive:
|
||||
return Kirigami.Theme.negativeTextColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color: {
|
||||
if (control.checked) {
|
||||
return Kirigami.Theme.focusColor
|
||||
}
|
||||
|
||||
switch (control.temprament) {
|
||||
case CallPageButton.Neutral:
|
||||
return Kirigami.Theme.backgroundColor
|
||||
case CallPageButton.Constructive:
|
||||
return Kirigami.Theme.positiveBackgroundColor
|
||||
case CallPageButton.Destructive:
|
||||
return Kirigami.Theme.negativeBackgroundColor
|
||||
}
|
||||
}
|
||||
border.color: Kirigami.Theme.focusColor
|
||||
border.width: control.visualFocus ? 2 : 0
|
||||
radius: height/2
|
||||
|
||||
Rectangle {
|
||||
visible: control.shimmering
|
||||
anchors.fill: parent
|
||||
radius: height/2
|
||||
|
||||
gradient: control.shimmering ? shimmerGradient : null
|
||||
}
|
||||
}
|
||||
}
|
||||
QQC2.Label {
|
||||
text: control.text
|
||||
font: Kirigami.Theme.smallFont
|
||||
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src/qml/Component/Call/VideoStreamDelegate.qml
Normal file
63
src/qml/Component/Call/VideoStreamDelegate.qml
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.freedesktop.gstreamer.GLVideoItem 1.0
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
Rectangle {
|
||||
id: videoStreamDelegate
|
||||
|
||||
implicitWidth: height / 9 * 16
|
||||
implicitHeight: 300
|
||||
color: "black"
|
||||
radius: 10
|
||||
|
||||
QQC2.Label {
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: "white"
|
||||
text: model.object.user.id
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
Loader {
|
||||
active: model.object.hasCamera
|
||||
Layout.maximumWidth: parent.width
|
||||
Layout.maximumHeight: parent.height
|
||||
Layout.preferredHeight: parent.height
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
onActiveChanged: if (active) model.object.initCamera(camera)
|
||||
Component.onCompleted: if (active) model.object.initCamera(camera)
|
||||
GstGLVideoItem {
|
||||
id: camera
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
active: false
|
||||
Layout.maximumWidth: parent.width
|
||||
Layout.maximumHeight: parent.height
|
||||
Layout.preferredHeight: parent.height
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
GstGLVideoItem {
|
||||
id: screenCast
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
Component.onCompleted: {
|
||||
//model.object.initCamera(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/qml/Component/Timeline/CallInviteDelegate.qml
Normal file
22
src/qml/Component/Timeline/CallInviteDelegate.qml
Normal file
@@ -0,0 +1,22 @@
|
||||
// SPDX-FileCopyrightText: 2022 Carson Black <uhhadd@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
TimelineContainer {
|
||||
width: ListView.view.width
|
||||
|
||||
innerObject: QQC2.Control {
|
||||
Layout.leftMargin: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing : 0
|
||||
padding: Kirigami.Units.gridUnit*2
|
||||
|
||||
contentItem: QQC2.Label {
|
||||
text: model.author.isLocalUser ? i18n("Outgoing Call") : i18n("Incoming Call")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,11 @@ DelegateChooser {
|
||||
delegate: StateDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.CallInvite
|
||||
delegate: CallInviteDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: MessageEventModel.Emote
|
||||
delegate: MessageDelegate {}
|
||||
|
||||
Reference in New Issue
Block a user