feat: gray out unsupported shift modes on unsupported hardware #237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit implements the ability to detect which shift modes (turbo, eco, silent) are supported by the laptop hardware and automatically disables (grays out) radio buttons for unsupported modes in the UI.
The implementation:
This prevents users from attempting to activate modes not supported by their hardware, improving the user experience.
Gray Out Unsupported Shift Modes Based on Hardware Capabilities
This PR addresses the issue where MSI laptops with different hardware capabilities (e.g., those lacking turbo mode support) display UI options that aren't available on the device.
Changes Made
1.Added Mode Support Detection Methods to the Operate Class:
isTurboModeSupported() - Checks if performance/turbo mode is available.
-isEcoModeSupported() - Checks if eco mode is available.
-isSilentModeSupported() - Checks if silent mode is available.
-isPerformanceModeSupported() - Checks performance mode availability.
-isSuperBatteryModeSupported() - Checks super battery mode availability.
2.Modified MainWindow::loadConfigs() to Disable Unsupported Modes:
-Grays out the high-performance mode radio button when unsupported.
-Grays out the silent mode radio button when unsupported.
-Grays out the super battery mode radio button when unsupported.
-Disables corresponding tray menu actions for unsupported modes.
Implementation Details
The implementation uses a "try and observe" approach to determine mode support:
1.Preserves the current mode.
2.Attempts to set a specific mode.
3.Checks whether the mode was successfully set.
4.Restores the original mode.
5.Returns whether the mode is supported.
This ensures that:
.Unsupported modes are detected automatically without user intervention.
.The UI clearly indicates which options are available for the specific hardware.
.Users cannot select modes that their hardware doesn't support.
Testing
Tested on multiple MSI laptop models with different hardware capabilities:
.Laptops with turbo mode support show all options.
.Laptops without turbo mode support show the turbo/performance mode option grayed out.
.Laptops without silent mode support show the silent mode option grayed out.
.All relevant UI controls and tray menu items are correctly enabled/disabled.
How to Test
.Build and run the application on MSI laptops with varying hardware capabilities.
.Observe the UI and tray menu to ensure unsupported modes are grayed out.
.Attempt to select grayed-out options to verify they are disabled.
Additional Notes
This PR improves the user experience by ensuring that only supported options are visible and selectable, reducing confusion and errors.