import { ScrollView, ListView, Slider } from "std-widgets.slint"; import { Theme } from "theme.slint"; import { ActionButton, TextField } from "controls.slint"; import { ChatBridge, ChatScreen } from "chat.slint"; import { SettingsScreen } from "settings.slint"; export struct ShellRow { id: string, key: string, title: string, subtitle: string, depth: int, selected: bool, expanded: bool, expandable: bool, talking: bool, muted: bool, unread: string, kind: int, joined: bool, password: bool, full: bool, moderated: bool, spacer: int, own: bool, contact: bool, deafened: bool, away: bool, recording: bool, streaming: bool, commander: bool, waveform: [int], } export struct ShellTab { id: string, title: string, selected: bool, microphone-owner: bool, connected: bool, unread: string } export struct ShellCommand { id: string, label: string, enabled: bool, reason: string, destructive: bool, glyph: int, heading: bool } export struct ShellInfo { label: string, value: string } export struct ShellStream { id: string, title: string, status: string, frame: image, has-frame: bool, volume: float, actions: [ShellCommand] } export global ShellBridge { in-out property compact-tree; in-out property channel-commander-as-lamp: true; in-out property <[ShellTab]> tabs; in-out property <[ShellRow]> tree; in-out property <[ShellRow]> bookmarks; in-out property <[ShellRow]> contacts; in-out property <[ShellRow]> entries; in-out property <[ShellTab]> sidebar-tabs; in-out property <[ShellRow]> sidebar-bookmarks; in-out property bookmarks-collapsed; callback toggle-bookmarks(); in-out property sidebar-search; in-out property bookmark-up-command; in-out property can-add-bookmark; in-out property bookmark-location; in-out property contact-add-command; in-out property label-add-contact; in-out property new-connection-command; in-out property identity-review; in-out property away-command; in-out property capture-command; in-out property create-channel-command; in-out property save-bookmark-command; in-out property server-chat-command; in-out property label-save-bookmark; in-out property label-server-chat; in-out property <[ShellInfo]> info; in-out property <[ShellCommand]> actions; in-out property <[ShellCommand]> detail-actions; in-out property <[ShellCommand]> menu-actions; in-out property <[ShellStream]> streams; in-out property <[string]> destinations; in-out property destination; in-out property depth; in-out property stage; in-out property title; in-out property subtitle; in-out property description; in-out property status; in-out property error; in-out property detail-error; in-out property loading; in-out property detail-loading; in-out property menu-visible; in-out property menu-title; in-out property menu-x; in-out property menu-y; in-out property menu-glyph: -1; in-out property has-voice; in-out property muted; in-out property deafened; in-out property transmitting; in-out property away; in-out property ptt-enabled; in-out property voice-title; in-out property voice-status; in-out property codec-warning; in-out property searchable; in-out property search; in-out property has-previous; in-out property has-next; in-out property label-back; in-out property label-more; in-out property label-close; in-out property label-loading; in-out property label-empty; in-out property label-tree-empty; in-out property label-stream-empty; in-out property label-stream-waiting; in-out property label-mute; in-out property label-deafen; in-out property label-ptt; in-out property label-bookmarks; in-out property label-connections; in-out property label-new-connection; in-out property label-away; in-out property label-commander; in-out property label-password; in-out property label-capture; in-out property label-create-channel; in-out property label-search; in-out property label-next; in-out property label-previous; in-out property label-volume; in-out property label-resize; in-out property <[string]> stages; in-out property sidebar-width: 270px; in-out property server-width: 500px; callback navigate(int); callback select-stage(int); callback back(); callback select(string); callback expand(string); callback context(string,float,float); callback menu(float,float); callback bookmark-menu(float,float); callback bookmark-drag-start(string); callback bookmark-drag-end(string,bool); callback close-menu(); callback invoke(string); callback row-press(string,bool,float,float); callback voice(int); callback held(bool); callback search-edited(string); callback sidebar-search-edited(); callback page(bool); in-out property fullscreen-stream; callback stream-volume(string,float,bool); callback resized(float,float); } component RecordingWaveform inherits Rectangle { in property <[int]> peaks; private property bucket-width: 2px; private property live-inset: 2px; height: 36px; background: Theme.header; clip: true; accessible-role: none; // Match the recording mixer lane: centered amplitudes, newest bucket at the right. for peak[index] in root.peaks: Rectangle { visible: peak > 0; x: root.width - root.live-inset - (root.peaks.length - index) * root.bucket-width; y: (root.height - self.height) / 2; width: root.bucket-width; height: max(2px, (root.height - 14px) * clamp(peak, 0, 1000) / 1000); background: Theme.high-contrast ? Theme.fg : Theme.tint-secondary; } Rectangle { x: root.width - root.live-inset; width: 1px; background: Theme.outline; } } global ShellColors { out property bar: Theme.dark ? #121a2c : Theme.shaded; out property sidebar-end: Theme.dark ? #1d2537 : Theme.bg; out property divider: Theme.dark ? #171c2a : Theme.deviant; out property strong: Theme.dark ? #0b1124 : Theme.contrast; out property client: Theme.high-contrast ? Theme.fg : Theme.dark ? #bbd6f3 : #445d77; out property subtitle: Theme.high-contrast ? Theme.fg : Theme.subtitle; out property selection-tint: Theme.high-contrast ? Theme.fg : Theme.tint-secondary; out property tool: Theme.dark || Theme.high-contrast ? Theme.fg : #494949; out property constructive: Theme.dark ? Theme.toggle-checked : Theme.success; out property detail-header: Theme.dark ? Theme.shaded : @linear-gradient(180deg, #f3f3f3, #dcdcdc); out property popup-disabled: Theme.high-contrast ? Theme.fg : Theme.dark ? #9c9c9c : #888; out property popup-danger: Theme.dark ? Theme.error-light : #e61919; out property popup-hover: Theme.dark ? #1c2538d9 : Theme.contrast; out property popup: @linear-gradient(180deg, (Theme.dark ? #0b1124 : Theme.contrast).with-alpha(Theme.high-contrast ? 1.0 : 0.8), (Theme.dark ? #222c41 : Theme.contrast).with-alpha(Theme.high-contrast ? 1.0 : 0.8)); out property tree: @linear-gradient(25deg, Theme.dark ? #252f44 : #e1e3ed 0%, Theme.dark ? #2e374c : Theme.bg 60%); out property banner: @linear-gradient(180deg, (Theme.dark ? #0b1124 : Theme.contrast).with-alpha(0.9), (Theme.dark ? #222c41 : Theme.deviant).with-alpha(0.9)); out property channel: @linear-gradient(90deg, Theme.dark ? #192031 : #a9bee1 50%, Theme.dark ? #1d263a : #8391b3 100%); out property commander-idle: Theme.high-contrast ? Theme.fg : Theme.commander; out property commander-talking: Theme.high-contrast ? Theme.success : @linear-gradient(203deg, Theme.commander-talking-start, Theme.commander-talking-stop); } component CommandList inherits VerticalLayout { in property <[ShellCommand]> commands; spacing: 4px; for command in root.commands: VerticalLayout { if command.heading: Text { text: command.label; color: ShellColors.subtitle; } if !command.heading: ActionButton { text: command.label; enabled: command.enabled; destructive: command.destructive; clicked => { ShellBridge.invoke(command.id); } } if command.reason != "": Text { text: command.reason; color: Theme.muted; wrap: word-wrap; } } } component StreamTile inherits Rectangle { in property item; min-height: 230px; background: Theme.contrast; border-radius: 8px; border-width: 2px; border-color: Theme.bg; VerticalLayout { padding: 8px; spacing: 4px; Text { text: root.item.title; color: Theme.fg; overflow: elide; } Rectangle { min-height: 150px; if root.item.has-frame: Image { source: root.item.frame; image-fit: contain; } if !root.item.has-frame: Text { text: root.item.status != "" ? root.item.status : ShellBridge.label-stream-waiting; color: Theme.muted; horizontal-alignment: center; vertical-alignment: center; wrap: word-wrap; } } Text { text: root.item.status; color: Theme.muted; overflow: elide; } parity-stream-gain := Slider { minimum: 0; maximum: 1; step: 0.01; value: root.item.volume; accessible-label: ShellBridge.label-volume; changed(value) => { ShellBridge.stream-volume(root.item.id,value,false); } released(value) => { ShellBridge.stream-volume(root.item.id,value,true); } } CommandList { commands: root.item.actions; } } } // Independent line pictograms: server, channel, person, chat, settings, chevrons, tools. component ShellGlyph inherits Rectangle { in property glyph; in property ink: Theme.fg; in property paint: root.ink; width: 22px; height: 22px; if root.glyph == 2: Rectangle { border-radius: self.width / 2; background: Theme.dark ? #202d31 : #c9d9e5; } Path { width: 100%; height: 100%; viewbox-width: 24; viewbox-height: 24; stroke: root.glyph == 31 ? transparent : root.paint; stroke-width: 1.5px; fill: root.glyph == 2 || root.glyph == 31 ? root.paint : transparent; commands: root.glyph == 0 ? "M12 2 L21 7 V17 L12 22 L3 17 V7 Z M3 10 L12 15 L21 10 M3 14 L12 19 L21 14 M3 7 L12 12 L21 7" : root.glyph == 1 ? "M12 2 L21 7 V17 L12 22 L3 17 V7 Z M12 2 V12 L21 17 M12 12 L3 17" : root.glyph == 2 ? "M12 5 A3 3 0 1 0 12 11 A3 3 0 1 0 12 5 Z M7 17 C7 12 17 12 17 17 C17 21 7 21 7 17 Z" : root.glyph == 3 ? "M5 4 H19 Q21 4 21 7 V16 Q21 18 19 18 H10 L4 22 V7 Q4 4 5 4 Z" : root.glyph == 4 ? "M12 8 A4 4 0 1 0 12 16 A4 4 0 1 0 12 8 Z M12 2 V6 M12 18 V22 M2 12 H6 M18 12 H22 M5 5 L8 8 M16 16 L19 19 M5 19 L8 16 M16 8 L19 5" : root.glyph == 5 ? "M7 10 L12 15 L17 10" : root.glyph == 6 ? "M10 7 L15 12 L10 17" : root.glyph == 7 ? "M5 12 L6 12 M11.5 12 L12.5 12 M18 12 L19 12" : root.glyph == 8 ? "M12 5 V19 M5 12 H19" : root.glyph == 9 ? "M12 2 A3 3 0 0 1 15 5 V12 A3 3 0 0 1 9 12 V5 A3 3 0 0 1 12 2 Z M5 11 A7 7 0 0 0 19 11 M12 18 V22 M8 22 H16" : root.glyph == 10 ? "M3 8 H7 L12 4 V20 L7 16 H3 Z M15 8 Q20 12 15 16 M18 5 Q25 12 18 19" : root.glyph == 11 ? "M12 2 A10 10 0 1 0 12 22 A10 10 0 1 0 12 2 Z M12 6 V12 L16 15" : root.glyph == 12 ? "M4 3 H20 V17 H4 Z M8 21 H16 M12 17 V21" : root.glyph == 13 ? "M6 3 H18 V21 L12 16 L6 21 Z" : root.glyph == 14 ? "M5 10 H19 V21 H5 Z M8 10 V6 A4 4 0 1 1 16 6 V10" : root.glyph == 18 ? "M10 3 A7 7 0 1 0 10 17 A7 7 0 1 0 10 3 Z M15 15 L21 21" : root.glyph == 15 ? "M6 6 L18 18 M18 6 L6 18" : root.glyph == 16 ? "M12 4 A8 8 0 1 0 12 20 A8 8 0 1 0 12 4 Z M12 10 V16 M12 7 V8" : root.glyph == 19 ? "M12 2 L21 7 V17 L12 22 L3 17 V7 Z M3 7 L12 12 L21 7 M12 12 V22" : root.glyph == 20 ? "M8 12 V5 A1.5 1.5 0 0 1 11 5 V10 L13 8 L17 9 L19 11 V15 L16 20 H10 L5 14 A2 2 0 0 1 8 12 Z" : root.glyph == 21 ? "M4 20 V12 H7 V20 Z M10 20 V7 H13 V20 Z M16 20 V3 H19 V20 Z" : root.glyph == 22 ? "M10 4 H5 V20 H10 M10 12 H20 M16 8 L20 12 L16 16" : root.glyph == 23 ? "M3 5 H21 V18 H16 M3 5 V18 H8 M12 22 V11 M8 15 L12 11 L16 15" : root.glyph == 24 ? "M3 4 H21 V19 H3 Z M5 14 L8 8 L11 14 M6 12 H10 M13 14 V8 H17 M13 11 H16 M19 8 V14" : root.glyph == 25 ? "M9 9 V5 A3 3 0 0 1 15 5 V11 M9 13 A3 3 0 0 0 14 14 M5 11 A7 7 0 0 0 16 17 M12 18 V22 M8 22 H16 M3 3 L21 21" : root.glyph == 26 ? "M3 8 H7 L12 4 V12 M3 8 V16 H7 L12 20 V16 M15 8 Q20 12 15 16 M3 3 L21 21" : root.glyph == 27 ? "M12 3 A9 9 0 1 0 12 21 A9 9 0 1 0 12 3 Z M12 7 V17 M7 12 H17" : root.glyph == 28 ? "M3 5 H9 L11 8 H21 V20 H3 Z" : root.glyph == 29 ? "M14 6 L8 12 L14 18" : // Native star and double chevron, based on the pinned ChannelCommander silhouette. root.glyph == 31 ? "M5.5 6 L7 9.5 L11 10 L8 12.8 L8.8 17 L5.5 15 L2 17 L2.8 12.8 L0 10 L4 9.5 Z M11 6 H14 L17.5 12 L14 18 H11 L14.5 12 Z M17 6 H20 L23.5 12 L20 18 H17 L20.5 12 Z" : "M12 4 A8 8 0 1 0 12 20 A8 8 0 1 0 12 4 Z M12 9 A3 3 0 1 0 12 15 A3 3 0 1 0 12 9 Z"; } } component EntryRow inherits Rectangle { in property item; private property commander-lamp: root.item.commander && ShellBridge.compact-tree && ShellBridge.channel-commander-as-lamp; function context-menu() { ShellBridge.context(root.item.id, (root.absolute-position.x + 20px) / 1px, (root.absolute-position.y + root.height / 2) / 1px); } height: max(44px, Theme.touch-target); border-radius: 9px; background: item.selected ? Theme.contrast : (touch.has-hover ? Theme.bg : transparent); border-width: item.selected || focus.has-focus ? 1.5px : 0px; border-color: Theme.tint; accessible-role: list-item; accessible-label: item.commander && item.subtitle == "" ? item.title + ", " + ShellBridge.label-commander : item.title + ". " + item.subtitle + (item.commander ? ", " + ShellBridge.label-commander : ""); accessible-item-selectable: true; accessible-item-selected: item.selected; accessible-expandable: item.expandable; accessible-expanded: item.expanded; accessible-action-expand => { if root.item.expandable { ShellBridge.expand(root.item.id); } } accessible-action-default => { ShellBridge.select(root.item.id); } HorizontalLayout { padding-left: 10px + root.item.depth * 14px; padding-right: 4px; spacing: 8px; if root.item.expandable: ActionButton { width: 44px; text: root.item.expanded ? ShellBridge.label-close : ShellBridge.label-more; clicked => { ShellBridge.expand(root.item.id); } } Rectangle { width: 6px; height: 6px; border-radius: 3px; background: root.commander-lamp ? (root.item.talking && !root.item.muted ? ShellColors.commander-talking : ShellColors.commander-idle) : root.item.talking ? Theme.success : root.item.muted ? Theme.error : Theme.muted; } VerticalLayout { spacing: 0px; alignment: center; Text { text: root.item.title; color: Theme.fg; font-size: Theme.font-size; overflow: elide; } if root.item.subtitle != "": Text { text: root.item.subtitle; color: Theme.muted; font-size: Theme.font-size * 0.86; overflow: elide; } } if root.item.waveform.length > 0: parity-recording-waveform := RecordingWaveform { width: min(130px, root.width / 3); peaks: root.item.waveform; } if root.item.commander && !root.commander-lamp: ShellGlyph { glyph: 31; width: 17px; height: 17px; } if root.item.unread != "": Text { text: root.item.unread; color: Theme.tint; vertical-alignment: center; } ActionButton { text: ShellBridge.label-more; width: 70px; clicked => { root.context-menu(); } } } focus := FocusScope { key-pressed(e) => { if e.text == "\n" { ShellBridge.select(root.item.id); return accept; } if e.text == Key.F10 && e.modifiers.shift { root.context-menu(); return accept; } return reject; } } // Explicit overflow is always available on touch; right click never selects a row. touch := TouchArea { x: root.item.expandable ? 54px + root.item.depth * 14px : 0px; width: max(0px,parent.width - self.x - 78px); clicked => { focus.focus(); ShellBridge.select(root.item.id); } pointer-event(e) => { if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.item.id, (self.absolute-position.x + self.mouse-x) / 1px, (self.absolute-position.y + self.mouse-y) / 1px); } if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.item.id,true,(self.absolute-position.x + self.mouse-x) / 1px,(self.absolute-position.y + self.mouse-y) / 1px); } if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel || (e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8)) { ShellBridge.row-press(root.item.id,false,0,0); } } } } component DesktopMenuEntry inherits Rectangle { in property command; property label-height: 30px; height: root.label-height + (root.command.reason == "" ? 0px : reason.preferred-height + 4px); accessible-role: button; accessible-label: root.command.label; accessible-description: root.command.reason; accessible-enabled: root.command.enabled; accessible-action-default => { if root.command.enabled { ShellBridge.invoke(root.command.id); } } background: pointer.has-hover || keyboard.has-focus ? ShellColors.popup-hover : transparent; border-width: keyboard.has-focus ? 1px : 0px; border-color: ShellColors.selection-tint; property ink: !root.command.enabled ? ShellColors.popup-disabled : root.command.destructive ? ShellColors.popup-danger : Theme.fg; if root.command.glyph >= 0: ShellGlyph { x: 5px; y: 4px; glyph: root.command.glyph; ink: root.ink; } Text { x: 36px; y: 0px; height: root.label-height; width: max(0px, parent.width - self.x - 8px); text: root.command.label; color: root.ink; font-size: 15px; font-weight: Theme.normal-weight; vertical-alignment: center; overflow: elide; } reason := Text { x: 36px; y: root.label-height; width: max(0px, parent.width - self.x - 8px); text: root.command.reason; color: ShellColors.subtitle; font-size: 13px; wrap: word-wrap; } keyboard := FocusScope { enabled: root.command.enabled && !root.command.heading; key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.invoke(root.command.id); return accept; } return reject; } } pointer := TouchArea { enabled: root.command.enabled && !root.command.heading; clicked => { ShellBridge.invoke(root.command.id); } } } component ChromeButton inherits Rectangle { in property label; in property text; in property glyph: -1; in property ink: Theme.fg; in property active; in property center-text: true; in property filled; in property icon-inset: 8px; in property caption-inset: 35px; in property caption-end-inset: 5px; in property button-text-size: 13px; in property button-weight: 450; in property enabled: true; out property hovered: touch.has-hover; callback clicked(); min-width: 0px; height: 26px; preferred-width: root.text != "" ? caption.preferred-width + (root.glyph >= 0 ? 42px : 24px) : 32px; out property text-width: caption.preferred-width; background: root.filled ? Theme.button-fill : (touch.has-hover || focus.has-focus ? Theme.bg : transparent); border-radius: root.filled ? 100px : 4px; border-width: focus.has-focus ? 1.5px : 0px; border-color: ShellColors.selection-tint; accessible-role: button; accessible-label: root.label != "" ? root.label : root.text; accessible-item-selectable: root.active; accessible-item-selected: root.active; accessible-enabled: root.enabled; accessible-action-default => { if root.enabled { root.clicked(); } } if root.enabled && root.text == "" && root.label != "": Tooltip { Rectangle { border-radius: 4px; background: Theme.contrast; HorizontalLayout { padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; Text { text: root.label; color: Theme.fg; font-size: 13px; } } } } if root.glyph >= 0: ShellGlyph { glyph: root.glyph; ink: root.active ? Theme.tint : (focus.has-focus && root.ink == transparent ? Theme.fg : root.ink); x: root.text == "" ? (root.width - self.width) / 2 : root.icon-inset; y: (root.height - self.height) / 2; } caption := Text { x: root.glyph < 0 ? 5px : root.caption-inset; width: max(0px, root.width - self.x - root.caption-end-inset); text: root.text; font-size: root.button-text-size; font-weight: root.active ? 600 : root.button-weight; color: root.active ? Theme.tint : root.ink; vertical-alignment: center; horizontal-alignment: root.center-text ? center : left; overflow: elide; } focus := FocusScope { enabled: root.enabled; key-pressed(e) => { if e.text == "\n" || e.text == " " { root.clicked(); return accept; } return reject; } } touch := TouchArea { enabled: root.enabled; clicked => { focus.focus(); root.clicked(); } } } component DesktopTreeRow inherits Rectangle { in property item; in property active; in property bookmark-drop-width; function open-row-menu() { ShellBridge.context(root.item.id, (root.absolute-position.x + root.indent + 31px) / 1px, (root.absolute-position.y + root.height / 2) / 1px); } property server: root.item.kind == 0; property channel: root.item.kind == 1; property client: root.item.kind == 2; property compact-client: root.client && ShellBridge.compact-tree; private property commander-lamp: root.compact-client && root.item.commander && ShellBridge.channel-commander-as-lamp; private property commander-icon: root.client && root.item.commander && !root.commander-lamp; property spacer: root.item.spacer > 0; property indent: min(max(0px, self.width - 90px), min(item.depth, 4) * 10px + max(item.depth - 4, 0) * 5px); property row-hover: parity-tree-hit.has-hover || more.hovered || (root.item.expandable && arrow.hovered); property highlighted: root.active || root.row-hover; property banner-tools-right: root.width - 27px; property has-banner-tools: ShellBridge.save-bookmark-command != "" || ShellBridge.server-chat-command != ""; height: root.server ? 100px : root.channel ? 44px : root.compact-client ? 28px : 40px; accessible-role: list-item; accessible-label: root.item.title + (root.item.password ? ", " + ShellBridge.label-password : "") + (root.item.away ? ", " + ShellBridge.label-away : "") + (root.item.commander ? ", " + ShellBridge.label-commander : ""); accessible-item-selectable: true; accessible-item-selected: root.item.selected; accessible-expandable: root.item.expandable; accessible-expanded: root.item.expanded; accessible-action-expand => { if root.item.expandable { ShellBridge.expand(root.item.id); } } accessible-action-default => { ShellBridge.select(root.item.id); } Rectangle { x: root.indent + (root.channel && root.highlighted ? 7px : 10px); y: root.server ? 18px : root.channel ? (root.highlighted ? 4px : 7px) : 1px; width: max(0px, root.width - self.x - (root.channel && root.highlighted ? 7px : 10px)); height: root.server ? 74px : root.height - 2 * self.y; border-radius: root.server ? 10px : root.channel ? 9px : 100px; background: root.server ? ShellColors.banner : root.spacer ? @linear-gradient(-115deg, Theme.deviant, Theme.dark ? #374263 : Theme.contrast) : root.channel ? ShellColors.channel : transparent; border-width: root.item.selected || focus.has-focus || (root.highlighted && root.channel) ? (root.server ? 1px : 1.5px) : root.item.full || root.item.password ? 2px : 0px; border-color: root.item.selected || focus.has-focus ? ShellColors.selection-tint : root.highlighted ? ShellColors.subtitle : root.item.full ? Theme.error : root.item.password ? Theme.warning : ShellColors.subtitle; } if root.client && root.highlighted && !root.item.selected && !focus.has-focus: Rectangle { x: root.indent + 10px; y: 1px; width: min(160px, max(0px, root.width - self.x - 10px)); height: root.height - 2px; border-radius: 100px; border-width: 1px; border-color: @linear-gradient(90deg, ShellColors.subtitle, ShellColors.subtitle.with-alpha(0)); } if !root.spacer && !root.commander-lamp: parity-tree-avatar := ShellGlyph { glyph: root.channel ? 19 : root.item.kind; ink: root.client ? (root.item.talking && !root.item.muted ? Theme.success : root.item.away ? ShellColors.subtitle : Theme.dark ? #a3b4b3 : #445d77) : root.channel ? (root.item.full ? Theme.error : root.item.password ? Theme.warning : Theme.dark ? #dbeaf7 : #445d77) : Theme.fg; x: root.indent + (root.server ? 30px : root.client ? 25px : 20px); y: root.server ? 28px : (root.height - self.height) / 2; width: root.server ? 55px : root.client && !root.compact-client ? 33px : 22px; height: self.width; } if root.commander-lamp: parity-tree-commander-lamp := ShellGlyph { glyph: 2; paint: root.item.talking && !root.item.muted ? ShellColors.commander-talking : ShellColors.commander-idle; x: root.indent + 25px; y: (root.height - self.height) / 2; } title := Text { x: root.indent + (root.server ? 105px : root.spacer ? 20px : root.compact-client ? 57px : root.client ? 68px : 52px); y: root.server ? 17px : 0px; height: root.server ? 74px : root.height; width: max(0px, (root.server ? root.banner-tools-right - 26px * (1 + (ShellBridge.save-bookmark-command == "" ? 0 : 1) + (ShellBridge.server-chat-command == "" ? 0 : 1)) : status.x) - self.x - 4px); text: root.item.title; font-size: root.server ? 16px : root.channel && !root.spacer ? 13px : root.compact-client ? 15px : 14px; font-weight: root.server ? 700 : root.item.own ? 500 : root.item.contact || root.spacer ? 600 : Theme.normal-weight; color: root.item.own || root.item.contact ? (Theme.high-contrast ? Theme.fg : Theme.tint) : root.client ? ShellColors.client : Theme.fg; horizontal-alignment: root.item.spacer == 2 ? center : root.item.spacer == 3 ? right : left; vertical-alignment: center; overflow: elide; } status := Rectangle { property marks: (root.commander-icon ? 1 : 0) + (root.item.password ? 1 : 0) + (root.item.moderated ? 1 : 0) + (root.item.muted ? 1 : 0) + (root.item.deafened ? 1 : 0) + (root.item.away ? 1 : 0) + (root.item.recording ? 1 : 0) + (root.item.streaming ? 1 : 0); x: max(0px, (root.item.expandable ? arrow.x : root.width - 20px) - self.width - 4px); y: (root.height - self.height) / 2; width: self.marks > 0 ? 10px + self.marks * 17px + (self.marks - 1) * 4px : 0px; height: 23px; border-radius: 7px; background: self.marks == 0 ? transparent : (Theme.dark ? #222a3b : Theme.contrast); HorizontalLayout { y: (parent.height - self.height) / 2; height: 17px; padding-left: 5px; padding-right: 5px; spacing: 4px; alignment: start; if root.commander-icon: parity-tree-commander-icon := ShellGlyph { glyph: 31; width: 17px; height: 17px; } if root.item.password: ShellGlyph { glyph: 14; ink: Theme.warning; width: 17px; height: 17px; } if root.item.moderated: Text { width: 17px; text: "M"; color: Theme.fg; font-size: 13px; vertical-alignment: center; horizontal-alignment: center; } if root.item.muted: ShellGlyph { glyph: 25; ink: Theme.error; width: 17px; height: 17px; } if root.item.deafened: ShellGlyph { glyph: 26; ink: Theme.error; width: 17px; height: 17px; } if root.item.away: ShellGlyph { glyph: 11; ink: Theme.warning; width: 17px; height: 17px; } if root.item.recording: ShellGlyph { glyph: 17; ink: Theme.error; width: 17px; height: 17px; } if root.item.streaming: ShellGlyph { glyph: 12; ink: ShellColors.constructive; width: 17px; height: 17px; } } } focus := FocusScope { key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.select(root.item.id); return accept; } if e.text == Key.F10 && e.modifiers.shift { root.open-row-menu(); return accept; } if root.item.expandable && ((e.text == Key.RightArrow && !root.item.expanded) || (e.text == Key.LeftArrow && root.item.expanded)) { ShellBridge.expand(root.item.id); return accept; } return reject; } } parity-tree-hit := TouchArea { width: max(0px, root.server && root.has-banner-tools ? root.banner-tools-right - 78px : root.item.expandable ? arrow.x : root.width); clicked => { focus.focus(); ShellBridge.select(root.item.id); } pointer-event(e) => { if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.item.id,(self.absolute-position.x + self.mouse-x) / 1px,(self.absolute-position.y + self.mouse-y) / 1px); } if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.item.id,true,(self.absolute-position.x + self.mouse-x) / 1px,(self.absolute-position.y + self.mouse-y) / 1px); if root.channel { ShellBridge.bookmark-drag-start(root.item.id); } } if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel || (e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8)) { ShellBridge.row-press(root.item.id,false,0,0); } if root.channel && (e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel) { ShellBridge.bookmark-drag-end(root.item.id,e.kind == PointerEventKind.up && self.absolute-position.x + self.mouse-x >= 0px && self.absolute-position.x + self.mouse-x < root.bookmark-drop-width); } } } if root.server && ShellBridge.save-bookmark-command != "": ChromeButton { x: root.banner-tools-right - 64px; y: 42px; width: 26px; glyph: 13; label: ShellBridge.label-save-bookmark; ink: ShellColors.subtitle; clicked => { ShellBridge.invoke(ShellBridge.save-bookmark-command); } } if root.server && ShellBridge.server-chat-command != "": ChromeButton { x: root.banner-tools-right - 37px; y: 42px; width: 26px; glyph: 3; label: ShellBridge.label-server-chat; ink: ShellColors.selection-tint; clicked => { ShellBridge.invoke(ShellBridge.server-chat-command); } } more := ChromeButton { x: max(0px, root.server ? root.banner-tools-right - 12px : root.width - (root.item.expandable ? 63px : 44px)); width: 24px; y: root.server ? 42px : (root.height - self.height) / 2; glyph: 7; label: ShellBridge.label-more; ink: root.row-hover || focus.has-focus || (root.server && !root.has-banner-tools) ? Theme.fg : transparent; clicked => { root.open-row-menu(); } } arrow := ChromeButton { x: max(0px, root.width - 37px); width: 22px; y: (root.height - self.height) / 2; glyph: root.item.expanded ? 5 : 6; ink: root.item.expanded ? Theme.fg : Theme.tint; label: root.item.expanded ? ShellBridge.label-close : ShellBridge.label-more; visible: root.item.expandable; enabled: root.item.expandable; clicked => { ShellBridge.expand(root.item.id); } } } component SidebarActivity inherits Rectangle { in property label; in property subtitle; in property row-id; in property unread; function context-menu() { ShellBridge.context(root.row-id,(root.absolute-position.x + 31px) / 1px,(root.absolute-position.y + root.height / 2) / 1px); } in property glyph; in property selected; in property connected; in property rail; height: 44px; accessible-role: list-item; accessible-label: root.label + (root.subtitle == "" ? "" : ", " + root.subtitle) + (root.unread == "" ? "" : ", " + root.unread); accessible-item-selectable: true; accessible-item-selected: root.selected; accessible-action-default => { ShellBridge.select(root.row-id); } Rectangle { x: 10px; y: 2px; width: parent.width - 20px; height: 40px; border-radius: 8px; background: touch.has-hover ? Theme.bg : Theme.deviant; border-width: focus.has-focus ? 1.5px : 0px; border-color: ShellColors.selection-tint; } ShellGlyph { glyph: root.glyph; x: 20px; y: 11px; ink: root.selected ? Theme.fg : ShellColors.client; } if root.connected: Rectangle { x: 16px; y: 18px; width: 3px; height: 8px; border-radius: 4px; background: Theme.success; } if !root.rail: Text { x: 52px; y: root.subtitle == "" ? 2px : 4px; width: max(0px, overflow-button.x - self.x - (root.unread == "" ? 0px : 30px)); height: root.subtitle == "" ? 40px : 19px; text: root.label; color: Theme.fg; font-size: 15px; font-weight: root.selected ? 600 : 450; vertical-alignment: center; overflow: elide; } if !root.rail && root.subtitle != "": Text { x: 52px; y: 22px; width: max(0px, overflow-button.x - self.x); height: 16px; text: root.subtitle; color: ShellColors.client; font-size: 13px; vertical-alignment: center; overflow: elide; } if root.unread != "": Text { x: root.rail ? 31px : max(52px, overflow-button.x - 30px); y: root.rail ? 3px : 2px; width: 21px; height: root.rail ? 16px : 40px; text: root.unread; color: Theme.tint; font-size: 13px; horizontal-alignment: center; vertical-alignment: center; overflow: elide; } focus := FocusScope { key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.select(root.row-id); return accept; } if e.text == Key.F10 && e.modifiers.shift { root.context-menu(); return accept; } return reject; } } touch := TouchArea { x: 10px; y: 2px; width: max(0px, (root.rail ? root.width - 10px : overflow-button.x) - self.x); height: 40px; clicked => { focus.focus(); ShellBridge.select(root.row-id); } pointer-event(e) => { if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.row-id,(self.absolute-position.x + self.mouse-x) / 1px,(self.absolute-position.y + self.mouse-y) / 1px); } if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.row-id,true,(self.absolute-position.x + self.mouse-x) / 1px,(self.absolute-position.y + self.mouse-y) / 1px); } if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel || (e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8)) { ShellBridge.row-press(root.row-id,false,0,0); } } } overflow-button := ChromeButton { visible: !root.rail; enabled: !root.rail; x: max(0px, root.width - 44px); y: 9px; width: 26px; glyph: 7; label: ShellBridge.label-more; ink: ShellColors.client; clicked => { root.context-menu(); } } } component DesktopSidebar inherits Rectangle { property rail: self.width < 200px; background: @linear-gradient(180deg, ShellColors.bar, ShellColors.sidebar-end); clip: true; VerticalLayout { spacing: 0px; parity-sidebar-brand := Rectangle { height: 71px; background: ShellColors.bar; Image { source: @image-url("../resources/icon.png"); width: 28px; height: 28px; x: root.rail ? (root.width - self.width) / 2 : 20px; y: (parent.height - self.height) / 2; image-fit: contain; } if !root.rail: Text { x: 56px; width: max(0px, parent.width - 66px); text: "TeamsPeach"; font-size: 20px; color: Theme.fg; font-weight: 700; vertical-alignment: center; overflow: elide; } } Rectangle { height: 36px; if !root.rail: parity-sidebar-search := Rectangle { x: 10px; y: 5px; width: parent.width - 20px; height: 26px; border-radius: 100px; background: Theme.deviant; border-width: search.has-focus ? 1.5px : 0px; border-color: Theme.tint; if ShellBridge.sidebar-search == "" && search.preedit-text == "": Text { x: 10px; width: parent.width - 20px; text: ShellBridge.label-search; color: ShellColors.subtitle; font-size: 13px; vertical-alignment: center; overflow: elide; } search := TextInput { x: 10px; width: parent.width - 20px; font-size: 13px; color: Theme.fg; vertical-alignment: center; single-line: true; text <=> ShellBridge.sidebar-search; accessible-label: ShellBridge.label-search; edited => { ShellBridge.sidebar-search-edited(); } } } if root.rail: ChromeButton { width: 32px; glyph: 7; label: ShellBridge.label-more; clicked => { ShellBridge.menu(self.absolute-position.x / 1px,(self.absolute-position.y + self.height) / 1px); } } } ScrollView { VerticalLayout { spacing: 4px; padding-top: 13px; parity-sidebar-servers := VerticalLayout { spacing: 4px; if !root.rail: Rectangle { height: 19px; ChromeButton { x: 15px; y: 0px; height: 19px; width: max(0px, parent.width - 30px); text: ShellBridge.label-connections; ink: ShellColors.subtitle; center-text: false; clicked => { ShellBridge.navigate(0); } } } for tab in ShellBridge.sidebar-tabs: parity-connection-tab := SidebarActivity { row-id: tab.id; label: tab.title; unread: tab.unread; selected: tab.selected; connected: tab.connected; glyph: 0; rail: root.rail; } } if ShellBridge.new-connection-command != "": Rectangle { height: 34px; ChromeButton { x: root.rail ? 12px : 20px; y: 4px; width: root.rail ? 38px : max(0px, parent.width - 40px); height: 30px; text: root.rail ? "" : ShellBridge.label-new-connection; label: ShellBridge.label-new-connection; glyph: 8; filled: true; ink: ShellColors.tool; button-weight: 600; clicked => { ShellBridge.invoke(ShellBridge.new-connection-command); } } } if !root.rail: Rectangle { height: 1px; } parity-sidebar-bookmarks := VerticalLayout { spacing: 4px; if !root.rail: Rectangle { height: 38px; Rectangle { x: 10px; y: 8px; width: parent.width - 20px; height: 26px; border-radius: 4px; background: Theme.bg; if ShellBridge.bookmark-up-command != "": ChromeButton { x: 2px; y: 0px; width: 28px; glyph: 29; label: ShellBridge.label-back; clicked => { ShellBridge.invoke(ShellBridge.bookmark-up-command); } } parity-bookmark-disclosure := ChromeButton { x: ShellBridge.bookmark-up-command == "" ? 0px : 30px; width: max(0px,parent.width - self.x - 30px); glyph: ShellBridge.bookmarks-collapsed ? 6 : 5; center-text: false; text: ShellBridge.bookmark-location == "" ? ShellBridge.label-bookmarks : ShellBridge.bookmark-location; accessible-expanded: !ShellBridge.bookmarks-collapsed; clicked => { ShellBridge.toggle-bookmarks(); } } if ShellBridge.can-add-bookmark: ChromeButton { x: parent.width - 30px; y: 0px; width: 28px; glyph: 8; label: ShellBridge.label-bookmarks; clicked => { ShellBridge.bookmark-menu(self.absolute-position.x / 1px,(self.absolute-position.y + self.height) / 1px); } } } } if root.rail && ShellBridge.bookmark-up-command != "": ChromeButton { width: 32px; glyph: 29; label: ShellBridge.label-back; clicked => { ShellBridge.invoke(ShellBridge.bookmark-up-command); } } if root.rail: ChromeButton { width: root.width; glyph: 13; label: ShellBridge.label-bookmarks; accessible-expanded: !ShellBridge.bookmarks-collapsed; clicked => { ShellBridge.toggle-bookmarks(); } } for item in (ShellBridge.bookmarks-collapsed ? [] : ShellBridge.sidebar-bookmarks): parity-bookmark-activity := SidebarActivity { row-id: item.id; label: item.title; subtitle: item.subtitle; glyph: item.kind == 3 ? 28 : 13; rail: root.rail; } if !ShellBridge.bookmarks-collapsed && !root.rail && ShellBridge.sidebar-bookmarks.length == 0: Text { height: 28px; text: ShellBridge.label-empty; color: ShellColors.client; font-size: 13px; horizontal-alignment: center; vertical-alignment: center; } } for index in [0, 1, 2]: Rectangle { visible: index != 0 || root.rail; height: self.visible ? 34px : 0px; ChromeButton { x: 10px; y: 4px; width: parent.width - 20px; height: 26px; glyph: index == 0 ? 0 : index == 1 ? 3 : 2; label: ShellBridge.destinations[index]; text: root.rail ? "" : self.label; active: ShellBridge.destination == index; enabled: index != 0 || root.rail; center-text: false; clicked => { ShellBridge.navigate(index); } } } } } parity-sidebar-footer := Rectangle { height: 55px; background: ShellColors.sidebar-end; Rectangle { x: root.rail ? 10px : 20px; y: 0px; width: max(0px, parent.width - 2 * self.x); height: 3px; background: ShellColors.divider; } if !root.rail && ShellBridge.has-voice: Text { x: 20px; width: max(0px, parent.width - 66px); text: ShellBridge.voice-title; color: ShellColors.client; font-size: 13px; vertical-alignment: center; overflow: elide; } ChromeButton { x: parent.width - 47px; y: (parent.height - self.height) / 2; width: 32px; glyph: 4; ink: ShellColors.subtitle; label: ShellBridge.destinations[3]; active: ShellBridge.destination == 3; clicked => { ShellBridge.navigate(3); } } } } } component DesktopVoiceTools inherits HorizontalLayout { padding-left: 56px; padding-top: 9px; padding-bottom: 9px; spacing: 13px; alignment: start; if ShellBridge.away-command != "": ChromeButton { glyph: 24; label: ShellBridge.label-away; ink: ShellBridge.away ? Theme.warning : ShellColors.tool; width: 36px; clicked => { ShellBridge.invoke(ShellBridge.away-command); } } if ShellBridge.has-voice: Rectangle { width: 85px; height: 26px; border-radius: 100px; background: Theme.bg; ChromeButton { x: 5px; y: 0px; width: 31px; glyph: ShellBridge.muted ? 25 : 9; label: ShellBridge.label-mute; ink: ShellBridge.muted ? Theme.error : (ShellBridge.transmitting ? Theme.success : ShellColors.tool); clicked => { ShellBridge.voice(0); } } Rectangle { x: 36px; y: 2px; width: 1px; height: 22px; background: ShellColors.strong; } ChromeButton { x: 37px; y: 0px; width: 32px; glyph: ShellBridge.deafened ? 26 : 10; label: ShellBridge.label-deafen; ink: ShellBridge.deafened ? Theme.error : ShellColors.tool; clicked => { ShellBridge.voice(1); } } } } component HoldButton inherits Rectangle { min-height: Theme.touch-target; background: ptt.pressed ? Theme.tint : Theme.bg; border-radius: 4px; accessible-role: button; accessible-label: ShellBridge.label-ptt; accessible-enabled: ShellBridge.ptt-enabled; Text { text: ShellBridge.label-ptt; color: Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; } ptt := TouchArea { enabled: ShellBridge.ptt-enabled; pointer-event(e) => { if e.kind == PointerEventKind.down { ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } } } } component DesktopServerPane inherits Rectangle { in property chat-visible; in property bookmark-drop-width; property compressed: root.width < 440px; VerticalLayout { spacing: 0px; parity-tree := Rectangle { vertical-stretch: 1; background: ShellColors.tree; if ShellBridge.tree.length > 0: HorizontalLayout { padding-left: root.compressed ? 10px : 9px; padding-right: root.compressed ? 10px : 9px; ListView { for item in ShellBridge.tree: parity-tree-row := DesktopTreeRow { bookmark-drop-width: root.bookmark-drop-width; item: item; active: root.chat-visible && item.key == ChatBridge.active-tree-key; } } } if ShellBridge.tree.length == 0 && ShellBridge.identity-review.id == "": Text { x: 20px; y: 18px; width: max(0px, parent.width - 40px); height: parent.height - 18px; text: ShellBridge.label-tree-empty; color: ShellColors.client; wrap: word-wrap; } if ShellBridge.identity-review.id != "": ActionButton { x: 10px; y: 12px; width: min(parent.width - 20px,self.preferred-width); text: ShellBridge.identity-review.label; clicked => { ShellBridge.invoke(ShellBridge.identity-review.id); } } } if ShellBridge.create-channel-command != "" || ShellBridge.capture-command != "" || (ShellBridge.has-voice && ShellBridge.ptt-enabled): parity-tree-status := Rectangle { height: 55px; background: Theme.bg; property side-inset: root.compressed ? 10px : 40px; property hold-width: min(105px, root.width / 3); Rectangle { y: 0px; width: parent.width; height: 3px; background: Theme.shaded; } HorizontalLayout { padding-left: parity-tree-status.side-inset; padding-right: parity-tree-status.side-inset; spacing: 4px; padding-top: 12.5px; padding-bottom: 12.5px; if ShellBridge.create-channel-command != "": ChromeButton { height: 30px; preferred-width: max(120px, self.text-width + 53px); glyph: 27; filled: true; ink: Theme.dark ? #fff : Theme.fg; text: ShellBridge.label-create-channel; icon-inset: 10px; caption-inset: 42px; caption-end-inset: 10px; center-text: false; button-weight: 600; clicked => { ShellBridge.invoke(ShellBridge.create-channel-command); } } if ShellBridge.capture-command != "": ChromeButton { height: 30px; preferred-width: self.text == "" ? 32px : self.text-width + 38px; glyph: 23; ink: ShellColors.constructive; label: ShellBridge.label-capture; text: root.width >= 330px ? ShellBridge.label-capture : ""; icon-inset: 0px; caption-inset: 32px; center-text: false; button-weight: 600; clicked => { ShellBridge.invoke(ShellBridge.capture-command); } } Rectangle { horizontal-stretch: 1; } if ShellBridge.has-voice && ShellBridge.ptt-enabled: Rectangle { width: parity-tree-status.hold-width; } } if ShellBridge.has-voice && ShellBridge.ptt-enabled: Rectangle { x: parent.width - parity-tree-status.side-inset - self.width; y: (parent.height - self.height) / 2; width: parity-tree-status.hold-width; height: Theme.touch-target; HoldButton { } } } } Path { x: 0px; y: 0px; width: 10px; height: 10px; viewbox-width: 10; viewbox-height: 10; commands: "M0 0 H10 A10 10 0 0 0 0 10 Z"; fill: ShellColors.bar; } } export component ShellScreen inherits Rectangle { background: Theme.shaded; min-width: 0px; min-height: 0px; preferred-width: 100%; preferred-height: 100%; property compact: self.width < 600px; property desktop: self.width >= 900px; property sidebar-width <=> ShellBridge.sidebar-width; property server-width <=> ShellBridge.server-width; property actual-sidebar: desktop ? min(clamp(sidebar-width, 62px, 420px), max(62px,self.width - 515px)) : 0px; property max-server-width: min(1600px,max(220px,self.width - actual-sidebar - 295px)); property actual-server: desktop ? clamp(server-width,220px,max-server-width) : min(300px,self.width * 0.4); property main-width: max(0px, self.width - actual-sidebar); property detail-width: max(0px, main-width - (root.desktop-tree || (!compact && ShellBridge.destination == 0) ? actual-server : 0px)); property desktop-tree: desktop && (ShellBridge.destination == 0 || (ShellBridge.destination == 1 && ShellBridge.tree.length > 0)); property chat-open: ShellBridge.destination == 1 || ShellBridge.stage == 1; HorizontalLayout { spacing: 0px; if root.desktop: DesktopSidebar { width: root.actual-sidebar; } VerticalLayout { spacing: 0px; Rectangle { height: 44px; background: root.desktop ? ShellColors.bar : Theme.header; if root.desktop: HorizontalLayout { spacing: 0px; if root.desktop-tree: parity-tree-toolbar := Rectangle { width: root.actual-server; DesktopVoiceTools { } } if root.desktop-tree: parity-detail-toolbar := Rectangle { horizontal-stretch: 1; ChromeButton{ x: max(0px, parent.width - 42px); y: 9px; glyph: 7; label: ShellBridge.label-more; clicked => { ShellBridge.menu((self.absolute-position.x + self.width) / 1px,(self.absolute-position.y + self.height) / 1px); } } } if !root.desktop-tree: HorizontalLayout { spacing: 0px; padding-right: 10px; DesktopVoiceTools { width: 192px; } Rectangle { horizontal-stretch: 1; } VerticalLayout { alignment: center; if ShellBridge.has-voice && ShellBridge.ptt-enabled: HoldButton { width: 105px; } } VerticalLayout { alignment: center; ChromeButton { glyph: 7; label: ShellBridge.label-more; clicked => { ShellBridge.menu((self.absolute-position.x + self.width) / 1px,(self.absolute-position.y + self.height) / 1px); } } } } } if !root.desktop: HorizontalLayout { padding-left: 10px; padding-right: 10px; spacing: 8px; ActionButton { text: ShellBridge.label-back; enabled: ShellBridge.depth > 0 || ShellBridge.destination != 0; clicked => { ShellBridge.back(); } } Text { text: "TeamsPeach"; color: Theme.fg; font-weight: 600; vertical-alignment: center; } Rectangle { horizontal-stretch: 1; } if !root.compact: HorizontalLayout { spacing: 8px; for label[index] in ShellBridge.destinations: ActionButton { text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } } } ActionButton { text: ShellBridge.label-more; clicked => { ShellBridge.menu(self.absolute-position.x / 1px,(self.absolute-position.y + self.height) / 1px); } } } } if ShellBridge.error != "": parity-shell-error := Text { text: ShellBridge.error; color: Theme.error; wrap: word-wrap; accessible-role: text; accessible-label: self.text; } if ShellBridge.destination == 0 && ShellBridge.codec-warning != "": parity-channel-codec-warning := Text { text: ShellBridge.codec-warning; color: Theme.warning; wrap: word-wrap; accessible-role: text; accessible-label: self.text; accessible-live-region: polite; } if ShellBridge.loading: Text { text: ShellBridge.label-loading; color: Theme.muted; } HorizontalLayout { spacing: 0px; vertical-stretch: 1; if ShellBridge.destination == 3: SettingsScreen { width: root.main-width; window-width: root.width; settings-label: ShellBridge.destinations[3]; } if ShellBridge.destination == 2: Rectangle { background: Theme.shaded; VerticalLayout { padding: 12px; spacing: 4px; HorizontalLayout { Text { text: ShellBridge.destinations[2]; color: Theme.fg; font-size: Theme.font-size * 1.6; font-weight: 700; overflow: elide; horizontal-stretch: 1; } if ShellBridge.contact-add-command != "": ChromeButton { glyph: 8; label: ShellBridge.label-add-contact; clicked => { ShellBridge.invoke(ShellBridge.contact-add-command); } } } ListView { for item in ShellBridge.contacts: Rectangle { height: item.kind == 4 ? 30px : max(44px, Theme.touch-target); if item.kind == 4: parity-contact-disclosure := ChromeButton { width: parent.width; height: parent.height; glyph: item.expanded ? 5 : 6; text: item.unread == "" ? item.title : item.title + " (" + item.unread + ")"; center-text: false; ink: ShellColors.subtitle; accessible-expanded: item.expanded; clicked => { ShellBridge.expand(item.id); } } if item.kind != 4: EntryRow { item: item; } } } if ShellBridge.contacts.length == 0: Text { text: ShellBridge.label-empty; color: Theme.muted; } } } if ShellBridge.destination == 0 || ShellBridge.destination == 1: HorizontalLayout { spacing: 0px; if root.desktop-tree: DesktopServerPane { width: root.actual-server; chat-visible: root.chat-open; bookmark-drop-width: root.actual-sidebar; } if !root.desktop && ShellBridge.destination == 0 && (!root.compact || ShellBridge.depth == 0): Rectangle { width: root.compact ? root.width : root.actual-server; background: Theme.bg; VerticalLayout { spacing: 0px; ScrollView { height: Theme.touch-target; HorizontalLayout { for tab in ShellBridge.tabs: ActionButton { text: tab.title + (tab.microphone-owner ? " · " + ShellBridge.label-mute : "") + (tab.unread != "" ? " (" + tab.unread + ")" : ""); primary: tab.selected; clicked => { ShellBridge.select(tab.id); } } } } if root.compact && ShellBridge.tabs.length == 0: ListView { for item in ShellBridge.bookmarks: EntryRow { item: item; } } ListView { for item in ShellBridge.tree: EntryRow { item: item; } } if ShellBridge.tree.length == 0 && ShellBridge.identity-review.id == "": Text { text: ShellBridge.label-tree-empty; color: Theme.muted; wrap: word-wrap; } if ShellBridge.identity-review.id != "": ActionButton { text: ShellBridge.identity-review.label; clicked => { ShellBridge.invoke(ShellBridge.identity-review.id); } } if !root.desktop: CommandList { commands: ShellBridge.actions; } } } if !root.compact || ShellBridge.depth > 0 || ShellBridge.destination == 1: parity-detail-pane := Rectangle { background: Theme.shaded; VerticalLayout { spacing: root.desktop ? 0px : 4px; if root.desktop: parity-detail-header := Rectangle { height: 71px; background: ShellColors.detail-header; HorizontalLayout { padding-left: 15px; padding-right: 10px; spacing: 10px; if (root.chat-open ? ChatBridge.title : ShellBridge.title) != "": VerticalLayout { width: 38px; alignment: center; ShellGlyph { glyph: root.chat-open && ChatBridge.can-info ? 2 : 19; width: 38px; height: 38px; ink: root.chat-open && ChatBridge.can-info ? (Theme.dark ? #a3b4b3 : #445d77) : (Theme.dark ? #dbeaf7 : #445d77); } } VerticalLayout { min-width: 0px; alignment: center; Text { text: root.chat-open && ChatBridge.title != "" ? ChatBridge.title : ShellBridge.title; color: Theme.fg; font-size: 24px; font-weight: 700; overflow: elide; } if !root.chat-open && ShellBridge.subtitle != "": Text { text: ShellBridge.subtitle; color: Theme.muted; font-size: 13px; overflow: elide; } } if ShellBridge.destination != 1: VerticalLayout { width: min(106px, root.detail-width * 0.38); alignment: center; Rectangle { height: 26px; border-radius: 100px; background: Theme.bg; HorizontalLayout { padding-left: 3px; padding-right: 3px; spacing: 1px; for name[index] in ShellBridge.stages: ChromeButton { horizontal-stretch: 1; glyph: index == 0 ? 16 : index == 1 ? 3 : 12; label: name; active: ShellBridge.stage == index; clicked => { ShellBridge.select-stage(index); } } } } } if root.chat-open && ChatBridge.can-info: VerticalLayout { width: 30px; alignment: center; ChromeButton { glyph: 16; width: 30px; label: ChatBridge.tr("admin.info"); clicked => { ChatBridge.client-info(); } } } if root.chat-open: VerticalLayout { width: 30px; alignment: center; ChromeButton { glyph: 18; width: 30px; label: ChatBridge.tr("admin.search"); clicked => { ChatBridge.toggle-search(); } } } } } if root.desktop: Rectangle { height: 4px; Rectangle { x: 20px; width: max(0px, parent.width - 40px); height: 4px; border-radius: 4px; background: Theme.header; } } if !root.desktop: Rectangle { min-height: 71px; background: Theme.shaded; VerticalLayout { padding: 12px; Text { text: ShellBridge.title; color: Theme.fg; font-size: Theme.font-size * 1.6; font-weight: 700; overflow: elide; } Text { text: ShellBridge.subtitle; color: Theme.muted; overflow: elide; } } } if !root.desktop: HorizontalLayout { for name[index] in ShellBridge.stages: ActionButton { text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.select-stage(index); } } } if root.chat-open: ChatScreen { width: root.detail-width; embedded-header: root.desktop; } if ShellBridge.stage == 2 && ShellBridge.destination != 1: ScrollView { VerticalLayout { padding: 10px; spacing: 10px; if ShellBridge.streams.length == 0: Text { text: ShellBridge.label-stream-empty; color: Theme.muted; wrap: word-wrap; } for stream in ShellBridge.streams: StreamTile { item: stream; } CommandList { commands: ShellBridge.detail-actions; } } } if ShellBridge.stage == 0 && ShellBridge.destination != 1: VerticalLayout { if ShellBridge.detail-loading: Text { text: ShellBridge.label-loading; color: Theme.muted; } if ShellBridge.detail-error != "": Text { text: ShellBridge.detail-error; color: Theme.error; wrap: word-wrap; } if ShellBridge.searchable: TextField { text: ShellBridge.search; placeholder: ShellBridge.label-search; edited(value) => { ShellBridge.search-edited(value); } } ScrollView { VerticalLayout { padding: 12px; spacing: 12px; if ShellBridge.description != "": Text { text: ShellBridge.description; color: Theme.fg; wrap: word-wrap; } for row in ShellBridge.info: VerticalLayout { Text { text: row.label; color: Theme.muted; } Text { text: row.value; color: Theme.fg; wrap: word-wrap; } } CommandList { commands: ShellBridge.detail-actions; } } } ListView { for item in ShellBridge.entries: EntryRow { item: item; } } if ShellBridge.has-previous || ShellBridge.has-next: HorizontalLayout { ActionButton { text: ShellBridge.label-previous; enabled: ShellBridge.has-previous; clicked => { ShellBridge.page(false); } } ActionButton { text: ShellBridge.label-next; enabled: ShellBridge.has-next; clicked => { ShellBridge.page(true); } } } } } } } } if !root.desktop && ShellBridge.has-voice: Rectangle { min-height: Theme.touch-target + 12px; background: Theme.contrast; VerticalLayout { Text { text: ShellBridge.voice-title + " · " + ShellBridge.voice-status; color: ShellBridge.transmitting ? Theme.success : Theme.fg; overflow: elide; } HorizontalLayout { spacing: 4px; ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-mute; destructive: ShellBridge.muted; clicked => { ShellBridge.voice(0); } } ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-deafen; destructive: ShellBridge.deafened; clicked => { ShellBridge.voice(1); } } HoldButton { } } } } if ShellBridge.status != "": Text { text: ShellBridge.status; color: Theme.muted; overflow: elide; } if root.compact: HorizontalLayout { height: max(48px, Theme.touch-target); for label[index] in ShellBridge.destinations: ActionButton { min-width: 0px; horizontal-stretch: 1; text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } } } } } if root.desktop: Rectangle { x: root.actual-sidebar - 4.5px; y: 44px; width: 9px; height: max(0px, root.height - self.y); background: split1.pressed ? Theme.tint.with-alpha(0.5) : transparent; accessible-role: slider; accessible-label: ShellBridge.label-resize; split1 := TouchArea { mouse-cursor: ew-resize; moved => { if self.pressed { root.sidebar-width = clamp(root.actual-sidebar + self.mouse-x - self.pressed-x,62px,min(420px,max(62px,root.width - 515px))); } } pointer-event(e) => { if e.kind == PointerEventKind.up { if root.sidebar-width < 200px { root.sidebar-width = 62px; } ShellBridge.resized(root.sidebar-width/1px,root.server-width/1px); } } } } if root.desktop-tree: Rectangle { x: root.actual-sidebar + root.actual-server - 4.5px; y: 44px; width: 9px; height: max(0px, root.height - self.y); background: split2.pressed ? Theme.tint.with-alpha(0.5) : transparent; accessible-role: slider; accessible-label: ShellBridge.label-resize; split2 := TouchArea { mouse-cursor: ew-resize; moved => { if self.pressed { root.server-width = clamp(root.actual-server + self.mouse-x - self.pressed-x,220px,root.max-server-width); } } pointer-event(e) => { if e.kind == PointerEventKind.up { ShellBridge.resized(root.sidebar-width/1px,root.server-width/1px); } } } } if ShellBridge.fullscreen-stream != "": Rectangle { background: Theme.contrast; VerticalLayout { ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.fullscreen-stream = ""; } } for stream in ShellBridge.streams: StreamTile { visible: stream.id == ShellBridge.fullscreen-stream; height: self.visible ? parent.height - Theme.touch-target : 0px; item: stream; } } } if ShellBridge.menu-visible && root.desktop: Rectangle { property inset: 8px; TouchArea { clicked => { if self.mouse-x < parity-context-menu.x || self.mouse-x >= parity-context-menu.x + parity-context-menu.width || self.mouse-y < parity-context-menu.y || self.mouse-y >= parity-context-menu.y + parity-context-menu.height { ShellBridge.close-menu(); } } pointer-event(e) => { if e.button == PointerEventButton.right && e.kind == PointerEventKind.down && (self.mouse-x < parity-context-menu.x || self.mouse-x >= parity-context-menu.x + parity-context-menu.width || self.mouse-y < parity-context-menu.y || self.mouse-y >= parity-context-menu.y + parity-context-menu.height) { ShellBridge.close-menu(); } } } parity-context-menu := Rectangle { width: min(236px, max(0px, parent.width - 2 * parent.inset)); height: min(450px, min(max(0px, parent.height - 2 * parent.inset), 30px + menu-rows.preferred-height)); x: clamp(ShellBridge.menu-x * 1px - root.absolute-position.x, parent.inset, parent.width - self.width - parent.inset); y: clamp(ShellBridge.menu-y * 1px - root.absolute-position.y, parent.inset, parent.height - self.height - parent.inset); background: ShellColors.popup; border-radius: 8px; clip: true; border-width: Theme.dark ? 0px : 1px; border-color: #e6eef3; drop-shadow-offset-x: 1px; drop-shadow-offset-y: 1px; drop-shadow-blur: 2px; drop-shadow-color: #0003; accessible-role: list; accessible-label: ShellBridge.menu-title; FocusScope { init => { self.focus(); } } if ShellBridge.menu-glyph >= 0: ShellGlyph { x: 5px; y: 4px; glyph: ShellBridge.menu-glyph; ink: ShellColors.popup-disabled; } Text { x: 36px; y: 0px; width: max(0px, parent.width - self.x - 8px); height: 30px; text: ShellBridge.menu-title; color: ShellColors.popup-disabled; font-size: 15px; font-weight: 500; vertical-alignment: center; overflow: elide; } ScrollView { x: 0px; y: 30px; width: parent.width; height: max(0px, parent.height - self.y); menu-rows := VerticalLayout { spacing: 0px; for command in ShellBridge.menu-actions: VerticalLayout { if command.heading: Rectangle { height: 22px; Text { x: 10px; width: max(0px, parent.width - 20px); text: command.label; color: ShellColors.subtitle; font-size: 13px; vertical-alignment: center; overflow: elide; } } if !command.heading: DesktopMenuEntry { command: command; } } } } } } if ShellBridge.menu-visible && !root.desktop: Rectangle { background: Theme.contrast.with-alpha(0.7); TouchArea { clicked => { ShellBridge.close-menu(); } } Rectangle { width: min(parent.width - 24px,360px); height: min(parent.height - 24px, menu.preferred-height); x: parent.width - self.width - 12px; y: root.compact ? parent.height - self.height - 12px : 12px; background: Theme.header; border-radius: 8px; border-width: 1px; border-color: Theme.outline; menu := VerticalLayout { padding: 12px; spacing: 8px; Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; } ScrollView { CommandList { commands: ShellBridge.menu-actions; } } ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } } } } } } export component StreamWindow inherits Window { in property item; title: item.title; preferred-width: 960px; preferred-height: 640px; min-width: 320px; min-height: 240px; background: Theme.contrast; default-font-family: Theme.font-family; default-font-size: Theme.font-size; StreamTile { item: root.item; } }