Skip to content

reco-gui: default calibration preference + overwrite confirmation - #435

Open
RufanMelfor wants to merge 1 commit into
reco-project:mainfrom
RufanMelfor:feat/default-calibration-preference
Open

reco-gui: default calibration preference + overwrite confirmation#435
RufanMelfor wants to merge 1 commit into
reco-project:mainfrom
RufanMelfor:feat/default-calibration-preference

Conversation

@RufanMelfor

@RufanMelfor RufanMelfor commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Default Calibration file path to reco-gui's Preferences dialog, used as a fallback whenever no calibration is otherwise loaded/picked for a session.
  • The fallback is applied in try_init_and_update - the single point every left/right/calibration pick path already converges on before initialization - so it covers "no calibration available" generically instead of needing per-pick-site handling. An explicit pick always takes priority over the default.
  • Saving over the file currently configured as the default now shows a confirmation modal ("Overwrite default calibration?") instead of silently overwriting it, since the whole point of a default is to stay a stable fallback rather than get mutated by whatever the current session happens to be editing.

Why

A default calibration is useful for rigs/setups that are reused across many sessions (e.g. a fixed camera rig at a home venue) - without it, every new session with no calibration picked requires re-selecting the same file. But since calibration_path can point at that same file during an editing session, an unprotected "Save Calibration" could silently clobber the shared default with in-progress, session-specific tweaks - the confirmation step exists specifically to prevent that.

Implementation

  • GuiSettings::default_calibration_path: Option<PathBuf> (crates/reco-gui/src/settings.rs), following the exact shape of the existing ai_model_path/recording_folder fields, plus a default_calibration() accessor that only returns the path if it still exists on disk (mirrors how MRU entries are already validated elsewhere in this file).
  • Preferences dialog: new "Default calibration" row (LineEdit + "Browse…") under AI model, wired via prefs-default-calibration-path + pick-prefs-default-calibration, prefilled/persisted in on_open_prefs_dialog/on_save_prefs.
  • AppState::is_default_calibration() compares the currently-loaded calibration_path against the configured default. on_save_calibration checks this first; if true, it opens a new overwrite-default-cal-warning-open modal instead of writing immediately. Confirming calls a separate confirm-save-calibration callback that performs the actual write (shared do_save_calibration helper avoids duplicating the save/toast logic between the two paths).

Test plan

  • cargo build -p reco-gui - clean
  • cargo fmt --all -- --check - clean
  • cargo test -p reco-gui settings:: - 5/5 pass (3 new tests covering default_calibration(): unset, stale/deleted path, existing path)
  • cargo clippy -p reco-gui --all-targets -- -D warnings - no new warnings; the 4 errors present are pre-existing on main (reco-core dead-code/unsafe-ptr-arg issues, same ones tracked by Clear pre-existing clippy -D warnings failures on Windows #423) and unrelated to this change
  • Manual GUI verification (set a default in Preferences, start a session with no calibration picked, confirm it loads; edit and Save, confirm the warning modal appears and Cancel/Overwrite both behave correctly) - confirmed working by @RufanMelfor
afbeelding

I have read the CLA Document and I hereby sign the CLA

Adds a "Default calibration" path in Preferences that reco-gui falls
back to whenever no calibration is otherwise loaded/picked for a
session (wired into try_init_and_update, the single point every
left/right/calibration pick path converges on before initialization).

Saving over the file currently configured as the default now prompts
for confirmation first ("Overwrite default calibration?"), since that
file is meant to be a stable fallback for future sessions rather than
scratch space for the current editing session.
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

All contributors have signed the CLA. Thank you!
Posted by the CLA Assistant Lite bot.

@RufanMelfor

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants