Add low battery notifications, improve device detection fallback by name, and fix tray icon rendering#22
Open
elazarit wants to merge 1 commit intoauto94:mainfrom
Open
Add low battery notifications, improve device detection fallback by name, and fix tray icon rendering#22elazarit wants to merge 1 commit intoauto94:mainfrom
elazarit wants to merge 1 commit intoauto94:mainfrom
Conversation
… fix tray icon rendering
Motivation
Provide an optional low-battery balloon notification so users can be alerted when headset battery is low.
Expose configuration for enabling the popup and setting the threshold from the existing Settings UI and persisted settings file.
Improve device detection reliability by adding a fallback mechanism to identify supported headsets by product name when Product IDs change due to firmware updates.
Fix an intermittent issue where the system tray icon could appear blank on some systems due to icon handle lifetime management.
Description
Added a lowBatteryPopupShown flag and logic in MainForm to show a single balloon tip when the battery level is non-zero and at-or-below the configured threshold, and reset the flag when appropriate in disconnected/no-device states.
Added UI controls to SettingsForm (cbLowBatteryPopup and numLowBatteryPopup) and wired them to load/save settings via SettingsHelper so users can enable the popup and set the percentage threshold.
Extended SettingsHelper (SettingsHelper.h / SettingsHelper.cpp) with:
getLowBatteryPopupEnabled
setLowBatteryPopupEnabled
getLowBatteryPopupLevel
setLowBatteryPopupLevel
to persist the new settings.
Added default values for the new settings to settings.xml and cleaned up object lifetime management where SettingsHelper instances are created and deleted.
Improved headset detection robustness by adding a fallback detection path in getHeadsetDevicePath() that:
Enumerates all HID devices
Identifies supported headsets by vendor ID and product name
Re-enumerates using the detected VID/PID
This ensures compatibility with devices where firmware updates change Product IDs while keeping the product name consistent.
Extended special-case detection logic for Cloud III Wireless and Cloud III S Wireless to also validate the product string in addition to Product ID, improving resilience against firmware revisions.
Fixed a system tray icon rendering issue by improving icon lifetime management:
Generated tray icons are now cloned into managed Icon instances before destroying the underlying unmanaged HICON
Added tracking and disposal of previously generated tray icons to prevent managed/GDI resource leaks
Preserved the existing fix for unmanaged handle leaks while ensuring the tray icon remains valid for asynchronous shell rendering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Description
to persist the new settings.
-Enumerates all HID devices
-Identifies supported headsets by vendor ID and product name
-This ensures compatibility with devices where firmware updates change Product IDs while keeping the product name consistent.
-Generated tray icons are now cloned into managed Icon instances before destroying the underlying unmanaged HICON