diff --git a/docs/core-protocol.md b/docs/core-protocol.md index af63eac95..36aa4816a 100644 --- a/docs/core-protocol.md +++ b/docs/core-protocol.md @@ -320,7 +320,12 @@ responses are suppressed: complete, `cleaned` after an allocation-free error or successful compensating cleanup, or `failed` when cleanup remains unresolved. `session_allocation_unresolved` also requires `failed`: a lost or malformed POST response does not prove that no -seat was allocated. Sending a response, +seat was allocated. `session_allocation_recovery_required` means an earlier +allocation record blocked admission before POST. It settles that new request as +`cleaned`, while the original record still blocks allocation until the core can +verify its outcome. Discovery includes a recorded origin omitted by the regional +list when it is the original account's provider endpoint or a canonical NVIDIA +queue zone. Sending a response, clearing a local request ID, or requesting cancellation is not settlement. An admission `busy` response means no worker was admitted and is not followed by settlement; Qt tracks retries until they are cancelled or admitted. diff --git a/native/opennow-core/src/cloudmatch.rs b/native/opennow-core/src/cloudmatch.rs index 0958d15c4..bcb170c7e 100644 --- a/native/opennow-core/src/cloudmatch.rs +++ b/native/opennow-core/src/cloudmatch.rs @@ -158,6 +158,35 @@ impl UnresolvedAllocation { && self.provider_code.len() <= 1024 && self.session_id.as_deref().is_none_or(valid_session_id) } + + fn matches(&self, auth: &AuthSession, device_id: &str) -> bool { + self.owner.0 == auth.provider.idp_id + && self.owner.1 == auth.user.user_id + && self.provider_code == auth.provider.code + && self.device_id == device_id + && self.provider_base == crate::gfn::effective_provider_url(&auth.provider) + } + + fn verified_base(&self, auth: &AuthSession) -> Option { + let base = trusted_cloudmatch_base(&self.allocation_base).ok()?; + if trusted_cloudmatch_base(&self.provider_base).ok().as_ref() == Some(&base) { + return Some(base); + } + // The free-tier queue selector can allocate in a zone omitted from + // serverInfo. Use the same canonical NVIDIA origin check as creation. + if auth.provider.idp_id == crate::gfn::DEFAULT_IDP_ID + && auth.provider.code.eq_ignore_ascii_case("NVIDIA") + && base + .host_str() + .and_then(|host| host.strip_suffix(".cloudmatchbeta.nvidiagrid.net")) + .and_then(|zone| crate::queue_servers::zone_url(&zone.to_ascii_uppercase())) + .as_deref() + == Some(base.as_str()) + { + return Some(base); + } + None + } } struct VerifiedCleanup { @@ -375,7 +404,10 @@ impl CloudMatchService { { return Err(allocation_in_progress()); } - return Err(unresolved_allocation()); + return Err(ServiceError { + code: "session_allocation_recovery_required", + ..unresolved_allocation() + }); } Ok(CreateAdmission { service: self, @@ -1213,7 +1245,20 @@ impl CloudMatchService { let requested = recovery_region.map_or_else(|| requested_streaming_base(params, settings, auth), Ok)?; let headers = cloudmatch_headers(session_token(auth), device_id)?; + let unresolved = self + .unresolved + .lock() + .expect("CloudMatch unresolved state poisoned") + .clone() + .filter(|record| record.matches(auth, device_id)); let mut bases = vec![requested.clone()]; + if let Some(base) = unresolved + .as_ref() + .and_then(|record| record.verified_base(auth)) + && base != requested + { + bases.push(base); + } let server_info_url = requested .join("v2/serverInfo") .map_err(|_| invalid("Invalid server-info URL"))?; @@ -1282,16 +1327,7 @@ impl CloudMatchService { .collect() })?; let owner = (auth.provider.idp_id.clone(), auth.user.user_id.clone()); - let unresolved = self - .unresolved - .lock() - .expect("CloudMatch unresolved state poisoned") - .clone(); if let Some(record) = unresolved - && record.owner == owner - && record.provider_code == auth.provider.code - && record.provider_base == crate::gfn::effective_provider_url(&auth.provider) - && record.device_id == device_id && complete && record.session_id.as_ref().map_or_else( || sessions.is_empty(), @@ -3580,13 +3616,13 @@ mod tests { ); assert_eq!( service.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); drop(service); let restarted = CloudMatchService::with_cleanup_path(Client::new(), path); assert_eq!( restarted.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); assert_eq!( restarted.finish_create("unrelated", true).unwrap_err().code, @@ -3687,12 +3723,12 @@ mod tests { assert!(service.active()["session"].is_null()); assert_eq!( service.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); let restarted = CloudMatchService::with_cleanup_path(Client::new(), path); assert_eq!( restarted.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); } } @@ -3709,20 +3745,29 @@ mod tests { "wrong-device", "wrong-provider", "forged-route", + "queue-absent", + "queue-present", + "queue-unreachable", + "queue-non-nvidia", "partial", "malformed", ] { let directory = tempfile::tempdir().unwrap(); let path = directory.path().join("pending-session-cleanup.json"); - let auth = conflict_auth(); + let mut auth = conflict_auth(); + if scenario.starts_with("queue-") && scenario != "queue-non-nvidia" { + auth.provider.idp_id = crate::gfn::DEFAULT_IDP_ID.into(); + } let record = UnresolvedAllocation { owner: (auth.provider.idp_id.clone(), auth.user.user_id.clone()), provider_code: auth.provider.code.clone(), provider_base: crate::gfn::effective_provider_url(&auth.provider), - allocation_base: if scenario == "forged-route" { - "https://attacker.example".into() - } else { - DEFAULT_STREAMING_BASE.trim_end_matches('/').into() + allocation_base: match scenario { + "forged-route" => "https://attacker.example".into(), + scenario if scenario.starts_with("queue-") => { + "https://np-usw-01.cloudmatchbeta.nvidiagrid.net".into() + } + _ => DEFAULT_STREAMING_BASE.trim_end_matches('/').into(), }, device_id: "device".into(), session_id: scenario.starts_with("known-").then(|| "seat".into()), @@ -3732,23 +3777,36 @@ mod tests { "other-seat" | "known-absent-among-other-seats" => { json!([{"sessionId":"unrelated-seat","status":3}]) } - "known-present" => json!([{"sessionId":"seat","status":3}]), + "known-present" | "queue-present" => json!([{"sessionId":"seat","status":3}]), "malformed" => json!([{"sessionId":"missing-status"}]), _ => json!([]), }; - let (base, server) = session_server( - vec![ - ( - if scenario == "partial" { 503 } else { 200 }, - json!({"metaData":[]}), - ), - ( - 200, - json!({"requestStatus":{"statusCode":1},"sessions":sessions}), - ), - ], - |_| {}, - ); + let mut replies = vec![ + ( + if scenario == "partial" { 503 } else { 200 }, + json!({"metaData":[]}), + ), + ( + 200, + json!({"requestStatus":{"statusCode":1},"sessions":sessions}), + ), + ]; + if scenario.starts_with("queue-") && scenario != "queue-non-nvidia" { + replies.push(( + if scenario == "queue-unreachable" { + 503 + } else { + 200 + }, + json!({"requestStatus":{"statusCode":1},"sessions":[]}), + )); + } + let expected_requests = replies.len(); + let request_count = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0)); + let server_count = request_count.clone(); + let (base, server) = session_server(replies, move |_| { + server_count.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + }); let mut service = CloudMatchService::with_cleanup_path(Client::new(), path.clone()); service.set_test_control_base(base); let mut current = auth.clone(); @@ -3768,14 +3826,22 @@ mod tests { "device" }, ); - if matches!(scenario, "partial" | "malformed") { + if matches!(scenario, "partial" | "malformed" | "queue-unreachable") { assert_eq!(result.unwrap_err().code, "session_discovery_failed"); } else { result.unwrap(); } + assert_eq!( + request_count.load(std::sync::atomic::Ordering::Relaxed), + expected_requests, + "{scenario}" + ); let received = server.join().unwrap(); assert!(received.iter().all(|request| request.starts_with("GET "))); - let resolved = matches!(scenario, "absent" | "known-absent-among-other-seats"); + let resolved = matches!( + scenario, + "absent" | "known-absent-among-other-seats" | "queue-absent" + ); assert_eq!(service.admit_create().is_ok(), resolved, "{scenario}"); assert_eq!( !path.with_file_name("unresolved-allocation.json").exists(), @@ -4291,7 +4357,7 @@ mod tests { assert!(service.fresh.lock().unwrap().is_none()); assert_eq!( service.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); let mut service = CloudMatchService::new(client.clone()); assert!( @@ -4333,7 +4399,10 @@ mod tests { assert!(service.allocation_admission.try_lock().is_ok()); assert!(service.fresh.lock().unwrap().is_none()); if code == "session_allocation_unresolved" { - assert_eq!(service.admit_create().err().unwrap().code, code); + assert_eq!( + service.admit_create().err().unwrap().code, + "session_allocation_recovery_required" + ); assert_eq!(service.finish_create("", false).unwrap_err().code, code); service = CloudMatchService::new(client.clone()); } else { diff --git a/native/opennow-core/src/gfn.rs b/native/opennow-core/src/gfn.rs index 76a3add1f..6d6923850 100644 --- a/native/opennow-core/src/gfn.rs +++ b/native/opennow-core/src/gfn.rs @@ -38,7 +38,7 @@ mod routing_tests; #[cfg(test)] mod store_launch_tests; -const DEFAULT_IDP_ID: &str = "PDiAhv2kJTFeQ7WOPqiQ2tRZ7lGhR2X11dXvM4TZSxg"; +pub(crate) const DEFAULT_IDP_ID: &str = "PDiAhv2kJTFeQ7WOPqiQ2tRZ7lGhR2X11dXvM4TZSxg"; const DEFAULT_STREAMING_URL: &str = "https://prod.cloudmatchbeta.nvidiagrid.net/"; // Alliance `prod.*` discovery endpoints are geo-steered: they resolve to the // nearest regional PoP from inside the partner footprint (via VPN or local @@ -3293,7 +3293,7 @@ fn public_game_to_info(item: &Value) -> Option { }) .unwrap_or_else(|| "Unknown".to_owned()); let image_url = steam_id.as_ref().map(|value| { - format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{value}/header.jpg") + format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{value}/library_600x900_2x.jpg") }); let hero_image_url = steam_id.as_ref().map(|value| { format!("https://cdn.cloudflare.steamstatic.com/steam/apps/{value}/library_hero.jpg") @@ -3340,15 +3340,40 @@ fn image_values(value: &Value, width: u32) -> Vec { let trimmed = value.trim(); if trimmed.is_empty() { None - } else if trimmed.contains("img.nvidiagrid.net") { - Some(format!("{trimmed};f=jpg;w={width}")) } else { - Some(trimmed.to_owned()) + Some(sized_artwork_url(trimmed, width)) } }) .collect() } +fn sized_artwork_url(source: &str, width: u32) -> String { + let Ok(mut url) = url::Url::parse(source) else { + return source.to_owned(); + }; + if url.host_str() != Some("img.nvidiagrid.net") { + return source.to_owned(); + } + let path = url.path(); + let Some((directory, file)) = path.rsplit_once('/') else { + return source.to_owned(); + }; + let mut parts = file.split(';'); + let mut sized = format!("{directory}/{}", parts.next().unwrap_or_default()); + for part in parts { + let key = part.split('=').next().unwrap_or_default(); + if !matches!(key, "f" | "w" | "h" | "dpr") { + sized.push(';'); + sized.push_str(part); + } + } + // JPEG is available in every supported Qt package. Keep the CDN's + // output dimensions independent of any older modifiers on the source. + sized.push_str(&format!(";f=jpg;w={width}")); + url.set_path(&sized); + url.into() +} + fn first_image(images: &Value, keys: &[&str], width: u32) -> Option { keys.iter() .find_map(|key| image_values(&images[*key], width).into_iter().next()) @@ -5318,7 +5343,7 @@ pub(crate) mod tests { } #[test] - fn public_catalog_mapping_matches_electron_contract() { + fn public_catalog_mapping_preserves_launch_identity_and_uses_portrait_art() { let game = public_game_to_info(&json!({ "id":"ignored", "title":"Portal 2", "status":"AVAILABLE", "steamUrl":"https://store.steampowered.com/app/620/Portal_2/", "store":"Steam" @@ -5331,11 +5356,24 @@ pub(crate) mod tests { game["imageUrl"] .as_str() .unwrap() - .contains("/620/header.jpg") + .contains("/620/library_600x900_2x.jpg") ); assert!(public_game_to_info(&json!({"title":"Gone", "status":"MAINTENANCE"})).is_none()); } + #[test] + fn nvidia_artwork_replaces_old_resize_options_and_keeps_query_parameters() { + let source = "https://img.nvidiagrid.net/apps/game%20art/GAME_BOX_ART_A.jpg;w=90;h=120;dpr=1;f=webp?locale=en"; + let resized = sized_artwork_url(source, 900); + assert_eq!( + resized, + "https://img.nvidiagrid.net/apps/game%20art/GAME_BOX_ART_A.jpg;f=jpg;w=900?locale=en" + ); + assert_eq!(sized_artwork_url(&resized, 900), resized); + let external = "https://example.com/img.nvidiagrid.net/GAME_BOX_ART.jpg;w=90"; + assert_eq!(sized_artwork_url(external, 900), external); + } + #[test] fn account_library_mapping_preserves_launch_and_ownership() { let game = app_to_game(&json!({ diff --git a/native/opennow-core/src/gfn/routing_tests.rs b/native/opennow-core/src/gfn/routing_tests.rs index c3c86094e..28d328991 100644 --- a/native/opennow-core/src/gfn/routing_tests.rs +++ b/native/opennow-core/src/gfn/routing_tests.rs @@ -766,7 +766,7 @@ fn fresh_create_provenance_failure_keeps_public_owner_and_durable_cleanup() { .err() .expect("restart must retain the allocation obligation") .code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); let record: Value = serde_json::from_slice(&std::fs::read(&recovery).unwrap()).unwrap(); assert_eq!(record["sessionId"], "fresh-seat"); @@ -831,7 +831,7 @@ fn fresh_create_write_ahead_record_survives_handoff_and_acceptance_until_stop() .err() .expect("restart before or after acceptance must retain ownership") .code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); assert_eq!( restarted @@ -922,7 +922,7 @@ fn failed_fresh_seat_identification_keeps_original_write_ahead_and_exact_cleanup ); assert_eq!( restarted.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); service.finish_session_create("fresh-seat", false).unwrap(); assert!(!path.join("unresolved-allocation.json").exists()); @@ -976,7 +976,7 @@ fn unrelated_terminal_poll_preserves_the_durable_allocation_obligation() { ); assert_eq!( restarted.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); service .stop_session(&json!({"sessionId":"fresh-seat"}), &json!({})) @@ -1246,7 +1246,7 @@ fn native_session_end_releases_created_obligation_across_restart() { ); assert_eq!( retained.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); assert_eq!( service.acknowledge_session_end(¬ification).unwrap()["cleared"], @@ -1651,7 +1651,7 @@ fn reject_concurrent_create_during(discovery: bool) { } else { assert_eq!( service.cloudmatch.admit_create().err().unwrap().code, - "session_allocation_unresolved" + "session_allocation_recovery_required" ); } worker.join().unwrap(); diff --git a/native/opennow-core/src/main.rs b/native/opennow-core/src/main.rs index 9e0879a4a..90d254c0a 100644 --- a/native/opennow-core/src/main.rs +++ b/native/opennow-core/src/main.rs @@ -1725,6 +1725,7 @@ mod acceptance_tests { for (code, outcome) in [ ("cancelled", "cleaned"), ("invalid_request", "cleaned"), + ("session_allocation_recovery_required", "cleaned"), ("session_cleanup_pending", "failed"), ("session_provenance_unavailable", "failed"), ] { diff --git a/opennow-qt/CMakeLists.txt b/opennow-qt/CMakeLists.txt index ddf9b8431..d42f7f1c7 100644 --- a/opennow-qt/CMakeLists.txt +++ b/opennow-qt/CMakeLists.txt @@ -7,7 +7,7 @@ if(POLICY CMP0207) cmake_policy(SET CMP0207 NEW) endif() -project(OpenNOWQt VERSION 1.0.4 LANGUAGES CXX) +project(OpenNOWQt VERSION 1.0.5 LANGUAGES CXX) include(GNUInstallDirs) include(cmake/BuildMetadata.cmake) diff --git a/opennow-qt/cmake/ApplicationIcons.cmake b/opennow-qt/cmake/ApplicationIcons.cmake index bbdb381a1..9587215e5 100644 --- a/opennow-qt/cmake/ApplicationIcons.cmake +++ b/opennow-qt/cmake/ApplicationIcons.cmake @@ -25,8 +25,9 @@ if(WIN32) OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/packaging/icons/OpenNOW.ico") target_sources(opennow-qt PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/OpenNOW.rc") elseif(APPLE) - set_source_files_properties(packaging/icons/OpenNOW.icns PROPERTIES + set(OPENNOW_MACOS_BUNDLE_ICONS packaging/icons/Assets.car packaging/icons/OpenNOW.icns) + set_source_files_properties(${OPENNOW_MACOS_BUNDLE_ICONS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - target_sources(opennow-qt PRIVATE packaging/icons/OpenNOW.icns) + target_sources(opennow-qt PRIVATE ${OPENNOW_MACOS_BUNDLE_ICONS}) set_target_properties(opennow-qt PROPERTIES MACOSX_BUNDLE_ICON_FILE OpenNOW.icns) endif() diff --git a/opennow-qt/cmake/QmlModule.cmake b/opennow-qt/cmake/QmlModule.cmake index ec4d4ac57..4b7b8ab8a 100644 --- a/opennow-qt/cmake/QmlModule.cmake +++ b/opennow-qt/cmake/QmlModule.cmake @@ -298,6 +298,7 @@ qt_add_qml_module(opennow-qt qml/desktop/components/DesktopKeyHint.qml qml/desktop/components/DesktopPoster.qml qml/desktop/components/DesktopPosterOverlay.qml + qml/desktop/components/DesktopPosterSkeleton.qml qml/desktop/components/DesktopTokens.qml qml/desktop/friends/DesktopFriendsScreen.qml qml/desktop/home/DesktopHomePoster.qml diff --git a/opennow-qt/cmake/Tests.cmake b/opennow-qt/cmake/Tests.cmake index adf965775..a526f5c63 100644 --- a/opennow-qt/cmake/Tests.cmake +++ b/opennow-qt/cmake/Tests.cmake @@ -34,7 +34,8 @@ if(BUILD_TESTING) if(WIN32) target_link_libraries(opennow-graphicsdevices-tests PRIVATE user32 dxgi d3d11) endif() - add_test(NAME opennow-graphicsdevices-tests COMMAND opennow-graphicsdevices-tests -o -,txt) + add_test(NAME opennow-graphicsdevices-tests COMMAND opennow-graphicsdevices-tests -o -,txt + -o "${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/graphics-device-results.xml,junitxml") set_tests_properties(opennow-graphicsdevices-tests PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen" TIMEOUT 20) qt_add_executable(opennow-macawdl-tests tests/tst_macawdlcontroller.cpp diff --git a/opennow-qt/packaging/Info.plist.in b/opennow-qt/packaging/Info.plist.in index 638f22ece..2c634d1f2 100644 --- a/opennow-qt/packaging/Info.plist.in +++ b/opennow-qt/packaging/Info.plist.in @@ -14,6 +14,8 @@ 6.0 CFBundleIconFile ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIconName + OpenNOW CFBundleName ${MACOSX_BUNDLE_BUNDLE_NAME} CFBundlePackageType diff --git a/opennow-qt/packaging/icons/Assets.car b/opennow-qt/packaging/icons/Assets.car new file mode 100644 index 000000000..558d4b591 Binary files /dev/null and b/opennow-qt/packaging/icons/Assets.car differ diff --git a/opennow-qt/packaging/icons/OpenNOW.icns b/opennow-qt/packaging/icons/OpenNOW.icns index 57a2295fd..4609e94eb 100644 Binary files a/opennow-qt/packaging/icons/OpenNOW.icns and b/opennow-qt/packaging/icons/OpenNOW.icns differ diff --git a/opennow-qt/packaging/icons/OpenNOW.icon/icon.json b/opennow-qt/packaging/icons/OpenNOW.icon/icon.json index 0fabcc5ad..dd1c580cb 100644 --- a/opennow-qt/packaging/icons/OpenNOW.icon/icon.json +++ b/opennow-qt/packaging/icons/OpenNOW.icon/icon.json @@ -1,5 +1,13 @@ { - "fill" : "system-dark", + "fill-specializations" : [ + { + "value" : "system-light" + }, + { + "appearance" : "dark", + "value" : "system-dark" + } + ], "groups" : [ { "layers" : [ @@ -7,7 +15,7 @@ "image-name" : "logo.png", "name" : "logo", "position" : { - "scale" : 0.7, + "scale" : 0.595, "translation-in-points" : [ 0, 0 diff --git a/opennow-qt/packaging/icons/README.md b/opennow-qt/packaging/icons/README.md index 0fa04b644..c82beae0a 100644 --- a/opennow-qt/packaging/icons/README.md +++ b/opennow-qt/packaging/icons/README.md @@ -5,18 +5,26 @@ transparent padding, fits the unmodified cloud into a centered 896-pixel area on a transparent 1024-pixel canvas, and downsamples with Lanczos. macOS uses Apple's Icon Composer project in `OpenNOW.icon/`. Its foreground is -an unchanged copy of the canonical `logo.png`, placed at 0.7 scale on the system -dark background with Icon Composer's native effects. Open this project in -Apple Icon Composer to edit it, then export the 1024-pixel **macOS pre-Tahoe** -image as `macos-source.png`. That export owns the rounded charcoal tile, alpha, -lighting, and cloud treatment; the Python generator only downsamples it and -packages the images. Do not redraw these effects in the generator. +an unchanged copy of the canonical `logo.png`, centered at 59.5% scale with Icon +Composer's native effects. Default uses System Light and Dark uses System Dark. +Open this project in Apple Icon Composer to edit it, then export the 1024-pixel +**macOS pre-Tahoe** image in the **Default** appearance as `macos-source.png`. +That export supplies the rounded tile, alpha, lighting, and cloud treatment for +macOS 13–15. The Python generator downsamples and packages the export. -The checked-in ICNS is the compatibility path for the supported macOS 13+ -application. Keeping the editable `.icon` project does not add an Xcode asset -compilation step or require a newer macOS deployment target. The Qt runtime -uses the same Mac artwork, so setting a window icon cannot replace the Dock's -dark tile with the shared transparent cloud. +The bundle uses the layered `Assets.car` on Tahoe and later and the `OpenNOW.icns` +fallback on older macOS versions. Compile the catalog with Icon Composer support +in Xcode. The compiled resource is checked in so release builders can keep using +the macOS 13 deployment toolchain. + +```sh +mkdir -p build/macos-icon +xcrun actool --compile build/macos-icon --platform macosx --target-device mac \ + --minimum-deployment-target 13.0 --app-icon OpenNOW \ + --output-partial-info-plist build/macos-icon/IconInfo.plist \ + opennow-qt/packaging/icons/OpenNOW.icon +cp build/macos-icon/Assets.car opennow-qt/packaging/icons/Assets.car +``` From the repository root, generate and check the assets with the pinned Pillow version: @@ -48,8 +56,8 @@ assets. `OpenNOW.ico` contains 16, 24, 32, 48, 64, 128, and 256-pixel RGBA images for the Windows executable resource and the setup.exe icon. `OpenNOW.icns` contains standard images at 16, 32, 64, 128, 256, and 512 pixels plus Retina images through -1024 pixels for the macOS bundle. `opennow-macos-*.png` supplies the Mac Qt -window/Dock icon; `opennow-*.png` supplies Windows, Linux, and Linux hicolor entries. +1024 pixels for the macOS bundle. `opennow-macos-*.png` supplies the matching Qt +resources. `opennow-*.png` supplies Windows, Linux, and Linux hicolor entries. The generated SVG embeds the shared 512-pixel PNG to preserve the existing Linux AppImage packaging path. It is a raster-backed SVG, not a traced vector approximation. diff --git a/opennow-qt/packaging/icons/macos-source.png b/opennow-qt/packaging/icons/macos-source.png index 63f5a6166..2d6184fa9 100644 Binary files a/opennow-qt/packaging/icons/macos-source.png and b/opennow-qt/packaging/icons/macos-source.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-1024.png b/opennow-qt/packaging/icons/opennow-macos-1024.png index 09108756d..9e8693740 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-1024.png and b/opennow-qt/packaging/icons/opennow-macos-1024.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-128.png b/opennow-qt/packaging/icons/opennow-macos-128.png index 5b8b0dd04..179b0f42a 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-128.png and b/opennow-qt/packaging/icons/opennow-macos-128.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-16.png b/opennow-qt/packaging/icons/opennow-macos-16.png index 133bfdbf0..e80732ce5 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-16.png and b/opennow-qt/packaging/icons/opennow-macos-16.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-24.png b/opennow-qt/packaging/icons/opennow-macos-24.png index 5edcec79b..ae622c09c 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-24.png and b/opennow-qt/packaging/icons/opennow-macos-24.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-256.png b/opennow-qt/packaging/icons/opennow-macos-256.png index e6a575c94..989d84f07 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-256.png and b/opennow-qt/packaging/icons/opennow-macos-256.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-32.png b/opennow-qt/packaging/icons/opennow-macos-32.png index ecaf194e0..af4ee9709 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-32.png and b/opennow-qt/packaging/icons/opennow-macos-32.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-48.png b/opennow-qt/packaging/icons/opennow-macos-48.png index 7b918e689..0582e031d 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-48.png and b/opennow-qt/packaging/icons/opennow-macos-48.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-512.png b/opennow-qt/packaging/icons/opennow-macos-512.png index 7fe37b0c6..bef15e121 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-512.png and b/opennow-qt/packaging/icons/opennow-macos-512.png differ diff --git a/opennow-qt/packaging/icons/opennow-macos-64.png b/opennow-qt/packaging/icons/opennow-macos-64.png index 4b7fb99f3..c9d3ed030 100644 Binary files a/opennow-qt/packaging/icons/opennow-macos-64.png and b/opennow-qt/packaging/icons/opennow-macos-64.png differ diff --git a/opennow-qt/qml/components/ArtworkSource.qml b/opennow-qt/qml/components/ArtworkSource.qml index dbf9f9521..d8d560c05 100644 --- a/opennow-qt/qml/components/ArtworkSource.qml +++ b/opennow-qt/qml/components/ArtworkSource.qml @@ -8,6 +8,8 @@ QtObject { property bool requestActive: active property string retainedSource: "" readonly property string resolvedUrl: active ? ShellStore.artworkUrl(sourceUrl) : "" + readonly property bool failed: active && Boolean(ShellStore.artworkRetrySources + && ShellStore.artworkRetrySources[sourceUrl]) function reportImageStatus(status, imageSource) { if (active && (status === Image.Error || status === Image.Ready)) diff --git a/opennow-qt/qml/components/RoundedArtwork.qml b/opennow-qt/qml/components/RoundedArtwork.qml index 7833db554..fafcdeff6 100644 --- a/opennow-qt/qml/components/RoundedArtwork.qml +++ b/opennow-qt/qml/components/RoundedArtwork.qml @@ -5,6 +5,7 @@ import OpenNOW Item { id: root property string artwork: "" + property string fallbackTitle: "" property color fallbackColor: Theme.cartSteam property real cornerRadius: 34 property real scrimStart: 0.28 @@ -25,18 +26,46 @@ Item { requestActive: root.visible } + Rectangle { + anchors.fill: parent + radius: root.cornerRadius + color: root.fallbackColor + } + + Text { + anchors.centerIn: parent + width: Math.max(0, parent.width - 20) + visible: root.fallbackTitle !== "" && !image.hasArtwork + && (root.normalizedArtwork === "" || artworkSource.failed || image.status === Image.Error) + text: root.fallbackTitle + textFormat: Text.PlainText + wrapMode: Text.Wrap + maximumLineCount: 3 + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + color: "#F6F7FB" + font.family: Theme.bodyFont + font.pixelSize: DesktopTokens.captionSize + font.weight: Font.DemiBold + Accessible.ignored: true + } + Rectangle { id: roundedMask anchors.fill: parent radius: root.cornerRadius color: "white" visible: false - layer.enabled: true + layer.enabled: artworkLayer.visible } Item { + id: artworkLayer anchors.fill: parent - layer.enabled: true + visible: opacity > 0 + opacity: image.hasArtwork ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: AppController.reducedMotion ? 0 : Theme.heroDuration } } + layer.enabled: visible layer.smooth: true layer.effect: MultiEffect { maskEnabled: true @@ -45,17 +74,23 @@ Item { maskSpreadAtMin: 0.2 } - Rectangle { anchors.fill: parent; color: root.fallbackColor } Image { + id: image + property url readySource: "" + readonly property bool hasArtwork: status === Image.Ready + || (status === Image.Loading && readySource.toString() === source.toString()) anchors.fill: parent source: artworkSource.resolvedUrl - onStatusChanged: artworkSource.reportImageStatus(status, source) + onStatusChanged: { + if (status === Image.Ready) readySource = source + artworkSource.reportImageStatus(status, source) + } fillMode: Image.PreserveAspectCrop - sourceSize: Qt.size(Math.ceil(width), Math.ceil(height)) + sourceSize: DesktopTokens.artworkSourceSize(width, height, Screen.devicePixelRatio) asynchronous: true cache: true - opacity: status === Image.Ready ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: Theme.heroDuration } } + retainWhileLoading: true + visible: hasArtwork } Rectangle { anchors.fill: parent diff --git a/opennow-qt/qml/desktop/components/DesktopPoster.qml b/opennow-qt/qml/desktop/components/DesktopPoster.qml index 502a7b98d..1b03b8795 100644 --- a/opennow-qt/qml/desktop/components/DesktopPoster.qml +++ b/opennow-qt/qml/desktop/components/DesktopPoster.qml @@ -34,6 +34,7 @@ ItemDelegate { id: art x: root.artGutter; y: root.artGutter; width: root.artWidth; height: root.artHeight artwork: DesktopTokens.artworkUrl(root.game, false) + fallbackTitle: String(root.game && root.game.title || "") cornerRadius: 12 scrimStart: root.cardLifted || root.showPlay ? 0.3 : 1 fallbackColor: "#1A2232" diff --git a/opennow-qt/qml/desktop/components/DesktopPosterSkeleton.qml b/opennow-qt/qml/desktop/components/DesktopPosterSkeleton.qml new file mode 100644 index 000000000..7adc113e4 --- /dev/null +++ b/opennow-qt/qml/desktop/components/DesktopPosterSkeleton.qml @@ -0,0 +1,26 @@ +import QtQuick +import OpenNOW + +Item { + id: root + + property int captionHeight: 0 + property real cornerRadius: 12 + Accessible.ignored: true + + Rectangle { + width: parent.width + height: Math.max(0, parent.height - root.captionHeight) + radius: root.cornerRadius + color: DesktopTokens.raised + border.color: DesktopTokens.seam + } + Column { + y: parent.height - root.captionHeight + DesktopTokens.px(8) + width: parent.width + spacing: DesktopTokens.px(6) + visible: root.captionHeight > 0 + Rectangle { width: parent.width * 0.78; height: DesktopTokens.px(8); radius: 3; color: DesktopTokens.raisedStrong } + Rectangle { width: parent.width * 0.42; height: DesktopTokens.px(7); radius: 3; color: DesktopTokens.raised } + } +} diff --git a/opennow-qt/qml/desktop/components/DesktopTokens.qml b/opennow-qt/qml/desktop/components/DesktopTokens.qml index db20214d4..a271c930e 100644 --- a/opennow-qt/qml/desktop/components/DesktopTokens.qml +++ b/opennow-qt/qml/desktop/components/DesktopTokens.qml @@ -155,9 +155,14 @@ QtObject { function artworkUrl(game, preferHero) { if (!game) return "" - const raw = preferHero - ? String(game.heroImageUrl || game.imageUrl || game.screenshotUrl || game.boxArtUrl || "") - : String(game.imageUrl || game.heroImageUrl || game.screenshotUrl || game.boxArtUrl || "") + if (preferHero) + return decodeArtworkUrl(game.heroImageUrl || game.imageUrl || game.screenshotUrl || game.boxArtUrl) + const raw = String(game.boxArtUrl || game.imageUrl || "").trim() + // Existing catalog entries can carry wide NVIDIA art as imageUrl. + // Cropping those assets into a 2:3 card cuts off logos and titles. + if (/^https?:\/\/img\.nvidiagrid\.net\//i.test(raw) + && /\/(?:KEY_ART|KEY_IMAGE|(?:MARQUEE_)?HERO_IMAGE|TV_BANNER|FEATURE_IMAGE|SCREENSHOTS?)(?:[_./;?]|$)/i.test(raw)) + return "" return decodeArtworkUrl(raw) } @@ -165,6 +170,15 @@ QtObject { return String(url || "").split(";f=webp").join(";f=jpg") } + function artworkSourceSize(width, height, pixelRatio) { + // Raster sourceSize is measured in pixels. Keep nearby window sizes in + // the same decode bucket to avoid reloading on every resize step. + const bucket = 64 + const scale = Math.max(1, pixelRatio) + return Qt.size(Math.max(bucket, Math.ceil(width * scale / bucket) * bucket), + Math.max(bucket, Math.ceil(height * scale / bucket) * bucket)) + } + function consoleModeOn(win) { return win ? Boolean(win.forceConsole || win.desktopSurfaceActive === false) diff --git a/opennow-qt/qml/desktop/home/DesktopHomePoster.qml b/opennow-qt/qml/desktop/home/DesktopHomePoster.qml index 2f3293368..a415f330a 100644 --- a/opennow-qt/qml/desktop/home/DesktopHomePoster.qml +++ b/opennow-qt/qml/desktop/home/DesktopHomePoster.qml @@ -44,6 +44,7 @@ Item { RoundedArtwork { anchors.fill: parent artwork: root.artwork + fallbackTitle: String(root.game && root.game.title || "") fallbackColor: "#171B27" cornerRadius: 12 scrimStart: root.highlighted ? 0.3 : 1 diff --git a/opennow-qt/qml/desktop/home/DesktopHomeScreen.qml b/opennow-qt/qml/desktop/home/DesktopHomeScreen.qml index 327574f4c..423670fb1 100644 --- a/opennow-qt/qml/desktop/home/DesktopHomeScreen.qml +++ b/opennow-qt/qml/desktop/home/DesktopHomeScreen.qml @@ -36,6 +36,7 @@ FocusScope { Accessible.name: pageTitle readonly property var games: ShellStore.catalogGames || [] + readonly property bool catalogLoading: ShellStore.catalogInitialLoading readonly property var sortedRecent: { const list = (root.games || []).slice() list.sort((left, right) => String(right.lastPlayed || "").localeCompare(String(left.lastPlayed || ""))) @@ -114,6 +115,46 @@ FocusScope { return root.takeGames(games, 0, root.homeTileCount) } + component HomePosters: Row { + id: rail + required property int zone + readonly property var games: root.zoneGames(zone) + y: 30 + width: parent.width + spacing: root.railGap + + Repeater { + model: root.homeTileCount + Loader { + id: slot + required property int index + readonly property var game: rail.games[index] || null + visible: game !== null || root.catalogLoading + z: item ? item.z : 0 + width: root.homeTileWidth + height: root.homeTileHeight + sourceComponent: game ? poster : root.catalogLoading ? skeleton : null + + Component { + id: skeleton + DesktopPosterSkeleton {} + } + Component { + id: poster + DesktopHomePoster { + game: slot.game + tileWidth: root.homeTileWidth + tileHeight: root.homeTileHeight + current: root.focusZone === rail.zone && root.focusIndex === slot.index + onPointed: root.setSelection(rail.zone, slot.index) + onActivated: root.openGame(slot.game) + onPlayRequested: root.playRequested(slot.game) + } + } + } + } + } + function setSelection(zone, index) { root.focusZone = Math.max(0, Math.min(3, zone)) const count = root.focusZone === 0 ? 2 : root.zoneGames(root.focusZone).length @@ -277,7 +318,7 @@ FocusScope { source: heroArtworkSource.resolvedUrl onStatusChanged: heroArtworkSource.reportImageStatus(status, source) fillMode: Image.PreserveAspectCrop - sourceSize: Qt.size(Math.ceil(width), Math.ceil(height)) + sourceSize: DesktopTokens.artworkSourceSize(width, height, Screen.devicePixelRatio) asynchronous: true cache: true } @@ -321,7 +362,8 @@ FocusScope { Text { width: parent.width elide: Text.ElideRight - text: root.heroGame ? String(root.heroGame.title || qsTr("Game")) : qsTr("No games yet") + text: root.catalogLoading ? qsTr("Loading…") + : root.heroGame ? String(root.heroGame.title || qsTr("Game")) : qsTr("No games yet") color: "#FFFFFF" font.family: Theme.displayFont font.pixelSize: 34 @@ -332,6 +374,7 @@ FocusScope { width: parent.width elide: Text.ElideRight text: root.heroMeta() + opacity: root.catalogLoading ? 0 : 1 color: "#B8FFFFFF" font.family: Theme.bodyFont font.pixelSize: 13 @@ -341,6 +384,8 @@ FocusScope { Row { spacing: 9 + opacity: root.catalogLoading ? 0 : 1 + enabled: !root.catalogLoading Rectangle { id: startButton @@ -429,23 +474,7 @@ FocusScope { HoverHandler { id: seeJump; cursorShape: Qt.PointingHandCursor } TapHandler { onTapped: root.routeRequested("library") } } - Row { - y: 30; width: parent.width; spacing: root.railGap - Repeater { - model: root.takeGames(root.jumpGames, 0, root.homeTileCount) - DesktopHomePoster { - required property var modelData - required property int index - game: modelData - tileWidth: root.homeTileWidth - tileHeight: root.homeTileHeight - current: root.focusZone === 1 && root.focusIndex === index - onPointed: root.setSelection(1, index) - onActivated: root.openGame(modelData) - onPlayRequested: root.playRequested(modelData) - } - } - } + HomePosters { zone: 1 } } Item { @@ -461,23 +490,7 @@ FocusScope { HoverHandler { id: seeFriends; cursorShape: Qt.PointingHandCursor } TapHandler { onTapped: root.routeRequested("library") } } - Row { - y: 30; width: parent.width; spacing: root.railGap - Repeater { - model: root.takeGames(root.favoriteGames, 0, root.homeTileCount) - DesktopHomePoster { - required property var modelData - required property int index - game: modelData - tileWidth: root.homeTileWidth - tileHeight: root.homeTileHeight - current: root.focusZone === 2 && root.focusIndex === index - onPointed: root.setSelection(2, index) - onActivated: root.openGame(modelData) - onPlayRequested: root.playRequested(modelData) - } - } - } + HomePosters { zone: 2 } } Item { @@ -493,23 +506,7 @@ FocusScope { HoverHandler { id: seeNew; cursorShape: Qt.PointingHandCursor } TapHandler { onTapped: root.routeRequested("library") } } - Row { - y: 30; width: parent.width; spacing: root.railGap - Repeater { - model: root.takeGames(root.newGames, 0, root.homeTileCount) - DesktopHomePoster { - required property var modelData - required property int index - game: modelData - tileWidth: root.homeTileWidth - tileHeight: root.homeTileHeight - current: root.focusZone === 3 && root.focusIndex === index - onPointed: root.setSelection(3, index) - onActivated: root.openGame(modelData) - onPlayRequested: root.playRequested(modelData) - } - } - } + HomePosters { zone: 3 } } } } diff --git a/opennow-qt/qml/desktop/library/DesktopLibraryScreen.qml b/opennow-qt/qml/desktop/library/DesktopLibraryScreen.qml index 1f3128725..a1c767987 100644 --- a/opennow-qt/qml/desktop/library/DesktopLibraryScreen.qml +++ b/opennow-qt/qml/desktop/library/DesktopLibraryScreen.qml @@ -103,6 +103,9 @@ FocusScope { return result } readonly property var games: filteredGames() + readonly property bool waitingForGames: root.games.length === 0 + && (root.activeFilter === "cloud-favorites" ? ShellStore.remoteFavoritesState === "loading" + : ShellStore.catalogInitialLoading) readonly property var filters: [ {key:"all", label:qsTr("All"), count:root.countWhere(function(game) { return !root.isHiddenGame(game) })}, {key:"cloud-favorites", label:qsTr("GeForce NOW favorites"), count:ShellStore.remoteFavorites.length}, @@ -356,6 +359,7 @@ FocusScope { model: root.games focus: true boundsBehavior: Flickable.StopAtBounds + Accessible.description: root.waitingForGames ? qsTr("Loading…") : "" ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded } delegate: DesktopPoster { required property var modelData @@ -379,11 +383,30 @@ FocusScope { } } + Item { + objectName: "libraryLoadingSkeleton" + anchors.fill: grid + clip: true + visible: root.waitingForGames + + Repeater { + model: root.waitingForGames ? root.libraryColumns * Math.min(4, + Math.ceil(Math.max(0, grid.height) / Math.max(1, root.libraryCellH))) : 0 + DesktopPosterSkeleton { + required property int index + x: (index % root.libraryColumns) * root.libraryCellW + 6 + y: Math.floor(index / root.libraryColumns) * root.libraryCellH + 6 + width: Math.max(1, root.libraryCellW - 12) + height: Math.max(1, root.libraryCellH - 12) + } + } + } + Column { anchors.centerIn: grid width: Math.min(grid.width - 48, 460) spacing: 12 - visible: root.games.length === 0 + visible: root.games.length === 0 && !root.waitingForGames Text { width: parent.width text: root.collection ? qsTr("No games in this view") : qsTr("No games found") diff --git a/opennow-qt/qml/desktop/shell/DesktopApp.qml b/opennow-qt/qml/desktop/shell/DesktopApp.qml index 1ea659394..3696f02b3 100644 --- a/opennow-qt/qml/desktop/shell/DesktopApp.qml +++ b/opennow-qt/qml/desktop/shell/DesktopApp.qml @@ -43,6 +43,8 @@ FocusScope { return qsTr("Home") } function subtitleForRoute(value) { + if ((value === "library" && ShellStore.catalogInitialLoading) + || (value === "store" && ShellStore.storeInitialLoading)) return "" if (value === "library" || value === "game-detail") return qsTr("%1 games").arg(ShellStore.catalogTotalCount || ShellStore.catalogGames.length) if (value === "store") return qsTr("%1 in catalog").arg(ShellStore.storeTotalCount || ShellStore.storeGames.length) if (value === "friends") return qsTr("Coming soon") diff --git a/opennow-qt/qml/desktop/store/DesktopStoreContent.qml b/opennow-qt/qml/desktop/store/DesktopStoreContent.qml index 2535ea748..db755f1b7 100644 --- a/opennow-qt/qml/desktop/store/DesktopStoreContent.qml +++ b/opennow-qt/qml/desktop/store/DesktopStoreContent.qml @@ -55,6 +55,7 @@ FocusScope { readonly property int catalogCount: Number(ShellStore.storeTotalCount || (root.storeGames || []).length) readonly property string catalogState: ShellStore.storeState readonly property string catalogError: ShellStore.storeError + readonly property bool waitingForStore: ShellStore.storeInitialLoading && root.panelShelves.length === 0 onSearchTextChanged: storeSearchDelay.restart() onActiveGenreChanged: storeSearchDelay.restart() onActiveStoreChanged: storeSearchDelay.restart() @@ -629,10 +630,23 @@ FocusScope { onDetailsRequested: game => root.gameSelected(game) } + Rectangle { + id: heroPlaceholder + x: hero.x + y: hero.y + width: hero.width + height: hero.height + radius: 16 + visible: root.waitingForStore && root.isDefaultBrowse() && !hero.visible + color: DesktopTokens.raised + border.color: DesktopTokens.seam + Accessible.ignored: true + } + Flow { id: chips x: 24 - y: hero.visible ? 292 : 18 + y: hero.visible || heroPlaceholder.visible ? 292 : 18 width: root.railInnerWidth spacing: 8 @@ -730,6 +744,13 @@ FocusScope { y: storeStatus.y + (storeStatus.visible ? storeStatus.height + 16 : 0) width: root.railInnerWidth spacing: 16 + DesktopStoreShelf { + objectName: "storeLoadingSkeleton" + width: parent.width + title: qsTr("Loading the store…") + showSeeAll: false + placeholderCount: root.waitingForStore ? root.railCount : 0 + } Repeater { id: shelfRepeater // Replacing a JS-array model recreates every row, including its @@ -860,7 +881,7 @@ FocusScope { anchors.centerIn: parent width: Math.min(root.width - 48, 600) spacing: 9 - visible: root.panelShelves.length === 0 && root.newGames.length === 0 && root.popularGames.length === 0 + visible: !root.waitingForStore && root.panelShelves.length === 0 && root.newGames.length === 0 && root.popularGames.length === 0 z: 200 Text { diff --git a/opennow-qt/qml/desktop/store/DesktopStoreHero.qml b/opennow-qt/qml/desktop/store/DesktopStoreHero.qml index 92884e28a..ddfa10d75 100644 --- a/opennow-qt/qml/desktop/store/DesktopStoreHero.qml +++ b/opennow-qt/qml/desktop/store/DesktopStoreHero.qml @@ -21,6 +21,7 @@ Item { readonly property var slide: slides.length ? slides[Math.max(0, Math.min(currentSlide, slides.length - 1))] : null readonly property var slideGame: slide && slide.game ? slide.game : null + readonly property int nextIndex: slides.length ? (currentSlide + 1) % slides.length : 0 function nextSlide() { if (slides.length > 1) @@ -68,6 +69,7 @@ Item { Repeater { model: root.slides Item { + id: slideItem required property var modelData required property int index anchors.fill: parent @@ -75,15 +77,23 @@ Item { opacity: index === root.currentSlide ? 1 : 0 Behavior on opacity { NumberAnimation { duration: AppController.reducedMotion ? 0 : 450; easing.type: Easing.OutCubic } } + ArtworkSource { + id: slideArtwork + sourceUrl: DesktopTokens.decodeArtworkUrl(String(slideItem.modelData.image || "")) + active: root.visible && (slideItem.opacity > 0 || slideItem.index === root.currentSlide + || slideItem.index === root.nextIndex) + } + Image { x: Math.round(parent.width * 0.28) width: parent.width - x height: parent.height - source: DesktopTokens.decodeArtworkUrl(String(modelData.image || "")) + source: slideArtwork.resolvedUrl + onStatusChanged: slideArtwork.reportImageStatus(status, source) fillMode: Image.PreserveAspectCrop asynchronous: true cache: true - sourceSize: Qt.size(Math.ceil(width), Math.ceil(height)) + sourceSize: DesktopTokens.artworkSourceSize(width, height, Screen.devicePixelRatio) } } } diff --git a/opennow-qt/qml/desktop/store/DesktopStoreShelf.qml b/opennow-qt/qml/desktop/store/DesktopStoreShelf.qml index a1b3e72ca..cdf679346 100644 --- a/opennow-qt/qml/desktop/store/DesktopStoreShelf.qml +++ b/opennow-qt/qml/desktop/store/DesktopStoreShelf.qml @@ -14,13 +14,17 @@ Item { property bool materialized: true property string categoryId: "" property int totalCount: 0 + property int placeholderCount: 0 property var localGames: [] property string requestId: "" property string loadError: "" property int loadedLimit: 0 property int requestedLimit: 0 readonly property var displayGames: categoryId ? localGames : games - readonly property bool empty: root.displayGames.length === 0 && root.loadError === "" + readonly property bool reserved: root.placeholderCount > 0 || (root.categoryId !== "" && root.totalCount > 0) + readonly property bool empty: !root.reserved && root.displayGames.length === 0 && root.loadError === "" + readonly property bool awaitingGames: root.reserved && root.displayGames.length === 0 + && root.loadedLimit === 0 && root.loadError === "" visible: !root.empty function cancelRequest() { loadDelay.stop() @@ -80,7 +84,8 @@ Item { readonly property int railGap: DesktopTokens.px(14) readonly property int columnCount: Math.max(1, Math.floor((width + railGap) / (DesktopTokens.libraryArtWidth + railGap))) - readonly property int tileCount: Math.max(1, Math.min(60, (root.categoryId ? root.totalCount : root.games.length) || 1, columnCount)) + readonly property int tileCount: Math.max(1, Math.min(60, (root.placeholderCount + || (root.categoryId ? root.totalCount : root.games.length)) || 1, columnCount)) // A short final page keeps the same poster size as a full row. readonly property int tileWidth: Math.max(DesktopTokens.libraryArtWidth, Math.floor((width - railGap * (columnCount - 1)) / columnCount)) readonly property int tileHeight: Math.round(tileWidth * 198 / 132) + DesktopTokens.storeCardInfoHeight @@ -151,6 +156,16 @@ Item { width: parent.width spacing: root.railGap + Repeater { + model: root.materialized && root.awaitingGames ? root.tileCount : 0 + DesktopPosterSkeleton { + width: root.tileWidth + height: root.tileHeight + captionHeight: DesktopTokens.storeCardInfoHeight + cornerRadius: DesktopTokens.px(12) + } + } + Repeater { model: root.materialized ? Math.min(root.displayGames.length, root.tileCount) : 0 diff --git a/opennow-qt/qml/state/ShellStore.qml b/opennow-qt/qml/state/ShellStore.qml index e9b3f06ac..b42895ba2 100644 --- a/opennow-qt/qml/state/ShellStore.qml +++ b/opennow-qt/qml/state/ShellStore.qml @@ -264,6 +264,7 @@ QtObject { property alias selectedGame: catalogOwner.selectedGame property alias catalogTotalCount: catalogOwner.catalogTotalCount property alias catalogState: catalogOwner.catalogState + readonly property bool catalogInitialLoading: catalogOwner.catalogInitialLoading property alias catalogComplete: catalogOwner.catalogComplete property alias catalogError: catalogOwner.catalogError property alias catalogNextCursor: catalogOwner.catalogNextCursor @@ -296,6 +297,7 @@ QtObject { property alias storeForceRefresh: catalogOwner.storeForceRefresh property alias storeLastPageCached: catalogOwner.storeLastPageCached readonly property bool storeLoading: catalogOwner.storeLoading + readonly property bool storeInitialLoading: catalogOwner.storeInitialLoading property alias storePageTimer: catalogOwner.storePageTimer property alias storeMarquee: catalogOwner.storeMarquee property alias storePanels: catalogOwner.storePanels @@ -660,17 +662,7 @@ QtObject { serverIp:root.conflictSession.serverIp || "" }, 35000) } else if (stage === "create") { - root.streamState = "requesting" - root.launchRequestedAtMs = Date.now() - root.pendingRequestedColorQuality = String(root.settings.colorQuality || "8bit_420") - root.streamCreateRequestId = CoreClient.request("session.create", - Object.assign({}, root.pendingLaunchParams, { - runtimeCapabilities: root.nativeRuntimeCapabilities, - maxEntitledFps: settingsOwner.maxEntitledFps(String(root.settings.resolution || "")), - // Active display physical DPI (auto per screen / OS). - screenDpi: AppController.screenDpi(), - devicePixelRatio: Screen.devicePixelRatio - }), 60000) + root.requestNewSession() } } function onRequestFailed(id, code, message) { @@ -2127,6 +2119,24 @@ QtObject { inspectLaunch("create") } + function requestNewSession() { + streamState = "requesting" + launchRequestedAtMs = Date.now() + pendingRequestedColorQuality = String(settings.colorQuality || "8bit_420") + streamCreateRequestId = CoreClient.request("session.create", + Object.assign({}, pendingLaunchParams, { + runtimeCapabilities: nativeRuntimeCapabilities, + maxEntitledFps: settingsOwner.maxEntitledFps(String(settings.resolution || "")), + // Active display physical DPI (auto per screen / OS). + screenDpi: AppController.screenDpi(), + devicePixelRatio: Screen.devicePixelRatio + }), 60000) + if (streamCreateRequestId === "") { + pendingRequestedColorQuality = "" + handleSessionCreateFailure("", CoreClient.lastError || qsTr("Session could not start")) + } + } + function resolveSessionConflict(choice) { if (streamBusy) return diff --git a/opennow-qt/qml/state/catalog/CatalogState.qml b/opennow-qt/qml/state/catalog/CatalogState.qml index 5e34efffb..c83277114 100644 --- a/opennow-qt/qml/state/catalog/CatalogState.qml +++ b/opennow-qt/qml/state/catalog/CatalogState.qml @@ -16,6 +16,7 @@ QtObject { property int catalogTotalCount: 0 property string catalogState: "idle" readonly property bool catalogBusy: catalogState === "loading" || catalogState === "refreshing" + readonly property bool catalogInitialLoading: catalogGames.length === 0 && (catalogState === "idle" || catalogBusy) property string catalogSource: "public" property string catalogRequestId: "" property bool catalogComplete: false @@ -407,6 +408,8 @@ QtObject { property bool storeLastPageCached: false property string storeRequestId: "" readonly property bool storeLoading: storeRequestId !== "" || storePageTimer.running + readonly property bool storeInitialLoading: storeGames.length === 0 + && (storeState === "idle" || storeState === "loading" || storeState === "refreshing") property Timer storePageTimer: Timer { interval: root.storeLastPageCached ? 1 : 75 onTriggered: root.requestStorePage() diff --git a/opennow-qt/src/app/ApplicationStartup.cpp b/opennow-qt/src/app/ApplicationStartup.cpp index 7dea6781b..e8baac9e8 100644 --- a/opennow-qt/src/app/ApplicationStartup.cpp +++ b/opennow-qt/src/app/ApplicationStartup.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #ifdef Q_OS_WIN @@ -148,7 +149,10 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta if (flyHighSelfTest >= 0 && flyHighSelfTest + 1 < application.arguments().size()) return FrameGenerationBenchmark::flyHighSelfTest(application.arguments().at(flyHighSelfTest + 1)); QGuiApplication::setDesktopFileName(u"io.github.opencloudgaming.OpenNOW"_s); +#ifndef Q_OS_MACOS + // On macOS, Cocoa must resolve the bundle's appearance-aware icon. QGuiApplication::setWindowIcon(applicationWindowIcon()); +#endif #if defined(Q_OS_LINUX) && QT_CONFIG(vulkan) && __has_include() LinuxVulkanGraphics::requestDeviceExtensions(); #endif @@ -349,9 +353,11 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta &macAwdl, [&] { macAwdl.setStreaming(nativeStreamRuntime.streaming()); }); macAwdl.setStreaming(nativeStreamRuntime.streaming()); #endif - QQmlApplicationEngine engine; + std::optional qmlEngine(std::in_place); + auto &engine = *qmlEngine; engine.setInitialProperties({{u"visible"_s, false}, {u"visibility"_s, QWindow::Hidden}}); - AcceptanceSession acceptance(application, engine, controller, coreClient, arguments); + std::optional acceptance(std::in_place, application, engine, controller, + coreClient, arguments); engine.rootContext()->setContextProperty(u"AppController"_s, &controller); engine.rootContext()->setContextProperty(u"ControllerInput"_s, &controllerInput); engine.rootContext()->setContextProperty(u"ThumbnailGenerator"_s, &thumbnailGenerator); @@ -371,7 +377,7 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta : arguments.contains(u"--console"_s) ? u"console"_s : QString{}); engine.rootContext()->setContextProperty( u"QuitAfterSession"_s, arguments.contains(u"--quit-after-session"_s)); - acceptance.configureContext(); + acceptance->configureContext(); QObject::connect(&localization, &Localization::localeChanged, &engine, &QQmlApplicationEngine::retranslate); QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, @@ -429,13 +435,13 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta return EXIT_FAILURE; } #endif - if (acceptance.prepareWindow() != EXIT_SUCCESS) return EXIT_FAILURE; + if (acceptance->prepareWindow() != EXIT_SUCCESS) return EXIT_FAILURE; if (rootWindow && arguments.contains(u"--fullscreen"_s)) rootWindow->showFullScreen(); else if (rootWindow && !rootWindow->isVisible()) rootWindow->show(); const auto qmlReadyMs = startupTimer.elapsed(); controller.handleArguments(arguments); QObject::connect(&controller, &AppController::activationRequested, - &application, [&engine] { + &engine, [&engine] { if (engine.rootObjects().isEmpty()) return; auto *window = qobject_cast(engine.rootObjects().first()); if (!window) return; @@ -464,12 +470,12 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta QObject::connect(rootWindow, SIGNAL(sessionQuitCancelled()), &singleInstance, SLOT(cancelQuitRequest())); - if (acceptance.measureStartup(startupTimer, qmlReadyMs) != EXIT_SUCCESS) + if (acceptance->measureStartup(startupTimer, qmlReadyMs) != EXIT_SUCCESS) return EXIT_FAILURE; if (!coreProgram.isEmpty()) coreClient.start(coreProgram); - if (acceptance.startWorkload() != EXIT_SUCCESS) return EXIT_FAILURE; + if (acceptance->startWorkload() != EXIT_SUCCESS) return EXIT_FAILURE; const auto exitCode = application.exec(); auto *qmlCoreClient = engine.rootContext()->contextProperty(u"CoreClient"_s).value(); @@ -479,9 +485,11 @@ static int runApplicationSession(int argc, char *argv[], QString &restartExecuta && engine.singletonInstance(u"OpenNOW"_s, u"ShellStore"_s)->property("sessionWorkIdle").toBool(); armTeardownDeadline(exitCode); coreClient.stop(); + // Let the engine tear down its roots, queued QML work and singletons while + // the GUI platform, fonts, controllers and native presentation are alive. + acceptance.reset(); + qmlEngine.reset(); #ifdef OPENNOW_EMBEDDED_STREAMER - const auto roots = engine.rootObjects(); - for (auto *root : roots) delete root; StreamVideoItem::setNativeStreamRuntime(nullptr); if (!nativeStreamRuntime.shutdown()) { qWarning("Could not complete embedded streamer shutdown: %s", diff --git a/opennow-qt/src/app/platform/GraphicsDeviceSelection.cpp b/opennow-qt/src/app/platform/GraphicsDeviceSelection.cpp index 1f60227dc..98017cd1c 100644 --- a/opennow-qt/src/app/platform/GraphicsDeviceSelection.cpp +++ b/opennow-qt/src/app/platform/GraphicsDeviceSelection.cpp @@ -1,6 +1,7 @@ #include "app/platform/GraphicsDeviceSelection.h" #include +#include #include #include #include @@ -61,30 +62,39 @@ bool decoderProfileSupports(ID3D11VideoDevice *video, const GUID &profile, DXGI_ return false; } -void indexAdapterDecode(IDXGIAdapter *adapter, bool *h264, bool *h265, bool *av1) +bool supportsShellRendering(IDXGIAdapter *adapter) +{ + constexpr D3D_FEATURE_LEVEL levels[] = {D3D_FEATURE_LEVEL_11_0}; + Microsoft::WRL::ComPtr device; + return SUCCEEDED(D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, + D3D11_CREATE_DEVICE_BGRA_SUPPORT, levels, UINT(std::size(levels)), D3D11_SDK_VERSION, + device.GetAddressOf(), nullptr, nullptr)); +} + +bool indexAdapterDecode(IDXGIAdapter *adapter, bool *h264, bool *h265, bool *av1) { *h264 = *h265 = *av1 = false; - if (!adapter) return; using Microsoft::WRL::ComPtr; const D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0}; ComPtr device; ComPtr context; + D3D_FEATURE_LEVEL level{}; const auto created = D3D11CreateDevice( adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_VIDEO_SUPPORT, levels, UINT(std::size(levels)), D3D11_SDK_VERSION, - device.GetAddressOf(), nullptr, context.GetAddressOf()); + device.GetAddressOf(), &level, context.GetAddressOf()); if (FAILED(created) || !device) { qInfo("Graphics adapter decode index skipped device creation: 0x%08lx", static_cast(created)); - return; + return supportsShellRendering(adapter); } ComPtr video; if (FAILED(device.As(&video)) || !video) { qInfo("Graphics adapter decode index has no D3D11 video device"); - return; + return level >= D3D_FEATURE_LEVEL_11_0; } const UINT profileCount = video->GetVideoDecoderProfileCount(); const UINT count = profileCount < 64u ? profileCount : 64u; @@ -102,6 +112,7 @@ void indexAdapterDecode(IDXGIAdapter *adapter, bool *h264, bool *h265, bool *av1 || decoderProfileSupports(video.Get(), profile, DXGI_FORMAT_P010); } } + return level >= D3D_FEATURE_LEVEL_11_0; } } #endif @@ -150,12 +161,12 @@ QList GraphicsDeviceSelection::detectAdapters( bool h264 = false; bool h265 = false; bool av1 = false; - indexAdapterDecode(adapter.Get(), &h264, &h265, &av1); + const bool shellRendering = indexAdapterDecode(adapter.Get(), &h264, &h265, &av1); const auto name = QString::fromWCharArray(description.Description); qInfo("Graphics adapter %s decode index: h264=%d h265=%d av1=%d", qUtf8Printable(name), int(h264), int(h265), int(av1)); adapters.append({id, name, luid, quint64(description.DedicatedVideoMemory), false, - h264, h265, av1}); + h264, h265, av1, shellRendering}); } #endif return adapters; @@ -211,8 +222,9 @@ const GraphicsDeviceSelection::Adapter *GraphicsDeviceSelection::automaticAdapte { const Adapter *fallback = nullptr; for (const auto &adapter : m_adapters) { - if (!fallback) fallback = &adapter; - if (canDecode(adapter)) return &adapter; + if (!fallback || (!fallback->supportsShellRendering && adapter.supportsShellRendering)) + fallback = &adapter; + if (adapter.supportsShellRendering && canDecode(adapter)) return &adapter; } return fallback; } @@ -262,7 +274,19 @@ bool GraphicsDeviceSelection::applyTo(QQuickWindow *window) const { if (!m_active.luid) return true; #ifdef Q_OS_WIN - if (!window || window->isVisible() || window->isSceneGraphInitialized()) return false; + // Qt's software scene graph reports itself initialized before it has a + // graphics device. Only an existing RHI makes adapter selection too late. + if (!window || window->isVisible() || window->rhi()) return false; + if (!m_active.supportsShellRendering) { + // Supplying a hardware adapter LUID disables Qt's built-in WARP retry. + // Keep the D3D11 scene graph and allow the shell to open on legacy GPUs. + auto configuration = window->graphicsConfiguration(); + configuration.setPreferSoftwareDevice(true); + window->setGraphicsConfiguration(configuration); + qWarning("Selected adapter %s cannot render the shell with D3D11 feature level 11.0; using WARP", + qUtf8Printable(m_active.name)); + return true; + } window->setGraphicsDevice(QQuickGraphicsDevice::fromAdapter( quint32(m_active.luid), std::bit_cast(quint32(m_active.luid >> 32)))); qInfo("Selected graphics adapter: %s (LUID %016llx)", qUtf8Printable(m_active.name), diff --git a/opennow-qt/src/app/platform/GraphicsDeviceSelection.h b/opennow-qt/src/app/platform/GraphicsDeviceSelection.h index 92f6a99af..c3dfe30ad 100644 --- a/opennow-qt/src/app/platform/GraphicsDeviceSelection.h +++ b/opennow-qt/src/app/platform/GraphicsDeviceSelection.h @@ -27,6 +27,7 @@ class GraphicsDeviceSelection final : public QObject bool h264 = false; bool h265 = false; bool av1 = false; + bool supportsShellRendering = true; }; static QList detectAdapters(); diff --git a/opennow-qt/src/streaming/StreamVideoItem.cpp b/opennow-qt/src/streaming/StreamVideoItem.cpp index 2c660f7ae..9703c1381 100644 --- a/opennow-qt/src/streaming/StreamVideoItem.cpp +++ b/opennow-qt/src/streaming/StreamVideoItem.cpp @@ -8,6 +8,7 @@ #include "streaming/rendering/StreamSenderPacer.h" #include +#include #include #include #include @@ -151,10 +152,16 @@ StreamVideoItem::StreamVideoItem(std::unique_ptr pointerCaptu }; connect(this, &QQuickItem::windowChanged, this, attachWindow); attachWindow(window()); +#if defined(Q_OS_WIN) + QCoreApplication::instance()->installNativeEventFilter(this); +#endif } StreamVideoItem::~StreamVideoItem() { +#if defined(Q_OS_WIN) + QCoreApplication::instance()->removeNativeEventFilter(this); +#endif m_windowsWindowMoveLoop.reset(); disconnect(this, nullptr, this, nullptr); disconnect(m_frameSwapConnection); diff --git a/opennow-qt/src/streaming/StreamVideoItem.h b/opennow-qt/src/streaming/StreamVideoItem.h index 18b2e1ba4..69f8dda93 100644 --- a/opennow-qt/src/streaming/StreamVideoItem.h +++ b/opennow-qt/src/streaming/StreamVideoItem.h @@ -14,6 +14,9 @@ #include #include #include +#if defined(Q_OS_WIN) +#include +#endif #include #include @@ -22,6 +25,9 @@ class QHoverEvent; class NativeStreamRuntime; class StreamVideoItem : public QQuickItem +#if defined(Q_OS_WIN) + , private QAbstractNativeEventFilter +#endif { Q_OBJECT Q_PROPERTY(QSize videoSize READ videoSize WRITE setVideoSize NOTIFY videoSizeChanged) @@ -220,6 +226,10 @@ class StreamVideoItem : public QQuickItem [[nodiscard]] quint16 eventVirtualKey(const QKeyEvent *event) const; [[nodiscard]] Qt::KeyboardModifiers eventModifiers(const QKeyEvent *event) const; [[nodiscard]] quint32 keyIdentity(const QKeyEvent *event) const; +#if defined(Q_OS_WIN) + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override; + QSet m_windowsDeadKeys; +#endif [[nodiscard]] static quint8 mouseButton(Qt::MouseButton button); static QPointer s_nativeRuntime; diff --git a/opennow-qt/src/streaming/StreamVideoItemInput.cpp b/opennow-qt/src/streaming/StreamVideoItemInput.cpp index 8c0c4c7aa..3a893f723 100644 --- a/opennow-qt/src/streaming/StreamVideoItemInput.cpp +++ b/opennow-qt/src/streaming/StreamVideoItemInput.cpp @@ -229,6 +229,46 @@ quint16 StreamVideoItem::windowsGameplayVirtualKey(int key, Qt::KeyboardModifier return windowsVirtualKey(key, modifiers, nativeVirtualKey); } +#if defined(Q_OS_WIN) +bool StreamVideoItem::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) +{ + if (!m_captureActive || eventType != "windows_generic_MSG") return false; + const auto &msg = *static_cast(message); + const bool pressed = msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN; + if (!pressed && msg.message != WM_KEYUP && msg.message != WM_SYSKEYUP) return false; + if (!m_inputWindow || !m_inputWindow->handle() + || msg.hwnd != reinterpret_cast(m_inputWindow->winId())) return false; + + const auto flags = HIWORD(msg.lParam); + const quint32 scanCode = LOBYTE(flags) | ((flags & KF_EXTENDED) ? 0xe000 : 0); + if (!windowsSet1VirtualKey(scanCode) || scanCode > 0xff) return false; + const auto nativeKey = quint32(msg.wParam); + if (nativeKey == 0 || nativeKey == VK_PROCESSKEY || nativeKey >= VK_PACKET) return false; + const auto modifiers = QGuiApplication::queryKeyboardModifiers(); + + if (pressed && !m_windowsDeadKeys.contains(scanCode)) { + // Qt consumes keydowns translated to WM_DEADCHAR and then has no keyup + // record. Probe before TranslateMessage so composition stays remote. + BYTE keyboardState[256]; + wchar_t spacingAccent[4]{}; + constexpr UINT preserveKeyboardState = 0x04; + if (!GetKeyboardState(keyboardState) + || ToUnicodeEx(nativeKey, scanCode, keyboardState, spacingAccent, 4, + preserveKeyboardState, GetKeyboardLayout(0)) >= 0) return false; + m_windowsDeadKeys.insert(scanCode); + QKeyEvent event(QEvent::KeyPress, int(spacingAccent[0]), modifiers, scanCode, + nativeKey, 0, {}, (flags & KF_REPEAT) != 0); + keyPressEvent(&event); + } else if (!pressed) { + if (!m_windowsDeadKeys.remove(scanCode)) return false; + QKeyEvent event(QEvent::KeyRelease, Qt::Key_unknown, modifiers, scanCode, nativeKey, 0); + keyReleaseEvent(&event); + } + if (result) *result = 0; + return true; +} +#endif + static quint16 macPhysicalVirtualKey(quint32 keyCode) { switch (keyCode) { @@ -992,6 +1032,9 @@ void StreamVideoItem::releaseInput() } m_pressedKeys.clear(); m_pressedShortcuts.clear(); +#if defined(Q_OS_WIN) + m_windowsDeadKeys.clear(); +#endif if (!m_rawInputActive) releaseQtMouseButtons(); else m_pressedMouseButtons.clear(); ungrabMouse(); diff --git a/opennow-qt/tests/StorePagingAcceptance.qml b/opennow-qt/tests/StorePagingAcceptance.qml index 02f58c0dc..b8f100c85 100644 --- a/opennow-qt/tests/StorePagingAcceptance.qml +++ b/opennow-qt/tests/StorePagingAcceptance.qml @@ -87,7 +87,11 @@ QtObject { const first = ShellStore.storeRequestId check(client.requests.find(r => r.id === first).params.limit === 40, "unbounded page requested") check(client.requests.find(r => r.id === first).method === "catalog.store.local", "Store did not use its local index") + const storeSkeleton = namedChild(screen, "storeLoadingSkeleton") + check(storeSkeleton && storeSkeleton.awaitingGames && storeSkeleton.height > 0, + "the initial Store load has no poster skeleton") client.responseReceived(first, page([game("a"),game("b")], "cursor-one", true)) + check(!storeSkeleton.awaitingGames && storeSkeleton.height === 0, "the Store kept its skeleton after results") check(ShellStore.storeGames.length === 2 && !ShellStore.storeLoading && ShellStore.storeHasMore, "Store automatically continued instead of waiting for demand (games=" + ShellStore.storeGames.length + ", loading=" + ShellStore.storeLoading + ", more=" + ShellStore.storeHasMore @@ -308,6 +312,8 @@ QtObject { DesktopTokens.uiScale = originalScale const shelf = shelfComponent.createObject(screen, {width:600,materialized:false,categoryId:"shelf:0:0",totalCount:90}) + const unloadedShelfHeight = shelf.height + check(shelf.awaitingGames && unloadedShelfHeight > 0, "offscreen shelf collapsed before its games loaded") const hiddenRequestCount = client.requests.length shelf.requestVisible() check(client.requests.length === hiddenRequestCount, "offscreen shelf requested games") @@ -322,6 +328,8 @@ QtObject { shelf.materialized = true shelf.requestVisible() client.responseReceived(shelf.requestId, {games:[ranked]}) + check(!shelf.awaitingGames && shelf.height === unloadedShelfHeight, + "loading a shelf changed its reserved height") const loadedShelfRequests = client.requests.length shelf.materialized = false check(shelf.localGames.length === 0, "hidden shelf retained visual model") @@ -348,12 +356,17 @@ QtObject { // A pinned/scaled sidebar can leave fewer than five posters' worth of // room. Rows and keyboard navigation must use the same visible bounds. const originalLibrary = ShellStore.catalogGames + const originalCatalogState = ShellStore.catalogState const homeGames = [] for (let i = 0; i < 14; ++i) homeGames.push(game("home-" + i)) - ShellStore.catalogGames = homeGames + ShellStore.catalogGames = [] + ShellStore.catalogState = "loading" const homeHost = hostComponent.createObject(screen, {width:600,height:500,visible:false}) const home = homeComponent.createObject(homeHost, {active:false}) check(home !== null, "the Home navigation fixture did not load") + check(home.catalogLoading, "Home did not show its initial loading state") + ShellStore.catalogGames = homeGames + check(!home.catalogLoading, "Home kept its skeleton after the first library page") check(home.homeTileWidth * home.homeTileCount + home.railGap * (home.homeTileCount - 1) <= home.railInnerWidth, "Home forced clipped posters into a narrow content column") home.setSelection(1, 0) @@ -366,6 +379,20 @@ QtObject { home.destroy() homeHost.destroy() ShellStore.catalogGames = originalLibrary + ShellStore.catalogState = originalCatalogState + + const hero = "https://img.nvidiagrid.net/apps/game/TV_BANNER_1.jpg;f=jpg;w=900" + const poster = "https://img.nvidiagrid.net/apps/game/GAME_BOX_ART_1.jpg;f=jpg;w=900" + check(DesktopTokens.artworkUrl({imageUrl:hero, heroImageUrl:hero}, false) === "" + && DesktopTokens.artworkUrl({imageUrl:hero, heroImageUrl:hero}, true) === hero, + "legacy wide artwork was not kept out of portrait cards") + check(DesktopTokens.artworkUrl({imageUrl:poster, heroImageUrl:hero}, false) === poster, + "portrait box art was not selected") + const retina = DesktopTokens.artworkSourceSize(132, 198, 2) + const resized = DesktopTokens.artworkSourceSize(136, 202, 2) + check(retina.width >= 264 && retina.height >= 396 + && resized.width === retina.width && resized.height === retina.height, + "posters did not account for Retina pixels or re-decoded during a small resize") // An account switch cancels both channels, and late results cannot leak. ShellStore.retryStore() @@ -437,7 +464,8 @@ QtObject { } else if (phase === 1) { if (!state.evicted) return card.destroy() - card = component.createObject(state, {artwork:source, width:43, height:43, scrimStart:1}) + // Cross a source-size bucket so Qt cannot reuse the decoded texture. + card = component.createObject(state, {artwork:source, width:95, height:95, scrimStart:1}) errorDeadline = Date.now() + 300 phase = 2 } else if (phase === 2) { diff --git a/opennow-qt/tests/test_application_icons.py b/opennow-qt/tests/test_application_icons.py index 9d0aa79af..1056b7156 100644 --- a/opennow-qt/tests/test_application_icons.py +++ b/opennow-qt/tests/test_application_icons.py @@ -70,7 +70,10 @@ def test_macos_icon_contains_standard_and_retina_images(self): def test_macos_icons_preserve_the_apple_composer_export(self): project = ICONS / "OpenNOW.icon" specification = json.loads((project / "icon.json").read_text()) - self.assertEqual(specification["fill"], "system-dark") + self.assertEqual(specification["fill-specializations"], [ + {"value": "system-light"}, + {"appearance": "dark", "value": "system-dark"}, + ]) for group in specification["groups"]: for layer in group["layers"]: self.assertEqual((project / "Assets" / layer["image-name"]).read_bytes(), @@ -88,7 +91,7 @@ def test_macos_icons_preserve_the_apple_composer_export(self): if size >= 128: r, g, b, alpha = image.getpixel((size // 2, size // 5)) self.assertEqual(alpha, 255) - self.assertLess(max(r, g, b), 100) + self.assertGreater(min(r, g, b), 200) def test_check_accepts_recompression_but_rejects_changed_pixels(self): original = (ICONS / "opennow-macos-32.png").read_bytes() @@ -132,6 +135,10 @@ def test_bundle_identity_is_preserved_and_icon_is_declared(self): plist = plistlib.loads((PACKAGING / "Info.plist.in").read_bytes()) self.assertEqual(plist["CFBundleIdentifier"], "${MACOSX_BUNDLE_GUI_IDENTIFIER}") self.assertEqual(plist["CFBundleIconFile"], "${MACOSX_BUNDLE_ICON_FILE}") + self.assertEqual(plist["CFBundleIconName"], "OpenNOW") + bundle_resources = (QT_ROOT / "cmake/ApplicationIcons.cmake").read_text() + self.assertIn("packaging/icons/Assets.car packaging/icons/OpenNOW.icns", bundle_resources) + self.assertTrue((ICONS / "Assets.car").read_bytes().startswith(b"BOMStore")) desktop = (PACKAGING / "io.github.opencloudgaming.OpenNOW.desktop").read_text() self.assertIn("Icon=io.github.opencloudgaming.OpenNOW\n", desktop) diff --git a/opennow-qt/tests/test_stable_release.py b/opennow-qt/tests/test_stable_release.py index 93b162d88..61285c191 100644 --- a/opennow-qt/tests/test_stable_release.py +++ b/opennow-qt/tests/test_stable_release.py @@ -32,9 +32,11 @@ def test_generated_release_notes_describe_both_signed_macos_dmgs(self): self.assertNotIn("Intel macOS is not included", notes) def test_stable_version_uses_project_version_without_nightly_suffix(self): - cmake = ROOT / "opennow-qt/CMakeLists.txt" - self.assertEqual(nightly_version(cmake, 1, 1, "stable"), "1.0.4") - self.assertEqual(nightly_version(cmake, 620, 1), "1.0.4-nightly.620.1") + with tempfile.TemporaryDirectory() as directory: + cmake = Path(directory) / "CMakeLists.txt" + cmake.write_text("project(OpenNOWQt VERSION 1.2.3 LANGUAGES CXX)\n") + self.assertEqual(nightly_version(cmake, 1, 1, "stable"), "1.2.3") + self.assertEqual(nightly_version(cmake, 620, 1), "1.2.3-nightly.620.1") def test_channels_cannot_relabel_each_others_versions(self): for version, channel in (("1.0.0-nightly.1.1", "stable"), ("1.0.0", "nightly"), diff --git a/opennow-qt/tests/tst_applicationicons.cpp b/opennow-qt/tests/tst_applicationicons.cpp index f973098cd..fe27ae538 100644 --- a/opennow-qt/tests/tst_applicationicons.cpp +++ b/opennow-qt/tests/tst_applicationicons.cpp @@ -25,12 +25,11 @@ private slots: QCOMPARE(image.pixelColor(0, 0).alpha(), 0); #if defined(Q_OS_MACOS) QVERIFY(path.contains(u"opennow-macos-"_s)); - // The charcoal tile must survive the runtime icon override rather - // than falling back to the shared transparent cloud silhouette. + // The light tile is part of the bundled macOS artwork. if (size >= 128) { const QColor tile = image.pixelColor(size / 2, size / 5); QCOMPARE(tile.alpha(), 255); - QVERIFY(tile.red() < 100 && tile.green() < 100 && tile.blue() < 100); + QVERIFY(tile.red() > 200 && tile.green() > 200 && tile.blue() > 200); } #else QVERIFY(!path.contains(u"macos"_s)); diff --git a/opennow-qt/tests/tst_embeddedorchestration.cpp b/opennow-qt/tests/tst_embeddedorchestration.cpp index c14cfff98..97c463e1e 100644 --- a/opennow-qt/tests/tst_embeddedorchestration.cpp +++ b/opennow-qt/tests/tst_embeddedorchestration.cpp @@ -1052,6 +1052,33 @@ private slots: } } + void refusedCreateLeavesRequestingState() + { + QJSEngine engine; + engine.installExtensions(QJSEngine::TranslationExtension); + QVERIFY(loadShellFunction(engine, QStringLiteral("requestNewSession"))); + QVERIFY(loadShellFunction(engine, QStringLiteral("handleSessionCreateFailure"))); + const auto result = engine.evaluate(QStringLiteral(R"JS( + var pendingLaunchParams = {appId:'123'}, settings = {}, nativeRuntimeCapabilities = {}; + var streamState = 'checking', streamMessage = '', streamCreateRequestId = ''; + var pendingRequestedColorQuality = '', launchRequestedAtMs = 0; + var settingsOwner = {maxEntitledFps:function(){return 60;}}; + var AppController = {screenDpi:function(){return 96;}}; + var Screen = {devicePixelRatio:1}; + var streamPollTimer = {stop:function(){}}; + var CoreClient = { + lastError:'Cloud allocation cleanup is unresolved', + request:function(){return '';} + }; + requestNewSession(); + )JS")); + QVERIFY2(!result.isError(), qPrintable(result.toString())); + QCOMPARE(engine.evaluate(QStringLiteral("streamState")).toString(), QStringLiteral("error")); + QCOMPARE(engine.evaluate(QStringLiteral("streamMessage")).toString(), + QStringLiteral("Cloud allocation cleanup is unresolved")); + QVERIFY(engine.evaluate(QStringLiteral("pendingRequestedColorQuality === ''")).toBool()); + } + void launchDiscoveryFailure_data() { QTest::addColumn("code"); @@ -3038,14 +3065,16 @@ private slots: const auto exec = main.indexOf(QStringLiteral("const auto exitCode = application.exec();")); const auto deadline = main.indexOf(QStringLiteral("armTeardownDeadline(exitCode);")); const auto core = main.indexOf(QStringLiteral("coreClient.stop();")); - const auto roots = main.indexOf(QStringLiteral("for (auto *root : roots) delete root;")); + const auto acceptance = main.indexOf(QStringLiteral("acceptance.reset();"), exec); + const auto qmlEngine = main.indexOf(QStringLiteral("qmlEngine.reset();"), exec); const auto streamer = main.indexOf(QStringLiteral("nativeStreamRuntime.shutdown()"), exec); const auto completed = main.indexOf(QStringLiteral("singleInstance.finishQuitRequest();"), exec); QVERIFY(exec >= 0); QVERIFY(deadline > exec); QVERIFY(core > deadline); - QVERIFY(roots > core); - QVERIFY(streamer > roots); + QVERIFY(acceptance > core); + QVERIFY(qmlEngine > acceptance); + QVERIFY(streamer > qmlEngine); QVERIFY(completed > streamer); QVERIFY(main.contains(QStringLiteral("if (exitCode == EXIT_SUCCESS && requestedQuitCompleted)"))); QVERIFY(main.contains(QStringLiteral("->property(\"sessionWorkIdle\").toBool()"))); @@ -3107,13 +3136,13 @@ private slots: const auto owner = main.indexOf(QStringLiteral("LinuxVulkanGraphics::Device vulkanDevice")); const auto diagnostics = main.indexOf(QStringLiteral("NativeStreamRuntime::initializeDiagnostics()")); const auto runtime = main.indexOf(QStringLiteral("NativeStreamRuntime nativeStreamRuntime")); - const auto engine = main.indexOf(QStringLiteral("QQmlApplicationEngine engine")); + const auto engine = main.indexOf(QStringLiteral("std::optional qmlEngine")); const auto hidden = main.indexOf(QStringLiteral("engine.setInitialProperties")); const auto load = main.indexOf(QStringLiteral("engine.loadFromModule")); const auto decorations = main.indexOf(QStringLiteral("WindowTheme::prepareWindow(rootWindow)")); const auto graphicsSetup = main.indexOf(QStringLiteral("graphicsDevices.applyTo(rootWindow)")); const auto adopt = main.indexOf(QStringLiteral("vulkanDevice.adopt(rootWindow)")); - const auto prepare = main.indexOf(QStringLiteral("acceptance.prepareWindow()")); + const auto prepare = main.indexOf(QStringLiteral("acceptance->prepareWindow()")); const auto show = main.indexOf(QStringLiteral("rootWindow->show()")); QVERIFY(owner >= 0); QVERIFY(diagnostics >= 0); diff --git a/opennow-qt/tests/tst_graphicsdeviceselection.cpp b/opennow-qt/tests/tst_graphicsdeviceselection.cpp index 5639d0cbd..0f4ac52dc 100644 --- a/opennow-qt/tests/tst_graphicsdeviceselection.cpp +++ b/opennow-qt/tests/tst_graphicsdeviceselection.cpp @@ -1,6 +1,10 @@ #include "app/platform/GraphicsDeviceSelection.h" #include +#include +#include +#include +#include #include #include @@ -98,6 +102,24 @@ private slots: QVERIFY(!options[1].toMap().value(u"value"_s).toString().isEmpty()); } + void legacyAdapterUsesWarpForTheShell() + { + const GraphicsDeviceSelection::Adapter legacy{ + u"legacy"_s, u"Legacy GPU"_s, 7, 0, false, false, false, false, false}; + const GraphicsDeviceSelection::Adapter modern{u"modern"_s, u"Modern GPU"_s, 8}; + GraphicsDeviceSelection automatic({legacy, modern}, {}); + QCOMPARE(automatic.adapterLuid(), 8ULL); +#ifdef Q_OS_WIN + GraphicsDeviceSelection onlyLegacy({legacy}, {}); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11); + QQuickWindow window; + QVERIFY(!window.rhi()); + QVERIFY(onlyLegacy.applyTo(&window)); + QVERIFY(window.graphicsConfiguration().prefersSoftwareDevice()); + QVERIFY(window.graphicsDevice().isNull()); +#endif + } + void hardwareEnumerationNeverReturnsSoftwareOrDuplicateLuids() { const auto adapters = GraphicsDeviceSelection::detectAdapters(); diff --git a/opennow-qt/tests/tst_streamvideoitem.cpp b/opennow-qt/tests/tst_streamvideoitem.cpp index c83dc7dbb..f37610f12 100644 --- a/opennow-qt/tests/tst_streamvideoitem.cpp +++ b/opennow-qt/tests/tst_streamvideoitem.cpp @@ -1542,6 +1542,8 @@ private slots: << quint32(0x11) << quint16(0xa2); QTest::newRow("no-scan-synthetic-altgr") << int(Qt::Key_AltGr) << quint32(0) << quint32(0) << quint16(0xa5); + QTest::newRow("german-circumflex-physical-position") << int(Qt::Key_AsciiCircum) + << quint32(0x29) << quint32(0xdc) << quint16(0xc0); } void windowsModifierScanCodesPreserveSides()