Update JackServerSettingsDialog.tsx

On close modified to have an ignore.
This commit is contained in:
Extremesecrecy
2025-07-27 12:48:57 -07:00
parent 3576f1c7cf
commit 13a8b47658
+14 -6
View File
@@ -299,6 +299,7 @@ const JackServerSettingsDialog = withStyles(
class extends ResizeResponsiveComponent<JackServerSettingsDialogProps, JackServerSettingsDialogState> { class extends ResizeResponsiveComponent<JackServerSettingsDialogProps, JackServerSettingsDialogState> {
model: PiPedalModel; model: PiPedalModel;
ignoreClose: boolean = false;
constructor(props: JackServerSettingsDialogProps) { constructor(props: JackServerSettingsDialogProps) {
super(props); super(props);
@@ -385,7 +386,6 @@ const JackServerSettingsDialog = withStyles(
} }
} }
// ---------------------- New API helpers ----------------------
/** Persist the current settings to permanent storage. */ /** Persist the current settings to permanent storage. */
saveSettings(settings?: JackServerSettings) { saveSettings(settings?: JackServerSettings) {
const s = (settings ?? this.state.jackServerSettings).clone(); const s = (settings ?? this.state.jackServerSettings).clone();
@@ -615,6 +615,7 @@ const JackServerSettingsDialog = withStyles(
return; return;
} }
// apply and persist the selected settings // apply and persist the selected settings
this.ignoreClose = true;
this.releaseDevices(); this.releaseDevices();
this.applySettings(); this.applySettings();
this.saveSettings(); this.saveSettings();
@@ -630,6 +631,7 @@ const JackServerSettingsDialog = withStyles(
this.suppressDeviceWarning = true; this.suppressDeviceWarning = true;
} }
this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => { this.setState({ showDeviceWarning: false, dontShowWarningAgain: false }, () => {
this.ignoreClose = true;
this.releaseDevices(); this.releaseDevices();
this.applySettings(); this.applySettings();
this.saveSettings(); this.saveSettings();
@@ -678,13 +680,19 @@ const JackServerSettingsDialog = withStyles(
const { onClose, open } = this.props; const { onClose, open } = this.props;
//Ignore close rutine if the ignoreclose is true. (After OK or Proceed or Multi Device Warning)
const handleClose = () => { const handleClose = () => {
if (this.ignoreClose) {
this.ignoreClose = false;
return;
} else {
this.releaseDevices(); this.releaseDevices();
if (this.originalJackServerSettings) { if (this.originalJackServerSettings) {
// Revert any applied settings // Revert any applied settings
this.applySettings(this.originalJackServerSettings); this.applySettings(this.originalJackServerSettings);
this.saveSettings(this.originalJackServerSettings); this.saveSettings(this.originalJackServerSettings);
this.originalJackServerSettings = undefined; this.originalJackServerSettings = undefined;
}
} }
onClose(); onClose();
}; };