Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
Not accessible with screen readers #86
Browse files Browse the repository at this point in the history
Update PoeShared to the latest version
  • Loading branch information
iXab3r committed May 14, 2022
1 parent a0a38d6 commit bfdcaac
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 51 deletions.
1 change: 1 addition & 0 deletions InitSymlinks.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mklink /J /D PoeShared.Wpf "../Submodules/PoeEye/PoeEye/PoeShared.Wpf"
mklink /J /D PoeShared.Native "../Submodules/PoeEye/PoeEye/PoeShared.Native"
mklink /J /D PoeShared.Tests "../Submodules/PoeEye/PoeEye/PoeShared.Tests"
mklink /J /D PoeShared.Squirrel "../Submodules/PoeEye/PoeEye/PoeShared.Squirrel"
mklink /J /D PoeShared.Squirrel.Shared "../Submodules/PoeEye/PoeEye/PoeShared.Squirrel.Shared"
mklink /J /D WindowsHook "../Submodules/PoeEye/PoeEye/WindowsHook"

mklink /J /D PropertyBinder "../Submodules/PropertyBinder/PropertyBinder"
Expand Down
21 changes: 21 additions & 0 deletions Sources/MicSwitch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PropertyBinder.Tests", "Pro
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsHook", "WindowsHook\WindowsHook.csproj", "{C742ABE3-0AA7-4BEB-9CD6-4D1D6AC14576}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoeShared.Squirrel.Shared", "PoeShared.Squirrel.Shared\PoeShared.Squirrel.Shared.csproj", "{578AC8DF-BF63-4E96-80BA-B37719574D50}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PoeShared", "PoeShared", "{E115FC7A-D043-42D0-9499-775104DC16D3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PropertyBinder", "PropertyBinder", "{CA5EC122-971C-4D1C-85E2-2187B0994C15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -66,5 +72,20 @@ Global
{C742ABE3-0AA7-4BEB-9CD6-4D1D6AC14576}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C742ABE3-0AA7-4BEB-9CD6-4D1D6AC14576}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C742ABE3-0AA7-4BEB-9CD6-4D1D6AC14576}.Release|Any CPU.Build.0 = Release|Any CPU
{578AC8DF-BF63-4E96-80BA-B37719574D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{578AC8DF-BF63-4E96-80BA-B37719574D50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{578AC8DF-BF63-4E96-80BA-B37719574D50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{578AC8DF-BF63-4E96-80BA-B37719574D50}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D304A5F9-62BB-4F5C-BC2C-5DD5DEE1C8AF} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{9AAA9005-0177-4F4C-B6DE-EB09037DB155} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{727A7F09-1047-4A8B-9114-09C715EAF2ED} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{578AC8DF-BF63-4E96-80BA-B37719574D50} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{4DFAC175-EE57-4540-86E2-6E96904D7221} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{38C9EBE2-2AC9-465F-8A2A-49DFB1CB9383} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{C742ABE3-0AA7-4BEB-9CD6-4D1D6AC14576} = {E115FC7A-D043-42D0-9499-775104DC16D3}
{BFF3B5DC-3EBB-4F4E-A679-0B39754DA2AA} = {CA5EC122-971C-4D1C-85E2-2187B0994C15}
{F0EC5ADD-A535-4604-B9DD-ABBB119095B3} = {CA5EC122-971C-4D1C-85E2-2187B0994C15}
EndGlobalSection
EndGlobal
14 changes: 2 additions & 12 deletions Sources/MicSwitch/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,8 @@ private void InitializeUpdateSettings()
{
var updateSourceProvider = Container.Resolve<IUpdateSourceProvider>();
Log.Debug($"Reconfiguring {nameof(UpdateSettingsConfig)}, current update source: {updateSourceProvider.UpdateSource}");
UpdateSettings.WellKnownUpdateSources.ForEach(x => updateSourceProvider.AddSource(x));

if (!updateSourceProvider.UpdateSource.IsValid || !UpdateSettings.WellKnownUpdateSources.Contains(updateSourceProvider.UpdateSource))
{
var plusUpdateSource = UpdateSettings.WellKnownUpdateSources.First();
Log.Info($"Future updates will be provided by {plusUpdateSource} instead of {updateSourceProvider.UpdateSource} (isValid: {updateSourceProvider.UpdateSource.IsValid})");
updateSourceProvider.UpdateSource = plusUpdateSource;
}
else
{
Log.Info($"Updates are provided by {updateSourceProvider.UpdateSource}");
}
updateSourceProvider.KnownSources = UpdateSettings.WellKnownUpdateSources;
Log.Debug(() => $"Update source provider {updateSourceProvider}, active: {updateSourceProvider.UpdateSource}, known sources: {updateSourceProvider.KnownSources.DumpToString()}");
}

private void SingleInstanceValidationRoutine(bool retryIfAbandoned)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ internal sealed class HotkeyEditorViewModel : DisposableReactiveObject, IHotkeyE
private bool ignoreModifiers;
private bool hasModifiers;
private bool isMouse;
private string description;

static HotkeyEditorViewModel()
{
Expand Down Expand Up @@ -68,6 +69,13 @@ public HotkeyGesture Key
set => RaiseAndSetIfChanged(ref key, value);
}


public string Description
{
get => description;
set => RaiseAndSetIfChanged(ref description, value);
}

public HotkeyGesture AlternativeKey
{
get => alternativeKey;
Expand All @@ -79,7 +87,7 @@ public bool SuppressKey
get => suppressKey;
set => RaiseAndSetIfChanged(ref suppressKey, value);
}

public bool IgnoreModifiers
{
get => ignoreModifiers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ internal interface IHotkeyEditorViewModel : IDisposableReactiveObject
{
HotkeyConfig Properties { get; }

string Description { get; set; }

HotkeyGesture Key { get; set; }

HotkeyGesture AlternativeKey { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
Expand Down Expand Up @@ -330,7 +331,7 @@ public MainWindowViewModel(
public bool RunAtLogin => startupManager.IsRegistered;

public Size MinSize { get; } = new Size(600, 430);
public Size MaxSize { get; } = new Size(900, 680);
public Size MaxSize { get; } = new Size(900, 980);
public Size DefaultSize { get; } = new Size(600, 680);

public WindowState WindowState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq.Expressions;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using DynamicData;
using DynamicData.Binding;
Expand Down Expand Up @@ -64,12 +65,12 @@ public MicrophoneControllerViewModel(
this.hotkeyConfigProvider = hotkeyConfigProvider;
this.uiScheduler = uiScheduler;
MuteMicrophoneCommand = CommandWrapper.Create<object>(MuteMicrophoneCommandExecuted);
Hotkey = PrepareHotkey(x => x.Hotkey, (config, hotkeyConfig) => config.Hotkey = hotkeyConfig);
HotkeyToggle = PrepareHotkey(x => x.HotkeyForToggle, (config, hotkeyConfig) => config.HotkeyForToggle = hotkeyConfig);
HotkeyMute = PrepareHotkey(x => x.HotkeyForMute, (config, hotkeyConfig) => config.HotkeyForMute = hotkeyConfig);
HotkeyUnmute = PrepareHotkey(x => x.HotkeyForUnmute, (config, hotkeyConfig) => config.HotkeyForUnmute = hotkeyConfig);
HotkeyPushToMute = PrepareHotkey(x => x.HotkeyForPushToMute, (config, hotkeyConfig) => config.HotkeyForPushToMute = hotkeyConfig);
HotkeyPushToTalk = PrepareHotkey(x => x.HotkeyForPushToTalk, (config, hotkeyConfig) => config.HotkeyForPushToTalk = hotkeyConfig);
Hotkey = PrepareHotkey("Mute/Un-mute microphone", x => x.Hotkey, (config, hotkeyConfig) => config.Hotkey = hotkeyConfig);
HotkeyToggle = PrepareHotkey("Toggle microphone state", x => x.HotkeyForToggle, (config, hotkeyConfig) => config.HotkeyForToggle = hotkeyConfig);
HotkeyMute = PrepareHotkey("Mute microphone", x => x.HotkeyForMute, (config, hotkeyConfig) => config.HotkeyForMute = hotkeyConfig);
HotkeyUnmute = PrepareHotkey("Un-mute microphone", x => x.HotkeyForUnmute, (config, hotkeyConfig) => config.HotkeyForUnmute = hotkeyConfig);
HotkeyPushToMute = PrepareHotkey("Push-To-Mute", x => x.HotkeyForPushToMute, (config, hotkeyConfig) => config.HotkeyForPushToMute = hotkeyConfig);
HotkeyPushToTalk = PrepareHotkey("Push-To-Talk", x => x.HotkeyForPushToTalk, (config, hotkeyConfig) => config.HotkeyForPushToTalk = hotkeyConfig);

PrepareTracker(HotkeyMode.Click, HotkeyToggle)
.ObservableForProperty(x => x.IsActive, skipInitial: true)
Expand Down Expand Up @@ -315,11 +316,13 @@ public bool MicrophoneVolumeControlEnabled
public CommandWrapper MuteMicrophoneCommand { get; }

private IHotkeyEditorViewModel PrepareHotkey(
string description,
Expression<Func<MicSwitchHotkeyConfig, HotkeyConfig>> fieldToMonitor,
Action<MicSwitchHotkeyConfig, HotkeyConfig> consumer)
{
return PrepareHotkey(
this,
description,
fieldToMonitor,
consumer).AddTo(Anchors);
}
Expand Down Expand Up @@ -387,6 +390,7 @@ private static IHotkeyTracker PrepareTracker(

private static IHotkeyEditorViewModel PrepareHotkey(
MicrophoneControllerViewModel owner,
string description,
Expression<Func<MicSwitchHotkeyConfig, HotkeyConfig>> fieldToMonitor,
Action<MicSwitchHotkeyConfig, HotkeyConfig> consumer)
{
Expand All @@ -411,6 +415,8 @@ private static IHotkeyEditorViewModel PrepareHotkey(
owner.hotkeyConfigProvider.Save(hotkeyConfig);
}, Log.HandleUiException)
.AddTo(owner.Anchors);

result.Description = description;

return result;
}
Expand Down
31 changes: 25 additions & 6 deletions Sources/MicSwitch/MainWindow/Views/HotkeyEditorView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,41 @@
xmlns:viewModels="clr-namespace:MicSwitch.MainWindow.ViewModels">
<DataTemplate DataType="{x:Type viewModels:HotkeyEditorViewModel}">
<st:StackPanel Orientation="Horizontal" MarginBetweenChildren="5">
<eye:HotKeyBox st:StackPanel.Fill="Fill" HotKey="{Binding Key}" Background="Transparent" AcceptsTab="False" AcceptsReturn="False"
AcceptsMouseKeys="True" />
<eye:HotKeyBox st:StackPanel.Fill="Fill"
HotKey="{Binding Key}"
Background="Transparent"
AcceptsTab="False"
AcceptsReturn="False"
AcceptsMouseKeys="True">
<eye:HotKeyBox.ToolTip>
<MultiBinding Converter="{StaticResource StringFormatConverter}"
ConverterParameter="Hotkey for {0} - Press Backspace, Delete or Escape to reset. Double-click respective keys to assign them as HotKeys">
<Binding Path="Description"/>
</MultiBinding>
</eye:HotKeyBox.ToolTip>
</eye:HotKeyBox>
<TextBlock Margin="10,0" Text="or" FontWeight="Bold" />
<eye:HotKeyBox st:StackPanel.Fill="Fill" HotKey="{Binding AlternativeKey}" Background="Transparent"
<eye:HotKeyBox st:StackPanel.Fill="Fill"
HotKey="{Binding AlternativeKey}" Background="Transparent"
AcceptsTab="False"
AcceptsReturn="False"
AcceptsMouseKeys="True" />
AcceptsMouseKeys="True">
<eye:HotKeyBox.ToolTip>
<MultiBinding Converter="{StaticResource StringFormatConverter}"
ConverterParameter="Alternative hotkey for {0} - Press Backspace, Delete or Escape to reset. Double-click respective keys to assign them as HotKeys">
<Binding Path="Description"/>
</MultiBinding>
</eye:HotKeyBox.ToolTip>
</eye:HotKeyBox>
<st:StackPanel Orientation="Vertical" MarginBetweenChildren="2.5">
<CheckBox
Content="Suppress"
ToolTip="If enabled other applications will not react to pressed hotkey. May not work for mouse buttons or special keys"
ToolTip="If enabled other applications will not react to selected hotkeys. May not work for mouse buttons or special keys"
IsChecked="{Binding SuppressKey, Mode=TwoWay}" />
<CheckBox
IsEnabled="{Binding HasModifiers, Converter={StaticResource NotConverter}}"
Content="Ignore modifiers"
ToolTip="Ctrl/Alt/Shift state will be ignored"
ToolTip="Ctrl/Alt/Shift state will be ignored for selected hotkeys"
IsChecked="{Binding IgnoreModifiers}" />
</st:StackPanel>
</st:StackPanel>
Expand Down
Loading

0 comments on commit bfdcaac

Please sign in to comment.