Update JackServerSettingsDialog.tsx
Apply button does not save settings, it is only used for testing. As per Robin on git. Ok button will save settings only. If the box is closed/cancelled, the settings revert to what they were before.
This commit is contained in:
@@ -322,6 +322,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
statusTimer?: number = undefined;
|
statusTimer?: number = undefined;
|
||||||
|
|
||||||
suppressDeviceWarning: boolean;
|
suppressDeviceWarning: boolean;
|
||||||
|
originalJackServerSettings?: JackServerSettings;
|
||||||
|
|
||||||
getFullScreen() {
|
getFullScreen() {
|
||||||
return document.documentElement.clientWidth < 420 ||
|
return document.documentElement.clientWidth < 420 ||
|
||||||
@@ -445,6 +446,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
}
|
}
|
||||||
componentDidUpdate(oldProps: JackServerSettingsDialogProps) {
|
componentDidUpdate(oldProps: JackServerSettingsDialogProps) {
|
||||||
if ((this.props.open && !oldProps.open) && this.mounted) {
|
if ((this.props.open && !oldProps.open) && this.mounted) {
|
||||||
|
this.originalJackServerSettings = this.props.jackServerSettings.clone();
|
||||||
// When opening, preserve the current settings until ALSA device
|
// When opening, preserve the current settings until ALSA device
|
||||||
// information is loaded. If we don't have device info yet, just
|
// information is loaded. If we don't have device info yet, just
|
||||||
// clone the provided settings without applying device defaults.
|
// clone the provided settings without applying device defaults.
|
||||||
@@ -463,6 +465,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
this.startStatusTimer();
|
this.startStatusTimer();
|
||||||
} else if (!this.props.open && oldProps.open) {
|
} else if (!this.props.open && oldProps.open) {
|
||||||
this.stopStatusTimer();
|
this.stopStatusTimer();
|
||||||
|
this.originalJackServerSettings = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,6 +610,9 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
const { onClose, open } = this.props;
|
const { onClose, open } = this.props;
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
if (this.originalJackServerSettings) {
|
||||||
|
this.model.setJackServerSettings(this.originalJackServerSettings);
|
||||||
|
}
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user