diff options
| author | a1xd <[email protected]> | 2020-10-06 02:54:27 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2020-10-07 05:31:24 -0400 |
| commit | 187de539ea370210146c7f1bcf398c2a100f758f (patch) | |
| tree | 2df7d336d62e221995fc76684fef8b6973a41889 /grapher/Models/Serialized/SettingsManager.cs | |
| parent | add static default settings in wrapper (diff) | |
| download | rawaccel-187de539ea370210146c7f1bcf398c2a100f758f.tar.xz rawaccel-187de539ea370210146c7f1bcf398c2a100f758f.zip | |
ease requirements for loading driver settings
gui settings are no longer needed
this covers edge case where interaccel converter
is used but the gui does not run until after reboot
Diffstat (limited to 'grapher/Models/Serialized/SettingsManager.cs')
| -rw-r--r-- | grapher/Models/Serialized/SettingsManager.cs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs index 416823e..f53c9c9 100644 --- a/grapher/Models/Serialized/SettingsManager.cs +++ b/grapher/Models/Serialized/SettingsManager.cs @@ -83,15 +83,7 @@ namespace grapher.Models.Serialized if (errors.Empty()) { RawAccelSettings.AccelerationSettings = settings; - RawAccelSettings.GUISettings = new GUISettings - { - AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked, - DPI = (int)DpiField.Data, - PollRate = (int)PollRateField.Data, - ShowLastMouseMove = ShowLastMouseMoveMenuItem.Checked, - ShowVelocityAndGain = ShowVelocityAndGainMoveMenuItem.Checked, - }; - + RawAccelSettings.GUISettings = MakeGUISettingsFromFields(); RawAccelSettings.Save(); } @@ -128,13 +120,25 @@ namespace grapher.Models.Serialized return errors; } + public GUISettings MakeGUISettingsFromFields() + { + return new GUISettings + { + AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked, + DPI = (int)DpiField.Data, + PollRate = (int)PollRateField.Data, + ShowLastMouseMove = ShowLastMouseMoveMenuItem.Checked, + ShowVelocityAndGain = ShowVelocityAndGainMoveMenuItem.Checked + }; + } + public void Startup() { if (RawAccelSettings.Exists()) { try { - RawAccelSettings = RawAccelSettings.Load(); + RawAccelSettings = RawAccelSettings.Load(() => MakeGUISettingsFromFields()); if (RawAccelSettings.GUISettings.AutoWriteToDriverOnStartup) { UpdateActiveAccelFromFileSettings(RawAccelSettings.AccelerationSettings); @@ -149,13 +153,7 @@ namespace grapher.Models.Serialized RawAccelSettings = new RawAccelSettings( DriverInterop.GetActiveSettings(), - new GUISettings - { - AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked, - DPI = (int)DpiField.Data, - PollRate = (int)PollRateField.Data, - ShowLastMouseMove = ShowLastMouseMoveMenuItem.Checked, - }); + MakeGUISettingsFromFields()); RawAccelSettings.Save(); } |