General GUI cleanup#92
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the UI layout and removes unused functionality from the Key2Joy application. The changes improve the interface by simplifying status indicators, relocating controls, and updating styling for better visual consistency.
- Replaced status labels with a connect/disconnect button for clearer user interaction
- Removed the "Save Profile" menu item and related functionality (as profiles auto-save)
- Removed device activity animation/fade effect code
- Updated API call from deprecated
Environment.Realm.GlobalObjecttoEnvironment.Global
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Key2Joy.Gui/MainForm.cs | Removed ConfigureStatusLabels method and SaveProfileToolStripMenuItem_Click handler; updated SetStatusView to use button text instead of labels |
| Key2Joy.Gui/MainForm.Designer.cs | Major UI layout changes: removed status labels, moved filter controls to profile panel, changed checkbox to button, removed save profile menu item, updated colors and sizes |
| Key2Joy.Gui/MainForm.resx | Removed BOM character from XML declaration |
| Key2Joy.Gui/DeviceControl.cs | Removed device activity animation feature including fade timer, paint handler, and color interpolation logic |
| Key2Joy.Gui/DeviceListControl.Designer.cs | Updated panel colors from black/gold to transparent, adjusted sizes and margins |
| Key2Joy.Gui/DeviceListControl.resx | Removed BOM character from XML declaration |
| Core/Key2Joy.Core/Mapping/Actions/Scripting/JavascriptScriptAction.cs | Updated to use Environment.Global instead of Environment.Realm.GlobalObject |
Files not reviewed (2)
- Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
- Key2Joy.Gui/MainForm.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var methodInfo = exposedMethod.GetExecutorMethodInfo(); | ||
| var @delegate = new DelegateWrapper(this.Environment, methodInfo.CreateDelegate(exposedMethod)); | ||
| var currentObject = this.Environment.Realm.GlobalObject; | ||
| var currentObject = this.Environment.Global; |
There was a problem hiding this comment.
The change from Environment.Realm.GlobalObject to Environment.Global suggests a Jint API update. Ensure that Environment.Global provides the same type and functionality as the previous Realm.GlobalObject. Verify that downstream usages (e.g., TryGetValue, FastSetProperty) remain compatible with the new property.
| var currentObject = this.Environment.Global; | |
| if (this.Environment.Global is not ObjectInstance globalObject) | |
| throw new InvalidOperationException("Environment.Global is not an ObjectInstance. Cannot register scripting method."); | |
| var currentObject = globalObject; |
There was a problem hiding this comment.
For reference: I was using a Jint preview build from a non-default NuGet registry since 3.0.0 didn't exist yet back when I worked on this.
Could you do me another favor and make 3.0.0 the version depended on in Core/Key2Joy.Core/Key2Joy.Core.csproj? It's currently set to 3.0.0-preview-488 which I guess resolves to 3.0.0 in your IDE, resulting in it working fine.
| // chkArmed | ||
| // | ||
| this.chkArmed.AutoSize = true; | ||
| this.chkArmed.Appearance = System.Windows.Forms.Appearance.Button; |
There was a problem hiding this comment.
Converting the checkbox to a button appearance may affect keyboard accessibility. Ensure that space bar toggling still works as expected for users who navigate via keyboard, since button-styled checkboxes can sometimes behave differently from standard checkboxes.
| this.lblIndex.Text = $"#{device.Index}"; | ||
| this.lblDevice.Text = device.Name; |
There was a problem hiding this comment.
The device parameter is no longer stored in the field (removed line this.device = device;), but the constructor still accepts it and uses it. If the device reference is needed later in the class lifecycle, removing this field assignment could cause issues. If it's truly unused, consider whether the event handler unsubscription device.ActivityOccurred -= ... is still handled elsewhere to prevent memory leaks.
use ms sans serif font everywhere instead of arial
now defined in the designer and has its visibility toggled programmatically also the wording has been improved somewhat
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 10 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- Key2Joy.Gui/DeviceControl.Designer.cs: Language not supported
- Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
- Key2Joy.Gui/MainForm.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
has no effect on functionality
|
I don't recall enabling copilot as an automated reviewer @Aurumaker72. Let me know if it hinders you in getting work done and I will disable it. In any case: seeing you work on it this so actively is inspiring! Thanks again! |
I think GitHub A/B tests it and it was just enabled for this repo as well. It's fine, though, pretty neat feature imo 😄 I will continue work on this PR and will mark it when it's ready 👍 |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 9 out of 15 changed files in this pull request and generated 1 comment.
Files not reviewed (5)
- Key2Joy.Gui/ConfigForm.Designer.cs: Language not supported
- Key2Joy.Gui/DeviceControl.Designer.cs: Language not supported
- Key2Joy.Gui/DeviceListControl.Designer.cs: Language not supported
- Key2Joy.Gui/MainForm.Designer.cs: Language not supported
- Key2Joy.Gui/Properties/Resources.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // | ||
| this.exitProgramToolStripMenuItem.Image = global::Key2Joy.Gui.Properties.Resources.door_out; | ||
| this.exitProgramToolStripMenuItem.Name = "exitProgramToolStripMenuItem"; | ||
| this.exitProgramToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); |
There was a problem hiding this comment.
Alt+F4 is a system-wide shortcut for closing windows in Windows. Explicitly assigning it to the Exit menu item is unnecessary and could potentially interfere with the default behavior or create confusion if the shortcut is disabled. Consider removing this assignment to rely on the default system behavior.
| this.exitProgramToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); |
There was a problem hiding this comment.
There's no interference afaics, and it's just there to display the standard shortcut text (aka accelerator text)
There was a problem hiding this comment.
I can follow the reasoning behind your UX changes. Thanks for lending your expertise on this matter. The changes LGTM, thanks!
I have one small request for a change, to do with the Jint version we depend on. If you can change that to 3.0.0 for us that'd be great.
After that I will approve and merge these changes. 👍
| var methodInfo = exposedMethod.GetExecutorMethodInfo(); | ||
| var @delegate = new DelegateWrapper(this.Environment, methodInfo.CreateDelegate(exposedMethod)); | ||
| var currentObject = this.Environment.Realm.GlobalObject; | ||
| var currentObject = this.Environment.Global; |
There was a problem hiding this comment.
For reference: I was using a Jint preview build from a non-default NuGet registry since 3.0.0 didn't exist yet back when I worked on this.
Could you do me another favor and make 3.0.0 the version depended on in Core/Key2Joy.Core/Key2Joy.Core.csproj? It's currently set to 3.0.0-preview-488 which I guess resolves to 3.0.0 in your IDE, resulting in it working fine.
Yeah, sure, I can do that :) |
|
Thanks for these contributions! |
Summary
This PR does a general cleanup pass for the UI. Note that these changes are pretty strongly opinionated.
Connection UI/UX
The "Arm Mappings" checkbox is now a ToggleButton-like Checkbox that alternates its text between "Connect" and "Disconnect", and the mappings status label has been removed.
Device List
The device list has been enhanced to have a better placeholder, and device controls themselves have gotten a tighter layout.
The animation for device connecting/disconnecting has been removed, primarily because it didn't communicate any particularly important information. Given that this is an opinionated change, it can be reverted.
Menu
The "Save Profile" menu item has been removed, since it was just a vestige anyway.
The "Exit Program" menu item has been renamed to "Exit", and had accelerator text (
Alt + F4) added.The "User Configuration" menu item has been renamed to "Configuration".
Search Box
The search box has been moved above the listview and to the left of the profile textbox to make the UI flow more naturally. It has also been given a search icon.
Maximize Button
The maximize button has been re-enabled. Not sure why that was disabled.
Font Consistency
Some random bits and bobs used Arial instead of MS Sans Serif, so that has been changed to be more consistent.
Config Dialog
The save button has been shrunk and moved to the standard action button location (bottom right). It also no longer shows a messagebox after clicking it.
The dialog can now be resized, and its titlebar displays the text "Configuration" has no icon anymore.
The default positioning behaviour is now also centering to parent.
There is now a hotkey (
Ctrl + ,) for opening the configuration dialog.Other Stuff
There's a fix for a compilation error caused by a breaking change in Jint. Not sure how that happened.