Update JackServerSettingsDialog.tsx
More time on trying to make sure that Ok behaves correctly.
This commit is contained in:
@@ -361,7 +361,7 @@ const JackServerSettingsDialog = withStyles(
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
// Error requesting ALSA info.
|
||||
});
|
||||
}
|
||||
|
||||
@@ -495,9 +495,10 @@ const JackServerSettingsDialog = withStyles(
|
||||
if (this.props.open) {
|
||||
this.requestAlsaInfo();
|
||||
this.startStatusTimer();
|
||||
this.saveSettingsTemporary(this.props.jackServerSettings);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
componentDidUpdate(oldProps: JackServerSettingsDialogProps) {
|
||||
if ((this.props.open && !oldProps.open) && this.mounted) {
|
||||
this.ignoreClose = false;
|
||||
@@ -535,12 +536,8 @@ const JackServerSettingsDialog = withStyles(
|
||||
this.saveSettings(this.originalJackServerSettings);
|
||||
this.originalJackServerSettings = undefined;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
||||
if (!this.state.alsaDevices) return undefined;
|
||||
for (let i = 0; i < this.state.alsaDevices.length; ++i) {
|
||||
@@ -609,22 +606,29 @@ const JackServerSettingsDialog = withStyles(
|
||||
this.startStatusTimer();
|
||||
}
|
||||
};
|
||||
|
||||
handleOk() {
|
||||
if (!this.state.okEnabled) return;
|
||||
|
||||
const proceedWithOk = () => {
|
||||
this.ignoreClose = true; // Indicate that the closing is intentional
|
||||
this.releaseDevices(); // Release devices
|
||||
this.applySettings(); // Apply current settings
|
||||
this.saveSettings(); // Save settings permanently
|
||||
this.originalJackServerSettings = undefined;
|
||||
if (this.props.onApply) {
|
||||
this.props.onApply(this.state.jackServerSettings.clone());
|
||||
}
|
||||
this.props.onClose(); // Close the dialog
|
||||
};
|
||||
|
||||
if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice
|
||||
&& !this.suppressDeviceWarning) {
|
||||
this.setState({ showDeviceWarning: true });
|
||||
return;
|
||||
}
|
||||
// apply and persist the selected settings
|
||||
this.ignoreClose = true;
|
||||
this.releaseDevices();
|
||||
this.applySettings();
|
||||
this.saveSettings();
|
||||
this.originalJackServerSettings = undefined;
|
||||
if (this.props.onApply) {
|
||||
this.props.onApply(this.state.jackServerSettings.clone());
|
||||
}
|
||||
|
||||
proceedWithOk();
|
||||
};
|
||||
|
||||
handleWarningProceed() {
|
||||
@@ -641,6 +645,7 @@ const JackServerSettingsDialog = withStyles(
|
||||
if (this.props.onApply) {
|
||||
this.props.onApply(this.state.jackServerSettings.clone());
|
||||
}
|
||||
this.props.onClose(); // Close the dialog after the warning
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user