feat: unify backends with QT#145
Conversation
480db0e to
3d9f350
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #145 +/- ##
==========================================
- Coverage 63.98% 59.23% -4.75%
==========================================
Files 5 3 -2
Lines 647 368 -279
Branches 214 129 -85
==========================================
- Hits 414 218 -196
+ Misses 153 102 -51
+ Partials 80 48 -32
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
|
Screenshot ComparisonPR #145 screenshots vs Matrix:
|
| Image | Baseline | PR |
|---|---|---|
tray_icon_initial.png |
||
tray_menu_checkbox_checked.png |
![]() |
|
tray_menu_checkbox_unchecked.png |
![]() |
|
tray_menu_shown.png |
![]() |
|
tray_notification_displayed.png |
![]() |
Matrix: Windows-qt6
Matrix: macOS
| Image | Baseline | PR |
|---|---|---|
tray_icon_initial.png |
||
tray_menu_checkbox_checked.png |
![]() |
|
tray_menu_checkbox_unchecked.png |
![]() |
|
tray_menu_shown.png |
![]() |
|
tray_notification_displayed.png |
![]() |
Matrix: macOS-qt6
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Add waitForNativeNotificationTimeout() (Windows-only sleep) in tests/utils.{cpp,h} and include chrono/thread headers. Update multiple tray unit tests to call this helper after clearing notifications to avoid races with native notification timeouts. Also tweak some Qt tests to use tooltip updates to exercise tray code paths and ensure events are pumped before waiting.
Add sonar-project.properties to set the Sonar project key and force C++17 for analysis. Remove inline NOSONAR suppressions on std::thread lambda usages in src/tray_qt.cpp and tests/unit/test_tray.cpp; the thread behavior is unchanged, only the comment-based suppressions were removed.
d9e7895 to
3c674d7
Compare
Add new tray icon assets (icons/icon2.ico, icons/icon2.png, icons/icon2.svg) and update example and tests to use icon2.png as TRAY_ICON2. Also replace/refresh existing icon.ico and icon.png binaries. This enables using a distinct second icon in the example and unit tests.
3c558f8 to
bdc4dd8
Compare
CMake: Only define default icon variables and install/copy helper when the project is top-level (TRAY_IS_TOP_LEVEL). Add a second set of default icons (icon2.*) and include them in TRAY_ICON_FILES. Gate the example target copying behind TRAY_IS_TOP_LEVEL as well. Tests: Convert many unit tests to parameterized tests over icon types (svg/ico/png/themed). Add icon constants for .ico and secondary icons, a TrayIconParam struct, helpers to print and name params, and a nativeNotificationSkipReason helper to conditionally skip notification tests on unsupported environments. Ensure test assets are copied only when an extension is present, update screenshot names to include the icon param, and instantiate the parameterized suites. Remove several redundant single-file icon tests and adjust a few tests to explicitly set SVG icons where needed. Overall this makes tests cover multiple icon formats and avoids top-level-only icon behavior when used as a subproject.
bdc4dd8 to
64a3ef2
Compare
Add an "Icon formats" section to README describing how `icon` and `notification_icon` can be file paths or theme names, listing supported formats per backend and recommending SVG/PNG for cross-platform use (noting libnotify limitations). Replace direct QIcon construction with lookupIcon(trayStruct->icon) in QtTrayMenu to properly resolve theme icon names and paths when setting the tray icon, aligning runtime behavior with the documented expectations.
f7847a4 to
2b7b7f6
Compare
Convert the multiple-icon update unit test to a parameterized test (TEST_P) using TrayIconTest/GetParam. Set the initial testTray.icon from the parameter, use the parameter's alternateIcon for the first update, add WaitForTrayReady and captureScreenshot using the parameter name, then restore the original icon. This enables running the same test across different icon variants and capturing screenshots for each.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
911e8e8 to
14bb48a
Compare
Drop libnotify integration and related build plumbing, simplify notification handling to use Qt only, and update docs/tests accordingly. Changes include: removed cmake/FindLibNotify.cmake and LibNotify detection/definitions from CMakeLists.txt; removed libnotify-dependent code paths, async threads, and notification bookkeeping from src/tray_qt.cpp and unused includes; simplified notify logic to always use QtTrayMenu; updated README to remove libnotify from platform dependency lists and simplified the icons table; and adjusted a unit test comment to reflect the new Qt-based callback behavior. Overall this removes the external libnotify dependency and cleans up associated code and build configuration.
14bb48a to
6fdb6b6
Compare
|
Just tested with 6fdb6b6 as I had to recompile to test something else and looks good to me on Linux. |
bc83e4b to
53869c1
Compare
Nice, thanks! I'm just trying to fix something with the screenshot timing/notifications on Windows in tests. |
522e702 to
6fdb6b6
Compare
tests/unit/test_tray.cpp: add <cstdlib> include and a new WaitForNotificationReady helper that calls WaitForTrayReady and, on Windows running in GitHub Actions (GITHUB_ACTIONS env var), pumps the tray loop multiple times with short sleeps to stabilize notification display. Replace direct WaitForTrayReady calls in the notification test with the new helper to reduce CI flakiness.
Introduce a cross-platform isGitHubActions() helper (uses _dupenv_s on Windows and getenv elsewhere) and declare it in tests/utils.h. Replace direct getenv usage in tests/unit/test_tray.cpp with the new helper and guard the Windows notification timeout to avoid unnecessary sleeps outside GitHub Actions. Also remove an unused <cstdlib> include.
640a03e to
13ba066
Compare
Replace the detailed table describing tray and notification icon backends with a concise line stating that SVG, ICO, PNG, and Qt theme icon names are supported. Keeps the existing recommendation to prefer SVG/PNG for predictable cross-platform behavior and removes redundant/verbose table markup.
|
|
Using Qt notifications on KDE also makes them appear in the notification history (IIRC that wasn't the case for libnotify). Unfortunately there's one drawback and that is that notification callbacks do not fire anymore (at least on KDE/Wayland) but Qt does not guarantee that in the docs (as Implementation is dependent on the underlying platform). This is reproducible with the following changes to the tray_example: diff --git a/src/example.c b/src/example.c
index a432255..ad1e452 100644
--- a/src/example.c
+++ b/src/example.c
@@ -20,13 +20,22 @@ static void toggle_cb(struct tray_menu *item) {
tray_update(&tray);
}
+static void notification_cb() {
+ printf("notification cb\n");
+}
+
static void hello_cb(struct tray_menu *item) {
(void) item;
printf("hello cb\n");
+ tray.notification_text = "... and goodbye!";
+ tray.notification_title = "Hello ...";
+ tray.notification_cb = notification_cb;
if (strcmp(tray.icon, TRAY_ICON1) == 0) {
tray.icon = TRAY_ICON2;
+ tray.notification_icon = TRAY_ICON2;
} else {
tray.icon = TRAY_ICON1;
+ tray.notification_icon = TRAY_ICON1;
}
tray_update(&tray);
}There's already bugreports on Qt's Jira for this, like QTBUG-120679 or QTBUG-87329 For Sunshine there's just one callback used and that's opening the Webpage for PIN entry so that's broken but changing the notification text so users can open Sunshine's configuration by themselves should be sufficient IMHO. |
|
Thanks for testing that further. I'm also having issues with packaging on Windows and macOS dmg in LizardByte/Sunshine#5260 I assumed it would be as easy as our other dependencies. |





































Description
Unify with QT for all platforms.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage