voelin-ui: lay out the Stream Studio screens

The studio gets its screens before its controller: scenes, sources, the
preview with LIVE, timer and viewers, the audio mixer, the stream chat,
the stream settings with the simulcast layers, the bottom bar and the
dialogs, arranged three ways (a page of the main window, a window of its
own, the phone layout). They read only the StudioBridge and StudioNav
globals, so the second window, which has globals of its own, shows the
same pieces once Rust fills both. A button in each top bar opens it.

Work in progress: nothing in Rust drives these globals yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 06:39:18 +03:00
1 parent 3977071cb1
commit 6887cebb90
12 files changed
+3251 -2

No files matched your search

+11 -2
View File
@@ -24,11 +24,16 @@ import { SettingsNav, SettingsPage } from "screens/settings.slint";
import { HomeNav, HomePage } from "screens/home.slint";
import { MobileServers, ActivityPage, YouPage } from "screens/mobile.slint";
import { BookmarkDialog, ShareDialog, ClientAudioDialog, AboutDialog } from "screens/dialogs.slint";
import { StudioBridge } from "studio-bridge.slint";
import { StudioPage, MobileStudio } from "screens/studio.slint";
// Rust reaches the globals and structs through this file.
export * from "bridge.slint";
export { Theme } from "theme.slint";
export { Nav, Page, MobileTab, SettingsSection } from "nav.slint";
// The Stream Studio: its data, and its own window (src/studio.rs).
export { StudioBridge, StudioNav, StudioScene, StudioSource, StudioAudio, StudioLayer, StudioViewer, StudioPick, StudioStatus, StudioForm, StudioSourceForm, StudioSettingsForm } from "studio-bridge.slint";
export { StudioWindow } from "studio-window.slint";
export component MainWindow inherits Window {
title: Bridge.app-name;
@@ -104,7 +109,7 @@ export component MainWindow inherits Window {
if !root.chrome: StreamViewer { }
if !Nav.narrow && root.chrome: DesktopShell {
context: Nav.page == Page.settings ? @tr("Settings") : "";
context: Nav.page == Page.settings ? @tr("Settings") : Nav.page == Page.studio ? @tr("Stream Studio") : "";
if Nav.page == Page.home: Sidebar {
HomeNav { }
Rectangle { vertical-stretch: 1; }
@@ -144,6 +149,9 @@ export component MainWindow inherits Window {
horizontal-stretch: 1;
SettingsPage { }
}
if Nav.page == Page.studio && !StudioBridge.status.detached: StudioPage {
horizontal-stretch: 1;
}
}
if Nav.narrow && root.chrome: MobileShell {
@@ -159,7 +167,7 @@ export component MainWindow inherits Window {
if Nav.page == Page.settings: SettingsPage {
compact: true;
}
if Nav.page != Page.settings && (Nav.page == Page.home || Nav.mobile-tab == MobileTab.home): HomePage { }
if Nav.page != Page.settings && Nav.page != Page.studio && (Nav.page == Page.home || Nav.mobile-tab == MobileTab.home): HomePage { }
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.servers: MobileServers { }
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.chat && Bridge.viewer-open: StreamViewer { }
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.chat && !Bridge.viewer-open: ChatView {
@@ -167,6 +175,7 @@ export component MainWindow inherits Window {
}
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.activity: ActivityPage { }
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.you: YouPage { }
if Nav.page == Page.studio && !StudioBridge.status.detached: MobileStudio { }
}
}
}
@@ -0,0 +1,18 @@
<!-- @license lucide-static v1.48.0 - ISC -->
<svg
class="lucide lucide-app-window"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="2" y="4" width="20" height="16" rx="2" />
<path d="M10 4v4" />
<path d="M2 8h20" />
<path d="M6 4v4" />
</svg>

After

Width:  |  Height:  |  Size: 410 B

+16
View File
@@ -0,0 +1,16 @@
<!-- @license lucide-static v1.48.0 - ISC -->
<svg
class="lucide lucide-crop"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M6 2v14a2 2 0 0 0 2 2h14" />
<path d="M18 22V8a2 2 0 0 0-2-2H2" />
</svg>

After

Width:  |  Height:  |  Size: 363 B

@@ -0,0 +1,17 @@
<!-- @license lucide-static v1.48.0 - ISC -->
<svg
class="lucide lucide-layers"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
<path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" />
<path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
</svg>

After

Width:  |  Height:  |  Size: 587 B

+3
View File
@@ -5,6 +5,7 @@
export global Icons {
out property <image> activity: @image-url("assets/icons/activity.svg");
out property <image> app-window: @image-url("assets/icons/app-window.svg");
out property <image> arrow-left: @image-url("assets/icons/arrow-left.svg");
out property <image> arrow-right: @image-url("assets/icons/arrow-right.svg");
out property <image> at-sign: @image-url("assets/icons/at-sign.svg");
@@ -27,6 +28,7 @@ export global Icons {
out property <image> coffee: @image-url("assets/icons/coffee.svg");
out property <image> compass: @image-url("assets/icons/compass.svg");
out property <image> copy: @image-url("assets/icons/copy.svg");
out property <image> crop: @image-url("assets/icons/crop.svg");
out property <image> crown: @image-url("assets/icons/crown.svg");
out property <image> download: @image-url("assets/icons/download.svg");
out property <image> more-vertical: @image-url("assets/icons/ellipsis-vertical.svg");
@@ -53,6 +55,7 @@ export global Icons {
out property <image> image: @image-url("assets/icons/image.svg");
out property <image> info: @image-url("assets/icons/info.svg");
out property <image> keyboard: @image-url("assets/icons/keyboard.svg");
out property <image> layers: @image-url("assets/icons/layers.svg");
out property <image> layout-grid: @image-url("assets/icons/layout-grid.svg");
out property <image> leaf: @image-url("assets/icons/leaf.svg");
out property <image> library: @image-url("assets/icons/library.svg");
+12
View File
@@ -3,6 +3,7 @@
// development switch VOELIN_OPEN (src/dev.rs).
import { Bridge, BookmarkForm, ShareForm } from "bridge.slint";
import { StudioBridge } from "studio-bridge.slint";
export enum Page {
// Welcome page: servers at a glance.
@@ -10,6 +11,8 @@ export enum Page {
// A server: channels, chat or the stream viewer, members and streams.
server,
settings,
// The Stream Studio (scenes, preview, mixer, going live).
studio,
}
// Sections of the settings page, in the order of its navigation.
@@ -104,6 +107,15 @@ export global Nav {
}
}
// The Stream Studio: its page, or its window when it has one.
public function open-studio() {
if StudioBridge.status.detached {
StudioBridge.open();
} else {
show(Page.studio);
}
}
public function select-server(id: int) {
show(Page.server);
Bridge.select-server(id);
File diff suppressed because it is too large. Load diff
+616
View File
@@ -0,0 +1,616 @@
// The Stream Studio in the main window (desktop and phone). The pieces are
// in studio-parts.slint; the detached window is studio-window.slint.
import { Theme } from "../theme.slint";
import { Icons } from "../icons.slint";
import { Bridge } from "../bridge.slint";
import { Nav, Page } from "../nav.slint";
import { StudioBridge, StudioNav } from "../studio-bridge.slint";
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, TextField, Select, Slider, Meter, Divider, ScrollView } from "../components/index.slint";
import { StudioKinds, StudioPanel, PanelTitle, ScenesCard, SourcesCard, StudioPreview, StudioHeader, StudioMark, MixerCard, StudioChat, StreamSettings, DestinationSelect, StudioActions, ViewerRequests, StudioDialogs } from "studio-parts.slint";
// Who streams, at the bottom left.
component StudioUser inherits HorizontalLayout {
spacing: Theme.space-3;
VerticalLayout {
alignment: center;
Avatar {
size: 38px;
initials: Bridge.nickname != "" ? "" : "?";
tint: Theme.accent;
label: Bridge.nickname;
crown: StudioBridge.status.live;
status: Bridge.voice-connected ? Status.online : Status.offline;
Icon {
source: Icons.user;
size: 20px;
tint: #ffffff;
visible: Bridge.nickname != "";
}
}
}
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
Text {
text: Bridge.nickname != "" ? Bridge.nickname : Bridge.app-name;
color: Theme.text;
font-weight: Theme.weight-semibold;
overflow: elide;
}
Text {
text: StudioBridge.status.live ? @tr("Live") : Bridge.voice-connected ? @tr("Online") : @tr("Offline");
color: StudioBridge.status.live ? Theme.live : Theme.text-muted;
font-size: Theme.font-xs;
}
}
}
// The studio as a page of the main window: scenes and sources, the
// preview with the mixer and the chat, the stream settings, the bottom bar.
export component StudioPage inherits Rectangle {
init => { StudioBridge.open(); }
VerticalLayout {
spacing: Theme.space-3;
HorizontalLayout {
vertical-stretch: 1;
spacing: Theme.space-3;
VerticalLayout {
width: 250px * max(1.0, Theme.font-scale);
spacing: Theme.space-3;
ScenesCard {
vertical-stretch: 1;
}
SourcesCard {
vertical-stretch: 1;
}
}
VerticalLayout {
horizontal-stretch: 1;
spacing: Theme.space-3;
StudioPanel {
vertical-stretch: 1.7;
VerticalLayout {
padding: Theme.space-4;
padding-top: Theme.space-3;
spacing: Theme.space-3;
StudioHeader { }
if StudioBridge.viewers.length > 0: ViewerRequests { }
StudioPreview {
vertical-stretch: 1;
min-height: 160px;
}
}
}
HorizontalLayout {
vertical-stretch: 1;
min-height: 250px;
spacing: Theme.space-3;
MixerCard {
horizontal-stretch: 1.35;
}
StudioChat {
horizontal-stretch: 1;
}
}
}
StudioPanel {
width: 300px * max(1.0, Theme.font-scale);
ScrollView {
StreamSettings { }
}
}
}
HorizontalLayout {
height: 64px;
spacing: Theme.space-3;
StudioUser {
width: 250px * max(1.0, Theme.font-scale);
padding-left: Theme.space-3;
}
StudioActions {
horizontal-stretch: 1;
}
Rectangle {
width: 150px;
Rectangle {
y: (parent.height - self.height) / 2;
height: 48px;
border-radius: Theme.radius-lg;
background: settings-touch.has-hover ? Theme.surface-3 : Theme.surface.transparentize(0.08);
border-width: 1px;
border-color: Theme.border;
accessible-role: AccessibleRole.button;
accessible-label: @tr("Studio Settings");
accessible-action-default => { StudioNav.open-settings(); }
settings-touch := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => { StudioNav.open-settings(); }
}
HorizontalLayout {
alignment: center;
spacing: Theme.space-3;
Icon {
source: Icons.settings;
size: Theme.icon-md;
tint: Theme.text-secondary;
y: (parent.height - self.height) / 2;
}
Text {
text: @tr("Studio Settings");
color: Theme.text;
font-size: Theme.font-sm;
vertical-alignment: center;
}
}
}
}
}
}
StudioDialogs {
width: parent.width;
height: parent.height;
}
}
// A section title of the phone layout with a link at the right.
component PhoneSection inherits HorizontalLayout {
in property <string> text;
in property <image> icon;
in property <string> action;
callback action-clicked();
spacing: Theme.space-3;
min-height: 32px;
if root.icon.width > 0: Icon {
source: root.icon;
size: Theme.icon-md;
tint: Theme.text-secondary;
y: (parent.height - self.height) / 2;
}
Text {
text: root.text;
color: Theme.text;
font-size: Theme.font-lg;
font-weight: Theme.weight-semibold;
vertical-alignment: center;
horizontal-stretch: 1;
}
if root.action != "": Text {
text: root.action;
color: Theme.accent-text;
font-size: Theme.font-sm;
vertical-alignment: center;
TouchArea {
clicked => { root.action-clicked(); }
}
}
}
// One of the phone's source cards.
component SourceCard inherits Rectangle {
in property <string> kind;
in property <string> title;
in property <string> subtitle;
in property <image> icon;
// A visible source of this kind is in the live scene.
in property <bool> shown;
height: 104px;
horizontal-stretch: 1;
border-radius: Theme.radius-lg;
background: root.shown ? Theme.accent-soft : touch.has-hover ? Theme.surface-3 : Theme.surface-2;
border-width: root.shown ? 2px : 1px;
border-color: root.shown ? Theme.accent : Theme.border;
accessible-role: AccessibleRole.radio-button;
accessible-label: root.title;
accessible-description: root.subtitle;
accessible-checkable: true;
accessible-checked: root.shown;
accessible-action-default => { StudioBridge.main-source(root.kind); }
touch := TouchArea {
clicked => { StudioBridge.main-source(root.kind); }
}
Rectangle {
x: parent.width - 26px;
y: 10px;
width: 18px;
height: 18px;
border-radius: 9px;
border-width: 2px;
border-color: root.shown ? Theme.accent-text : Theme.text-muted;
if root.shown: Rectangle {
width: 8px;
height: 8px;
border-radius: 4px;
background: Theme.accent-text;
}
}
VerticalLayout {
alignment: center;
spacing: Theme.space-2;
padding: Theme.space-2;
HorizontalLayout {
alignment: center;
Icon {
source: root.icon;
size: 28px;
tint: root.shown ? Theme.accent-text : Theme.icon;
}
}
Text {
text: root.title;
color: Theme.text;
font-size: Theme.font-body;
font-weight: Theme.weight-medium;
horizontal-alignment: center;
overflow: elide;
}
Text {
text: root.subtitle;
color: Theme.text-muted;
font-size: Theme.font-xs;
horizontal-alignment: center;
overflow: elide;
}
}
}
// An audio row of the phone layout.
component PhoneAudioRow inherits Rectangle {
in property <int> index;
property <bool> valid: index < StudioBridge.audio.length;
height: 72px;
border-radius: Theme.radius-lg;
background: Theme.surface-2.transparentize(0.3);
border-width: 1px;
border-color: Theme.border;
HorizontalLayout {
padding-left: Theme.space-3;
padding-right: Theme.space-2;
spacing: Theme.space-3;
Rectangle {
width: 42px;
height: 42px;
y: (parent.height - self.height) / 2;
border-radius: Theme.radius-md;
background: Theme.surface-3;
Icon {
source: StudioKinds.icon(root.valid ? StudioBridge.audio[root.index].kind : "");
size: 22px;
}
}
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
spacing: Theme.space-2;
HorizontalLayout {
Text {
text: root.valid ? StudioBridge.audio[root.index].name + (StudioBridge.audio[root.index].detail != "" ? " (" + StudioBridge.audio[root.index].detail + ")" : "") : "";
color: Theme.text;
font-size: Theme.font-sm;
horizontal-stretch: 1;
overflow: elide;
}
Text {
text: !root.valid ? "" : StudioBridge.audio[root.index].muted ? @tr("muted") : @tr("{} dB", round(StudioBridge.audio[root.index].gain-db * 10) / 10);
color: Theme.text-secondary;
font-size: Theme.font-xs;
}
}
HorizontalLayout {
spacing: Theme.space-3;
Meter {
y: (parent.height - self.height) / 2;
height: 8px;
segments: 14;
floor: -60;
min-width: 60px;
level: root.valid ? StudioBridge.audio[root.index].level : -100;
active: root.valid && !StudioBridge.audio[root.index].muted;
}
Slider {
width: 46%;
horizontal-stretch: 0;
y: (parent.height - self.height) / 2;
minimum: -60;
maximum: 20;
step: 0.5;
value: root.valid ? StudioBridge.audio[root.index].gain-db : 0;
label: @tr("Gain");
changed(v) => { StudioBridge.set-gain(root.index, v, false); }
released(v) => { StudioBridge.set-gain(root.index, v, true); }
}
}
}
IconButton {
icon: root.valid && StudioBridge.audio[root.index].muted ? Icons.volume-x : Icons.volume-2;
label: @tr("Mute");
checked: root.valid && StudioBridge.audio[root.index].muted;
danger: true;
size: 34px;
y: (parent.height - self.height) / 2;
clicked => { StudioBridge.toggle-mute(root.index); }
}
}
}
// The studio in the phone layout: preview, what to share, audio, details,
// Go Live.
export component MobileStudio inherits Rectangle {
init => { StudioBridge.open(); }
sv := ScrollView {
VerticalLayout {
width: sv.visible-width;
padding: Theme.space-4;
padding-top: Theme.space-2;
spacing: Theme.space-4;
// Header: back, the mark, title, destination.
HorizontalLayout {
spacing: Theme.space-3;
IconButton {
icon: Icons.chevron-left;
label: @tr("Back");
size: 32px;
y: (parent.height - self.height) / 2;
clicked => { Nav.show(Page.server); }
}
StudioMark {
size: 40px;
y: (parent.height - self.height) / 2;
}
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
Text {
text: @tr("Stream Studio");
color: Theme.text;
font-size: Theme.font-xl;
font-weight: Theme.weight-semibold;
overflow: elide;
}
Text {
text: StudioBridge.status.live ? @tr("Live · {}", StudioBridge.status.elapsed) : StudioBridge.chat-name != "" ? @tr("Go live to {}", StudioBridge.chat-name) : StudioBridge.status.hint;
color: StudioBridge.status.live ? Theme.live : Theme.accent-text;
font-size: Theme.font-sm;
overflow: elide;
}
}
}
// The preview.
Rectangle {
height: (sv.visible-width - 2 * Theme.space-4) * 9 / 16;
border-radius: Theme.radius-lg;
border-width: 1px;
border-color: Theme.accent.transparentize(0.4);
clip: true;
StudioPreview {
large: false;
caption: false;
}
Rectangle {
x: Theme.space-3;
y: Theme.space-3;
width: badge.preferred-width + 16px;
height: 24px;
border-radius: Theme.radius-xs;
background: Theme.live;
visible: !StudioBridge.status.live;
badge := Text {
text: @tr("LIVE PREVIEW");
color: #ffffff;
font-size: Theme.font-xs;
font-weight: Theme.weight-bold;
}
}
Rectangle {
x: parent.width - self.width - Theme.space-3;
y: Theme.space-3;
width: fmt.preferred-width + 20px;
height: 26px;
border-radius: Theme.radius-pill;
background: #060a18c8;
border-width: 1px;
border-color: #ffffff20;
fmt := Text {
text: StudioBridge.status.output-height + "p • " + StudioBridge.status.fps + " FPS";
color: #ffffff;
font-size: Theme.font-xs;
}
}
}
// What to share.
PhoneSection {
text: @tr("Source");
action: @tr("What do you want to share?");
}
HorizontalLayout {
spacing: Theme.space-2;
SourceCard {
kind: "screen";
title: @tr("Screen / Game");
subtitle: @tr("Apps or games");
icon: Icons.gamepad-2;
shown: StudioBridge.status.screen-shown;
}
SourceCard {
kind: "camera";
title: @tr("Camera");
subtitle: @tr("Front or back");
icon: Icons.video;
shown: StudioBridge.status.camera-shown;
}
SourceCard {
kind: "window";
title: @tr("App Window");
subtitle: @tr("A single app");
icon: Icons.smartphone;
shown: StudioBridge.status.window-shown;
}
}
// Audio.
PhoneSection {
text: @tr("Audio");
icon: Icons.mic;
action: @tr("Add a source");
action-clicked => { StudioNav.pick-audio(); }
}
for audio[i] in StudioBridge.audio: PhoneAudioRow {
index: i;
}
// Details.
PhoneSection {
text: @tr("Stream Details");
icon: Icons.file-text;
}
TextField {
text: StudioBridge.form.title;
placeholder: @tr("What are you streaming?");
label: @tr("Stream title");
edited(t) => { StudioBridge.edit-form("title", t); }
}
HorizontalLayout {
spacing: Theme.space-3;
VerticalLayout {
spacing: Theme.space-2;
Text {
text: @tr("Game");
color: Theme.text-secondary;
font-size: Theme.font-sm;
}
TextField {
text: StudioBridge.form.game;
placeholder: @tr("Category");
label: @tr("Game or category");
edited(t) => { StudioBridge.edit-form("game", t); }
}
}
VerticalLayout {
spacing: Theme.space-2;
Text {
text: @tr("Quality");
color: Theme.text-secondary;
font-size: Theme.font-sm;
}
Select {
model: ["720p • 30 FPS", "720p • 60 FPS", "1080p • 30 FPS", "1080p • 60 FPS"];
current-value: StudioBridge.status.output-height + "p • " + StudioBridge.status.fps + " FPS";
label: @tr("Output quality");
selected(v) => {
if v == "720p • 30 FPS" {
StudioBridge.set-output("1280", "720", "30");
} else if v == "720p • 60 FPS" {
StudioBridge.set-output("1280", "720", "60");
} else if v == "1080p • 30 FPS" {
StudioBridge.set-output("1920", "1080", "30");
} else {
StudioBridge.set-output("1920", "1080", "60");
}
}
}
}
}
HorizontalLayout {
spacing: Theme.space-3;
HorizontalLayout {
spacing: Theme.space-2;
Icon {
source: Icons.radio;
tint: Theme.accent-text;
y: (parent.height - self.height) / 2;
}
Text {
text: @tr("Go Live To");
color: Theme.accent-text;
vertical-alignment: center;
}
}
DestinationSelect {
horizontal-stretch: 1;
}
}
// Go live (or end) and save a clip.
HorizontalLayout {
spacing: Theme.space-3;
height: 68px;
Rectangle {
horizontal-stretch: 1;
border-radius: Theme.radius-lg;
background: StudioBridge.status.live || StudioBridge.status.starting ? Theme.danger-soft : !StudioBridge.status.can-go-live ? Theme.surface-3 : go.pressed ? Theme.accent-pressed : Theme.accent;
border-width: 1px;
border-color: StudioBridge.status.live ? Theme.danger : Theme.accent-hover;
accessible-role: AccessibleRole.button;
accessible-label: StudioBridge.status.live ? @tr("End Stream") : @tr("Go Live");
accessible-description: StudioBridge.status.hint;
go := TouchArea {
clicked => {
if StudioBridge.status.live || StudioBridge.status.starting {
StudioBridge.end-stream();
} else if StudioBridge.status.can-go-live {
StudioBridge.go-live();
}
}
}
HorizontalLayout {
alignment: center;
spacing: Theme.space-4;
Icon {
source: StudioBridge.status.live ? Icons.square : Icons.radio;
size: 30px;
tint: StudioBridge.status.live ? Theme.danger : Theme.on-accent;
y: (parent.height - self.height) / 2;
}
VerticalLayout {
alignment: center;
Text {
text: StudioBridge.status.live ? @tr("End Stream") : StudioBridge.status.starting ? @tr("Starting…") : @tr("Go Live");
color: StudioBridge.status.live ? Theme.danger : Theme.on-accent;
font-size: Theme.font-xl;
font-weight: Theme.weight-semibold;
}
Text {
text: StudioBridge.status.live ? StudioBridge.status.elapsed : StudioBridge.chat-name != "" ? @tr("Start streaming to {}", StudioBridge.chat-name) : StudioBridge.status.hint;
color: StudioBridge.status.live ? Theme.danger : #ffffffc0;
font-size: Theme.font-xs;
overflow: elide;
}
}
}
}
Rectangle {
width: 88px;
border-radius: Theme.radius-lg;
background: clip.pressed ? Theme.surface-4 : Theme.surface-2;
border-width: 1px;
border-color: Theme.border;
accessible-role: AccessibleRole.button;
accessible-label: @tr("Save a clip");
clip := TouchArea {
clicked => { StudioBridge.save-clip(); }
}
VerticalLayout {
alignment: center;
spacing: Theme.space-1;
HorizontalLayout {
alignment: center;
Icon {
source: Icons.record;
size: 26px;
tint: Theme.live;
}
}
Text {
text: @tr("Clip");
color: Theme.text-secondary;
font-size: Theme.font-sm;
horizontal-alignment: center;
}
}
}
}
if StudioBridge.viewers.length > 0: ViewerRequests { }
}
}
StudioDialogs {
width: parent.width;
height: parent.height;
}
}
+7
View File
@@ -218,6 +218,13 @@ 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 and streams");
+9
View File
@@ -117,6 +117,15 @@ 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");
+322
View File
@@ -0,0 +1,322 @@
// The Stream Studio's data and callbacks (Rust: src/studio.rs, the view
// models in src/vm/studio.rs). The main window and the detached studio
// window each have their own instance of these globals: Rust sets the same
// models and values on both, and wires both to the same controller.
import { ChatLine } from "bridge.slint";
// A scene of the studio.
export struct StudioScene {
id: int,
name: string,
// Its sources, front first: "Screen + Camera + Text".
detail: string,
// Composited now (the live scene).
live: bool,
// The kind of its front-most source (for the icon).
kind: string,
}
// A source of the live scene, front first.
export struct StudioSource {
id: int,
name: string,
// screen, window, portal, camera, image, text, colour, pattern
kind: string,
visible: bool,
locked: bool,
// keep, blur, image, colour
background: string,
// Why it shows nothing ("" while it works).
error: string,
// "1920×1080 · 60 fps"
info: string,
// At the front or the back (cannot move further).
front: bool,
back: bool,
}
// An audio source of the stream (`stream.audio_sources`).
export struct StudioAudio {
name: string,
// "Elgato Wave:3", the application...
detail: string,
// microphone, desktop, app, window, tone
kind: string,
gain-db: float,
muted: bool,
// The meter in dBFS, after the gain.
level: float,
// Why it captures nothing.
error: string,
}
// A simulcast layer (`stream.layers`) as typed: any numbers.
export struct StudioLayer {
// "1280x720"; empty: `scale` of the output.
size: string,
scale: string,
// Frame-rate cap; empty: the output's.
fps: string,
// kbit/s.
bitrate: string,
// kbit/s a viewer needs for this layer.
min-bitrate: string,
}
// A viewer of the studio's stream.
export struct StudioViewer {
client: int,
name: string,
// requested, connecting, connected
state: string,
}
// An entry of a picker (screens, windows, cameras, audio sources).
export struct StudioPick {
name: string,
detail: string,
// For the icon: monitor, window, portal, camera, microphone, desktop, app, tone
kind: string,
}
// The header, the preview's badges and the bottom bar.
export struct StudioStatus {
// The engine runs (preview, mixer, replay buffer).
running: bool,
// "Chill Zone • Starfall Community"; empty without a destination.
destination: string,
// 0: not live, 1: poor, 2: fair, 3: good, 4: excellent.
quality: int,
quality-text: string,
// "1080p • 60 FPS • 8,250 kbps"
format: string,
// The numbers behind it, for the info button.
details: string,
live: bool,
// Going live: waiting for the server.
starting: bool,
// "00:12:34"
elapsed: string,
viewers: int,
participants: int,
can-go-live: bool,
// Why Go Live is off, or what goes wrong.
hint: string,
recording: bool,
recorded: string,
// The replay buffer's window (0: off) and what it holds now.
replay-seconds: int,
replay-held: string,
output-width: int,
output-height: int,
fps: int,
detached: bool,
// The live scene shows a screen, a camera, a window (the phone's cards).
screen-shown: bool,
camera-shown: bool,
window-shown: bool,
}
// The stream settings panel (`studio.stream`, `stream.bitrate_kbps`).
export struct StudioForm {
destination: int,
title: string,
game: string,
message: string,
show-viewers: bool,
show-chat: bool,
show-now-playing: bool,
audio: bool,
// kbit/s of the stream without layers, as typed.
bitrate: string,
}
// The source properties dialog (also for adding text, colour and image
// sources: `id` -1). Numbers as typed.
export struct StudioSourceForm {
id: int,
name: string,
kind: string,
x: string,
y: string,
// Empty: the source's own size times `scale`.
width: string,
height: string,
scale: string,
// contain, cover, stretch
fit: string,
crop-left: string,
crop-top: string,
crop-right: string,
crop-bottom: string,
// Percent.
opacity: float,
locked: bool,
visible: bool,
// keep, blur, image, colour
background: string,
// Blur radius in percent of the picture's height.
blur: string,
background-path: string,
background-colour: string,
// Text, colour ("#rrggbb" or "#rrggbbaa") and image sources.
text: string,
text-size: string,
colour: string,
path: string,
mirror: bool,
}
// The studio settings dialog (`studio.*` keys and the preview).
export struct StudioSettingsForm {
replay-seconds: string,
replay-memory: string,
recording-dir: string,
preview-width: string,
preview-fps: string,
}
export global StudioBridge {
in property <StudioStatus> status;
in property <StudioForm> form;
// The composite, downscaled (the engine's preview tap).
in property <image> preview;
in property <bool> has-preview;
in property <[StudioScene]> scenes;
in property <[StudioSource]> sources;
in property <[StudioAudio]> audio;
in property <[StudioLayer]> layers;
// "Chill Zone • Starfall Community", one per server the stream can go to.
in property <[string]> destinations;
in property <[StudioViewer]> viewers;
// The chat of the channel the stream goes to, and its name.
in property <[ChatLine]> chat;
in property <string> chat-name;
// Filled right before a picker shows.
in property <[StudioPick]> picks;
// Where recordings and clips go.
in property <string> recordings-dir;
// The studio page or window appeared: start the engine.
callback open();
// Into a window of its own, and back.
callback detach();
callback dock();
callback select-scene(int);
callback add-scene();
callback rename-scene(int, string);
callback remove-scene(int);
// Fill `picks` for adding a screen, window or camera source; false:
// nothing to pick (it was added directly, e.g. through the portal).
callback list-sources(string) -> bool;
callback add-picked(string, int);
// Text, colour and image sources from the dialog.
callback add-source(StudioSourceForm);
callback source-form(int) -> StudioSourceForm;
callback apply-source(StudioSourceForm);
callback toggle-source(int);
// up, down, lock, remove, bg-keep, bg-blur
callback source-action(int, string);
// The phone layout's source cards: screen, camera, window.
callback main-source(string);
// Audio: fill `picks` with what can be added; add, change, remove.
callback list-audio();
callback add-audio(int);
// While dragging (`done` false) and at the end.
callback set-gain(int, float, bool);
callback toggle-mute(int);
callback remove-audio(int);
// A field of the stream settings: title, game, message, show-viewers,
// show-chat, show-now-playing, audio ("true"/"false"), bitrate,
// destination (its index).
callback edit-form(string, string);
callback set-output(string, string, string);
callback set-layer(int, StudioLayer);
callback add-layer();
callback remove-layer(int);
callback advanced-settings();
// Bottom bar.
callback share(string);
callback save-clip();
callback toggle-recording();
callback open-recordings();
callback go-live();
callback end-stream();
callback settings-form() -> StudioSettingsForm;
callback apply-settings(StudioSettingsForm);
callback respond-viewer(int, bool);
callback send-chat(string);
callback open-chat();
}
// What one window shows of the studio: dialogs and pickers (each window has
// its own).
export global StudioNav {
// "", "pick", "source", "scene", "settings"
in-out property <string> dialog;
// What the picker picks: screen, window, camera, audio
in-out property <string> pick-kind;
in-out property <StudioSourceForm> source-form;
// The scene being renamed.
in-out property <int> scene-id: -1;
in-out property <string> scene-name;
in-out property <StudioSettingsForm> settings-form;
public function pick(kind: string) {
if StudioBridge.list-sources(kind) {
pick-kind = kind;
dialog = "pick";
}
}
public function pick-audio() {
StudioBridge.list-audio();
pick-kind = "audio";
dialog = "pick";
}
public function edit-source(id: int) {
source-form = StudioBridge.source-form(id);
dialog = "source";
}
// A new text, colour or image source.
public function new-source(kind: string) {
source-form = {
id: -1,
kind: kind,
name: kind == "text" ? @tr("Text") : kind == "colour" ? @tr("Colour") : @tr("Image"),
text: @tr("Your text"),
text-size: "64",
colour: kind == "text" ? "#ffffff" : "#101a3c",
opacity: 100,
visible: true,
fit: "contain",
scale: "1",
background: "keep",
};
dialog = "source";
}
public function rename-scene(id: int, name: string) {
scene-id = id;
scene-name = name;
dialog = "scene";
}
public function open-settings() {
settings-form = StudioBridge.settings-form();
dialog = "settings";
}
public function close() {
dialog = "";
}
}
+136
View File
@@ -0,0 +1,136 @@
// The Stream Studio in a window of its own, while the main window goes on.
// Same pieces as the integrated studio (screens/studio-parts.slint), more
// compact; it has its own globals, which Rust fills from the same models
// (src/studio.rs). Closing it docks the studio back into the main window.
import { Theme } from "theme.slint";
import { Icons } from "icons.slint";
import { StudioBridge, StudioNav } from "studio-bridge.slint";
import { IconButton } from "components/index.slint";
import { ScenesCard, SourcesCard, StudioPanel, PanelTitle, StudioPreview, MixerCard, StreamSettings, StudioActions, ViewerRequests, StudioDialogs } from "screens/studio-parts.slint";
export component StudioWindow inherits Window {
title: @tr("Stream Studio");
preferred-width: 900px;
preferred-height: 720px;
min-width: 640px;
min-height: 480px;
background: Theme.bg-app;
default-font-family: "Inter";
default-font-size: Theme.font-body;
icon: Icons.logo;
Rectangle {
background: Theme.backdrop;
VerticalLayout {
padding: Theme.space-3;
padding-top: 0;
spacing: Theme.space-3;
// The app and what this is, and back into the main window.
HorizontalLayout {
height: 52px;
spacing: Theme.space-3;
padding-left: Theme.space-2;
Image {
width: 28px;
height: 28px;
y: (parent.height - self.height) / 2;
source: Icons.logo;
}
Text {
text: "Voelin";
color: Theme.text;
font-size: Theme.font-xl;
font-weight: Theme.weight-semibold;
vertical-alignment: center;
}
Text {
text: @tr("Stream Studio");
color: Theme.accent-text;
font-size: Theme.font-md;
vertical-alignment: center;
horizontal-stretch: 1;
}
IconButton {
icon: Icons.minimize-2;
label: @tr("Back into the main window");
y: (parent.height - self.height) / 2;
clicked => { StudioBridge.dock(); }
}
}
HorizontalLayout {
vertical-stretch: 1;
spacing: Theme.space-3;
VerticalLayout {
width: 216px * max(1.0, Theme.font-scale);
spacing: Theme.space-3;
ScenesCard {
compact: true;
vertical-stretch: 1;
}
SourcesCard {
compact: true;
vertical-stretch: 1;
}
}
VerticalLayout {
horizontal-stretch: 1;
spacing: Theme.space-3;
StudioPanel {
vertical-stretch: 1.25;
VerticalLayout {
padding: Theme.space-3;
spacing: Theme.space-2;
PanelTitle {
text: @tr("Stream Preview");
compact: true;
}
if StudioBridge.viewers.length > 0: ViewerRequests { }
StudioPreview {
vertical-stretch: 1;
large: false;
caption: false;
controls: true;
}
}
}
HorizontalLayout {
vertical-stretch: 1;
min-height: 220px;
spacing: Theme.space-3;
MixerCard {
compact: true;
horizontal-stretch: 1.15;
}
StudioPanel {
horizontal-stretch: 1;
StreamSettings {
compact: true;
}
}
}
}
}
HorizontalLayout {
height: 52px;
spacing: Theme.space-3;
StudioActions {
compact: true;
horizontal-stretch: 1;
}
IconButton {
icon: Icons.settings;
label: @tr("Studio Settings");
filled: true;
size: 44px;
y: (parent.height - self.height) / 2;
clicked => { StudioNav.open-settings(); }
}
}
}
}
StudioDialogs {
width: parent.width;
height: parent.height;
}
}