From cacb023ccf5242cb6f8633aec616991376d1d7ea Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 18:59:51 +0300 Subject: [PATCH] voelin-ui: open the Stream Studio from the Share button The studio had a button of its own in the top bar (and the phone's header), apart from the Share button. The Share buttons (the voice buttons on the desktop, Go Live on the phone) now open a small menu: "Share screen", the quick share of a screen or a window as before, or "Stream Studio". While a share runs they open its dialog directly, as before; while the studio is live, "Share screen" is off and the button shows the live state. The separate studio buttons are gone. Checked headless on the demo UI: the menu opens above the button, and each entry opens the share dialog or the studio. Co-Authored-By: Claude Opus 5.5 --- crates/voelin-ui/ui/screens/mobile.slint | 16 ++++++--- crates/voelin-ui/ui/share-menu.slint | 42 ++++++++++++++++++++++++ crates/voelin-ui/ui/shells/common.slint | 18 ++++++---- crates/voelin-ui/ui/shells/desktop.slint | 7 ---- crates/voelin-ui/ui/shells/mobile.slint | 9 ----- docs/ui.md | 4 ++- 6 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 crates/voelin-ui/ui/share-menu.slint diff --git a/crates/voelin-ui/ui/screens/mobile.slint b/crates/voelin-ui/ui/screens/mobile.slint index 277c2eb..1ec2bb1 100644 --- a/crates/voelin-ui/ui/screens/mobile.slint +++ b/crates/voelin-ui/ui/screens/mobile.slint @@ -9,6 +9,8 @@ import { Icon, Button, ButtonKind, IconButton, Avatar, Status, CountBadge, LiveB import { ServerHeader, ConnectActions, ChannelTree } from "channels.slint"; import { StreamsPanel } from "streams.slint"; import { VoiceCard, VoiceButtons } from "../shells/common.slint"; +import { StudioBridge } from "../studio-bridge.slint"; +import { ShareMenu } from "../share-menu.slint"; // Servers as a horizontal strip, the current server, its channels. export component MobileServers inherits VerticalLayout { @@ -166,11 +168,15 @@ export component YouPage inherits ScrollView { enabled: Bridge.voice-connected; clicked => { Bridge.set-output-muted(!Bridge.output-muted); } } - if Bridge.streams-available && Bridge.can-share: ActionButton { - icon: Icons.radio; - text: Bridge.share-state == "live" ? @tr("Live") : @tr("Go Live"); - checked: Bridge.share-state == "live"; - clicked => { Nav.open-share(); } + // A screen or the Stream Studio (ShareMenu). + if Bridge.streams-available && Bridge.can-share: VerticalLayout { + live := ActionButton { + icon: Icons.radio; + text: Bridge.share-state == "live" || StudioBridge.status.live ? @tr("Live") : @tr("Go Live"); + checked: Bridge.share-state == "live" || StudioBridge.status.live; + clicked => { share-menu.open(0, - live.height - share-menu.menu-height - 4px); } + } + share-menu := ShareMenu { } } ActionButton { icon: Icons.phone-off; diff --git a/crates/voelin-ui/ui/share-menu.slint b/crates/voelin-ui/ui/share-menu.slint new file mode 100644 index 0000000..df491e5 --- /dev/null +++ b/crates/voelin-ui/ui/share-menu.slint @@ -0,0 +1,42 @@ +// What a Share button opens: a quick share of a screen or a window (the +// share dialog) or the Stream Studio. While a share runs it opens the share +// dialog right away, to manage it. + +import { Theme } from "theme.slint"; +import { Icons } from "icons.slint"; +import { PopupMenu } from "components/index.slint"; +import { Bridge } from "bridge.slint"; +import { StudioBridge } from "studio-bridge.slint"; +import { Nav } from "nav.slint"; + +export component ShareMenu inherits Rectangle { + // The menu's height, to open it above a button. + out property menu-height: 2 * Theme.control-height + 2 * Theme.space-2 + 2px; + width: 0; + height: 0; + + // Open at (x, y), relative to this element. + public function open(x: length, y: length) { + if Bridge.share-state == "live" || Bridge.share-state == "starting" { + Nav.open-share(); + } else { + menu.show(x, y); + } + } + + menu := PopupMenu { + menu-width: 220px; + entries: [ + // The studio's stream takes the place of a simple share. + { text: @tr("Share screen"), icon: Icons.monitor-up, enabled: !StudioBridge.status.live }, + { text: @tr("Stream Studio"), icon: Icons.radio, enabled: true }, + ]; + activated(i) => { + if i == 0 { + Nav.open-share(); + } else { + Nav.open-studio(); + } + } + } +} diff --git a/crates/voelin-ui/ui/shells/common.slint b/crates/voelin-ui/ui/shells/common.slint index cf66e86..63134ea 100644 --- a/crates/voelin-ui/ui/shells/common.slint +++ b/crates/voelin-ui/ui/shells/common.slint @@ -4,6 +4,8 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge } from "../bridge.slint"; import { Nav, SettingsSection } from "../nav.slint"; +import { StudioBridge } from "../studio-bridge.slint"; +import { ShareMenu } from "../share-menu.slint"; import { Icon, IconButton, Avatar, Status } from "../components/index.slint"; // A rounded panel of the frame (sidebar, main area, right panel). @@ -131,12 +133,16 @@ export component VoiceButtons inherits HorizontalLayout { enabled: Bridge.voice-connected; clicked => { Bridge.set-output-muted(!Bridge.output-muted); } } - if Bridge.streams-available && Bridge.can-share: IconButton { - icon: Icons.monitor-up; - label: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share screen"); - checked: Bridge.share-state == "live"; - size: root.size; - clicked => { Nav.open-share(); } + // A screen or window, or the Stream Studio (ShareMenu). + if Bridge.streams-available && Bridge.can-share: VerticalLayout { + IconButton { + icon: Icons.monitor-up; + label: Bridge.share-state == "live" ? @tr("Sharing") : StudioBridge.status.live ? @tr("Live in the Stream Studio") : @tr("Share or go live"); + checked: Bridge.share-state == "live" || StudioBridge.status.live; + size: root.size; + clicked => { share-menu.open(0, - root.size - share-menu.menu-height - 4px); } + } + share-menu := ShareMenu { } } IconButton { icon: Icons.settings; diff --git a/crates/voelin-ui/ui/shells/desktop.slint b/crates/voelin-ui/ui/shells/desktop.slint index dc1ea85..a5fcfcc 100644 --- a/crates/voelin-ui/ui/shells/desktop.slint +++ b/crates/voelin-ui/ui/shells/desktop.slint @@ -218,13 +218,6 @@ export component TopBar inherits Rectangle { } } } - IconButton { - icon: Icons.radio; - label: @tr("Stream Studio"); - checked: Nav.page == Page.studio; - y: (parent.height - self.height) / 2; - clicked => { Nav.open-studio(); } - } IconButton { icon: Icons.users; label: @tr("Members"); diff --git a/crates/voelin-ui/ui/shells/mobile.slint b/crates/voelin-ui/ui/shells/mobile.slint index 25bd331..c75a72d 100644 --- a/crates/voelin-ui/ui/shells/mobile.slint +++ b/crates/voelin-ui/ui/shells/mobile.slint @@ -117,15 +117,6 @@ export component MobileShell inherits Rectangle { overflow: elide; } } - IconButton { - icon: Icons.radio; - label: @tr("Stream Studio"); - round: true; - filled: true; - checked: Nav.page == Page.studio; - y: (parent.height - self.height) / 2; - clicked => { Nav.open-studio(); } - } IconButton { icon: Icons.bell; label: @tr("Notifications"); diff --git a/docs/ui.md b/docs/ui.md index 719f174..4a6decf 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -149,7 +149,9 @@ Activity tab. ![Stream Studio](screenshots/desktop-studio-live.png) The studio (mockups 09, 10 and the phone's 04) is a page of the main window -(the radio button in the top bar), a window of its own (the button in its +(the Share button's menu: "Share screen" for a quick share of a screen or +window, "Stream Studio" for the studio; while a share runs the button opens +its dialog), a window of its own (the button in its header; closing that window brings it back) and a phone page. Its controller is `src/studio.rs` on the engine's studio ([studio.md](studio.md)): the studio runs while it is shown, live or recording, and a `Streamer` started