diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index c4d32bf3..6e46027a 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -49,6 +49,9 @@ import ObjectiveC.runtime @objc public weak var functionalButtonDelegate: OnScreenFunctionalButtonDelegate? @objc protocol OnScreenFunctionalButtonDelegate: AnyObject { func expandSettingsView() + func disconnectRemoteSession() + func disconnectAndQuitApp() + func enterPip() func bringUpToolboxMenu() func openWidgetLayoutTool() func openWidgetProfileTable(pickProfile: Bool) @@ -2516,8 +2519,14 @@ import ObjectiveC.runtime DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { self.functionalButtonDelegate?.expandSettingsView() } + case "DISCONNECT": + self.functionalButtonDelegate?.disconnectRemoteSession() + case "QUITAPP": + self.functionalButtonDelegate?.disconnectAndQuitApp() case "TOOLBOX": self.functionalButtonDelegate?.bringUpToolboxMenu() + case "PIP": + self.functionalButtonDelegate?.enterPip() case "WIDGETTOOL": temporaryDisableFolderButtonAnimation() DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 035ab742..18d17bd5 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -675,6 +675,29 @@ } } }, + "=Folder" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "控件夹" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "控制項夾" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "控制項夾" + } + } + } + }, "=GamepadOverlayOff" : { "extractionState" : "manual", "localizations" : { @@ -3483,6 +3506,52 @@ } } }, + "Disconnect and quit current app" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "断开并退出当前应用" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "斷開並退出目前應用程式" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "斷開並退出目前應用程式" + } + } + } + }, + "Disconnect current connection" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "断开当前连接" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "斷開目前連線" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "斷開目前連線" + } + } + } + }, "Displacement-based right stick pad" : { "extractionState" : "manual", "localizations" : { @@ -3846,7 +3915,7 @@ } } }, - "Edit Layout" : { + "Edit layout" : { "extractionState" : "manual", "localizations" : { "zh-Hans" : { @@ -4117,6 +4186,52 @@ } } }, + "Enter picture-in-picture mode" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "进入画中画模式" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "進入子母畫面模式" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "進入子母畫面模式" + } + } + } + }, + "Enter PiP" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "画中画" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "子母畫面" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "子母畫面" + } + } + } + }, "Enter the command & alias label" : { "extractionState" : "manual", "localizations" : { @@ -8954,6 +9069,29 @@ } } }, + "Quit app" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "退出应用" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "退出應用程式" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "退出應用程式" + } + } + } + }, "Quit App" : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLinkPreview/WidgetPickerView.swift b/VoidLinkPreview/WidgetPickerView.swift index 091010ec..cd3a4293 100644 --- a/VoidLinkPreview/WidgetPickerView.swift +++ b/VoidLinkPreview/WidgetPickerView.swift @@ -357,6 +357,36 @@ struct WidgetPickerView: View { allowsShortcutCombo: false, forcedComboMode: nil ), + FunctionalButtonOption( + label: SwiftLocalizationHelper.localizedString(forKey: "Disconnect"), + cmd: "DISCONNECT", + tip: SwiftLocalizationHelper.localizedString(forKey: "Disconnect current connection"), + allowsKeyboardCombination: false, + allowsGamepadCombination: false, + allowsSkillCombo: false, + allowsShortcutCombo: false, + forcedComboMode: nil + ), + FunctionalButtonOption( + label: SwiftLocalizationHelper.localizedString(forKey: "Quit app"), + cmd: "QUITAPP", + tip: SwiftLocalizationHelper.localizedString(forKey: "Disconnect and quit current app"), + allowsKeyboardCombination: false, + allowsGamepadCombination: false, + allowsSkillCombo: false, + allowsShortcutCombo: false, + forcedComboMode: nil + ), + FunctionalButtonOption( + label: SwiftLocalizationHelper.localizedString(forKey: "Enter PiP"), + cmd: "PIP", + tip: SwiftLocalizationHelper.localizedString(forKey: "Enter picture-in-picture mode"), + allowsKeyboardCombination: false, + allowsGamepadCombination: false, + allowsSkillCombo: false, + allowsShortcutCombo: false, + forcedComboMode: nil + ), FunctionalButtonOption( label: SwiftLocalizationHelper.localizedString(forKey: "Folder"), cmd: "FOLDER", @@ -378,7 +408,7 @@ struct WidgetPickerView: View { forcedComboMode: nil ), FunctionalButtonOption( - label: SwiftLocalizationHelper.localizedString(forKey: "Edit Layout"), + label: SwiftLocalizationHelper.localizedString(forKey: "Edit layout"), cmd: "WIDGETTOOL", tip: SwiftLocalizationHelper.localizedString(forKey: "Open on-screen widget layout tool"), allowsKeyboardCombination: false, @@ -1745,6 +1775,9 @@ struct WidgetPickerView: View { let initialButtonLabel, targetWidgetKind == .button { widgetButtonLabel = initialButtonLabel + } else if targetWidgetKind == .button, + let selectedFunctionalButtonOption { + widgetButtonLabel = selectedFunctionalButtonOption.cmd == "FOLDER" ? SwiftLocalizationHelper.localizedString(forKey: "=Folder") : selectedFunctionalButtonOption.label } else { widgetButtonLabel = "" }