Render channel commander status and confirm self-only changes
This commit is contained in:
1 parent
d9570f3cc8
commit
d1450439d5
20 files changed
+640
-64
No files matched your search
+75
-50
@@ -8,6 +8,7 @@ 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 }
|
||||
@@ -16,6 +17,7 @@ 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 <bool> compact-tree;
|
||||
in-out property <bool> channel-commander-as-lamp: true;
|
||||
in-out property <[ShellTab]> tabs;
|
||||
in-out property <[ShellRow]> tree;
|
||||
in-out property <[ShellRow]> bookmarks;
|
||||
@@ -90,6 +92,7 @@ export global ShellBridge {
|
||||
in-out property <string> label-connections;
|
||||
in-out property <string> label-new-connection;
|
||||
in-out property <string> label-away;
|
||||
in-out property <string> label-commander;
|
||||
in-out property <string> label-password;
|
||||
in-out property <string> label-capture;
|
||||
in-out property <string> label-create-channel;
|
||||
@@ -148,51 +151,6 @@ component RecordingWaveform inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
component EntryRow inherits Rectangle {
|
||||
in property <ShellRow> item;
|
||||
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.title + ". " + item.subtitle;
|
||||
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.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.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); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global ShellColors {
|
||||
out property <color> bar: Theme.dark ? #121a2c : Theme.shaded;
|
||||
@@ -212,6 +170,9 @@ global ShellColors {
|
||||
out property <brush> tree: @linear-gradient(25deg, Theme.dark ? #252f44 : #e1e3ed 0%, Theme.dark ? #2e374c : Theme.bg 60%);
|
||||
out property <brush> banner: @linear-gradient(180deg, (Theme.dark ? #0b1124 : Theme.contrast).with-alpha(0.9), (Theme.dark ? #222c41 : Theme.deviant).with-alpha(0.9));
|
||||
out property <brush> channel: @linear-gradient(90deg, Theme.dark ? #192031 : #a9bee1 50%, Theme.dark ? #1d263a : #8391b3 100%);
|
||||
out property <brush> commander-idle: Theme.high-contrast ? Theme.fg : Theme.commander;
|
||||
out property <brush> commander-talking: Theme.high-contrast ? Theme.success :
|
||||
@linear-gradient(203deg, Theme.commander-talking-start, Theme.commander-talking-stop);
|
||||
}
|
||||
|
||||
component CommandList inherits VerticalLayout {
|
||||
@@ -253,12 +214,13 @@ component StreamTile inherits Rectangle {
|
||||
component ShellGlyph inherits Rectangle {
|
||||
in property <int> glyph;
|
||||
in property <color> ink: Theme.fg;
|
||||
in property <brush> 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.ink; stroke-width: 1.5px;
|
||||
fill: root.glyph == 2 ? root.ink : transparent;
|
||||
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" :
|
||||
@@ -288,10 +250,65 @@ component ShellGlyph inherits Rectangle {
|
||||
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 <ShellRow> item;
|
||||
private property <bool> 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 <ShellCommand> command;
|
||||
property <length> label-height: 30px;
|
||||
@@ -367,6 +384,8 @@ component DesktopTreeRow inherits Rectangle {
|
||||
property <bool> channel: root.item.kind == 1;
|
||||
property <bool> client: root.item.kind == 2;
|
||||
property <bool> compact-client: root.client && ShellBridge.compact-tree;
|
||||
private property <bool> commander-lamp: root.compact-client && root.item.commander && ShellBridge.channel-commander-as-lamp;
|
||||
private property <bool> commander-icon: root.client && root.item.commander && !root.commander-lamp;
|
||||
property <bool> spacer: root.item.spacer > 0;
|
||||
property <length> indent: min(max(0px, self.width - 90px), min(item.depth, 4) * 10px + max(item.depth - 4, 0) * 5px);
|
||||
property <bool> row-hover: parity-tree-hit.has-hover || more.hovered || (root.item.expandable && arrow.hovered);
|
||||
@@ -375,7 +394,7 @@ component DesktopTreeRow inherits Rectangle {
|
||||
property <bool> 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 : "");
|
||||
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;
|
||||
@@ -397,13 +416,18 @@ component DesktopTreeRow inherits Rectangle {
|
||||
border-radius: 100px; border-width: 1px;
|
||||
border-color: @linear-gradient(90deg, ShellColors.subtitle, ShellColors.subtitle.with-alpha(0));
|
||||
}
|
||||
if !root.spacer: ShellGlyph {
|
||||
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;
|
||||
@@ -416,13 +440,14 @@ component DesktopTreeRow inherits Rectangle {
|
||||
vertical-alignment: center; overflow: elide;
|
||||
}
|
||||
status := Rectangle {
|
||||
property <int> marks: (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);
|
||||
property <int> 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; }
|
||||
|
||||
Reference in new issue
Block a user