feat(qt): Offline settings 'Check now'
Hands out the connectivity actor's existing public request_recheck so the row probes immediately instead of waiting for the next scheduled check — the passthrough was the whole gap. cc
This commit is contained in:
3 files changed
+33
No files matched your search
@@ -55,6 +55,18 @@ Column {
|
||||
onToggled: function (v) { QbzBridge.settingsBool("offline-mode-enabled", v) }
|
||||
}
|
||||
}
|
||||
// Ask the connectivity actor for an immediate probe rather than waiting
|
||||
// for its next scheduled one. Disabled under MANUAL offline (mode 2),
|
||||
// where the answer is a user decision and not a network fact.
|
||||
SettingRow {
|
||||
label: QbzSession.tr("Check connection", QbzSession.trRev)
|
||||
description: QbzSession.tr("Test the connection now instead of waiting for the next automatic check.", QbzSession.trRev)
|
||||
SettingsButton {
|
||||
text: QbzSession.tr("Check now", QbzSession.trRev)
|
||||
enabled: QbzSession.offlineMode !== 2
|
||||
onClicked: QbzBridge.settingsString("offline-recheck", "")
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSpacer { }
|
||||
SettingsDivider { }
|
||||
|
||||
@@ -57,6 +57,23 @@ pub fn start() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Settings > Offline "Check now": ask the actor for an immediate probe
|
||||
/// instead of waiting for its next scheduled one.
|
||||
///
|
||||
/// The passthrough is the whole gap this closes — `ConnectivityActor::
|
||||
/// request_recheck` has been public since the actor landed
|
||||
/// (`qbz-app/src/offline_mode/connectivity.rs:471`) and the reference exposes
|
||||
/// it the same way (`crates/qbz/src/offline_mode.rs:61-64`); this module just
|
||||
/// never handed out its private `OnceLock`.
|
||||
///
|
||||
/// A no-op before boot, which is when there is nothing to re-check anyway.
|
||||
pub fn request_recheck() {
|
||||
match CONNECTIVITY.get() {
|
||||
Some(actor) => actor.request_recheck(),
|
||||
None => log::warn!("[qbz-qt] offline recheck ignored: connectivity actor not started"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Mirror every engine status change into the bridge properties (the login
|
||||
/// affordances + the D2 recovery banner read them). Also seeds
|
||||
/// `hasPreviousSession` once; `enter_shell` refreshes it after a successful
|
||||
|
||||
@@ -2483,6 +2483,10 @@ pub async fn settings_string(key: &str, value: String) {
|
||||
"plex-clear-cache" => library::plex_clear_cache().await,
|
||||
// --- Offline --------------------------------------------------------
|
||||
"lyrics-cache-clear" => offline::clear_lyrics_cache().await,
|
||||
// Offline > "Check now": nudge the connectivity actor. The status it
|
||||
// publishes flows back through offline_fwd's forwarder, so there is
|
||||
// nothing to await and nothing to republish here.
|
||||
"offline-recheck" => crate::offline_fwd::request_recheck(),
|
||||
// --- Developer ------------------------------------------------------
|
||||
"open-log-file" => devtools::open_log_file(),
|
||||
// The value is the include-auth gate ("with-auth" or empty) — see
|
||||
|
||||
Reference in new issue
Block a user