feat(app): P5 — async full-res render, full preferences, shortcut map

- viewers show the 480px proxy immediately and a background thread
  fills the sequence-resolution frame (per-monitor in-flight job,
  generation-based staleness, playback skips full-res)
- preferences dialog complete: cache dir (now consumed by
  default_disk_cache_path), proxy policy/divider, snapshot interval
  (write-through era autosave), default transition length, audio
  in/out devices (new facade device-enumeration exports; audio init
  from config — playback was never creating the audio instance),
  language/theme/renderer backend, all persisted via config
- shortcut map (src/shortcuts.rs): space/J/K/L, I/O, S split, A/^A,
  ⌘Z/⌘⇧Z, ⌘N/⌘O/⌘S/⌘E/⌘Q, frame step, Home, track zoom; dispatch
  shares the menu action path and stays silent over modals
- screenshots: preferences dialog zh/en captured and reviewed
This commit is contained in:
2026-08-16 18:05:03 +08:00
parent 466cdcb7d7
commit e346ea5338
17 changed files with 2237 additions and 72 deletions
+47 -1
View File
@@ -244,7 +244,11 @@ impl ManagerInner {
self.output_device = device;
self.output_started = false;
self.output_buffer.clear();
// The stream reopens with the new device on the next push.
// The stream reopens with the new device on the next push. Drop the
// cached params too: `push_to_output` only re-opens the stream on a
// params change, so without this the switch would stay silent until
// the format changed.
self.output_params = None;
self.output_device_stream.close();
Ok(())
}
@@ -440,6 +444,48 @@ pub fn find_device_by_name_s_or_default(name: &String, _is_output_device: bool)
}
/// The host's output device names in enumeration order; the list index is
/// the device index [`ManagerInner::set_output_device`] takes. The default
/// device is NOT marked — callers prepend their own "system default" entry
/// (index -1). Static (needs no manager instance).
pub fn output_device_names() -> Vec<String> {
device_names(true)
}
/// The host's input device names in enumeration order (see
/// [`output_device_names`]).
pub fn input_device_names() -> Vec<String> {
device_names(false)
}
/// Enumerates the default host's devices, keeping only the ones that
/// support the requested direction; unnamed devices are skipped.
fn device_names(output: bool) -> Vec<String> {
let host = cpal::default_host();
let devices = if output {
host.output_devices()
} else {
host.input_devices()
};
let Ok(devices) = devices else {
return Vec::new();
};
devices
.filter_map(|d| d.id().ok().map(|id| id.id().to_string()))
.collect()
}
/// The enumeration index of the device named `name` (`None` when absent);
/// the inverse of [`output_device_names`]/[`input_device_names`].
pub fn device_index_by_name(name: &str, output: bool) -> Option<i32> {
let names = if output {
output_device_names()
} else {
input_device_names()
};
names.iter().position(|n| n == name).map(|i| i as i32)
}
#[cfg(test)]
mod tests {
+10
View File
@@ -926,10 +926,20 @@ mod tests {
/// The default disk cache directory (C++ `DiskManager::
/// get_default_disk_cache_path`): `<configuration location>/mediacache`.
///
/// The `DiskCachePath` config key overrides the location when set (the
/// preferences dialog's cache-directory setting); an empty/absent value
/// keeps the default.
///
/// Single-lib unification: this used to live in the oakrender crate's
/// `bridge::common` fallback (see `docs/zh/plans/riir/single-lib.md`);
/// oaknode and oakrender both call it directly now.
pub fn default_disk_cache_path() -> String {
// A configured override wins (whitespace-only counts as absent).
if let Ok(custom) = crate::configstore::ConfigStore::instance().get(None, "DiskCachePath") {
if !custom.trim().is_empty() {
return custom;
}
}
Path::new(
&FileFunctions::new()
.get_configuration_location()