added import/export to menu

This commit is contained in:
Swiftzerr 2022-01-31 21:17:28 -05:00
parent cb48e9291d
commit f314d98aa1

View file

@ -274,14 +274,14 @@
"icon": "./assets/feather/share.svg", "icon": "./assets/feather/share.svg",
"name": app.getLz('action.import'), "name": app.getLz('action.import'),
"action": function () { "action": function () {
notyf.error("Not implemented yet") this.importPreset()
} }
}, },
"export": { "export": {
"icon": "./assets/feather/share.svg", "icon": "./assets/feather/share.svg",
"name": app.getLz('action.export'), "name": app.getLz('action.export'),
"action": function () { "action": function () {
notyf.error("Not implemented yet") this.exportPreset()
} }
}, },
} }
@ -398,6 +398,26 @@
preset.vibrantBass = app.cfg.audio.equalizer.vibrantBass preset.vibrantBass = app.cfg.audio.equalizer.vibrantBass
notyf.success("Saved Preset") notyf.success("Saved Preset")
}, },
exportPreset() {
app.cfg.audio.equalizer.presets.find(p => p.preset == app.cfg.audio.equalizer.preset)
const jsonObj = {"name": preset.name, "frequency": preset.frequencies, "gain": newPreset.gain, "q": preset.Q, "preamp": preset.preamp, "mix": preset.mix, "vibrantBass": preset.vibrantBass};
ipcRenderer.send("export-eq", JSON.stringify(jsonObj))
},
importPreset() {
ipcRenderer.sendSync("import-eq").then((result) => {
JSON.parse(result)
let newPreset = new self.eqPreset()
newPreset.name = res
newPreset.frequencies = result.frequency
newPreset.gain = result.gain
newPreset.Q = result.q
newPreset.preamp = result.preamp
newPreset.mix = result.mix
newPreset.vibrantBass = result.vibrantBass
app.cfg.audio.equalizer.presets.push(newPreset)
notyf.success("Imported preset " + result.name)
})
},
applyPreset(preset) { applyPreset(preset) {
Object.assign(this.$root.cfg.audio.equalizer, preset) Object.assign(this.$root.cfg.audio.equalizer, preset)
this.changePreamp() this.changePreamp()