reco-gui: default calibration preference + overwrite confirmation - #435
Open
RufanMelfor wants to merge 1 commit into
Open
reco-gui: default calibration preference + overwrite confirmation#435RufanMelfor wants to merge 1 commit into
RufanMelfor wants to merge 1 commit into
Conversation
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.
|
All contributors have signed the CLA. Thank you! |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.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_pathcan 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 existingai_model_path/recording_folderfields, plus adefault_calibration()accessor that only returns the path if it still exists on disk (mirrors how MRU entries are already validated elsewhere in this file).LineEdit+ "Browse…") under AI model, wired viaprefs-default-calibration-path+pick-prefs-default-calibration, prefilled/persisted inon_open_prefs_dialog/on_save_prefs.AppState::is_default_calibration()compares the currently-loadedcalibration_pathagainst the configured default.on_save_calibrationchecks this first; if true, it opens a newoverwrite-default-cal-warning-openmodal instead of writing immediately. Confirming calls a separateconfirm-save-calibrationcallback that performs the actual write (shareddo_save_calibrationhelper avoids duplicating the save/toast logic between the two paths).Test plan
cargo build -p reco-gui- cleancargo fmt --all -- --check- cleancargo test -p reco-gui settings::- 5/5 pass (3 new tests coveringdefault_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 onmain(reco-coredead-code/unsafe-ptr-arg issues, same ones tracked by Clear pre-existing clippy -D warnings failures on Windows #423) and unrelated to this changeI have read the CLA Document and I hereby sign the CLA