diff libervia/desktop_kivy/plugins/plugin_wid_calls.kv @ 506:0480f883f0a6

plugin calls: update UI: - there is now a "search" UI to select a contact to call - "call" UI is displayed only when we actually are in a call - new control button to (un)mute audio and video - new control button to go to fullscreen/back to normal - add an extra "hang up" button directly in the call UI, so there is always one even in fullscreen mode - UI is similar to the one implemented in web frontend - notification + ringtone + desktop notification on incoming call - if an incoming call is cancelled from initiator, confirmation dialog is removed rel 425
author Goffi <goffi@goffi.org>
date Wed, 25 Oct 2023 15:28:44 +0200
parents f387992d8e37
children 97ab236e8f20
line wrap: on
line diff
--- a/libervia/desktop_kivy/plugins/plugin_wid_calls.kv	Wed Oct 25 15:24:42 2023 +0200
+++ b/libervia/desktop_kivy/plugins/plugin_wid_calls.kv	Wed Oct 25 15:28:44 2023 +0200
@@ -14,33 +14,120 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+<CallControlButton>:
+    size_hint: None, None
+    size: "50dp", "50dp"
+    color: 1, 1, 1, 1
+    background_color: (0.28, 0.78, 0.56, 1) if self.active else (1.0, 0.88, 0.54, 1)
+    canvas.before:
+        Color:
+            rgba: root.background_color
+        Rectangle:
+            size: (self.width - 2*dp(self.margin_x), self.height - 2*dp(self.margin_y))
+            pos: (self.x + dp(self.margin_x), self.y + dp(self.margin_y))
+    canvas.after:
+        Color:
+            rgba: (1, 0, 0, 1) if not self.active else (0, 0, 0, 0)
+        Line:
+            points: [self.x + dp(10), self.y + dp(10), self.right - dp(10), self.top - dp(10)]
+            width: 2
+            cap: "round"
 
 <Calls>:
+    jid_selector: jid_selector
+    call_layout: call_layout
     remote_video: remote_video
     local_video: local_video
-    orientation: 'vertical'
-    FloatLayout:
-        id: float_layout
-        pos_hint: {'x': 0, 'y': 0}
-        size_hint: 1, 1
+    screen_manager: screen_manager
+    call_screen: call_screen
+    ScreenManager:
+        id: screen_manager
+        SearchScreen:
+            name: "search"
+            JidSelector:
+                id: jid_selector
+                on_select: root.on_jid_select(args[1])
+                to_show: ["roster"]
+        InCallScreen:
+            id: call_screen
+            name: "call"
+            remote_video: remote_video
+            local_video: local_video
+            orientation: "vertical"
+            FloatLayout:
+                id: call_layout
+                pos_hint: {"x": 0, "y": 0}
+                size_hint: 1, 1
 
-        VideoStreamWidget:
-            id: remote_video
-            size: float_layout.size
-            pos: float_layout.pos
-            fit_mode: "contain"
+                VideoStreamWidget:
+                    id: remote_video
+                    size: call_layout.size
+                    pos: call_layout.pos
+                    fit_mode: "contain"
+                    canvas.before:
+                        Color:
+                            rgba: (0, 0, 0, 1)
+                        Rectangle:
+                            pos: self.pos
+                            size: self.size
+
+                VideoStreamWidget:
+                    id: local_video
+                    size_hint: 0.25, 0.25
+                    pos_hint: {"right": 1, "bottom": 0}
+                    fit_mode: "contain"
+                    canvas.before:
+                        Color:
+                            rgba: (0, 0, 0, 1)
+                        Rectangle:
+                            pos: self.pos
+                            size: self.size
 
-        VideoStreamWidget:
-            id: local_video
-            size_hint: 0.25, 0.25
-            pos_hint: {'right': 1, 'bottom': 0}
-            fit_mode: "contain"
-            canvas.before:
-                Color:
-                    rgba: (0, 0, 0, 0)
-                Rectangle:
-                    pos: self.pos
-                    size: self.size
+                CallControlButton:
+                    id: full_screen_btn
+                    size: "60dp", "60dp"
+                    pos_hint: {"right": 1, "top": 1}
+                    margin_x: dp(10)
+                    margin_y: dp(10)
+                    symbol: "resize-small" if root.fullscreen else "resize-full"
+                    color: 0.29, 0.29, 0.29, 1
+                    background_color: 0.96, 0.96, 0.96, 1
+                    on_press: root.fullscreen = not root.fullscreen
+
+
+                BoxLayout:
+                    id: call_controls
+                    orientation: "horizontal"
+                    size_hint: 0.5, None  # Adjusted to 50% of the width
+                    height: "50dp"
+                    pos_hint: {"x": 0.25, "y": 0.05}  # Adjusted starting position
+                    spacing: "30dp"
+                    Widget:
+
+                    CallControlButton:
+                        symbol: "videocam"
+                        active: not root.video_muted
+                        on_press: root.video_muted = not root.video_muted
+
+                    CallControlButton:
+                        symbol: "volume-up"
+                        active: not root.audio_muted
+                        on_press: root.audio_muted = not root.audio_muted
+
+
+                    CallControlButton:
+                        symbol: "phone"
+                        background_color: 0.95, 0.27, 0.41, 1
+                        on_press: root.hang_up()
+                        canvas.before:
+                            PushMatrix
+                            Rotate:
+                                angle: 225
+                                origin: self.center
+                        canvas.after:
+                            PopMatrix
+
+                    Widget:
 
 
 <CallButton>: