Merge pull request #311 from trilene/webrtc-video
Support video calls
5 files changed, 41 insertions, 5 deletions
diff --git a/resources/icons/ui/video-call.png b/resources/icons/ui/video-call.png
new file mode 100644
index 00000000..f40ce022
--- /dev/null
+++ b/resources/icons/ui/video-call.png
Binary files differdiff --git a/resources/qml/ActiveCallBar.qml b/resources/qml/ActiveCallBar.qml
index dcdec9ef..7137197b 100644
--- a/resources/qml/ActiveCallBar.qml
+++ b/resources/qml/ActiveCallBar.qml
@@ -10,6 +10,12 @@ Rectangle {
color: "#2ECC71"
implicitHeight: visible ? rowLayout.height + 8 : 0
+ MouseArea {
+ anchors.fill: parent
+ onClicked: if (TimelineManager.onVideoCall)
+ stackLayout.currentIndex = stackLayout.currentIndex ? 0 : 1;
+ }
+
RowLayout {
id: rowLayout
@@ -33,7 +39,8 @@ Rectangle {
Image {
Layout.preferredWidth: 24
Layout.preferredHeight: 24
- source: "qrc:/icons/icons/ui/place-call.png"
+ source: TimelineManager.onVideoCall ?
+ "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png"
}
Label {
@@ -58,9 +65,12 @@ Rectangle {
callStateLabel.text = "00:00";
var d = new Date();
callTimer.startTime = Math.floor(d.getTime() / 1000);
+ if (TimelineManager.onVideoCall)
+ stackLayout.currentIndex = 1;
break;
case WebRTCState.DISCONNECTED:
callStateLabel.text = "";
+ stackLayout.currentIndex = 0;
}
}
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index de047e8a..9d00442c 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -4,7 +4,7 @@ import "./emoji"
import QtGraphicalEffects 1.0
import QtQuick 2.9
import QtQuick.Controls 2.3
-import QtQuick.Layouts 1.2
+import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import im.nheko 1.0
import im.nheko.EmojiModel 1.0
@@ -190,9 +190,26 @@ Page {
anchors.fill: parent
spacing: 0
- MessageView {
- Layout.fillWidth: true
- Layout.fillHeight: true
+ StackLayout {
+ id: stackLayout
+ currentIndex: 0
+
+ Connections {
+ target: TimelineManager
+ function onActiveTimelineChanged() {
+ stackLayout.currentIndex = 0;
+ }
+ }
+
+ MessageView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ }
+
+ Loader {
+ source: TimelineManager.onVideoCall ? "VideoCall.qml" : ""
+ onLoaded: TimelineManager.setVideoCallItem()
+ }
}
TypingIndicator {
diff --git a/resources/qml/VideoCall.qml b/resources/qml/VideoCall.qml
new file mode 100644
index 00000000..69fc1a2b
--- /dev/null
+++ b/resources/qml/VideoCall.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.9
+
+import org.freedesktop.gstreamer.GLVideoItem 1.0
+
+GstGLVideoItem {
+ objectName: "videoCallItem"
+}
diff --git a/resources/res.qrc b/resources/res.qrc
index d11b78bc..4eba0bca 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -74,6 +74,7 @@
<file>icons/ui/end-call.png</file>
<file>icons/ui/microphone-mute.png</file>
<file>icons/ui/microphone-unmute.png</file>
+ <file>icons/ui/video-call.png</file>
<file>icons/emoji-categories/people.png</file>
<file>icons/emoji-categories/people@2x.png</file>
@@ -135,6 +136,7 @@
<file>qml/Reactions.qml</file>
<file>qml/ScrollHelper.qml</file>
<file>qml/TimelineRow.qml</file>
+ <file>qml/VideoCall.qml</file>
<file>qml/emoji/EmojiButton.qml</file>
<file>qml/emoji/EmojiPicker.qml</file>
<file>qml/UserProfile.qml</file>
|