From a0ac3712ea817dbf5faa0de9cbc31bf43ea4692f Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Thu, 27 Jan 2022 23:24:32 -0800 Subject: [PATCH] presets can now be deleted --- src/renderer/views/components/equalizer.ejs | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/renderer/views/components/equalizer.ejs b/src/renderer/views/components/equalizer.ejs index d9604dcf..889c054c 100644 --- a/src/renderer/views/components/equalizer.ejs +++ b/src/renderer/views/components/equalizer.ejs @@ -105,6 +105,12 @@
+
+ +
+
+ +
@@ -116,7 +122,7 @@ template: '#eq-view', data: function () { return { - app: this.$root, + // app: this.$root, eqPreset: function () { this.preset = uuidv4() this.name = "" @@ -224,6 +230,21 @@ mounted() { }, methods: { + sharePreset() { + notyf.error("Not implemented") + }, + deletePreset() { + let presets = this.$root.cfg.audio.equalizer.presets + bootbox.confirm("Are you sure you want to delete this preset?", (result) => { + if (result) { + this.changePreset("default") + // find the preset by id (preset) and remove it + let index = presets.findIndex(p => p.preset == this.preset) + presets.splice(index, 1) + notyf.success("Removed preset") + } + }) + }, close() { app.resetState() }, @@ -270,6 +291,7 @@ newPreset.mix = eqSettings.mix app.cfg.audio.equalizer.presets.push(newPreset) notyf.success("Added Preset") + self.changePreset(newPreset.preset) } }) }, @@ -287,7 +309,7 @@ notyf.success("Saved Preset") }, applyPreset(preset) { - Object.assign(this.app.cfg.audio.equalizer, preset) + Object.assign(this.$root.cfg.audio.equalizer, preset) for (var i = 0; i < 10; i++) { this.changeGain(i) this.changeFreq(i)