voelin-gpui: the voice channel page and its call bar
Slice 3 of plan section 6 step 3, first part. VoicePage is a cached pane of its own, a sibling of the server page that MainView puts in the main area while the page is asked for (show_voice_view, through voelin-ui-vm's logic) and voice is connected, as the Slint VoiceView is. It shows the channel (name, topic, banner under the surface veil, "N in voice / limit total"), the people of our channel as TreeView::members gives them through the tree model's Voice event (the ring that is green while they talk and blue while they stream, the bars or the microphone and sound marks in the corner, the crown, "Speaking", "Streaming", "Away"; a click opens the card), and the call bar: mute, deafen, Share and the voice settings (both logged until their slices), Leave. The smaller stage, one row of small avatars, is ui.voice_compact and always in a window under 800 pixels tall, which MainView pushes into the pane (a cached pane does not see a resize); VOELIN_OPEN=voice[:compact] asks for it, the sample servers keep nothing. The server page gets a Voice channel button for the way in, and the meter counts the page's renders. Tests on the test platform: the page takes the main area and gives it back, the people and their marks, talking and mute events redraw the page once and the rail, top bar and main area not at all (one model build for three lists), Leave reaches the engine, the call bar's buttons, the stage kept in the settings and forced short, the banner. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3fb5de8f32
commit
ba4fe3c8ca
10 files changed
+1242
-47
No files matched your search
@@ -7,6 +7,9 @@
|
||||
//! components, the icons) in place of the shell. The Slint front end's
|
||||
//! other pages do not exist here yet; they are named in a warning and
|
||||
//! skipped.
|
||||
//! - `VOELIN_OPEN=voice` (`voice:compact`): the voice channel page on screen
|
||||
//! once voice is connected, in place of the server page; `voice:compact`
|
||||
//! with the smaller stage, which is not stored.
|
||||
//! - `VOELIN_DEMO_UI=1`: the Slint front end's sample servers, shown through
|
||||
//! the app's own events, with their pictures as files of a folder in the
|
||||
//! temporary directory (removed when the window closes); nothing is sent to
|
||||
@@ -42,6 +45,12 @@ pub enum Page {
|
||||
pub struct Switches {
|
||||
/// The page to open on.
|
||||
pub open: Page,
|
||||
/// The voice channel page is asked for (`VOELIN_OPEN=voice`): it shows
|
||||
/// once voice is connected.
|
||||
pub voice: bool,
|
||||
/// With the voice page, the smaller stage, as the switch says (it is not
|
||||
/// stored, as the Slint front end's `voice:compact`).
|
||||
pub voice_compact: bool,
|
||||
/// Show the sample servers instead of the stored ones.
|
||||
pub demo_ui: bool,
|
||||
/// Write the sample servers' pictures to a folder of the temporary
|
||||
@@ -69,6 +78,8 @@ impl Default for Switches {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
open: Page::Shell,
|
||||
voice: false,
|
||||
voice_compact: false,
|
||||
demo_ui: false,
|
||||
demo_pictures: false,
|
||||
demo_server: None,
|
||||
@@ -95,8 +106,10 @@ impl Switches {
|
||||
for what in list.split(',').map(str::trim).filter(|w| !w.is_empty()) {
|
||||
match what {
|
||||
"swatch" => switches.open = Page::Swatch,
|
||||
"voice" => switches.voice = true,
|
||||
"voice:compact" => (switches.voice, switches.voice_compact) = (true, true),
|
||||
other => tracing::warn!(
|
||||
"VOELIN_OPEN={other}: this page is not in the GPUI front end yet (swatch is)"
|
||||
"VOELIN_OPEN={other}: this page is not in the GPUI front end yet (swatch and voice are)"
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -166,7 +179,7 @@ mod tests {
|
||||
#[test]
|
||||
fn every_switch_is_read() {
|
||||
let s = env(&[
|
||||
("VOELIN_OPEN", "swatch"),
|
||||
("VOELIN_OPEN", "swatch,voice:compact"),
|
||||
("VOELIN_DEMO_UI", "1"),
|
||||
("VOELIN_DEMO_SERVER", "2"),
|
||||
("VOELIN_DEMO_TALK", "10"),
|
||||
@@ -176,6 +189,7 @@ mod tests {
|
||||
("VOELIN_METER", "1"),
|
||||
]);
|
||||
assert_eq!(s.open, Page::Swatch);
|
||||
assert!(s.voice && s.voice_compact, "the voice page, with the smaller stage");
|
||||
assert!(s.demo_ui && s.demo_pictures, "the sample servers come with their pictures");
|
||||
assert_eq!(s.demo_server, Some(2));
|
||||
assert_eq!(s.demo_talk, Some(10.0));
|
||||
@@ -185,6 +199,12 @@ mod tests {
|
||||
assert!(s.meter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_voice_page_alone_has_the_larger_stage() {
|
||||
let s = env(&[("VOELIN_OPEN", "voice")]);
|
||||
assert_eq!((s.open, s.voice, s.voice_compact), (Page::Shell, true, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn what_makes_no_sense_is_left_out() {
|
||||
let s = env(&[
|
||||
|
||||
Reference in new issue
Block a user