diff --git a/HandheldCompanion/Managers/ProfileManager.cs b/HandheldCompanion/Managers/ProfileManager.cs index f704d88b4..206a48fd4 100644 --- a/HandheldCompanion/Managers/ProfileManager.cs +++ b/HandheldCompanion/Managers/ProfileManager.cs @@ -532,6 +532,8 @@ private static void ControllerManager_ControllerPlugged(IController Controller, UpdateProfileWrapper(profile); } + public static Profile? GetProfileWithDefaultLayout() => profiles.Values.FirstOrDefault(p => p.Layout.IsDefaultLayout); + #region events public static event DeletedEventHandler Deleted; diff --git a/HandheldCompanion/Misc/Layout.cs b/HandheldCompanion/Misc/Layout.cs index bb2d6aa8c..e3d046288 100644 --- a/HandheldCompanion/Misc/Layout.cs +++ b/HandheldCompanion/Misc/Layout.cs @@ -14,6 +14,8 @@ public partial class Layout : ICloneable, IDisposable public SortedDictionary AxisLayout { get; set; } = new(); public SortedDictionary GyroLayout { get; set; } = new(); + public bool IsDefaultLayout { get; set; } + // gyro related public Layout() @@ -60,8 +62,12 @@ public object Clone() { var jsonString = JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); - return JsonConvert.DeserializeObject(jsonString, + var deserialized = JsonConvert.DeserializeObject(jsonString, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); + + deserialized.IsDefaultLayout = false; // Clone shouldn't be default layout in case it is true + + return deserialized; } public void Dispose() diff --git a/HandheldCompanion/Properties/Resources.Designer.cs b/HandheldCompanion/Properties/Resources.Designer.cs index c6f780fec..9bcd89f4c 100644 --- a/HandheldCompanion/Properties/Resources.Designer.cs +++ b/HandheldCompanion/Properties/Resources.Designer.cs @@ -3555,6 +3555,15 @@ public static string LayoutPage_SaveGameInfoLayout { } } + /// + /// Looks up a localized string similar to Make this the default layout. + /// + public static string LayoutPage_SetAsDefault { + get { + return ResourceManager.GetString("LayoutPage_SetAsDefault", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show current controller templates only. /// diff --git a/HandheldCompanion/Properties/Resources.de-DE.resx b/HandheldCompanion/Properties/Resources.de-DE.resx index 32d2cac13..46025ab4c 100644 --- a/HandheldCompanion/Properties/Resources.de-DE.resx +++ b/HandheldCompanion/Properties/Resources.de-DE.resx @@ -2322,4 +2322,7 @@ Wenn die Bewegungseingabe aktiviert ist, verwenden Sie die ausgewählte(n) Taste Waiting for foreground process... + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.es-ES.resx b/HandheldCompanion/Properties/Resources.es-ES.resx index ce61f08d0..613565945 100644 --- a/HandheldCompanion/Properties/Resources.es-ES.resx +++ b/HandheldCompanion/Properties/Resources.es-ES.resx @@ -2320,4 +2320,7 @@ No se puede deshacer esta acción. Plantilla aplicada anteriormente: {0} - + + Make this the default layout + + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.fr-FR.resx b/HandheldCompanion/Properties/Resources.fr-FR.resx index 3f69604b1..2b535bb46 100644 --- a/HandheldCompanion/Properties/Resources.fr-FR.resx +++ b/HandheldCompanion/Properties/Resources.fr-FR.resx @@ -2311,4 +2311,7 @@ with motion input enabled, use selected button(s) to disable motion. You can't undo this action. Previously applied template: {0} + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.it-IT.resx b/HandheldCompanion/Properties/Resources.it-IT.resx index 4cdf4aa09..21853a0fb 100644 --- a/HandheldCompanion/Properties/Resources.it-IT.resx +++ b/HandheldCompanion/Properties/Resources.it-IT.resx @@ -2320,4 +2320,7 @@ You can't undo this action. Previously applied template: {0} + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.ja-JP.resx b/HandheldCompanion/Properties/Resources.ja-JP.resx index 5ed4fe329..797b0fcc2 100644 --- a/HandheldCompanion/Properties/Resources.ja-JP.resx +++ b/HandheldCompanion/Properties/Resources.ja-JP.resx @@ -2320,4 +2320,7 @@ You can't undo this action. Previously applied template: {0} + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.pt-BR.resx b/HandheldCompanion/Properties/Resources.pt-BR.resx index 48c123cf3..8b89f562f 100644 --- a/HandheldCompanion/Properties/Resources.pt-BR.resx +++ b/HandheldCompanion/Properties/Resources.pt-BR.resx @@ -2321,4 +2321,7 @@ com a entrada de movimento ligada, use o(s) botão(ões) selecionado(s) para des GPU + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.resx b/HandheldCompanion/Properties/Resources.resx index d366498b7..647981f7e 100644 --- a/HandheldCompanion/Properties/Resources.resx +++ b/HandheldCompanion/Properties/Resources.resx @@ -2354,4 +2354,7 @@ with motion input enabled, use selected button(s) to disable motion. Please switch your controller off and then on again by pressing and holding the Guide button to finalize pairing. + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.ru-RU.resx b/HandheldCompanion/Properties/Resources.ru-RU.resx index 7325a9147..9b2162bf3 100644 --- a/HandheldCompanion/Properties/Resources.ru-RU.resx +++ b/HandheldCompanion/Properties/Resources.ru-RU.resx @@ -2302,4 +2302,7 @@ Warning + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.zh-CN.resx b/HandheldCompanion/Properties/Resources.zh-CN.resx index fca65511b..ac61b919a 100644 --- a/HandheldCompanion/Properties/Resources.zh-CN.resx +++ b/HandheldCompanion/Properties/Resources.zh-CN.resx @@ -2302,4 +2302,7 @@ You can't undo this action. Previously applied template: {0} + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Properties/Resources.zh-Hant.resx b/HandheldCompanion/Properties/Resources.zh-Hant.resx index 621fcef57..ea9122380 100644 --- a/HandheldCompanion/Properties/Resources.zh-Hant.resx +++ b/HandheldCompanion/Properties/Resources.zh-Hant.resx @@ -2302,4 +2302,7 @@ You can't undo this action. Previously applied template: {0} + + Make this the default layout + \ No newline at end of file diff --git a/HandheldCompanion/Views/Pages/LayoutPage.xaml b/HandheldCompanion/Views/Pages/LayoutPage.xaml index 103fce254..8d3be2046 100644 --- a/HandheldCompanion/Views/Pages/LayoutPage.xaml +++ b/HandheldCompanion/Views/Pages/LayoutPage.xaml @@ -113,91 +113,102 @@ IsEnabled="false" /> - - - - - - - - - + + + + + + + +