From 2e897b788db53cbefc70000fbfcd8f73f470f75b Mon Sep 17 00:00:00 2001 From: Codectory <61698721+Codectory@users.noreply.github.com> Date: Sun, 2 Jan 2022 23:01:03 +0100 Subject: [PATCH] 1.9.1 [Bug fixes] - Display action: Cannot changecolor depth when changing HDR was disabled - Unclear label for changing HDR - Backup settings file will no longer end with ".xml.bak" --- .../ProjectLocales.Designer.cs | 117 ++++++++++-------- .../ProjectLocales.de.resx | 39 +++--- .../ProjectLocales.resx | 39 +++--- Source/AutoHDR/Globals.cs | 2 +- .../Profiles/Actions/AudioDeviceAction.cs | 32 ++--- .../AutoHDR/Profiles/Actions/DisplayAction.cs | 39 +++--- .../Profiles/Actions/ProfileActionAdder.cs | 1 + Source/AutoHDR/Profiles/Profile.cs | 4 +- Source/AutoHDR/Properties/AssemblyInfo.cs | 4 +- Source/AutoHDR/UserAppSettings.cs | 9 ++ Source/AutoHDR/Views/AudioActionView.xaml | 12 +- Source/AutoHDR/Views/DisplayActionView.xaml | 33 +++-- 12 files changed, 182 insertions(+), 149 deletions(-) diff --git a/Source/AutoHDR.ProjectResources/ProjectLocales.Designer.cs b/Source/AutoHDR.ProjectResources/ProjectLocales.Designer.cs index 5b770f1..c16bacc 100644 --- a/Source/AutoHDR.ProjectResources/ProjectLocales.Designer.cs +++ b/Source/AutoHDR.ProjectResources/ProjectLocales.Designer.cs @@ -277,6 +277,24 @@ public static string BuyBeer { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change color depth ähnelt. + /// + public static string ChangeColorDepth { + get { + return ResourceManager.GetString("ChangeColorDepth", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change HDR ähnelt. + /// + public static string ChangeHDR { + get { + return ResourceManager.GetString("ChangeHDR", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Changelog ähnelt. /// @@ -286,6 +304,42 @@ public static string Changelog { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change playback device ähnelt. + /// + public static string ChangePlaybackDevice { + get { + return ResourceManager.GetString("ChangePlaybackDevice", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change record device ähnelt. + /// + public static string ChangeRecordDevice { + get { + return ResourceManager.GetString("ChangeRecordDevice", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change refresh rate ähnelt. + /// + public static string ChangeRefreshRate { + get { + return ResourceManager.GetString("ChangeRefreshRate", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Change resolution ähnelt. + /// + public static string ChangeResolution { + get { + return ResourceManager.GetString("ChangeResolution", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Check for new version on startup ähnelt. /// @@ -628,15 +682,6 @@ public static string Info { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Input device ähnelt. - /// - public static string InputDevice { - get { - return ResourceManager.GetString("InputDevice", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die Primary ähnelt. /// @@ -751,6 +796,15 @@ public static string ManagedHDR { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Invalid settings. ähnelt. + /// + public static string MessageInvalidSettings { + get { + return ResourceManager.GetString("MessageInvalidSettings", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Mssing audio device. ähnelt. /// @@ -877,15 +931,6 @@ public static string Open { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Output device ähnelt. - /// - public static string OutputDevice { - get { - return ResourceManager.GetString("OutputDevice", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die Priority ähnelt. /// @@ -1012,42 +1057,6 @@ public static string Save { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Set color depth ähnelt. - /// - public static string SetColorDepth { - get { - return ResourceManager.GetString("SetColorDepth", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Set HDR ähnelt. - /// - public static string SetHDR { - get { - return ResourceManager.GetString("SetHDR", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Set refresh rate ähnelt. - /// - public static string SetRefreshRate { - get { - return ResourceManager.GetString("SetRefreshRate", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Set resolution ähnelt. - /// - public static string SetResolution { - get { - return ResourceManager.GetString("SetResolution", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die Settings ähnelt. /// diff --git a/Source/AutoHDR.ProjectResources/ProjectLocales.de.resx b/Source/AutoHDR.ProjectResources/ProjectLocales.de.resx index be1627a..56747d2 100644 --- a/Source/AutoHDR.ProjectResources/ProjectLocales.de.resx +++ b/Source/AutoHDR.ProjectResources/ProjectLocales.de.resx @@ -180,9 +180,27 @@ Kauf mir ein Bier! + + Farbtiefe ändern + + + HDR ändern + Changelog + + Wiedergabegerät ändern + + + Aufnahmegerät ändern + + + Bildwiederholrate ändern + + + Auflösung ändern + Beim Start auf neuere Version prüfen @@ -273,9 +291,6 @@ Info - - Eingangsgerät - Hauptmonitor @@ -300,6 +315,9 @@ Automatischer HDR-Modus + + Ungültige Einstellungen + Audiogerät fehlt. @@ -342,9 +360,6 @@ Öffnen - - Ausgangsgerät - Priorität @@ -390,18 +405,6 @@ Speichern - - Farbtiefe ändern - - - HDR ändern - - - Bildwiederholrate ändern - - - Auflösung ändern - Einstellungen diff --git a/Source/AutoHDR.ProjectResources/ProjectLocales.resx b/Source/AutoHDR.ProjectResources/ProjectLocales.resx index 8f37c3c..2524181 100644 --- a/Source/AutoHDR.ProjectResources/ProjectLocales.resx +++ b/Source/AutoHDR.ProjectResources/ProjectLocales.resx @@ -190,9 +190,27 @@ Buy me a beer! + + Change color depth + + + Change HDR + Changelog + + Change playback device + + + Change record device + + + Change refresh rate + + + Change resolution + Check for new version on startup @@ -307,9 +325,6 @@ Info - - Input device - Primary @@ -1016,6 +1031,9 @@ Public License instead of this License. But first, please read Automated HDR mode + + Invalid settings. + Mssing audio device. @@ -1058,9 +1076,6 @@ Public License instead of this License. But first, please read Open - - Output device - Priority @@ -1103,18 +1118,6 @@ Public License instead of this License. But first, please read Save - - Set color depth - - - Set HDR - - - Set refresh rate - - - Set resolution - Settings diff --git a/Source/AutoHDR/Globals.cs b/Source/AutoHDR/Globals.cs index 446475a..a2fb31d 100644 --- a/Source/AutoHDR/Globals.cs +++ b/Source/AutoHDR/Globals.cs @@ -72,7 +72,7 @@ public void LoadSettings() } catch (Exception ex) { - string backupFile = $"{System.AppDomain.CurrentDomain.BaseDirectory}Backup_Settings_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xml.bak"; + string backupFile = $"{System.AppDomain.CurrentDomain.BaseDirectory}Backup_Settings_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.json"; if (File.Exists(SettingsPath)) { File.Move(SettingsPath, backupFile); diff --git a/Source/AutoHDR/Profiles/Actions/AudioDeviceAction.cs b/Source/AutoHDR/Profiles/Actions/AudioDeviceAction.cs index 0a2d56c..9efe5d5 100644 --- a/Source/AutoHDR/Profiles/Actions/AudioDeviceAction.cs +++ b/Source/AutoHDR/Profiles/Actions/AudioDeviceAction.cs @@ -10,43 +10,43 @@ namespace AutoHDR.Profiles.Actions public class AudioDeviceAction : ProfileActionBase { - public override bool CanSave => (SetOutput && OutputDevice!=null) || (SetInput && InputDevice != null); + public override bool CanSave => (ChangePlaybackDevice && PlaybackDevice!=null) || (ChangeRecordDevice && RecordDevice != null); public override string CannotSaveMessage => ProjectLocales.MessageMissingAudioDevice; public override string ActionTypeName => ProjectLocales.AudioAction; - private Guid _outputDeviceID = Guid.Empty; + private Guid _playbackDeviceID = Guid.Empty; [JsonProperty] - public Guid OutputDeviceID { get => _outputDeviceID; set { _outputDeviceID = value; OnPropertyChanged(); OnPropertyChanged(nameof(OutputDevice)); } } + public Guid PlaybackDeviceID { get => _playbackDeviceID; set { _playbackDeviceID = value; OnPropertyChanged(); OnPropertyChanged(nameof(PlaybackDevice)); } } - public AudioDevice OutputDevice { get => AudioController.Instance.OutputAudioDevices.FirstOrDefault(d => d.ID.Equals(OutputDeviceID)); set { OutputDeviceID = value.ID; } } + public AudioDevice PlaybackDevice { get => AudioController.Instance.OutputAudioDevices.FirstOrDefault(d => d.ID.Equals(PlaybackDeviceID)); set { PlaybackDeviceID = value.ID; } } private bool _setOutput = false; [JsonProperty] - public bool SetOutput { get => _setOutput; set { _setOutput = value; OnPropertyChanged(); } } + public bool ChangePlaybackDevice { get => _setOutput; set { _setOutput = value; OnPropertyChanged(); } } - private Guid _inputDeviceID =Guid.Empty; + private Guid _recodDeviceID =Guid.Empty; [JsonProperty] - public Guid InputDeviceID { get => _inputDeviceID; set { _inputDeviceID = value; OnPropertyChanged(); OnPropertyChanged(nameof(InputDevice)); } } + public Guid RecordDeviceID { get => _recodDeviceID; set { _recodDeviceID = value; OnPropertyChanged(); OnPropertyChanged(nameof(RecordDevice)); } } - public AudioDevice InputDevice { get => AudioController.Instance.InputAudioDevices.FirstOrDefault(d => d.ID.Equals(InputDeviceID)); set { InputDeviceID = value.ID; } } + public AudioDevice RecordDevice { get => AudioController.Instance.InputAudioDevices.FirstOrDefault(d => d.ID.Equals(RecordDeviceID)); set { RecordDeviceID = value.ID; } } private bool _setInput = false; [JsonProperty] - public bool SetInput { get => _setInput; set { _setInput = value; OnPropertyChanged(); } } + public bool ChangeRecordDevice { get => _setInput; set { _setInput = value; OnPropertyChanged(); } } - public override string ActionDescription => $"[{(OutputDevice != null && SetOutput ? OutputDevice.Name : string.Empty)} {(InputDevice != null && SetInput ? InputDevice.Name : string.Empty)}]"; + public override string ActionDescription => $"[{(PlaybackDevice != null && ChangePlaybackDevice ? PlaybackDevice.Name : string.Empty)} {(RecordDevice != null && ChangeRecordDevice ? RecordDevice.Name : string.Empty)}]"; public AudioDeviceAction() : base() @@ -57,15 +57,15 @@ public override ActionEndResult RunAction(ApplicationChangedType applicationChan { try { - if (SetOutput) + if (ChangePlaybackDevice) { - CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting output audio device to {OutputDevice.Name}")); - OutputDevice.SetAsDefault(); + CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting playback device to {PlaybackDevice.Name}")); + PlaybackDevice.SetAsDefault(); } - if (SetInput) + if (ChangeRecordDevice) { - CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting input audio device to {InputDevice.Name}")); - InputDevice.SetAsDefault(); + CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting record audio device to {RecordDevice.Name}")); + RecordDevice.SetAsDefault(); } return new ActionEndResult(true); } diff --git a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs index d093a4d..c436f17 100644 --- a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs +++ b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs @@ -17,8 +17,8 @@ namespace AutoHDR.Profiles.Actions [JsonObject(MemberSerialization.OptIn)] public class DisplayAction : ProfileActionBase { - public override bool CanSave => Resolution != null; - public override string CannotSaveMessage => ProjectLocales.MessageMissingAudioDevice; + public override bool CanSave => (!ChangeResolution || Resolution != null) && (!ChangeRefreshRate || RefreshRate != 0) && (!ChangeColorDepth || ColorDepth != ColorDepth.BPCUnkown); + public override string CannotSaveMessage => ProjectLocales.MessageInvalidSettings; public List AllDisplays { get @@ -32,7 +32,8 @@ public List AllDisplays private Display _display = null; [JsonProperty] - public Display Display { + public Display Display + { get => _display; set { @@ -54,24 +55,24 @@ public Display Display { - private bool _setHDR = false; + private bool _changeHDR = false; [JsonProperty] - public bool SetHDR { get => _setHDR; set { _setHDR = value; OnPropertyChanged(); } } + public bool ChangeHDR { get => _changeHDR; set { _changeHDR = value; OnPropertyChanged(); } } - private bool _setResolution = false; + private bool _changeResolution = false; [JsonProperty] - public bool SetResolution { get => _setResolution; set { _setResolution = value; OnPropertyChanged(); } } + public bool ChangeResolution { get => _changeResolution; set { _changeResolution = value; OnPropertyChanged(); } } - private bool _setRefreshRate = false; + private bool _changeRefreshRate = false; [JsonProperty] - public bool SetRefreshRate { get => _setRefreshRate; set { _setRefreshRate = value; OnPropertyChanged(); } } + public bool ChangeRefreshRate { get => _changeRefreshRate; set { _changeRefreshRate = value; OnPropertyChanged(); } } - private bool _setColorDepth =false; + private bool _changeColorDepth =false; [JsonProperty] - public bool SetColorDepth { get => _setColorDepth; set { _setColorDepth = value; OnPropertyChanged(); } } + public bool ChangeColorDepth { get => _changeColorDepth; set { _changeColorDepth = value; OnPropertyChanged(); } } private bool _enableHDR = false; @@ -100,13 +101,13 @@ public override string ActionDescription get { string returnValue = $"[{Display.Name}]:"; - if (SetHDR) + if (ChangeHDR) returnValue += $" {ProjectLocales.HDR} {(EnableHDR ? ProjectLocales.Yes : ProjectLocales.No)}"; - if (SetResolution) + if (ChangeResolution) returnValue += $" {ProjectLocales.Resolution} {Resolution.Width}x{Resolution.Height}"; - if (SetRefreshRate) + if (ChangeRefreshRate) returnValue += $" {ProjectLocales.RefreshRate} {RefreshRate}Hz"; - if (SetColorDepth) + if (ChangeColorDepth) returnValue += $" {ProjectLocales.ColorDepth} {ColorDepth}"; return returnValue; } @@ -124,7 +125,7 @@ public override ActionEndResult RunAction(ApplicationChangedType applicationChan { try { - if (SetHDR) + if (ChangeHDR) if (Display.IsAllDisplay()) { CallNewLog(new CodectoryCore.Logging.LogEntry($"{(EnableHDR ? "Activating" : "Deactivating")} HDR for all displays.")); @@ -139,7 +140,7 @@ public override ActionEndResult RunAction(ApplicationChangedType applicationChan HDRController.SetHDRState(Display.UID, EnableHDR); } System.Threading.Thread.Sleep(100); - if (SetResolution) + if (ChangeResolution) if (Display.IsAllDisplay()) { CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting resolution {Resolution} for all displays.")); @@ -152,7 +153,7 @@ public override ActionEndResult RunAction(ApplicationChangedType applicationChan Display.SetResolution(Resolution); } System.Threading.Thread.Sleep(100); - if (SetRefreshRate) + if (ChangeRefreshRate) if (Display.IsAllDisplay()) { CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting refresh rate {RefreshRate} for all displays.")); @@ -166,7 +167,7 @@ public override ActionEndResult RunAction(ApplicationChangedType applicationChan Display.SetRefreshRate(RefreshRate); } System.Threading.Thread.Sleep(100); - if (SetColorDepth) + if (ChangeColorDepth) if (Display.IsAllDisplay()) { CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting color depth {ColorDepth} for all displays.")); diff --git a/Source/AutoHDR/Profiles/Actions/ProfileActionAdder.cs b/Source/AutoHDR/Profiles/Actions/ProfileActionAdder.cs index a51ae8e..0eb4854 100644 --- a/Source/AutoHDR/Profiles/Actions/ProfileActionAdder.cs +++ b/Source/AutoHDR/Profiles/Actions/ProfileActionAdder.cs @@ -54,6 +54,7 @@ public BaseViewModel ContentControlViewModel _contentControlViewModel = value; OnPropertyChanged(); ProfileAction = (IProfileAction)ContentControlViewModel; + UpdateCanCreate(); } } diff --git a/Source/AutoHDR/Profiles/Profile.cs b/Source/AutoHDR/Profiles/Profile.cs index 252a6cd..198a707 100644 --- a/Source/AutoHDR/Profiles/Profile.cs +++ b/Source/AutoHDR/Profiles/Profile.cs @@ -32,11 +32,11 @@ public static Profile DefaultProfile() defaultProfile.Name = "HDR"; Profiles.Actions.DisplayAction startAction = new Profiles.Actions.DisplayAction(); startAction.Display = Display.AllDisplays; - startAction.SetHDR = true; + startAction.ChangeHDR = true; startAction.EnableHDR = true; Profiles.Actions.DisplayAction endAction = new Profiles.Actions.DisplayAction(); endAction.Display = Display.AllDisplays; - endAction.SetHDR = true; + endAction.ChangeHDR = true; endAction.EnableHDR = false; defaultProfile.ApplicationStarted.Add(startAction); defaultProfile.ApplicationClosed.Add(endAction); diff --git a/Source/AutoHDR/Properties/AssemblyInfo.cs b/Source/AutoHDR/Properties/AssemblyInfo.cs index 6d1bdfd..88246db 100644 --- a/Source/AutoHDR/Properties/AssemblyInfo.cs +++ b/Source/AutoHDR/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.0.0")] -[assembly: AssemblyFileVersion("1.9.0.0")] +[assembly: AssemblyVersion("1.9.1.0")] +[assembly: AssemblyFileVersion("1.9.1.0")] diff --git a/Source/AutoHDR/UserAppSettings.cs b/Source/AutoHDR/UserAppSettings.cs index 20d5468..c73786b 100644 --- a/Source/AutoHDR/UserAppSettings.cs +++ b/Source/AutoHDR/UserAppSettings.cs @@ -118,6 +118,15 @@ private static string UpgradeJson(string serializedJson) { serializedJson = serializedJson.Replace("\"$type\": \"AutoHDR.Displays.Display, AutoHDR\"", "\"$type\": \"AutoHDR.Displays.Display, AutoHDR.Displays\""); serializedJson = serializedJson.Replace("\"Monitors\": [", "\"Displays\": ["); + serializedJson = serializedJson.Replace("\"SetHDR\":", "\"ChangeHDR\":"); + serializedJson = serializedJson.Replace("\"SetResolution\":", "\"ChangeResolution\":"); + serializedJson = serializedJson.Replace("\"SetRefreshRate\":", "\"ChangeRefreshRate\":"); + serializedJson = serializedJson.Replace("\"SetColorDepth\":", "\"ChangeColorDepth\":"); + serializedJson = serializedJson.Replace("\"SetOutput\":", "\"ChangePlaybackDevice\":"); + serializedJson = serializedJson.Replace("\"SetInput\":", "\"ChangeRecordDevice\":"); + serializedJson = serializedJson.Replace("\"OutputDeviceID\":", "\"PlaybackDeviceID\":"); + serializedJson = serializedJson.Replace("\"InputDeviceID\":", "\"RecordDeviceID\":"); + return serializedJson; } diff --git a/Source/AutoHDR/Views/AudioActionView.xaml b/Source/AutoHDR/Views/AudioActionView.xaml index 9f08a5a..6f22b4a 100644 --- a/Source/AutoHDR/Views/AudioActionView.xaml +++ b/Source/AutoHDR/Views/AudioActionView.xaml @@ -41,15 +41,15 @@ - - + + - + - + - + - + diff --git a/Source/AutoHDR/Views/DisplayActionView.xaml b/Source/AutoHDR/Views/DisplayActionView.xaml index 672b052..3d6e829 100644 --- a/Source/AutoHDR/Views/DisplayActionView.xaml +++ b/Source/AutoHDR/Views/DisplayActionView.xaml @@ -35,30 +35,36 @@ - - - - + + + + + + + + + + - - + + - + - - + + - + - + - + - + +