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) => {
|
.catch((error) => {
|
||||||
|
// Error requesting ALSA info.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,9 +495,10 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
if (this.props.open) {
|
if (this.props.open) {
|
||||||
this.requestAlsaInfo();
|
this.requestAlsaInfo();
|
||||||
this.startStatusTimer();
|
this.startStatusTimer();
|
||||||
|
this.saveSettingsTemporary(this.props.jackServerSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
componentDidUpdate(oldProps: JackServerSettingsDialogProps) {
|
componentDidUpdate(oldProps: JackServerSettingsDialogProps) {
|
||||||
if ((this.props.open && !oldProps.open) && this.mounted) {
|
if ((this.props.open && !oldProps.open) && this.mounted) {
|
||||||
this.ignoreClose = false;
|
this.ignoreClose = false;
|
||||||
@@ -535,12 +536,8 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
this.saveSettings(this.originalJackServerSettings);
|
this.saveSettings(this.originalJackServerSettings);
|
||||||
this.originalJackServerSettings = undefined;
|
this.originalJackServerSettings = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
||||||
if (!this.state.alsaDevices) return undefined;
|
if (!this.state.alsaDevices) return undefined;
|
||||||
for (let i = 0; i < this.state.alsaDevices.length; ++i) {
|
for (let i = 0; i < this.state.alsaDevices.length; ++i) {
|
||||||
@@ -609,22 +606,29 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
this.startStatusTimer();
|
this.startStatusTimer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleOk() {
|
handleOk() {
|
||||||
if (!this.state.okEnabled) return;
|
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
|
if (this.state.jackServerSettings.alsaInputDevice !== this.state.jackServerSettings.alsaOutputDevice
|
||||||
&& !this.suppressDeviceWarning) {
|
&& !this.suppressDeviceWarning) {
|
||||||
this.setState({ showDeviceWarning: true });
|
this.setState({ showDeviceWarning: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// apply and persist the selected settings
|
|
||||||
this.ignoreClose = true;
|
proceedWithOk();
|
||||||
this.releaseDevices();
|
|
||||||
this.applySettings();
|
|
||||||
this.saveSettings();
|
|
||||||
this.originalJackServerSettings = undefined;
|
|
||||||
if (this.props.onApply) {
|
|
||||||
this.props.onApply(this.state.jackServerSettings.clone());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleWarningProceed() {
|
handleWarningProceed() {
|
||||||
@@ -641,6 +645,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
if (this.props.onApply) {
|
if (this.props.onApply) {
|
||||||
this.props.onApply(this.state.jackServerSettings.clone());
|
this.props.onApply(this.state.jackServerSettings.clone());
|
||||||
}
|
}
|
||||||
|
this.props.onClose(); // Close the dialog after the warning
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user