view libervia/desktop_kivy/plugins/plugin_wid_calls.kv @ 508:d87b9a6b0b69

doc (calls): updated documentation to describe the new UI features: fix 425
author Goffi <goffi@goffi.org>
date Wed, 25 Oct 2023 15:29:33 +0200
parents 0480f883f0a6
children 97ab236e8f20
line wrap: on
line source

# desktop/mobile frontend for Libervia XMPP client
# Copyright (C) 2016-2023 Jérôme Poisson (goffi@goffi.org)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# 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
    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: 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

                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>:
    size_hint: None, 1
    text: "Hang Up" if self.parent_widget.in_call else "Call"
    background_color: (1, 0, 0, 1) if self.parent_widget.in_call else (0, 1, 0, 1)