From d263719e644016a170e61e7dd2ae4e388adce3c4 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 24 Oct 2022 15:17:07 +0800 Subject: [PATCH] Repo // Change the buzz() trigger with certain NSAlert instances. --- Source/Modules/SessionCtl_Menu.swift | 2 +- Source/Modules/UIModules/PrefUI/VwrPrefPaneCassette.swift | 2 +- Source/Modules/WindowControllers/CtlPrefWindow.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Modules/SessionCtl_Menu.swift b/Source/Modules/SessionCtl_Menu.swift index 7f605b8d..23b85732 100644 --- a/Source/Modules/SessionCtl_Menu.swift +++ b/Source/Modules/SessionCtl_Menu.swift @@ -230,6 +230,7 @@ extension SessionCtl { resetInputHandler() if !PrefMgr.shared.cassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) { DispatchQueue.main.async { + IMEApp.buzz() let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: "")) alert.informativeText = NSLocalizedString( "Please reconfigure the cassette path to a valid one before enabling this mode.", comment: "" @@ -240,7 +241,6 @@ extension SessionCtl { PrefMgr.shared.cassetteEnabled = false } NSApp.setActivationPolicy(.accessory) - IMEApp.buzz() } return } diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPaneCassette.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPaneCassette.swift index 5c86f026..b0b68f7c 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPaneCassette.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPaneCassette.swift @@ -109,6 +109,7 @@ struct VwrPrefPaneCassette: View { isOn: $selCassetteEnabled.onChange { if selCassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) { if let window = CtlPrefUI.shared.controller.window { + IMEApp.buzz() let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: "")) alert.informativeText = NSLocalizedString( "Please reconfigure the cassette path to a valid one before enabling this mode.", comment: "" @@ -118,7 +119,6 @@ struct VwrPrefPaneCassette: View { PrefMgr.shared.cassetteEnabled = false selCassetteEnabled = false } - IMEApp.buzz() } } else { PrefMgr.shared.cassetteEnabled = selCassetteEnabled diff --git a/Source/Modules/WindowControllers/CtlPrefWindow.swift b/Source/Modules/WindowControllers/CtlPrefWindow.swift index 77ab544a..33d54bef 100644 --- a/Source/Modules/WindowControllers/CtlPrefWindow.swift +++ b/Source/Modules/WindowControllers/CtlPrefWindow.swift @@ -283,6 +283,7 @@ class CtlPrefWindow: NSWindowController { @IBAction func onToggleCassetteMode(_: Any) { if PrefMgr.shared.cassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) { if let window = window { + IMEApp.buzz() let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: "")) alert.informativeText = NSLocalizedString( "Please reconfigure the cassette path to a valid one before enabling this mode.", comment: "" @@ -291,7 +292,6 @@ class CtlPrefWindow: NSWindowController { LMMgr.resetCassettePath() PrefMgr.shared.cassetteEnabled = false } - IMEApp.buzz() } } else { LMMgr.loadCassetteData()