Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix(windows): after a long sentence with the talk key, the bar's Speaking to others / Sent to meeting status is no longer pushed off its edge

wquguruef7839f17bd7
diff --git a/site/changelog.json b/site/changelog.json
index 72d1508..e35df44 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -72,6 +72,14 @@
],
"title": "正在听时在设置里换了界面语言,回来后“结束”按钮也跟着换。",
"text": "原来底部的“结束”还停在旧的语言。"
+ },
+ {
+ "kind": "fixed",
+ "platforms": [
+ "windows"
+ ],
+ "title": "按住说话键说的话很长时,底部提示条右边的“正在说给对方听…”“对方已听到”不再被挤出边外。",
+ "text": "长句子会换行,状态始终留在提示条右边。"
}
]
},
diff --git a/windows/src/Cicada/SpeakBar.cs b/windows/src/Cicada/SpeakBar.cs
index 2b0deb3..1bca0ae 100644
--- a/windows/src/Cicada/SpeakBar.cs
+++ b/windows/src/Cicada/SpeakBar.cs
@@ -56,8 +56,8 @@ sealed class SpeakBar : Window
var said = new StackPanel { VerticalAlignment = VerticalAlignment.Center, MaxWidth = 480 };
if (s.Said is not null) said.Children.Add(Ui.Text(s.Said, 12, Palette.NightText));
said.Children.Add(Gap(Ui.Text(s.Heard!, 15, Brushes.White, FontWeights.Bold), s.Said is null ? 0 : 2));
- var done = s.State == SpeakEngine.Phase.Speaking ? L("正在说给对方听…") : L("对方已听到");
- content = Ui.Row(12, Key(false), said, Ui.Text(done, 12, Palette.NightText, wrap: false));
+ var done = Ui.Text(s.State == SpeakEngine.Phase.Speaking ? L("正在说给对方听…") : L("对方已听到"), 12, Palette.NightText, wrap: false);
+ content = Fill(Key(false), said, done);
if (s.State == SpeakEngine.Phase.Idle) hide.Start();
break;
case SpeakEngine.Phase.Failed:
@@ -92,5 +92,21 @@ sealed class SpeakBar : Window
return row;
}
+ /// The key, then what was said taking whatever width is left, then the status at the right: in a
+ /// plain row a long sentence pushed the status out past the bar's edge.
+ static FrameworkElement Fill(FrameworkElement key, FrameworkElement said, FrameworkElement status)
+ {
+ var dock = new DockPanel { LastChildFill = true };
+ foreach (var (e, side) in new[] { (key, Dock.Left), (status, Dock.Right) })
+ {
+ e.VerticalAlignment = VerticalAlignment.Center;
+ DockPanel.SetDock(e, side);
+ dock.Children.Add(e);
+ }
+ key.Margin = new Thickness(0, 0, 12, 0); status.Margin = new Thickness(12, 0, 0, 0);
+ dock.Children.Add(said);
+ return dock;
+ }
+
static FrameworkElement Gap(FrameworkElement e, double top) { e.Margin = new Thickness(0, top, 0, 0); return e; }
}