From d4aa5e100368728929e0c4ab792e1e770dd7e452 Mon Sep 17 00:00:00 2001 From: gramps Date: Wed, 26 Aug 2026 08:28:48 -0700 Subject: [PATCH] Thumbnail strip: show hotkey label next to each scene name --- MainWindow.xaml | 7 ++++--- Models/Scene.cs | 11 +++++++++++ Models/SceneCatalog.cs | 12 ++++++++++++ ViewModels/MainViewModel.cs | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/MainWindow.xaml b/MainWindow.xaml index ad7d607..8b020dc 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -238,11 +238,12 @@ Stretch="UniformToFill" RenderOptions.BitmapScalingMode="LowQuality"/> - + TextTrimming="CharacterEllipsis"> + + diff --git a/Models/Scene.cs b/Models/Scene.cs index ad6d411..06f72c8 100644 --- a/Models/Scene.cs +++ b/Models/Scene.cs @@ -15,6 +15,7 @@ public class Scene : INotifyPropertyChanged private bool _hasSocialBar; private bool _isStaged; private bool _isLive; + private string _hotkeyLabel = string.Empty; public bool IsStaged { @@ -83,6 +84,16 @@ public class Scene : INotifyPropertyChanged set => Set(ref _snapshot, value); } + /// + /// The current hotkey label for this scene (e.g. "F1", "Ctrl+F10"). + /// Set by MainViewModel from the active bindings; empty for non-canonical scenes. + /// + public string HotkeyLabel + { + get => _hotkeyLabel; + set => Set(ref _hotkeyLabel, value); + } + public event PropertyChangedEventHandler? PropertyChanged; private void Set(ref T field, T value, [CallerMemberName] string? propertyName = null) diff --git a/Models/SceneCatalog.cs b/Models/SceneCatalog.cs index 89799fe..224f7cd 100644 --- a/Models/SceneCatalog.cs +++ b/Models/SceneCatalog.cs @@ -1,7 +1,9 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Windows.Data; +using ytLive.Services; namespace ytLive.Models; @@ -21,6 +23,16 @@ public static class SceneCatalog public static readonly string[] All = { Starting, Live, Brb, Chat, Ending }; + /// Maps each canonical scene name to its hotkey action. + public static readonly IReadOnlyDictionary SceneHotkeys = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + [Starting] = HotkeyId.SceneStarting, + [Live] = HotkeyId.SceneLive, + [Brb] = HotkeyId.SceneBrb, + [Chat] = HotkeyId.SceneChat, + [Ending] = HotkeyId.SceneEnding, + }; + private static readonly Dictionary DisplayNames = new(StringComparer.OrdinalIgnoreCase) { }; diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index e300bc2..d73ac9e 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -404,6 +404,22 @@ public class MainViewModel : ViewModelBase // Reload bindings from DB (the dialog already saved them). _hotkeyBindings = _layoutStore.LoadHotkeyBindings(); HotkeyBindingsChanged?.Invoke(_hotkeyBindings); + RefreshHotkeyLabels(); + } + } + + private void RefreshHotkeyLabels() + { + foreach (var scene in Scenes) + { + if (SceneCatalog.SceneHotkeys.TryGetValue(scene.Name, out var hid) + && _hotkeyBindings.TryGetValue(hid, out var chord)) + scene.HotkeyLabel = chord.ToDisplayString(); + else if (SceneCatalog.SceneHotkeys.TryGetValue(scene.Name, out var defId) + && GlobalHotkeyManager.Defaults.TryGetValue(defId, out var defChord)) + scene.HotkeyLabel = defChord.ToDisplayString(); + else + scene.HotkeyLabel = string.Empty; } } @@ -1842,6 +1858,7 @@ public class MainViewModel : ViewModelBase AddScene(name); } HealBackgrounds(); + RefreshHotkeyLabels(); foreach (var scene in Scenes) foreach (var config in scene.Elements.OfType())