feat: show loaded config path in Config
Expose the server-owned active profile path through IPC and render it in the Config tab. Keep the displayed path current when switching profiles and document the diagnostic. Tests: cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo test -p tui; cargo test -p fader_master profile_switch_prepares_before_commit_and_invalid_candidate_keeps_old_profile; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo test --workspace --doc --all-features; cargo build --workspace --release --all-features. Full workspace tests reach the pre-existing user-edited arch-pipewire fixture failure: expected surface id apc-mini, got apc-mini-apc-mini-midi-1.
This commit is contained in:
parent
5983b1cfb5
commit
af3b460375
|
|
@ -578,7 +578,7 @@ reserved relative-mode runtime work is complete.
|
|||
The secondary Config tab is not an alternative object editor. It presents
|
||||
profile theme, mixer orientation and pickup-status selection, a popup listing
|
||||
all hidden faders for individual restoration, unsaved and Save state, active
|
||||
profile/backend status, MIDI-learn
|
||||
profile/backend status, the server-resolved loaded configuration path, MIDI-learn
|
||||
cancellation, and MIDI device diagnostics. Object and layout edits stay on the
|
||||
main mixer. Its quick-help footer calls out Left/Right layout switching
|
||||
alongside Save and navigation. There is no separate hidden-fader mode: hidden
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
use std::{fs, io, path::PathBuf};
|
||||
use std::{
|
||||
fs, io,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use fader_config::{
|
||||
AtomicFile, ConfigError, PersistenceError, Profile, ProfileDocument, SelectorDraft,
|
||||
|
|
@ -47,6 +50,10 @@ impl ConfigurationEditor {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
|
||||
pub(crate) const fn revision(&self) -> u64 {
|
||||
self.revision
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::io::{self, Read, Write};
|
|||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||
use thiserror::Error;
|
||||
|
||||
pub const PROTOCOL_VERSION: u16 = 23;
|
||||
pub const PROTOCOL_VERSION: u16 = 24;
|
||||
pub const MAX_FRAME_BYTES: usize = 64 * 1024;
|
||||
|
||||
/// Kind of mixer object addressed by a client.
|
||||
|
|
@ -264,6 +264,8 @@ pub struct ConfigurationSnapshot {
|
|||
pub error: Option<String>,
|
||||
pub profile_id: String,
|
||||
#[serde(default)]
|
||||
pub profile_path: Option<String>,
|
||||
#[serde(default)]
|
||||
pub available_profiles: Vec<String>,
|
||||
pub mixer_orientation: MixerOrientation,
|
||||
pub status_display: StatusDisplayMode,
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ pub(crate) fn configuration_snapshot(
|
|||
learning: None,
|
||||
error: None,
|
||||
profile_id: profile.id().to_string(),
|
||||
profile_path: None,
|
||||
available_profiles: vec![profile.id().to_string()],
|
||||
mixer_orientation: match profile.mixer_orientation() {
|
||||
fader_config::MixerOrientation::Vertical => crate::ipc::MixerOrientation::Vertical,
|
||||
|
|
|
|||
|
|
@ -398,6 +398,8 @@ impl LocalServer {
|
|||
self.configuration.dirty(),
|
||||
self.applied_configuration_revision,
|
||||
);
|
||||
configuration.profile_path =
|
||||
Some(self.configuration.path().to_string_lossy().into_owned());
|
||||
configuration.available_profiles =
|
||||
available_profile_ids(&self.profile_directory, profile.id().as_str());
|
||||
configuration.learning = Some(format!("{surface} -> {fader} ({action:?})"));
|
||||
|
|
@ -630,6 +632,7 @@ impl LocalServer {
|
|||
self.configuration.dirty(),
|
||||
self.applied_configuration_revision,
|
||||
);
|
||||
configuration.profile_path = Some(self.configuration.path().to_string_lossy().into_owned());
|
||||
configuration.available_profiles =
|
||||
available_profile_ids(&self.profile_directory, profile.id().as_str());
|
||||
configuration.error = error;
|
||||
|
|
@ -945,6 +948,15 @@ mod tests {
|
|||
panic!("valid candidate should activate");
|
||||
};
|
||||
assert_eq!(snapshot.configuration.profile_id, "secondary");
|
||||
assert_eq!(
|
||||
snapshot.configuration.profile_path.as_deref(),
|
||||
Some(
|
||||
root.path()
|
||||
.join("secondary.toml")
|
||||
.to_string_lossy()
|
||||
.as_ref()
|
||||
)
|
||||
);
|
||||
assert_eq!(snapshot.objects[0].label, "Listening");
|
||||
assert!(snapshot.revision > old_revision);
|
||||
let active = fader_config::ActiveConfig::parse(
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ impl IpcMixerClient {
|
|||
learning: snapshot.configuration.learning,
|
||||
error: snapshot.configuration.error,
|
||||
profile_id: snapshot.configuration.profile_id,
|
||||
profile_path: snapshot.configuration.profile_path,
|
||||
available_profiles: snapshot.configuration.available_profiles,
|
||||
mixer_orientation: match snapshot.configuration.mixer_orientation {
|
||||
crate::ipc::MixerOrientation::Vertical => tui::MixerOrientation::Vertical,
|
||||
|
|
|
|||
2
task.md
2
task.md
|
|
@ -378,6 +378,8 @@ Dependencies: M8, M2, M1.
|
|||
The server now owns the validated draft and its independent revision; stale
|
||||
or invalid edit requests are rejected without advancing or altering it, and
|
||||
accepted edits are exposed as an unsaved draft in the Config tab.
|
||||
The Config tab also reports the server-resolved path of the loaded profile so
|
||||
configuration failures can be traced to the file that needs inspection.
|
||||
- [x] **M9.2 Surface bindings / MIDI learn:** select surface, listen for one supported control, preview conflicts and save binding. Tests: learning suppresses the normal action, other surfaces are not captured accidentally, cancellation restores routing, duplicate binding is rejected.
|
||||
The Config tab starts surface/fader/action-scoped learning with `L` and
|
||||
cancels with `C`. Captured CC/note identity is added to the validated server
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
|
|||
learning: None,
|
||||
error: None,
|
||||
profile_id: "desktop".to_owned(),
|
||||
profile_path: Some("/home/alex/.config/fader_master/profiles/desktop.toml".to_owned()),
|
||||
available_profiles: vec!["desktop".to_owned()],
|
||||
mixer_orientation,
|
||||
status_display: tui::StatusDisplayMode::Symbol,
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ pub struct ConfigurationSnapshot {
|
|||
pub learning: Option<String>,
|
||||
pub error: Option<String>,
|
||||
pub profile_id: String,
|
||||
pub profile_path: Option<String>,
|
||||
pub available_profiles: Vec<String>,
|
||||
pub mixer_orientation: MixerOrientation,
|
||||
pub status_display: StatusDisplayMode,
|
||||
|
|
@ -4590,6 +4591,9 @@ impl<C: MixerClient> LiveTui<C> {
|
|||
))
|
||||
.bold(),
|
||||
];
|
||||
if let Some(path) = &config.profile_path {
|
||||
lines.push(Line::from(format!("Config file: {path}")));
|
||||
}
|
||||
lines.push(Line::from(format!(
|
||||
"Backend: {} · {} · mixer revision {}",
|
||||
self.snapshot.backend, self.snapshot.status, self.snapshot.revision
|
||||
|
|
@ -7052,6 +7056,7 @@ mod tests {
|
|||
learning: None,
|
||||
error: None,
|
||||
profile_id: "desktop".into(),
|
||||
profile_path: Some("/home/test/.config/fader_master/profiles/desktop.toml".into()),
|
||||
available_profiles: vec!["desktop".into(), "streaming".into()],
|
||||
mixer_orientation: MixerOrientation::Vertical,
|
||||
status_display: StatusDisplayMode::Detailed,
|
||||
|
|
@ -7122,6 +7127,9 @@ mod tests {
|
|||
.collect::<String>();
|
||||
|
||||
assert!(rendered.contains("Profile: desktop"));
|
||||
assert!(
|
||||
rendered.contains("Config file: /home/test/.config/fader_master/profiles/desktop.toml")
|
||||
);
|
||||
assert!(rendered.contains("unsaved draft"));
|
||||
assert!(rendered.contains("Theme Default"));
|
||||
assert!(rendered.contains("Pickup status Detailed"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue