Thumbnail strip: show hotkey label next to each scene name
This commit is contained in:
+4
-3
@@ -238,11 +238,12 @@
|
|||||||
Stretch="UniformToFill"
|
Stretch="UniformToFill"
|
||||||
RenderOptions.BitmapScalingMode="LowQuality"/>
|
RenderOptions.BitmapScalingMode="LowQuality"/>
|
||||||
</Border>
|
</Border>
|
||||||
<TextBlock Grid.Row="1" Text="{Binding Name}"
|
<TextBlock Grid.Row="1" Foreground="#a0a0b0" FontSize="10"
|
||||||
Foreground="#a0a0b0" FontSize="10"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Margin="0,2,0,0"
|
Margin="0,2,0,0"
|
||||||
TextTrimming="CharacterEllipsis"/>
|
TextTrimming="CharacterEllipsis">
|
||||||
|
<Run Text="{Binding Name, Mode=OneWay}"/><Run Text=" "/><Run Text="{Binding HotkeyLabel, Mode=OneWay}" Foreground="#6a6a7a" FontWeight="SemiBold"/>
|
||||||
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class Scene : INotifyPropertyChanged
|
|||||||
private bool _hasSocialBar;
|
private bool _hasSocialBar;
|
||||||
private bool _isStaged;
|
private bool _isStaged;
|
||||||
private bool _isLive;
|
private bool _isLive;
|
||||||
|
private string _hotkeyLabel = string.Empty;
|
||||||
|
|
||||||
public bool IsStaged
|
public bool IsStaged
|
||||||
{
|
{
|
||||||
@@ -83,6 +84,16 @@ public class Scene : INotifyPropertyChanged
|
|||||||
set => Set(ref _snapshot, value);
|
set => Set(ref _snapshot, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current hotkey label for this scene (e.g. "F1", "Ctrl+F10").
|
||||||
|
/// Set by MainViewModel from the active bindings; empty for non-canonical scenes.
|
||||||
|
/// </summary>
|
||||||
|
public string HotkeyLabel
|
||||||
|
{
|
||||||
|
get => _hotkeyLabel;
|
||||||
|
set => Set(ref _hotkeyLabel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
using ytLive.Services;
|
||||||
|
|
||||||
namespace ytLive.Models;
|
namespace ytLive.Models;
|
||||||
|
|
||||||
@@ -21,6 +23,16 @@ public static class SceneCatalog
|
|||||||
|
|
||||||
public static readonly string[] All = { Starting, Live, Brb, Chat, Ending };
|
public static readonly string[] All = { Starting, Live, Brb, Chat, Ending };
|
||||||
|
|
||||||
|
/// <summary>Maps each canonical scene name to its hotkey action.</summary>
|
||||||
|
public static readonly IReadOnlyDictionary<string, HotkeyId> SceneHotkeys = new Dictionary<string, HotkeyId>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
[Starting] = HotkeyId.SceneStarting,
|
||||||
|
[Live] = HotkeyId.SceneLive,
|
||||||
|
[Brb] = HotkeyId.SceneBrb,
|
||||||
|
[Chat] = HotkeyId.SceneChat,
|
||||||
|
[Ending] = HotkeyId.SceneEnding,
|
||||||
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> DisplayNames = new(StringComparer.OrdinalIgnoreCase)
|
private static readonly Dictionary<string, string> DisplayNames = new(StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -404,6 +404,22 @@ public class MainViewModel : ViewModelBase
|
|||||||
// Reload bindings from DB (the dialog already saved them).
|
// Reload bindings from DB (the dialog already saved them).
|
||||||
_hotkeyBindings = _layoutStore.LoadHotkeyBindings();
|
_hotkeyBindings = _layoutStore.LoadHotkeyBindings();
|
||||||
HotkeyBindingsChanged?.Invoke(_hotkeyBindings);
|
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);
|
AddScene(name);
|
||||||
}
|
}
|
||||||
HealBackgrounds();
|
HealBackgrounds();
|
||||||
|
RefreshHotkeyLabels();
|
||||||
|
|
||||||
foreach (var scene in Scenes)
|
foreach (var scene in Scenes)
|
||||||
foreach (var config in scene.Elements.OfType<WebcamSceneConfig>())
|
foreach (var config in scene.Elements.OfType<WebcamSceneConfig>())
|
||||||
|
|||||||
Reference in New Issue
Block a user